changeset 261:9e24c33c3361 Orthanc-0.3.1

possibility to compile just the CoreLibrary
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 09 Dec 2012 14:41:53 +0100
parents 6f4591ba5051
children 3b3525dee661
files CMakeLists.txt
diffstat 1 files changed, 58 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sun Dec 09 14:34:02 2012 +0100
+++ b/CMakeLists.txt	Sun Dec 09 14:41:53 2012 +0100
@@ -20,6 +20,7 @@
 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
 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")
 
 mark_as_advanced(USE_DYNAMIC_JSONCPP)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
@@ -27,6 +28,7 @@
 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)
 
 # Some basic inclusions
 include(CheckIncludeFiles)
@@ -78,7 +80,11 @@
 endif()
 
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
-include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
+
+if(NOT ONLY_CORE_LIBRARY)
+  include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
+endif()
+
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
@@ -133,57 +139,60 @@
   OrthancCppClient/HttpException.cpp
   )  
 
-add_library(ServerLibrary
-  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
-  ${DCMTK_SOURCES}
-  OrthancServer/main.cpp
-  )
-
-target_link_libraries(Orthanc ServerLibrary CoreLibrary)
-
-install(
-  TARGETS Orthanc
-  RUNTIME DESTINATION bin
-  )
 
 
-# Build the unit tests if required
-if (BUILD_UNIT_TESTS)
-  include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
-  add_executable(UnitTests
-    ${GTEST_SOURCES}
-    UnitTests/MessageWithDestination.cpp
-    UnitTests/RestApi.cpp
-    UnitTests/SQLite.cpp
-    UnitTests/SQLiteChromium.cpp
-    UnitTests/ServerIndex.cpp
-    UnitTests/Versions.cpp
-    UnitTests/Zip.cpp
-    UnitTests/FileStorage.cpp
-    UnitTests/main.cpp
+if(NOT ONLY_CORE_LIBRARY)
+  add_library(ServerLibrary
+    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
     )
-  target_link_libraries(UnitTests ServerLibrary CoreLibrary)
+
+  # Ensure autogenerated code is built before building ServerLibrary
+  add_dependencies(ServerLibrary CoreLibrary)
+
+  add_executable(Orthanc
+    ${DCMTK_SOURCES}
+    OrthancServer/main.cpp
+    )
+
+  target_link_libraries(Orthanc ServerLibrary CoreLibrary)
+
+  install(
+    TARGETS Orthanc
+    RUNTIME DESTINATION bin
+    )
+
+  # Build the unit tests if required
+  if (BUILD_UNIT_TESTS)
+    include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
+    add_executable(UnitTests
+      ${GTEST_SOURCES}
+      UnitTests/MessageWithDestination.cpp
+      UnitTests/RestApi.cpp
+      UnitTests/SQLite.cpp
+      UnitTests/SQLiteChromium.cpp
+      UnitTests/ServerIndex.cpp
+      UnitTests/Versions.cpp
+      UnitTests/Zip.cpp
+      UnitTests/FileStorage.cpp
+      UnitTests/main.cpp
+      )
+    target_link_libraries(UnitTests ServerLibrary CoreLibrary)
+  endif()
 endif()