diff --git a/CMakeLists.txt b/CMakeLists.txt index f392e51a2..ef59d95de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ option(ICINGA2_WITH_COMPAT "Build the compat module" ${ICINGA2_MASTER}) option(ICINGA2_WITH_LIVESTATUS "Build the Livestatus module" ${ICINGA2_MASTER}) option(ICINGA2_WITH_NOTIFICATION "Build the notification module" ON) option(ICINGA2_WITH_PERFDATA "Build the perfdata module" ${ICINGA2_MASTER}) -option(ICINGA2_WITH_TESTS "Run unit tests" ON) option(ICINGA2_WITH_ICINGADB "Build the IcingaDB module" ${ICINGA2_MASTER}) option (USE_SYSTEMD @@ -471,9 +470,6 @@ install( DESTINATION ${CMAKE_INSTALL_DOCDIR} ) -include(CTest) -enable_testing() - set_property(GLOBAL PROPERTY USE_FOLDERS ON) add_subdirectory(third-party) @@ -494,7 +490,8 @@ if(MSVC) add_subdirectory(icinga-installer) endif() -if(ICINGA2_WITH_TESTS) +include(CTest) +if(BUILD_TESTING) add_subdirectory(test) endif() diff --git a/doc/21-development.md b/doc/21-development.md index c3f46fb92..143319b34 100644 --- a/doc/21-development.md +++ b/doc/21-development.md @@ -1453,7 +1453,7 @@ Second, define the two build types with their specific CMake variables. ```bash export I2_DEBUG="-DCMAKE_BUILD_TYPE=Debug -DICINGA2_UNITY_BUILD=OFF $I2_GENERIC" -export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_WITH_TESTS=ON -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" +export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" ``` Third, depending on your likings, you may use a bash alias for building, @@ -1655,7 +1655,7 @@ export I2_USER=$(id -u -n) export I2_GROUP=$(id -g -n) export I2_GENERIC="-DCMAKE_INSTALL_PREFIX=/usr/local/icinga/icinga2 -DICINGA2_USER=$I2_USER -DICINGA2_GROUP=$I2_GROUP -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include -DOPENSSL_SSL_LIBRARY=/usr/local/opt/openssl@1.1/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARY=/usr/local/opt/openssl@1.1/lib/libcrypto.dylib -DICINGA2_PLUGINDIR=/usr/local/sbin -DICINGA2_WITH_PGSQL=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" export I2_DEBUG="-DCMAKE_BUILD_TYPE=Debug -DICINGA2_UNITY_BUILD=OFF $I2_GENERIC" -export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_WITH_TESTS=ON -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" +export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" cd debug cmake $I2_DEBUG .. @@ -1686,7 +1686,7 @@ export I2_GROUP=$(id -g -n) export I2_GENERIC="-DCMAKE_INSTALL_PREFIX=/usr/local/icinga/icinga2 -DICINGA2_USER=$I2_USER -DICINGA2_GROUP=$I2_GROUP -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include -DOPENSSL_SSL_LIBRARY=/usr/local/opt/openssl@1.1/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARY=/usr/local/opt/openssl@1.1/lib/libcrypto.dylib -DICINGA2_PLUGINDIR=/usr/local/sbin -DICINGA2_WITH_PGSQL=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" export I2_DEBUG="-DCMAKE_BUILD_TYPE=Debug -DICINGA2_UNITY_BUILD=OFF $I2_GENERIC" -export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_WITH_TESTS=ON -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" +export I2_RELEASE="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_UNITY_BUILD=ON $I2_GENERIC" alias i2_debug="mkdir -p debug; cd debug; cmake $I2_DEBUG ..; make -j4; make -j4 install; cd .." alias i2_release="mkdir -p release; cd release; cmake $I2_RELEASE ..; make -j4; make -j4 install; cd .." @@ -2365,7 +2365,6 @@ Also see `CMakeLists.txt` for details. * `ICINGA2_WITH_LIVESTATUS`: Determines whether the Livestatus module is built; defaults to `ON` * `ICINGA2_WITH_NOTIFICATION`: Determines whether the notification module is built; defaults to `ON` * `ICINGA2_WITH_PERFDATA`: Determines whether the perfdata module is built; defaults to `ON` -* `ICINGA2_WITH_TESTS`: Determines whether the unit tests are built; defaults to `ON` #### MySQL or MariaDB