Switch to standard opt-out BUILD_TESTING instead of opt-in UNIT_TESTING
authorDominik Schmidt <dev@dominik-schmidt.de>
Thu, 6 Dec 2018 11:03:59 +0000 (12:03 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:36 +0000 (10:58 +0100)
Compare https://cmake.org/cmake/help/v3.0/module/CTest.html
Craft automatically handles BUILD_TESTING, so we don't need to handle it
in our own blueprint.

.drone.yml
CMakeLists.txt
src/csync/DefineOptions.cmake

index ab39fc1f034333e753572530078556be7008313f..0955e5492310ae90900c2274e508954f8251c4e6 100644 (file)
@@ -9,7 +9,7 @@ steps:
       path: /drone/build
   commands:
     - cd /drone/build
-    - cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DNO_SHIBBOLETH=1 -DBUILD_UPDATER=ON -DUNIT_TESTING=1 -DSANITIZE_ADDRESS=ON ../src
+    - cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DNO_SHIBBOLETH=1 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DSANITIZE_ADDRESS=ON ../src
 - name: compile
   image: nextcloudci/client-5.12:client-5.12-11
   volumes:
@@ -53,7 +53,7 @@ steps:
       path: /drone/build
   commands:
     - cd /drone/build
-    - cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DNO_SHIBBOLETH=1 -DBUILD_UPDATER=ON -DUNIT_TESTING=1 -DSANITIZE_ADDRESS=ON ../src
+    - cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DNO_SHIBBOLETH=1 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DSANITIZE_ADDRESS=ON ../src
 - name: compile
   image: nextcloudci/client-5.12:client-5.12-11
   volumes:
index 4c01fbd87eaa8fe91d6794a9a344b967bab0916d..7da9f36deeabe3630df729bbcf3e4a86300b5b45 100644 (file)
@@ -259,9 +259,11 @@ if(BUILD_SHELL_INTEGRATION)
     add_subdirectory(shell_integration)
 endif()
 
-if(UNIT_TESTING)
+include(CTest)
+if(BUILD_TESTING)
+    enable_testing()
     add_subdirectory(test)
-endif(UNIT_TESTING)
+endif()
 
 configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
index 485e183221cbdff564d8aa974799dec8fa467a3c..5cb525fe4fdd16f513232ce97f5def93b7c5ecfe 100644 (file)
@@ -1,2 +1 @@
-option(UNIT_TESTING "Build with unit tests" OFF)
 option(MEM_NULL_TESTS "Enable NULL memory testing" OFF)