# HG changeset patch # User Sebastien Jodogne # Date 1594124603 -7200 # Node ID 9286649df2795c6b5fc59d7adc2cc425264e7f0a # Parent 7d0f42c98419dac5fa6da31d524f5218e79e1fa5 use of C++11 in the unit tests of the shared library diff -r 7d0f42c98419 -r 9286649df279 OrthancFramework/SharedLibrary/CMakeLists.txt --- a/OrthancFramework/SharedLibrary/CMakeLists.txt Tue Jul 07 13:12:23 2020 +0200 +++ b/OrthancFramework/SharedLibrary/CMakeLists.txt Tue Jul 07 14:23:23 2020 +0200 @@ -466,6 +466,10 @@ ) endif() + if (JSONCPP_CXX11) + list(APPEND Flags -DUSE_CXX11=1) + endif() + # Build the unit tests, linking them against the just-created # "OrthancFramework" library externalproject_add(UnitTests diff -r 7d0f42c98419 -r 9286649df279 OrthancFramework/UnitTestsSources/CMakeLists.txt --- a/OrthancFramework/UnitTestsSources/CMakeLists.txt Tue Jul 07 13:12:23 2020 +0200 +++ b/OrthancFramework/UnitTestsSources/CMakeLists.txt Tue Jul 07 14:23:23 2020 +0200 @@ -9,6 +9,7 @@ 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_CXX11 OFF CACHE BOOL "Whether to enable compiler support for C++11") if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) @@ -31,6 +32,14 @@ include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) +if (USE_CXX11) + if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() +endif() + add_definitions( -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests