Apply c++ standard flag only to files of CXX language. (#1678)

This commit is contained in:
Lori A. Burns
2019-06-11 16:05:00 -04:00
committed by Wenzel Jakob
parent 77ef03d5b1
commit 868d94fcb4
2 changed files with 10 additions and 2 deletions

View File

@@ -185,7 +185,11 @@ function(pybind11_add_module target_name)
endif()
# Make sure C++11/14 are enabled
target_compile_options(${target_name} PUBLIC ${PYBIND11_CPP_STANDARD})
if(CMAKE_VERSION VERSION_LESS 3.3)
target_compile_options(${target_name} PUBLIC ${PYBIND11_CPP_STANDARD})
else()
target_compile_options(${target_name} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${PYBIND11_CPP_STANDARD}>)
endif()
if(ARG_NO_EXTRAS)
return()