diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2017-05-01 13:29:03 (GMT) |
---|---|---|
committer | Chuck Atkins <chuck.atkins@kitware.com> | 2017-05-02 13:49:23 (GMT) |
commit | 87b9d6d93f2e5e6076992cae7395647359de306d (patch) | |
tree | baa1bb65a89c21138efa3993b9db44adeb35874e /Modules/Compiler/XL-C.cmake | |
parent | ccd7d98b38de3246ac238777aa7e592693a22e4c (diff) | |
download | CMake-87b9d6d93f2e5e6076992cae7395647359de306d.zip CMake-87b9d6d93f2e5e6076992cae7395647359de306d.tar.gz CMake-87b9d6d93f2e5e6076992cae7395647359de306d.tar.bz2 |
XL: Use common compiler macros for language standard default
Diffstat (limited to 'Modules/Compiler/XL-C.cmake')
-rw-r--r-- | Modules/Compiler/XL-C.cmake | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index ac84da2..5dc8bc1 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -12,21 +12,21 @@ string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") # little-endian, all versions on Linux ppc64 big-endian, all versions on AIX # and BGQ, etc) are derived from the UNIX compiler and only accept the # -qlanglvl option. -if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) - set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") - set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + else () + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + endif () else () - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") - endif () -else () - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") @@ -38,15 +38,4 @@ else () endif () endif() -if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.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}") - else () - set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) - endif () - elseif (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_C_STANDARD_DEFAULT 90) - endif () -endif () +__compiler_check_default_language_standard(C 10.1 90) |