Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions CMake/AbseilDll.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,18 @@ set(ABSL_INTERNAL_TEST_DLL_TARGETS
"status_matchers"
)

include(CheckCXXSourceCompiles)
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD_REQUIRED)
if(CMAKE_CXX_STANDARD GREATER_EQUAL 20)
set(ABSL_INTERNAL_AT_LEAST_CXX20 ON)
set(ABSL_INTERNAL_AT_LEAST_CXX17 ON)
elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 17)
set(ABSL_INTERNAL_AT_LEAST_CXX17 ON)
endif()
else()
include(CheckCXXSourceCompiles)

check_cxx_source_compiles(
[==[
check_cxx_source_compiles(
[==[
#ifdef _MSC_VER
# if _MSVC_LANG < 201703L
# error "The compiler defaults or is configured for C++ < 17"
Expand All @@ -737,10 +745,10 @@ check_cxx_source_compiles(
#endif
int main() { return 0; }
]==]
ABSL_INTERNAL_AT_LEAST_CXX17)
ABSL_INTERNAL_AT_LEAST_CXX17)

check_cxx_source_compiles(
[==[
check_cxx_source_compiles(
[==[
#ifdef _MSC_VER
# if _MSVC_LANG < 202002L
# error "The compiler defaults or is configured for C++ < 20"
Expand All @@ -750,7 +758,8 @@ check_cxx_source_compiles(
#endif
int main() { return 0; }
]==]
ABSL_INTERNAL_AT_LEAST_CXX20)
ABSL_INTERNAL_AT_LEAST_CXX20)
endif()

if(ABSL_INTERNAL_AT_LEAST_CXX20)
set(ABSL_INTERNAL_CXX_STD_FEATURE cxx_std_20)
Expand Down