Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: resolve cmake version check TODO in DetectCXXStandard.cmake #4268

Merged
merged 2 commits into from
Nov 4, 2022
Merged
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
5 changes: 2 additions & 3 deletions cmake/DetectCXXStandard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ function(DetectCXXStandard OUTPUT_VAR)
set(CXX_STANDARD14_FLAG "/std:c++14")
endif()

# TODO use VERSION_GREATER_EQUAL in cmake 3.7+
check_cxx_compiler_flag(${CXX_STANDARD20_FLAG} HAS_CXX20_FLAG)
if (HAS_CXX20_FLAG AND ((${CMAKE_VERSION} VERSION_EQUAL "3.12.0") OR (${CMAKE_VERSION} VERSION_GREATER "3.12.0")))
if (HAS_CXX20_FLAG AND (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0"))
set(${OUTPUT_VAR} 20 PARENT_SCOPE)
return()
endif()

check_cxx_compiler_flag(${CXX_STANDARD17_FLAG} HAS_CXX17_FLAG)
if (HAS_CXX17_FLAG AND ((${CMAKE_VERSION} VERSION_EQUAL "3.8.0") OR (${CMAKE_VERSION} VERSION_GREATER "3.8.0")))
if (HAS_CXX17_FLAG)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our minimum is 3.10 so this version check is not needed anymore

set(${OUTPUT_VAR} 17 PARENT_SCOPE)
return()
endif()
Expand Down