comparison OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4117:9286649df279

use of C++11 in the unit tests of the shared library
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 14:23:23 +0200
parents 99e2054d1e8d
children 304842a0d152
comparison
equal deleted inserted replaced
4115:7d0f42c98419 4117:9286649df279
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_CXX11 OFF CACHE BOOL "Whether to enable compiler support for C++11")
12 13
13 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) 14 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
14 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) 15 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
15 else() 16 else()
16 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) 17 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
28 endif() 29 endif()
29 30
30 set(ENABLE_GOOGLE_TEST ON) 31 set(ENABLE_GOOGLE_TEST ON)
31 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) 32 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
32 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) 33 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)
34
35 if (USE_CXX11)
36 if (CMAKE_COMPILER_IS_GNUCXX)
37 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
38 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
39 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
40 endif()
41 endif()
33 42
34 add_definitions( 43 add_definitions(
35 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 44 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1
36 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests 45 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests
37 ) 46 )