$NetBSD: patch-git_21465191,v 1.1 2014/11/13 09:44:02 markd Exp $ commit 2146519108ec66300328b7b3979477c7789795d3 Author: Raphael Kubo da Costa Date: Wed Aug 13 23:22:11 2014 +0300 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 +++ 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) --- libs/CMakeLists.txt +++ 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 --- server/CMakeLists.txt +++ 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)