changeset 35:89712e602e90

Option to prevent compiling the unit tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jul 2015 08:41:43 +0200
parents 97c2eb74c383
children 283b2890d2b1
files CMakeLists.txt NEWS
diffstat 2 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Jul 29 10:35:52 2015 +0200
+++ b/CMakeLists.txt	Thu Jul 30 08:41:43 2015 +0200
@@ -26,6 +26,7 @@
 # Parameters of the build
 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
+set(BUILD_UNIT_TESTS ON CACHE BOOL "Build UnitTests")
 
 # Advanced parameters to fine-tune linking against system libraries
 set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
@@ -47,7 +48,10 @@
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/PostgreSQLConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
+
+if (BUILD_UNIT_TESTS)
+  include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
+endif()
 
 
 # Check that the Orthanc SDK headers are available or download them
@@ -129,13 +133,15 @@
   LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
   )
 
-add_executable(UnitTests
-  ${CORE_SOURCES}
-  ${GTEST_SOURCES}
-  ${AUTOGENERATED_SOURCES}
-  ${CMAKE_SOURCE_DIR}/IndexPlugin/PostgreSQLWrapper.cpp
-  ${CMAKE_SOURCE_DIR}/StoragePlugin/PostgreSQLStorageArea.cpp
-  ${CMAKE_SOURCE_DIR}/UnitTestsSources/UnitTestsMain.cpp
-  ${CMAKE_SOURCE_DIR}/UnitTestsSources/PostgreSQLTests.cpp
-  ${CMAKE_SOURCE_DIR}/UnitTestsSources/PostgreSQLWrapperTests.cpp
-  )
+if (BUILD_UNIT_TESTS)
+  add_executable(UnitTests
+    ${CORE_SOURCES}
+    ${GTEST_SOURCES}
+    ${AUTOGENERATED_SOURCES}
+    ${CMAKE_SOURCE_DIR}/IndexPlugin/PostgreSQLWrapper.cpp
+    ${CMAKE_SOURCE_DIR}/StoragePlugin/PostgreSQLStorageArea.cpp
+    ${CMAKE_SOURCE_DIR}/UnitTestsSources/UnitTestsMain.cpp
+    ${CMAKE_SOURCE_DIR}/UnitTestsSources/PostgreSQLTests.cpp
+    ${CMAKE_SOURCE_DIR}/UnitTestsSources/PostgreSQLWrapperTests.cpp
+    )
+endif()
--- a/NEWS	Wed Jul 29 10:35:52 2015 +0200
+++ b/NEWS	Thu Jul 30 08:41:43 2015 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Option to prevent compiling the unit tests (if no PostgreSQL test server is available)
+
 
 Release 1.1 (2015/07/03)
 ========================