changeset 4094:1c89208fbba9

fix build of orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2020 17:00:18 +0200
parents fb64d481940a
children d633e5bb7ba3
files OrthancFramework/SharedLibrary/CMakeLists.txt OrthancFramework/UnitTestsSources/CMakeLists.txt
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/SharedLibrary/CMakeLists.txt	Tue Jun 30 15:53:17 2020 +0200
+++ b/OrthancFramework/SharedLibrary/CMakeLists.txt	Tue Jun 30 17:00:18 2020 +0200
@@ -38,6 +38,12 @@
 
 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/OrthancFrameworkParameters.cmake)
 
+if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
+  set(STANDALONE_BUILD ON)
+else()
+  set(STANDALONE_BUILD OFF)
+endif()
+
 set(ENABLE_DCMTK ON)
 set(ENABLE_DCMTK_TRANSCODING ON)
 set(ENABLE_GOOGLE_TEST ON)
@@ -464,14 +470,18 @@
   externalproject_add(UnitTests
     SOURCE_DIR "${CMAKE_SOURCE_DIR}/../UnitTestsSources"
     CMAKE_ARGS
-    -DALLOW_DOWNLOADS:BOOL=ON
     -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
     -DORTHANC_FRAMEWORK_LIBDIR:PATH=${CMAKE_CURRENT_BINARY_DIR}
     -DORTHANC_FRAMEWORK_ROOT:PATH=${CMAKE_CURRENT_BINARY_DIR}/Include/orthanc-framework
     -DORTHANC_FRAMEWORK_SOURCE:STRING=system
     -DORTHANC_FRAMEWORK_STATIC:BOOL=${STATIC_BUILD}
+
+    -DALLOW_DOWNLOADS:BOOL=${ALLOW_DOWNLOADS}
+    -DSTATIC_BUILD:BOOL=${STATIC_BUILD}
     -DUNIT_TESTS_WITH_HTTP_CONNEXIONS:BOOL=${UNIT_TESTS_WITH_HTTP_CONNEXIONS}
-    -DUSE_SYSTEM_GOOGLE_TEST:BOOL=OFF
+    -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE:BOOL=${USE_GOOGLE_TEST_DEBIAN_PACKAGE}
+    -DUSE_SYSTEM_GOOGLE_TEST:BOOL=${USE_SYSTEM_GOOGLE_TEST}
+    -DUSE_SYSTEM_JSONCPP:BOOL=${USE_SYSTEM_JSONCPP}
     ${Flags}
     )
 
--- a/OrthancFramework/UnitTestsSources/CMakeLists.txt	Tue Jun 30 15:53:17 2020 +0200
+++ b/OrthancFramework/UnitTestsSources/CMakeLists.txt	Tue Jun 30 17:00:18 2020 +0200
@@ -5,7 +5,12 @@
 cmake_minimum_required(VERSION 2.8)
 project(UnitTestsProject)
 
-SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
+set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
+set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
+set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
+set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
+set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
+set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
 
 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
   add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
@@ -22,6 +27,8 @@
   
 set(ENABLE_GOOGLE_TEST ON)
 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
+include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)
+include(${CMAKE_SOURCE_DIR}/../Resources/CMake/JsonCppConfiguration.cmake)
 
 add_definitions(
   -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1