diff CMakeLists.txt @ 36:92b93845d84b

use of OrthancPluginsExports.cmake, link against system-wide orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Jul 2020 13:20:02 +0200
parents eb09eb1251b9
children 56c9b700a0db
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Jul 02 11:15:14 2020 +0200
+++ b/CMakeLists.txt	Mon Jul 06 13:20:02 2020 +0200
@@ -26,22 +26,38 @@
 set(ORTHANC_SDK_VERSION "1.0.0" CACHE STRING "Version of the Orthanc plugin SDK to use, if not using the system version (can be \"1.0.0\")")
 
 
-include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
+
+# Download and setup the Orthanc framework
+include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake)
 
-set(OPENSSL_STATIC_VERSION "1.0.2" CACHE STRING "TODO - Upgrade to OpenSSL 1.1.1" FORCE)
+if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+  link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
 
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
+  set(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
+  set(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL")
+  
+  include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/LibCurlConfiguration.cmake)
+  include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/OpenSslConfiguration.cmake)
 
-set(ENABLE_CRYPTO_OPTIONS ON)
-set(ENABLE_ZLIB ON)
-set(ENABLE_WEB_CLIENT ON)
-set(ENABLE_OPENSSL_ENGINES ON)  # Necessary on Windows
+else()
+  set(OPENSSL_STATIC_VERSION "1.0.2" CACHE STRING "TODO - Upgrade to OpenSSL 1.1.1" FORCE)
+
+  include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
 
-include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+  set(ENABLE_CRYPTO_OPTIONS ON)
+  set(ENABLE_ZLIB ON)
+  set(ENABLE_WEB_CLIENT ON)
+  set(ENABLE_OPENSSL_ENGINES ON)  # Necessary on Windows
+  
+  include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
+  include_directories(${ORTHANC_FRAMEWORK_ROOT}/Sources)
+endif()
+
 
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/CRC32C.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/NlohmannJson.cmake)
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleCloudPlatform.cmake)
+include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
 
 
 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
@@ -68,7 +84,6 @@
 
 include_directories(
   ${AUTOGENERATED_DIR}
-  ${ORTHANC_FRAMEWORK_ROOT}/Sources/
   )
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
@@ -89,7 +104,7 @@
 endif()
 
 
-if (ON)
+if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
   # Redefine the list of Orthanc sources, removing unused items, in
   # order to reduce the number of files and speed up the builds
   set(ORTHANC_CORE_SOURCES