@@ -20,7 +20,7 @@ include(CMakeParseArguments)
20
20
21
21
# Use the language standards abstraction if CMake supports it with the current compiler
22
22
if (NOT CMAKE_VERSION VERSION_LESS 3.1)
23
- if (NOT CMAKE_CXX_STANDARD)
23
+ if (NOT CMAKE_CXX_STANDARD AND NOT PYBIND11_CPP_STANDARD )
24
24
if (CMAKE_CXX14_STANDARD_COMPILE_OPTION)
25
25
set (CMAKE_CXX_STANDARD 14)
26
26
elseif (CMAKE_CXX11_STANDARD_COMPILE_OPTION)
@@ -56,6 +56,8 @@ if(NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD)
56
56
"C++ standard flag, e.g. -std=c++11, -std=c++14, /std:c++14. Defaults to C++14 mode." FORCE)
57
57
endif ()
58
58
59
+ message (PYBIND11_CPP_STANDARD = ${PYBIND11_CPP_STANDARD} )
60
+
59
61
# Checks whether the given CXX/linker flags can compile and link a cxx file. cxxflags and
60
62
# linkerflags are lists of flags to use. The result variable is a unique variable name for each set
61
63
# of flags: the compilation result will be cached base on the result variable. If the flags work,
@@ -218,8 +220,10 @@ function(pybind11_add_module target_name)
218
220
# Make sure C++11/14 are enabled
219
221
if (PYBIND11_CPP_STANDARD)
220
222
if (CMAKE_VERSION VERSION_LESS 3.3 OR CMAKE_GENERATOR MATCHES "Visual Studio" )
223
+ message ("HERE, I hope?" )
221
224
target_compile_options (${target_name} PUBLIC ${PYBIND11_CPP_STANDARD} )
222
225
else ()
226
+ message ("NOT HERE, I hope?" )
223
227
target_compile_options (${target_name} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${PYBIND11_CPP_STANDARD} >)
224
228
endif ()
225
229
endif ()
0 commit comments