mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
fix: address review points from @YannickJadoul
This commit is contained in:
committed by
Henry Schreiner
parent
6ec1775fff
commit
1b92cd1703
@@ -27,15 +27,20 @@ find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Use the language standards abstraction if CMake supports it with the current compiler
|
||||
# Warn or error if old variable name used
|
||||
if(PYBIND11_CPP_STANDARD)
|
||||
message(WARNING "USE -DCMAKE_CXX_STANDARD=11 instead of PYBIND11_PYTHON_VERSION")
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
string(REGEX MATCH
|
||||
[=[..^]=]
|
||||
VAL
|
||||
"${PYBIND11_CPP_STANDARD}")
|
||||
set(CMAKE_CXX_STANDARD ${VAL})
|
||||
set(supported_standards 11 14 17 20)
|
||||
if("${VAL}" IN_LIST supported_standards)
|
||||
message(WARNING "USE -DCMAKE_CXX_STANDARD=${VAL} instead of PYBIND11_PYTHON_VERSION")
|
||||
set(CMAKE_CXX_STANDARD ${VAL})
|
||||
else()
|
||||
message(FATAL_ERROR "PYBIND11_CPP_STANDARD should be replaced with CMAKE_CXX_STANDARD")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user