Commit 9addce99 authored by Brad King's avatar Brad King

Features: Record standard flags for Intel C/C++ on Windows

Select the `-std=` or `-Qstd=` flag based on whether Intel is GNU-like
or MSVC-like, respectively.
parent 15a6c950
......@@ -8,18 +8,22 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>")
if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11")
endif()
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(_std -Qstd)
else()
set(_std -std)
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=c89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=c99")
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=c11")
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "${_std}=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=c89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "${_std}=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=c99")
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
......@@ -38,6 +42,8 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
endif()
endif()
unset(_std)
macro(cmake_record_c_compile_features)
macro(_get_intel_c_features std_version list)
record_compiler_features(C "${std_version}" ${list})
......
......@@ -8,29 +8,33 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>")
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
# todo: there is no gnu++14 value supported; figure out what to do
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
# todo: there is no gnu++14 value supported; figure out what to do
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++1y")
endif()
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(_std -Qstd)
else()
set(_std -std)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++14")
# todo: there is no gnu++14 value supported; figure out what to do
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++14")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++1y")
# todo: there is no gnu++14 value supported; figure out what to do
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++1y")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++11")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++0x")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
......@@ -46,6 +50,8 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
endif()
endif()
unset(_std)
macro(cmake_record_cxx_compile_features)
macro(_get_intel_features std_version list)
record_compiler_features(CXX "${std_version}" ${list})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment