Skip to content

Commit

Permalink
Merge pull request #642 from ManifoldFR/topic/wjallet/enforce-cxx-sta…
Browse files Browse the repository at this point in the history
…ndard-when-ok

Properly enforce (when asked) value of CMAKE_CXX_STANDARD when not set but C++ compiler reports right standard
  • Loading branch information
jcarpent authored Nov 27, 2023
2 parents 02719f3 + ef8618c commit d76210f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cxx-standard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ 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 d76210f

Please sign in to comment.