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