comparison CMakeLists.txt @ 517:b2b56b4e33b0

simplifications to cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Aug 2013 14:47:03 +0200
parents 012b63028085
children e318e9d49815 586499635f4c 0e510ea3de31
comparison
equal deleted inserted replaced
515:a8be42bcf2bb 517:b2b56b4e33b0
12 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 12 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
13 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") 13 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
14 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests") 14 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests")
15 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)") 15 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)")
16 16
17 # Advanced parameters (for Debian packaging) 17 # Advanced parameters to fine-tune linking against system libraries
18 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp (only for Debian sid)") 18 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp")
19 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log") 19 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log")
20 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)") 20 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test")
21 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite") 21 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
22 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose") 22 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose")
23 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua") 23 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua")
24 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)") 24 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
25 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
26 SET(ONLY_CORE_LIBRARY OFF CACHE BOOL "Only build the core library")
27 25
28 mark_as_advanced(USE_DYNAMIC_JSONCPP) 26 mark_as_advanced(USE_DYNAMIC_JSONCPP)
29 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG) 27 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
30 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST) 28 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST)
31 mark_as_advanced(USE_DYNAMIC_SQLITE) 29 mark_as_advanced(USE_DYNAMIC_SQLITE)
32 mark_as_advanced(DEBIAN_FORCE_HARDENING) 30 mark_as_advanced(DEBIAN_USE_GTEST_SOURCE_PACKAGE)
33 mark_as_advanced(DEBIAN_USE_STATIC_GOOGLE_TEST)
34 mark_as_advanced(ONLY_CORE_LIBRARY)
35 31
36 # Some basic inclusions 32 # Some basic inclusions
37 include(CheckIncludeFiles) 33 include(CheckIncludeFiles)
38 include(CheckIncludeFileCXX) 34 include(CheckIncludeFileCXX)
39 include(CheckLibraryExists) 35 include(CheckLibraryExists)
62 else() 58 else()
63 add_definitions(-DORTHANC_SSL_ENABLED=0) 59 add_definitions(-DORTHANC_SSL_ENABLED=0)
64 endif() 60 endif()
65 61
66 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) 62 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
67 63 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
68 if(NOT ONLY_CORE_LIBRARY)
69 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
70 endif()
71
72 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) 64 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
73 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) 65 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
74 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) 66 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
75 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) 67 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
76 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) 68 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
162 OrthancCppClient/Instance.cpp 154 OrthancCppClient/Instance.cpp
163 OrthancCppClient/Patient.cpp 155 OrthancCppClient/Patient.cpp
164 ) 156 )
165 157
166 158
167 159 add_library(ServerLibrary
168 if(NOT ONLY_CORE_LIBRARY) 160 STATIC
169 add_library(ServerLibrary 161 ${DCMTK_SOURCES}
170 STATIC 162 OrthancServer/DicomProtocol/DicomFindAnswers.cpp
171 ${DCMTK_SOURCES} 163 OrthancServer/DicomProtocol/DicomServer.cpp
172 OrthancServer/DicomProtocol/DicomFindAnswers.cpp 164 OrthancServer/DicomProtocol/DicomUserConnection.cpp
173 OrthancServer/DicomProtocol/DicomServer.cpp 165 OrthancServer/FromDcmtkBridge.cpp
174 OrthancServer/DicomProtocol/DicomUserConnection.cpp 166 OrthancServer/Internals/CommandDispatcher.cpp
175 OrthancServer/FromDcmtkBridge.cpp 167 OrthancServer/Internals/FindScp.cpp
176 OrthancServer/Internals/CommandDispatcher.cpp 168 OrthancServer/Internals/MoveScp.cpp
177 OrthancServer/Internals/FindScp.cpp 169 OrthancServer/Internals/StoreScp.cpp
178 OrthancServer/Internals/MoveScp.cpp 170 OrthancServer/OrthancInitialization.cpp
179 OrthancServer/Internals/StoreScp.cpp 171 OrthancServer/OrthancRestApi.cpp
180 OrthancServer/OrthancInitialization.cpp 172 OrthancServer/ServerIndex.cpp
181 OrthancServer/OrthancRestApi.cpp 173 OrthancServer/ToDcmtkBridge.cpp
182 OrthancServer/ServerIndex.cpp 174 OrthancServer/DatabaseWrapper.cpp
183 OrthancServer/ToDcmtkBridge.cpp 175 OrthancServer/ServerContext.cpp
184 OrthancServer/DatabaseWrapper.cpp 176 OrthancServer/ServerEnumerations.cpp
185 OrthancServer/ServerContext.cpp 177 OrthancServer/ServerToolbox.cpp
186 OrthancServer/ServerEnumerations.cpp 178 )
187 OrthancServer/ServerToolbox.cpp 179
188 ) 180 # Ensure autogenerated code is built before building ServerLibrary
189 181 add_dependencies(ServerLibrary CoreLibrary)
190 # Ensure autogenerated code is built before building ServerLibrary 182
191 add_dependencies(ServerLibrary CoreLibrary) 183 add_executable(Orthanc
192 184 OrthancServer/main.cpp
193 add_executable(Orthanc 185 )
194 OrthancServer/main.cpp 186
195 ) 187 target_link_libraries(Orthanc ServerLibrary CoreLibrary)
196 188
197 target_link_libraries(Orthanc ServerLibrary CoreLibrary) 189 install(
198 190 TARGETS Orthanc
199 install( 191 RUNTIME DESTINATION bin
200 TARGETS Orthanc 192 )
201 RUNTIME DESTINATION bin 193
202 ) 194 # Build the unit tests if required
203 195 if (BUILD_UNIT_TESTS)
204 # Build the unit tests if required 196 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
205 if (BUILD_UNIT_TESTS) 197 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
206 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1) 198 add_executable(UnitTests
207 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) 199 ${GTEST_SOURCES}
208 add_executable(UnitTests 200 UnitTests/FileStorage.cpp
209 ${GTEST_SOURCES} 201 UnitTests/MemoryCache.cpp
210 UnitTests/FileStorage.cpp 202 UnitTests/Png.cpp
211 UnitTests/MemoryCache.cpp 203 UnitTests/RestApi.cpp
212 UnitTests/Png.cpp 204 UnitTests/SQLite.cpp
213 UnitTests/RestApi.cpp 205 UnitTests/SQLiteChromium.cpp
214 UnitTests/SQLite.cpp 206 UnitTests/ServerIndex.cpp
215 UnitTests/SQLiteChromium.cpp 207 UnitTests/Versions.cpp
216 UnitTests/ServerIndex.cpp 208 UnitTests/Zip.cpp
217 UnitTests/Versions.cpp 209 UnitTests/Lua.cpp
218 UnitTests/Zip.cpp 210 UnitTests/main.cpp
219 UnitTests/Lua.cpp 211 )
220 UnitTests/main.cpp 212 target_link_libraries(UnitTests ServerLibrary CoreLibrary)
221 )
222 target_link_libraries(UnitTests ServerLibrary CoreLibrary)
223 endif()
224 endif() 213 endif()
225 214
226 215
227 # Generate the Doxygen documentation if Doxygen is present 216 # Generate the Doxygen documentation if Doxygen is present
228 find_package(Doxygen) 217 find_package(Doxygen)