diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2016-04-15 17:40:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-04-28 13:16:35 (GMT) |
commit | 36f32ede8d1a2aa1578a726f687a24dec4cc3f33 (patch) | |
tree | 8258a383b95b406a7a5dd0ab3f8c760c355d33ff /Modules/Compiler/Intel-C.cmake | |
parent | d028b948721d7a6042b87e238542a11fea78edb0 (diff) | |
download | CMake-36f32ede8d1a2aa1578a726f687a24dec4cc3f33.zip CMake-36f32ede8d1a2aa1578a726f687a24dec4cc3f33.tar.gz CMake-36f32ede8d1a2aa1578a726f687a24dec4cc3f33.tar.bz2 |
Features: Record standards and features for Intel C on UNIX
Record features for Intel C 12.1 and above. Skip this for now on
Windows (where Intel C simulates MSVC).
Diffstat (limited to 'Modules/Compiler/Intel-C.cmake')
-rw-r--r-- | Modules/Compiler/Intel-C.cmake | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 77363eb..6e07436 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -8,5 +8,55 @@ 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 (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() +endif() + +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + endif() + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 90) + endif() + endif() +endif() + +macro(cmake_record_c_compile_features) + macro(_get_intel_c_features std_version list) + record_compiler_features(C "${std_version}" ${list}) + endmacro() + + set(_result 0) + if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + _get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_c_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_c_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + endif() + endif() +endmacro() + set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") |