diff 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
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Aug 19 13:40:36 2013 +0200
+++ b/CMakeLists.txt	Mon Aug 19 14:47:03 2013 +0200
@@ -14,24 +14,20 @@
 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests")
 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)
@@ -64,11 +60,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)
@@ -164,63 +156,60 @@
   )  
 
 
+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(NOT ONLY_CORE_LIBRARY)
-  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)
+
+install(
+  TARGETS Orthanc
+  RUNTIME DESTINATION bin
+  )
 
-  # Ensure autogenerated code is built before building ServerLibrary
-  add_dependencies(ServerLibrary CoreLibrary)
-
-  add_executable(Orthanc
-    OrthancServer/main.cpp
+# 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(Orthanc ServerLibrary CoreLibrary)
-
-  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)
-  endif()
+  target_link_libraries(UnitTests ServerLibrary CoreLibrary)
 endif()