mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update CMakeLists.txt
This commit is contained in:
parent
2a719c18c2
commit
8df5f03d7b
@ -13,9 +13,16 @@ if(WIN32 AND MINGW)
|
|||||||
option(COPY_DEPENDENCIES "Copy deppendent DLLs into the deps folder." OFF)
|
option(COPY_DEPENDENCIES "Copy deppendent DLLs into the deps folder." OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# C++14 is mandatory
|
||||||
|
set(CPP_STD_NUMBER 14)
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
# C++ standard availability check
|
# C++ standard availability check
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(${CMAKE_CXX_COMPILER_ID} MATCHES "(GNU)+")
|
||||||
|
# Specific flags
|
||||||
|
set(CPP_STD_COMPILER_FLAG "-std=c++14")
|
||||||
|
# Don't even bother with previous version
|
||||||
|
if(CPP_STD_NUMBER LESS 20 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||||
check_cxx_compiler_flag(-std=c++20 HAVE_FLAG_STD_CXX20)
|
check_cxx_compiler_flag(-std=c++20 HAVE_FLAG_STD_CXX20)
|
||||||
check_cxx_compiler_flag(-std=c++2a HAVE_FLAG_STD_CXX2A)
|
check_cxx_compiler_flag(-std=c++2a HAVE_FLAG_STD_CXX2A)
|
||||||
if(HAVE_FLAG_STD_CXX20 OR HAVE_FLAG_STD_CXX2A)
|
if(HAVE_FLAG_STD_CXX20 OR HAVE_FLAG_STD_CXX2A)
|
||||||
@ -23,9 +30,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
set(CPP_STD_NUMBER 20)
|
set(CPP_STD_NUMBER 20)
|
||||||
# Specific flags
|
# Specific flags
|
||||||
if (HAVE_FLAG_STD_CXX2A AND NOT HAVE_FLAG_STD_CXX20)
|
if (HAVE_FLAG_STD_CXX2A AND NOT HAVE_FLAG_STD_CXX20)
|
||||||
set(CPP_STD_COMPILER_FLAG "-std=c++20")
|
|
||||||
else()
|
|
||||||
set(CPP_STD_COMPILER_FLAG "-std=c++2a")
|
set(CPP_STD_COMPILER_FLAG "-std=c++2a")
|
||||||
|
else()
|
||||||
|
set(CPP_STD_COMPILER_FLAG "-std=c++20")
|
||||||
endif()
|
endif()
|
||||||
# Need these workarounds for older CMake
|
# Need these workarounds for older CMake
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||||
@ -37,17 +44,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
|
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
endif()
|
||||||
|
endif()
|
||||||
|
# Don't even bother with previous version
|
||||||
|
if(CPP_STD_NUMBER LESS 17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||||
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
|
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
|
||||||
check_cxx_compiler_flag(-std=c++1z HAVE_FLAG_STD_CXX1Z)
|
check_cxx_compiler_flag(-std=c++1z HAVE_FLAG_STD_CXX1Z)
|
||||||
if(HAVE_FLAG_STD_CXX17 OR HAVE_FLAG_STD_CXX1Z)
|
if(HAVE_FLAG_STD_CXX17 OR HAVE_FLAG_STD_CXX1Z)
|
||||||
# We can use C++17
|
# We can use C++17
|
||||||
set(CPP_STD_NUMBER 17)
|
set(CPP_STD_NUMBER 17)
|
||||||
# Specific flags
|
# Specific flags
|
||||||
if (HAVE_FLAG_STD_CXX17 AND NOT HAVE_FLAG_STD_CXX1Z)
|
if (HAVE_FLAG_STD_CXX1Z AND NOT HAVE_FLAG_STD_CXX17)
|
||||||
set(CPP_STD_COMPILER_FLAG "-std=c++17")
|
|
||||||
else()
|
|
||||||
set(CPP_STD_COMPILER_FLAG "-std=c++1z")
|
set(CPP_STD_COMPILER_FLAG "-std=c++1z")
|
||||||
|
else()
|
||||||
|
set(CPP_STD_COMPILER_FLAG "-std=c++17")
|
||||||
endif()
|
endif()
|
||||||
# Need these workarounds for older CMake
|
# Need these workarounds for older CMake
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||||
@ -59,11 +69,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
|
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
# C++14 is mandatory
|
|
||||||
set(CPP_STD_NUMBER 14)
|
|
||||||
# Specific flags
|
|
||||||
set(CPP_STD_COMPILER_FLAG "-std=c++14")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
Loading…
Reference in New Issue
Block a user