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