File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,23 @@ include(CheckCXXCompilerFlag)
2525
2626# Warn or error if old variable name used
2727if (PYBIND11_CPP_STANDARD)
28- if (NOT CMAKE_CXX_STANDARD)
29- string (REGEX MATCH [=[..^]=] VAL "${PYBIND11_CPP_STANDARD} " )
28+ string (REGEX MATCH [[..$]] VAL "${PYBIND11_CPP_STANDARD} " )
29+ if (CMAKE_CXX_STANDARD)
30+ if (NOT CMAKE_CXX_STANDARD STREQUAL VAL)
31+ message (WARNING "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} does not match "
32+ "PYBIND11_CPP_STANDARD=${PYBIND11_CPP_STANDARD} , "
33+ "please remove PYBIND11_CPP_STANDARD from your cache" )
34+ endif ()
35+ else ()
3036 set (supported_standards 11 14 17 20)
3137 if ("${VAL} " IN_LIST supported_standards)
3238 message (WARNING "USE -DCMAKE_CXX_STANDARD=${VAL} instead of PYBIND11_PYTHON_VERSION" )
33- set (CMAKE_CXX_STANDARD ${VAL} )
39+ set (CMAKE_CXX_STANDARD
40+ ${VAL}
41+ CACHE STRING "From PYBIND11_CPP_STANDARD" )
3442 else ()
35- message (FATAL_ERROR "PYBIND11_CPP_STANDARD should be replaced with CMAKE_CXX_STANDARD" )
43+ message (FATAL_ERROR "PYBIND11_CPP_STANDARD should be replaced with CMAKE_CXX_STANDARD "
44+ "(last two chars: ${VAL} not understood as a valid CXX std)" )
3645 endif ()
3746 endif ()
3847endif ()
You can’t perform that action at this time.
0 commit comments