diff CMakeLists.txt @ 546:0e510ea3de31 laaw

merge mainline -> laaw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Sep 2013 11:25:08 +0200
parents fe796b053863 b2b56b4e33b0
children ffedcc8f0938
line wrap: on
line diff
--- a/CMakeLists.txt	Fri Sep 13 11:10:58 2013 +0200
+++ b/CMakeLists.txt	Fri Sep 13 11:25:08 2013 +0200
@@ -20,24 +20,20 @@
 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library")
 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)") 
 
-# Advanced parameters (for Debian packaging)
-SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp (only for Debian sid)")
+# Advanced parameters to fine-tune linking against system libraries
+SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp")
 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log")
-SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)")
+SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test")
 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose")
 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua")
-SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)")
-SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
-SET(ONLY_CORE_LIBRARY OFF CACHE BOOL "Only build the core library")
+SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
 
 mark_as_advanced(USE_DYNAMIC_JSONCPP)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST)
 mark_as_advanced(USE_DYNAMIC_SQLITE)
-mark_as_advanced(DEBIAN_FORCE_HARDENING)
-mark_as_advanced(DEBIAN_USE_STATIC_GOOGLE_TEST)
-mark_as_advanced(ONLY_CORE_LIBRARY)
+mark_as_advanced(DEBIAN_USE_GTEST_SOURCE_PACKAGE)
 
 # Some basic inclusions
 include(CheckIncludeFiles)
@@ -79,11 +75,7 @@
 endif()
 
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
-
-if(NOT ONLY_CORE_LIBRARY)
-  include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
-endif()
-
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
@@ -193,83 +185,81 @@
   )  
 
 
+#####################################################################
+## Build the Orthanc server
+#####################################################################
 
-if(NOT ONLY_CORE_LIBRARY)
-  #####################################################################
-  ## Build the Orthanc server
-  #####################################################################
+add_library(ServerLibrary
+  STATIC
+  ${DCMTK_SOURCES}
+  OrthancServer/DicomProtocol/DicomFindAnswers.cpp
+  OrthancServer/DicomProtocol/DicomServer.cpp
+  OrthancServer/DicomProtocol/DicomUserConnection.cpp
+  OrthancServer/FromDcmtkBridge.cpp
+  OrthancServer/Internals/CommandDispatcher.cpp
+  OrthancServer/Internals/FindScp.cpp
+  OrthancServer/Internals/MoveScp.cpp
+  OrthancServer/Internals/StoreScp.cpp
+  OrthancServer/OrthancInitialization.cpp
+  OrthancServer/OrthancRestApi.cpp
+  OrthancServer/ServerIndex.cpp
+  OrthancServer/ToDcmtkBridge.cpp
+  OrthancServer/DatabaseWrapper.cpp
+  OrthancServer/ServerContext.cpp
+  OrthancServer/ServerEnumerations.cpp
+  OrthancServer/ServerToolbox.cpp
+  )
+
+# Ensure autogenerated code is built before building ServerLibrary
+add_dependencies(ServerLibrary CoreLibrary)
+
+add_executable(Orthanc
+  OrthancServer/main.cpp
+  )
+
+target_link_libraries(Orthanc ServerLibrary CoreLibrary)
 
-  add_library(ServerLibrary
-    STATIC
-    ${DCMTK_SOURCES}
-    OrthancServer/DicomProtocol/DicomFindAnswers.cpp
-    OrthancServer/DicomProtocol/DicomServer.cpp
-    OrthancServer/DicomProtocol/DicomUserConnection.cpp
-    OrthancServer/FromDcmtkBridge.cpp
-    OrthancServer/Internals/CommandDispatcher.cpp
-    OrthancServer/Internals/FindScp.cpp
-    OrthancServer/Internals/MoveScp.cpp
-    OrthancServer/Internals/StoreScp.cpp
-    OrthancServer/OrthancInitialization.cpp
-    OrthancServer/OrthancRestApi.cpp
-    OrthancServer/ServerIndex.cpp
-    OrthancServer/ToDcmtkBridge.cpp
-    OrthancServer/DatabaseWrapper.cpp
-    OrthancServer/ServerContext.cpp
-    OrthancServer/ServerEnumerations.cpp
-    OrthancServer/ServerToolbox.cpp
+if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
+  target_link_libraries(Orthanc OpenSSL)
+endif()
+
+install(
+  TARGETS Orthanc
+  RUNTIME DESTINATION bin
+  )
+
+
+
+#####################################################################
+## Build the unit tests if required
+#####################################################################
+
+if (BUILD_UNIT_TESTS)
+  add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
+  include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
+  add_executable(UnitTests
+    ${GTEST_SOURCES}
+    UnitTests/FileStorage.cpp
+    UnitTests/MemoryCache.cpp
+    UnitTests/Png.cpp
+    UnitTests/RestApi.cpp
+    UnitTests/SQLite.cpp
+    UnitTests/SQLiteChromium.cpp
+    UnitTests/ServerIndex.cpp
+    UnitTests/Versions.cpp
+    UnitTests/Zip.cpp
+    UnitTests/Lua.cpp
+    UnitTests/main.cpp
     )
-
-  # Ensure autogenerated code is built before building ServerLibrary
-  add_dependencies(ServerLibrary CoreLibrary)
-
-  add_executable(Orthanc
-    OrthancServer/main.cpp
-    )
-
-  target_link_libraries(Orthanc ServerLibrary CoreLibrary)
+  target_link_libraries(UnitTests ServerLibrary CoreLibrary)
 
   if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
-    target_link_libraries(Orthanc OpenSSL)
-  endif()
-
-  install(
-    TARGETS Orthanc
-    RUNTIME DESTINATION bin
-    )
-
-
-  #####################################################################
-  ## Build the unit tests if required
-  #####################################################################
-
-  if (BUILD_UNIT_TESTS)
-    add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
-    include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
-    add_executable(UnitTests
-      ${GTEST_SOURCES}
-      UnitTests/FileStorage.cpp
-      UnitTests/MemoryCache.cpp
-      UnitTests/Png.cpp
-      UnitTests/RestApi.cpp
-      UnitTests/SQLite.cpp
-      UnitTests/SQLiteChromium.cpp
-      UnitTests/ServerIndex.cpp
-      UnitTests/Versions.cpp
-      UnitTests/Zip.cpp
-      UnitTests/Lua.cpp
-      UnitTests/main.cpp
-      )
-    target_link_libraries(UnitTests ServerLibrary CoreLibrary)
-
-    if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
-      target_link_libraries(UnitTests OpenSSL)
-    endif()
-
+    target_link_libraries(UnitTests OpenSSL)
   endif()
 endif()
 
 
+
 #####################################################################
 ## Create the standalone DLL containing the Orthanc Client API
 #####################################################################
@@ -332,20 +322,13 @@
     message(FATAL_ERROR "Support your platform here")
   endif()
 
-  # Copy the header file of the client library to the build directory
-  add_custom_command(
-    TARGET OrthancClient PRE_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy
-    ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h 
-    ${CMAKE_BINARY_DIR})
-
   install(
     TARGETS OrthancClient
     LIBRARY DESTINATION lib
     )
 
   install(
-    FILES ${CMAKE_BINARY_DIR}/OrthancCppClient.h
+    FILES ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h 
     DESTINATION include/orthanc
     )
 endif()