aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2020-01-24 20:56:29 +1300
committerGitHub <noreply@github.com>2020-01-24 20:56:29 +1300
commite16a24ab397142ce23fe1e8824fce624fe5fdb42 (patch)
treed499d8c72efc6253c1f3760c5fc6b2720f84b975
parentdf4f78a8c1ea3c08f0b32c061b38b40c4a2d9f60 (diff)
parent43dc8c575275d60ac0455e3a9110d813d5348ec4 (diff)
downloadPROJ-e16a24ab397142ce23fe1e8824fce624fe5fdb42.tar.gz
PROJ-e16a24ab397142ce23fe1e8824fce624fe5fdb42.zip
Merge pull request #1870 from mwtoews/build-testing
CMake: replace PROJ_TESTS with CTest's BUILD_TESTING option
-rw-r--r--CMakeLists.txt25
-rw-r--r--docs/source/install.rst4
-rw-r--r--src/CMakeLists.txt4
3 files changed, 24 insertions, 9 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()
diff --git a/docs/source/install.rst b/docs/source/install.rst
index 9362521b..bda3c1fa 100644
--- a/docs/source/install.rst
+++ b/docs/source/install.rst
@@ -240,6 +240,10 @@ Tests are run with::
The test suite requires that the proj-datumgrid package is installed
in :envvar:`PROJ_LIB`.
+If tests are not required, PROJ can be built without the test suite using the following configuration::
+
+ cmake -DBUILD_TESTING=OFF ..
+
Building on Windows with vcpkg and Visual Studio 2017 or 2019
--------------------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 48c785a5..8cf57306 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -51,7 +51,9 @@ endif()
if(BUILD_GEOD)
include(bin_geod.cmake)
- include(bin_geodtest.cmake)
+ if(BUILD_TESTING)
+ include(bin_geodtest.cmake)
+ endif()
set(BIN_TARGETS ${BIN_TARGETS} geod)
endif()