comparison CMakeLists.txt @ 634:d775a3cb5a06

refactoring of CMake scripts
author jodogne
date Tue, 29 Oct 2013 10:31:02 +0100
parents e207b33216db
children cd3b60f6e7d4
comparison
equal deleted inserted replaced
633:e207b33216db 634:d775a3cb5a06
9 ##################################################################### 9 #####################################################################
10 ## CMake parameters tunable at the command line 10 ## CMake parameters tunable at the command line
11 ##################################################################### 11 #####################################################################
12 12
13 # Parameters of the build 13 # Parameters of the build
14 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 14 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
15 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 15 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
16 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") 16 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
17 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests")
18 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library") 17 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library")
19 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)") 18 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)")
19 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
20 20
21 # Advanced parameters to fine-tune linking against system libraries 21 # Advanced parameters to fine-tune linking against system libraries
22 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp") 22 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
23 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log") 23 SET(USE_SYSTEM_GOOGLE_LOG ON CACHE BOOL "Use the system version of Google Log")
24 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test") 24 SET(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
25 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite") 25 SET(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")
26 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose") 26 SET(USE_SYSTEM_MONGOOSE ON CACHE BOOL "Use the system version of Mongoose")
27 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua") 27 SET(USE_SYSTEM_LUA ON CACHE BOOL "Use the system version of Lua")
28 SET(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK") 28 SET(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK")
29 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") 29 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
30 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") 30 SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of LibPng")
31 31 SET(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
32 mark_as_advanced(USE_DYNAMIC_JSONCPP) 32
33 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG) 33 # Distribution-specific settings
34 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST) 34 SET(USE_GTEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
35 mark_as_advanced(USE_DYNAMIC_SQLITE) 35 mark_as_advanced(USE_GTEST_DEBIAN_PACKAGE)
36 mark_as_advanced(DEBIAN_USE_GTEST_SOURCE_PACKAGE)
37 36
38 # Some basic inclusions 37 # Some basic inclusions
39 include(CheckIncludeFiles) 38 include(CheckIncludeFiles)
40 include(CheckIncludeFileCXX) 39 include(CheckIncludeFileCXX)
41 include(CheckLibraryExists) 40 include(CheckLibraryExists)
237 236
238 ##################################################################### 237 #####################################################################
239 ## Build the unit tests if required 238 ## Build the unit tests if required
240 ##################################################################### 239 #####################################################################
241 240
242 if (BUILD_UNIT_TESTS) 241 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
243 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1) 242 add_executable(UnitTests
244 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) 243 ${GTEST_SOURCES}
245 add_executable(UnitTests 244 UnitTestsSources/FileStorage.cpp
246 ${GTEST_SOURCES} 245 UnitTestsSources/MemoryCache.cpp
247 UnitTestsSources/FileStorage.cpp 246 UnitTestsSources/Png.cpp
248 UnitTestsSources/MemoryCache.cpp 247 UnitTestsSources/RestApi.cpp
249 UnitTestsSources/Png.cpp 248 UnitTestsSources/SQLite.cpp
250 UnitTestsSources/RestApi.cpp 249 UnitTestsSources/SQLiteChromium.cpp
251 UnitTestsSources/SQLite.cpp 250 UnitTestsSources/ServerIndex.cpp
252 UnitTestsSources/SQLiteChromium.cpp 251 UnitTestsSources/Versions.cpp
253 UnitTestsSources/ServerIndex.cpp 252 UnitTestsSources/Zip.cpp
254 UnitTestsSources/Versions.cpp 253 UnitTestsSources/Lua.cpp
255 UnitTestsSources/Zip.cpp 254 UnitTestsSources/main.cpp
256 UnitTestsSources/Lua.cpp 255 )
257 UnitTestsSources/main.cpp 256 target_link_libraries(UnitTests ServerLibrary CoreLibrary)
258 ) 257
259 target_link_libraries(UnitTests ServerLibrary CoreLibrary) 258 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
260 259 target_link_libraries(UnitTests OpenSSL)
261 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
262 target_link_libraries(UnitTests OpenSSL)
263 endif()
264 endif() 260 endif()
265 261
266 262
267 263
268 ##################################################################### 264 #####################################################################