comparison OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4097:99e2054d1e8d

fix unit tests for orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2020 11:15:29 +0200
parents 1c89208fbba9
children 9286649df279
comparison
equal deleted inserted replaced
4096:d633e5bb7ba3 4097:99e2054d1e8d
7 7
8 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") 8 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
9 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 9 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
10 set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") 10 set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
11 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") 11 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
12 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
13 set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
14 12
15 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) 13 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
16 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) 14 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
17 else() 15 else()
18 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) 16 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
21 if (NOT ORTHANC_FRAMEWORK_STATIC) 19 if (NOT ORTHANC_FRAMEWORK_STATIC)
22 set(ENABLE_DCMTK ON) 20 set(ENABLE_DCMTK ON)
23 set(ENABLE_LUA ON) 21 set(ENABLE_LUA ON)
24 set(ENABLE_PUGIXML ON) 22 set(ENABLE_PUGIXML ON)
25 set(ENABLE_SQLITE ON) 23 set(ENABLE_SQLITE ON)
24
25 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
26 else()
27 set(USE_SYSTEM_GOOGLE_TEST OFF CACHE INTERNAL "")
26 endif() 28 endif()
27 29
28 set(ENABLE_GOOGLE_TEST ON) 30 set(ENABLE_GOOGLE_TEST ON)
29 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) 31 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
30 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) 32 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)
31 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/JsonCppConfiguration.cmake)
32 33
33 add_definitions( 34 add_definitions(
34 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 35 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1
35 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests 36 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests
36 ) 37 )
58 59
59 ${AUTOGENERATED_SOURCES} 60 ${AUTOGENERATED_SOURCES}
60 ${GOOGLE_TEST_SOURCES} 61 ${GOOGLE_TEST_SOURCES}
61 ) 62 )
62 63
63 target_link_libraries(UnitTests OrthancFramework) 64 target_link_libraries(UnitTests ${ORTHANC_FRAMEWORK_LIBRARIES})
64 set_target_properties(UnitTests PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
65 set_target_properties(UnitTests PROPERTIES INSTALL_RPATH ${ORTHANC_FRAMEWORK_LIBDIR})
66 65
67 install(TARGETS UnitTests 66 install(TARGETS UnitTests
68 DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR} 67 DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR}
69 ) 68 )