Skip to content

Commit 0adfaf1

Browse files
committed
Don't use $<COMPILE_LANGUAGE:CXX> to add PYBIND11_CPP_STANDARD for VS CMake generators
1 parent 9a7dfef commit 0adfaf1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/pybind11Tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function(pybind11_add_module target_name)
217217

218218
# Make sure C++11/14 are enabled
219219
if(PYBIND11_CPP_STANDARD)
220-
if(CMAKE_VERSION VERSION_LESS 3.3)
220+
if(CMAKE_VERSION VERSION_LESS 3.3 OR CMAKE_GENERATOR MATCHES "Visual Studio")
221221
target_compile_options(${target_name} PUBLIC ${PYBIND11_CPP_STANDARD})
222222
else()
223223
target_compile_options(${target_name} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${PYBIND11_CPP_STANDARD}>)

0 commit comments

Comments
 (0)