diff options
author | Robert <krzmbrzl@gmail.com> | 2020-09-11 17:49:45 +0300 |
---|---|---|
committer | Robert <krzmbrzl@gmail.com> | 2020-09-11 19:13:56 +0300 |
commit | a8a857928d107736b8559513fd0158270abeda73 (patch) | |
tree | c3faf5c88b1c18236bff1d0be665a138ba6ae2be /CMakeLists.txt | |
parent | d5a059f13abfdcdd6e7143d77370e4a156894789 (diff) |
BUILD(cmake): Don't re-use BUILD_TESTING
We used the BUILD_TESTING variable in order to indicate whether or not
tests shall be built. However this variable is used by e.g. CTest
already and there it had a different default value. Therefore we now
deprecate BUILD_TESTING and use the tests option instead.
This also fits better with our other options in terms of casing.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e17cdd6f6..e7c97d80f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,12 +32,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/FindModules" ) + include(pkg-utils) -include(CTest) include(project-utils) -option(BUILD_TESTING "Build tests." OFF) +option(tests "Build tests" OFF) option(optimize "Build a heavily optimized version, specific to the machine it's being compiled on." OFF) option(static "Build static binaries." OFF) @@ -96,6 +96,21 @@ message(STATUS "Architecture: ${ARCH}") message(STATUS "Build type: ${BUILD_STR}") message(STATUS "##################################################") +# We have to check for BUILD_TESTING before including CTest as CTest defines this variable +if(DEFINED BUILD_TESTING) + message(WARNING "Use of option \"BUILD_TESTING\" is deprecated. Use \"tests\" instead.") + + if(NOT tests) + # Allow deprecated option to enable tests if they had been disabled otherwise + set(tests "${BUILD_TESTING}") + endif() +endif() + +if(tests) + include(CTest) +endif() + + add_subdirectory(src) if(g15 AND WIN32) |