From 5e4eb52f848de2b29e6c45adb6964fa90a571465 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Tue, 11 Jun 2024 23:47:02 +0900 Subject: [PATCH] fix: add cxx_std to check_cxx_source_compiles in macos, default version is 98 and it fails to compile boost test. ci fails in the test branch because of apt timeout, but osx jobs works. --- tests/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8253359..47b6489 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -105,9 +105,13 @@ find_package(Boost COMPONENTS unit_test_framework REQUIRED) set(PREVIOUSLY_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") set(PREVIOUSLY_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") +set(PREVIOUSLY_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") list(APPEND CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS}) list(APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +if(APPLE) + list(APPEND CMAKE_REQUIRED_FLAGS "-std=c++11") +endif() check_cxx_source_compiles(" #define BOOST_TEST_MODULE \"dummy\" @@ -135,9 +139,11 @@ BOOST_AUTO_TEST_CASE(proforma) { BOOST_TEST(true); } set(CMAKE_REQUIRED_INCLUDES "${PREVIOUSLY_REQUIRED_INCLUDES}") set(CMAKE_REQUIRED_LIBRARIES "${PREVIOUSLY_REQUIRED_LIBRARIES}") +set(CMAKE_REQUIRED_FLAGS "${PREVIOUSLY_REQUIRED_FLAGS}") unset(PREVIOUSLY_REQUIRED_INCLUDES) unset(PREVIOUSLY_REQUIRED_LIBRARIES) +unset(PREVIOUSLY_REQUIRED_FLAGS) if(TOML11_WITH_BOOST_TEST_DYNAMIC) add_definitions(-DUNITTEST_FRAMEWORK_LIBRARY_EXIST -DBOOST_TEST_DYN_LINK)