aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2020-01-23 14:24:11 +1300
committerMike Taves <mwtoews@gmail.com>2020-01-24 20:26:53 +1300
commit43dc8c575275d60ac0455e3a9110d813d5348ec4 (patch)
treeba6313a1c8c92d70a8c1a8107438b98b6d1cda6a /CMakeLists.txt
parentdb31b6dfa9c8fe37d5706d95ce81012b8db3c3b9 (diff)
downloadPROJ-43dc8c575275d60ac0455e3a9110d813d5348ec4.tar.gz
PROJ-43dc8c575275d60ac0455e3a9110d813d5348ec4.zip
CMake: replace PROJ_TESTS with CTest's BUILD_TESTING option
* CTest automatically creates a BUILD_TESTING option (default is ON) * Also allow PROJ_TESTS to be used, but show deprecation message; and add note to remove this option by PROJ 8.0 * Only build geodtest when tests are enabled * Add documentation to configure a build using -DBUILD_TESTING=OFF
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 17 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2264b25..fde2b28a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,13 +212,6 @@ if(MSVC OR CMAKE_CONFIGURATION_TYPES)
set(CMAKE_DEBUG_POSTFIX _d)
endif()
-option(PROJ_TESTS "Enable build of collection of PROJ tests" ON)
-boost_report_value(PROJ_TESTS)
-if(PROJ_TESTS)
- enable_testing()
-endif()
-include(ProjTest)
-
# Put the libraries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf
# directories. This simplifies manual testing and the use of the build
@@ -246,6 +239,22 @@ set(CMAKECONFIGDIR "${DEFAULT_CMAKEDIR}"
CACHE PATH "The directory to install cmake config files into.")
################################################################################
+# Tests
+################################################################################
+include(CTest)
+
+# Support older option, to be removed by PROJ 8.0
+if(DEFINED PROJ_TESTS)
+ message(DEPRECATION "PROJ_TESTS has been replaced with BUILD_TESTING")
+ set(BUILD_TESTING ${PROJ_TESTS})
+endif()
+
+boost_report_value(BUILD_TESTING)
+if(BUILD_TESTING)
+ include(ProjTest)
+endif()
+
+################################################################################
# Build configured components
################################################################################
include_directories(${PROJ4_SOURCE_DIR}/src)
@@ -256,6 +265,6 @@ add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(man)
add_subdirectory(cmake)
-if(PROJ_TESTS)
+if(BUILD_TESTING)
add_subdirectory(test)
endif()