diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 70ed8e5da..665fd5935 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -181,7 +181,10 @@ CMAKE_POP_CHECK_STATE() # the CHECK_CXX_SOURCE_COMPILES function. See CMake issue #16456. # Ensure we do this after the FIND_PACKAGE calls which use C, and will error on a C++ # standards flag. -LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") +# Also see https://github.com/fish-shell/fish-shell/issues/5865 +IF(NOT POLICY CMP0067) + LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") +ENDIF() CHECK_CXX_SOURCE_COMPILES(" #include @@ -195,14 +198,6 @@ int main () { FIND_PROGRAM(SED sed) -# https://github.com/fish-shell/fish-shell/issues/5865 -CMAKE_PUSH_CHECK_STATE() -# Needed until CMP0067 is set to NEW -# g++ 4.8 needs -std=gnu+11 set to enable atomic features, but CMake < 3.8 does not add that -# flag to TRY_COMPILE targets even when set for the project -IF(CMAKE_COMPILER_IS_GNUCXX) - LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=gnu++11") -ENDIF() CHECK_CXX_SOURCE_COMPILES(" #include #include @@ -214,4 +209,3 @@ LIBATOMIC_NOT_NEEDED) IF (NOT LIBATOMIC_NOT_NEEDED) SET(ATOMIC_LIBRARY "atomic") ENDIF() -CMAKE_POP_CHECK_STATE()