changeset 1836:5a6adbc20ace

cleanup cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 12 Jun 2021 13:43:42 +0200
parents 6c252e51008d
children f6eaf617d8e8 80e029f8ec91
files Applications/Samples/RtViewerPlugin/CMakeLists.txt OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 2 files changed, 34 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/RtViewerPlugin/CMakeLists.txt	Sat Jun 12 09:01:40 2021 +0200
+++ b/Applications/Samples/RtViewerPlugin/CMakeLists.txt	Sat Jun 12 13:43:42 2021 +0200
@@ -54,6 +54,17 @@
 include_directories(${ORTHANC_FRAMEWORK_ROOT})
 
 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  if (ORTHANC_FRAMEWORK_USE_SHARED)
+    include(FindBoost)
+    find_package(Boost COMPONENTS system)
+    
+    if (NOT Boost_FOUND)
+      message(FATAL_ERROR "Unable to locate Boost on this system")
+    endif()
+    
+    link_libraries(${Boost_LIBRARIES} jsoncpp)
+  endif()
+
   link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
 
 else()
--- a/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake	Sat Jun 12 09:01:40 2021 +0200
+++ b/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake	Sat Jun 12 13:43:42 2021 +0200
@@ -24,15 +24,33 @@
 #####################################################################
 
 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
-  # DCMTK and curl are necessarily enabled if using Orthanc framework:
-  # "DownloadOrthancFramework.cmake" must be aware of this fact
-  set(ENABLE_DCMTK ON)   
-  set(ENABLE_WEB_CLIENT ON)
+  # DCMTK, pugixml and curl are necessarily enabled if using the
+  # system-wide Orthanc framework
+  include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake)
+  
+  if (ORTHANC_FRAMEWORK_USE_SHARED)
+    include(FindBoost)
+    find_package(Boost COMPONENTS filesystem regex thread ${ORTHANC_BOOST_COMPONENTS})
+    
+    if (NOT Boost_FOUND)
+      message(FATAL_ERROR "Unable to locate Boost on this system")
+    endif()
+    
+    include(FindDCMTK NO_MODULE)
+    link_libraries(${Boost_LIBRARIES} ${DCMTK_LIBRARIES} pugixml jsoncpp)
+  endif()
 
-  include(${CMAKE_CURRENT_LIST_DIR}/../Orthanc/CMake/DownloadOrthancFramework.cmake)
   link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
 
+  add_definitions(
+    -DORTHANC_ENABLE_DCMTK=1
+    -DORTHANC_ENABLE_PUGIXML=1
+    )
+  
+  set(ENABLE_DCMTK ON)
   set(ENABLE_LOCALE ON)
+  set(ENABLE_PUGIXML ON)
+  set(ENABLE_WEB_CLIENT ON)
   
 else()
   if (ENABLE_DCMTK)