From: TimePath Date: Thu, 14 Apr 2016 04:16:06 +0000 (+1000) Subject: CMake: make everything optional X-Git-Tag: xonotic-v0.8.2~24^2 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=4e3a68ee0d03f41a839403003225dcfaa8ca63ec CMake: make everything optional --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c1e0adb8..734d5934 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,27 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR) project(xonotic) -add_subdirectory(darkplaces) -add_subdirectory(data/xonotic-data.pk3dir) -add_subdirectory(gmqcc) -add_subdirectory(netradiant) +option(DOWNLOAD_MAPS "Download new maps from the build server" ON) +option(BUILD_RELEASE "Package a release" OFF) -add_custom_target(update-maps ALL - COMMAND ${PROJECT_SOURCE_DIR}/misc/tools/xonotic-map-compiler-autobuild download - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - ) +macro(subproject name) + if (EXISTS "${PROJECT_SOURCE_DIR}/${name}/CMakeLists.txt") + add_subdirectory(${name} ${ARGN}) + endif () +endmacro() -include(release.cmake) +subproject(darkplaces) +subproject(data/xonotic-data.pk3dir) +subproject(gmqcc) +subproject(netradiant) + +if (DOWNLOAD_MAPS) + add_custom_target(update-maps ALL + COMMAND ${PROJECT_SOURCE_DIR}/misc/tools/xonotic-map-compiler-autobuild download + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) +endif () + +if (BUILD_RELEASE) + include(release.cmake) +endif ()