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