Skip to content

Commit

Permalink
Maybe partially fix issue #76 where CMAKE_CXX_STANDARD wasn't affecti…
Browse files Browse the repository at this point in the history
…ng probes for <filesystem>.
  • Loading branch information
ned14 committed Apr 15, 2021
1 parent db383d6 commit 6735fab
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,18 @@ if(NOT MSVC OR CMAKE_VERSION VERSION_GREATER 3.59)
cxx_variable_templates
)
endif()
set(check_cxx_source_linkage_flags)
# If on VS2019 16.3 or later, or on Apple, we require C++ 17
if((MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL 1923) OR APPLE)
all_compile_features(PUBLIC
cxx_std_17
)
if(MSVC)
set(check_cxx_source_linkage_flags /std:c++17)
else()
set(check_cxx_source_linkage_flags -std=c++17)
if(NOT CMAKE_CXX_STANDARD)
if(MSVC)
set(check_cxx_source_linkage_flags /std:c++17)
else()
set(check_cxx_source_linkage_flags -std=c++17)
endif()
endif()
endif()
# Set the library dependencies this library has
Expand All @@ -184,6 +187,13 @@ function(check_cxx_source_linkage prog var)
if(MSVC AND CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /EHsc")
endif()
if(CMAKE_CXX_STANDARD)
if(MSVC)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /std:c++${CMAKE_CXX_STANDARD}")
else()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++${CMAKE_CXX_STANDARD}")
endif()
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR} AND NOT LLFIO_ASSUME_CROSS_COMPILING)
check_cxx_source_runs("${prog}" ${var})
else()
Expand Down

0 comments on commit 6735fab

Please sign in to comment.