Browse Source

Modified pybind support for C++17 to fix issues with Xcode 11

refactoring
Matthias Volk 5 years ago
parent
commit
a526933814
  1. 2
      resources/pybind11/include/pybind11/common.h
  2. 2
      resources/pybind11/include/pybind11/stl.h
  3. 5
      resources/pybind11/tools/pybind11Tools.cmake

2
resources/pybind11/include/pybind11/common.h

@ -19,7 +19,7 @@
#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
# if __cplusplus >= 201402L
# define PYBIND11_CPP14
# if __cplusplus > 201402L /* Temporary: should be updated to >= the final C++17 value once known */
# if __cplusplus >= 201703L /* Temporary: should be updated to >= the final C++17 value once known */
# define PYBIND11_CPP17
# endif
# endif

2
resources/pybind11/include/pybind11/stl.h

@ -30,7 +30,7 @@
# define PYBIND11_HAS_OPTIONAL 1
# endif
// std::experimental::optional (but not allowed in c++11 mode)
# if defined(PYBIND11_CPP14) && __has_include(<experimental/optional>)
# if defined(PYBIND11_CPP14) && __has_include(<experimental/optional>) && !__has_include(<optional>)
# include <experimental/optional>
# define PYBIND11_HAS_EXP_OPTIONAL 1
# endif

5
resources/pybind11/tools/pybind11Tools.cmake

@ -21,10 +21,13 @@ include(CMakeParseArguments)
function(select_cxx_standard)
if(NOT PYBIND11_CPP_STANDARD)
if(NOT MSVC)
check_cxx_compiler_flag("-std=c++17" HAS_CPP17_FLAG)
check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG)
check_cxx_compiler_flag("-std=c++11" HAS_CPP11_FLAG)
if (HAS_CPP14_FLAG)
if (HAS_CPP17_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++17)
elseif (HAS_CPP14_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++14)
elseif (HAS_CPP11_FLAG)
set(PYBIND11_CPP_STANDARD -std=c++11)

Loading…
Cancel
Save