CMake: fixed compiler check algorithm (support of C++11)

CXX_STANDARD supported values are 98, 11, 14, 17 and 20.
- https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html
This commit is contained in:
r-a-sattarov 2020-05-03 13:48:13 +03:00
parent 7eddea53f5
commit 0f0053b143
4 changed files with 5 additions and 6 deletions

View file

@ -116,18 +116,17 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
#add_definitions(-Wall)
add_definitions(-Werror=format-security)
add_definitions(-Werror=format)
# Compiler check (needs -std=c++11 flag)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_STANDARD 11)
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_STANDARD 0x)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CPU_TYPE)
add_definitions(-DCPUSTRING="${CPU_TYPE}")

0
neo/cmake-linux-debug-nosimd.sh Normal file → Executable file
View file

0
neo/cmake-linux-release-nosimd.sh Normal file → Executable file
View file

View file

@ -113,7 +113,7 @@ If you have questions concerning this license or the applicable additional terms
#define CPUSTRING "e2k"
#elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
#define CPUSTRING "aarch64"
#else
#else
#error unknown CPU
#endif
#endif