From 2146519108ec66300328b7b3979477c7789795d3 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Wed, 13 Aug 2014 23:22:11 +0300 Subject: [PATCH 02/30] Do not enter the test/ directories if AKONADI_BUILD_TESTS is off. enable_testing() only determines whether a "test" target and the related CTest files will be created. And in Akonadi's case it is actually invoked regardless of the value of the AKONADI_BUILD_TESTS option because Akonadi includes the CTest module, which calls enable_testing() based on the value of another variable, BUILD_TESTING. In any case, whether the executables and libraries that compose Akonadi's unit tests will be built has nothing to do with enable_testing(). To make AKONADI_BUILD_TESTS really disable the build of the unit tests we now avoid entering the tests/ directories at all when it is off, so that neither tests nor targets they depend on get built. REVIEW: 119776 --- CMakeLists.txt | 6 +----- libs/CMakeLists.txt | 4 +++- server/CMakeLists.txt | 5 ++++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c52009..e081d23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ include(FeatureSummary) ############### Build Options ############### -include(CTest) +include(CTest) # Calls enable_testing(). include(CTestConfig.cmake) option(AKONADI_BUILD_TESTS "Build the Akonadi unit tests." TRUE) option(AKONADI_BUILD_QSQLITE "Build the Sqlite backend." TRUE) @@ -27,10 +27,6 @@ if(NOT DEFINED DATABASE_BACKEND) set(DATABASE_BACKEND "MYSQL" CACHE STRING "The default database backend to use for Akonadi. Can be either MYSQL, POSTGRES or SQLITE") endif() -if(AKONADI_BUILD_TESTS) - enable_testing() -endif() - ############### CMake Macros ############### include(InstallSettings) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index de6ab0d..74de6b2 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -36,5 +36,7 @@ install(FILES DESTINATION ${INCLUDE_INSTALL_DIR}/akonadi/private ) -add_subdirectory(tests) +if(AKONADI_BUILD_TESTS) + add_subdirectory(tests) +endif() diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index e4829f3..275938d 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -64,7 +64,10 @@ endmacro() add_subdirectory(akonadictl) add_subdirectory(control) add_subdirectory(src) -add_subdirectory(tests) + +if(AKONADI_BUILD_TESTS) + add_subdirectory(tests) +endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_ENABLE_EXCEPTIONS}") if(MYSQLD_EXECUTABLE) -- 2.1.0