Skip to content

Commit

Permalink
[cxx-standard] enforce value of CMAKE_CXX_STANDARD even when found va…
Browse files Browse the repository at this point in the history
…lue of __cplusplus satisfies minimum and ENFORCE option is set
  • Loading branch information
ManifoldFR committed Nov 23, 2023
1 parent 0468780 commit 53b9527
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cxx-standard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ macro(CHECK_MINIMAL_CXX_STANDARD STANDARD)
STATUS
"C++ standard sufficient: Minimal required ${_MINIMAL_CXX_STANDARD}, currently defined: ${_CURRENT_STANDARD}"
)
# current C++ standard was not set in CMake but we enforce it
if(NOT DEFINED CMAKE_CXX_STANDARD AND (ENFORCE_MINIMAL_CXX_STANDARD OR MINIMAL_CXX_STANDARD_ENFORCE))
message(STATUS "CMAKE_CXX_STANDARD was not set: automatically set to currently defined standard ${_CURRENT_STANDARD}")
set(CMAKE_CXX_STANDARD ${_CURRENT_STANDARD})
endif()
endif() # requested minimum is higher than the currently selected
endif()
endmacro()

0 comments on commit 53b9527

Please sign in to comment.