c++infra/fix: proper way to check variant/optional
@@ -122,7 +122,10 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# see https://bugs.llvm.org/show_bug.cgi?id=33222
message(STATUS "clang is used on linux, disable c++17 mode")
set(HAS_STDCXX_17 FALSE)
- else ()
+ endif ()
+ if (HAS_STDCXX_17 AND (NOT USE_BOOST))
+ set_target_properties(c++-rust-swig-test PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
+ add_definitions(-DHAS_STDCXX_17)
check_include_file_cxx(optional HAVE_STD17_OPTIONAL)
if (NOT HAVE_STD17_OPTIONAL)
message(STATUS "c++ compiler support c++17, but have no optional")
@@ -133,10 +136,6 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "c++ compiler support c++17, but have no variant")
add_definitions(-DNO_HAVE_STD17_VARIANT)
endif ()
- endif ()
- if (HAS_STDCXX_17 AND (NOT USE_BOOST))
- set_target_properties(c++-rust-swig-test PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
- add_definitions(-DHAS_STDCXX_17)
else()
set_target_properties(c++-rust-swig-test PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
endif()
