Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- 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