Mercurial > hg > orthanc
comparison OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4535:c40c1234a696
simplification of DownloadOrthancFramework.cmake
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Feb 2021 13:50:37 +0100 |
parents | d64e6f401a8a |
children | 7053502fbf97 |
comparison
equal
deleted
inserted
replaced
4534:d9700b9f4ad9 | 4535:c40c1234a696 |
---|---|
23 ## | 23 ## |
24 | 24 |
25 cmake_minimum_required(VERSION 2.8) | 25 cmake_minimum_required(VERSION 2.8) |
26 project(UnitTestsProject) | 26 project(UnitTestsProject) |
27 | 27 |
28 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") | |
29 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") | 28 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") |
30 set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") | 29 set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") |
31 | 30 |
32 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") | 31 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") |
33 set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") | |
34 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") | 32 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") |
35 | |
36 set(BOOST_LOCALE_BACKEND "libiconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"gcc\", \"libiconv\", \"icu\", or \"wconv\" on Windows)") | |
37 set(USE_CXX11 OFF CACHE BOOL "Whether to enable compiler support for C++11") | |
38 | 33 |
39 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) | 34 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) |
40 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) | 35 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) |
41 else() | 36 else() |
42 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) | 37 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) |
43 endif() | 38 endif() |
44 | 39 |
45 set(ENABLE_DCMTK ON) | 40 if (ORTHANC_FRAMEWORK_STATIC) |
46 set(ENABLE_GOOGLE_TEST ON) | 41 include_directories(${ORTHANC_FRAMEWORK_ROOT}/..) |
47 set(ENABLE_LUA ON) | 42 else() |
48 set(ENABLE_PUGIXML ON) | 43 include(CheckIncludeFile) |
49 set(ENABLE_SQLITE ON) | 44 include(CheckIncludeFileCXX) |
50 set(ENABLE_WEB_CLIENT ON) | |
51 | 45 |
52 if (NOT ORTHANC_FRAMEWORK_STATIC) | 46 link_libraries(jsoncpp) |
53 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") | 47 |
54 else() | 48 include(FindLua) |
55 set(USE_SYSTEM_GOOGLE_TEST OFF CACHE INTERNAL "") | 49 if (NOT LUA_FOUND) |
50 message(FATAL_ERROR "Please install the liblua-dev package") | |
51 endif() | |
52 include_directories(${LUA_INCLUDE_DIR}) | |
53 link_libraries(${LUA_LIBRARIES}) | |
54 | |
55 check_include_file(sqlite3.h HAVE_SQLITE_H) | |
56 if (NOT HAVE_SQLITE_H) | |
57 message(FATAL_ERROR "Please install the libsqlite3-dev package") | |
58 endif() | |
59 link_libraries(sqlite3) | |
60 | |
61 check_include_file_cxx(pugixml.hpp HAVE_PUGIXML_H) | |
62 if (NOT HAVE_PUGIXML_H) | |
63 message(FATAL_ERROR "Please install the libpugixml-dev package") | |
64 endif() | |
65 link_libraries(pugixml) | |
66 | |
67 find_package(Boost COMPONENTS filesystem thread system date_time iostreams locale regex) | |
68 if (NOT Boost_FOUND) | |
69 message(FATAL_ERROR "Unable to locate Boost on this system") | |
70 endif() | |
71 link_libraries(${Boost_LIBRARIES}) | |
72 | |
73 include(FindDCMTK NO_MODULE) | |
74 link_libraries(${DCMTK_LIBRARIES}) | |
56 endif() | 75 endif() |
57 | 76 |
58 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) | 77 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) |
59 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/BoostConfiguration.cmake) | |
60 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) | 78 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) |
61 | |
62 if (USE_CXX11) | |
63 if (CMAKE_COMPILER_IS_GNUCXX) | |
64 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") | |
65 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
66 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
67 endif() | |
68 endif() | |
69 | 79 |
70 add_definitions( | 80 add_definitions( |
71 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 | 81 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 |
72 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests | 82 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests |
73 ) | 83 ) |