Merge pull request #3036 from xuzhen/master

Fixed CMakeLists.txt for the compilers without C++17 support
This commit is contained in:
zdenop 2020-06-26 14:40:38 +02:00 committed by GitHub
commit d17ec2c754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,6 +118,13 @@ else() # minimum required standard
set(CMAKE_CXX_STANDARD 11)
endif()
if ("${CMAKE_CXX17_STANDARD_COMPILE_OPTION}" STREQUAL "")
set(CMAKE_CXX_STANDARD 14)
endif()
if ("${CMAKE_CXX14_STANDARD_COMPILE_OPTION}" STREQUAL "")
set(CMAKE_CXX_STANDARD 11)
endif()
# Avoid using experimental c++1y (c++1z) standard even if the compiler announces cxx14 (cxx17)
# in CMAKE_CXX_KNOWN_FEATURES and CMAKE_CXX_COMPILE_FEATURES
# It is the case of clang 3.9, 4.0 (announces c++1z) and gcc 4.8 (announces c++1y)