Avoid duplicate C++ standard flags if CMAKE_CXX_STANDARD is set

CMAKE_CXX_STANDARD is only available on CMake >= 3.1. If the flag is
set, we avoid initializing PYBIND11_CPP_STANDARD.
This commit is contained in:
Dean Moldovan 2017-08-13 15:48:08 +02:00
parent 97aa54fefa
commit 76e06c89e4

View File

@ -18,7 +18,7 @@ find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(CMakeParseArguments) include(CMakeParseArguments)
if(NOT PYBIND11_CPP_STANDARD) if(NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD)
if(NOT MSVC) if(NOT MSVC)
check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG) check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG)