diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-09-15 17:42:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-09-18 14:00:21 (GMT) |
commit | 7235334a2f1b9a627cc1cdbc701ae0768b6e32c3 (patch) | |
tree | 36675c9df0477e6ecdb027979cfce0dbbdab2d15 /Modules/Compiler/GNU-C.cmake | |
parent | cda189356e7e0a897377c3d7ed02ea3a3ad1de5a (diff) | |
download | CMake-7235334a2f1b9a627cc1cdbc701ae0768b6e32c3.zip CMake-7235334a2f1b9a627cc1cdbc701ae0768b6e32c3.tar.gz CMake-7235334a2f1b9a627cc1cdbc701ae0768b6e32c3.tar.bz2 |
Project: Determine default language dialect for the compiler.
Use the __cplusplus and __STDC_VERSION__ macros to automatically
determine the default dialect for the compiler while determining its
id and version.
Diffstat (limited to 'Modules/Compiler/GNU-C.cmake')
-rw-r--r-- | Modules/Compiler/GNU-C.cmake | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 031ab73..5c68b1e 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -22,12 +22,14 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") endif() -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - set(CMAKE_C_STANDARD_DEFAULT 11) -elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) - set(CMAKE_C_STANDARD_DEFAULT 90) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + 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}) endif() + macro(cmake_record_c_compile_features) macro(_get_gcc_features std_version list) record_compiler_features(C "${std_version}" ${list}) |