diff options
author | Brad King <brad.king@kitware.com> | 2017-05-03 15:00:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-05-03 15:01:12 (GMT) |
commit | bf3c08d648c398026eef363bb43d3f8bfaf2a286 (patch) | |
tree | 9c325a427ffb2df7298ce512345d211df1a1d45c /Modules | |
parent | f1e91c694b1581b4ae923b3bd4a243372cb29023 (diff) | |
parent | d908987634ad1dd1295ac585ffe7c810bda69415 (diff) | |
download | CMake-bf3c08d648c398026eef363bb43d3f8bfaf2a286.zip CMake-bf3c08d648c398026eef363bb43d3f8bfaf2a286.tar.gz CMake-bf3c08d648c398026eef363bb43d3f8bfaf2a286.tar.bz2 |
Merge topic 'port-language-default-to-common-macro'
d9089876 AppleClang: Use common compiler macros for language standard default
174c02e1 SunPro: Use common compiler macros for language standard default
08fa2ba8 Clang: Use common compiler macros for language standard default
0198502f Intel: Use common compiler macros for language standard default
d1aa2b3f GNU: Use common compiler macros for language standard default
87b9d6d9 XL: Use common compiler macros for language standard default
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !787
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/AppleClang-C.cmake | 12 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-CXX.cmake | 13 | ||||
-rw-r--r-- | Modules/Compiler/Clang-C.cmake | 16 | ||||
-rw-r--r-- | Modules/Compiler/Clang-CXX.cmake | 12 | ||||
-rw-r--r-- | Modules/Compiler/Clang.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/GNU-C.cmake | 16 | ||||
-rw-r--r-- | Modules/Compiler/GNU-CXX.cmake | 12 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/Intel-C.cmake | 18 | ||||
-rw-r--r-- | Modules/Compiler/Intel-CXX.cmake | 15 | ||||
-rw-r--r-- | Modules/Compiler/Intel.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/SunPro-CXX.cmake | 17 | ||||
-rw-r--r-- | Modules/Compiler/SunPro.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/XL-C.cmake | 41 | ||||
-rw-r--r-- | Modules/Compiler/XL-CXX.cmake | 53 | ||||
-rw-r--r-- | Modules/Compiler/XL.cmake | 2 |
16 files changed, 69 insertions, 174 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index f874e74..c18f541 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -12,17 +12,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) - 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. - set(CMAKE_C_STANDARD_DEFAULT 99) - endif() -endif() +__compiler_check_default_language_standard(C 4.0 99) macro(cmake_record_c_compile_features) set(_result 0) diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index ee900ae..904d965 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -27,18 +27,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - endif() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif() -endif() - +__compiler_check_default_language_standard(CXX 4.0 98) macro(cmake_record_cxx_compile_features) set(_result 0) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index bcd9218..b94087f 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -17,21 +17,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - 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 3.6) - set(CMAKE_C_STANDARD_DEFAULT 11) - else() - set(CMAKE_C_STANDARD_DEFAULT 99) - endif() - endif() -endif() +__compiler_check_default_language_standard(C 3.4 99 3.6 11) macro(cmake_record_c_compile_features) set(_result 0) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 8ed3695..5904efa 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -36,17 +36,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - endif() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif() -endif() +__compiler_check_default_language_standard(CXX 3.1 98) macro(cmake_record_cxx_compile_features) set(_result 0) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 8c2f87d..ef7ff2e 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -8,6 +8,8 @@ if(__COMPILER_CLANG) endif() set(__COMPILER_CLANG 1) +include(Compiler/CMakeCommonCompilerMacros) + if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") macro(__compiler_clang lang) diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 3f02618..8090fa6 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -22,21 +22,7 @@ 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 3.4) - 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 5.0) - set(CMAKE_C_STANDARD_DEFAULT 11) - else() - set(CMAKE_C_STANDARD_DEFAULT 90) - endif() - endif() -endif() +__compiler_check_default_language_standard(C 3.4 90 5.0 11) macro(cmake_record_c_compile_features) set(_result 0) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 2499d2f..b221c4a 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -38,17 +38,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - endif() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif() -endif() +__compiler_check_default_language_standard(CXX 4.4 98 6.0 14) macro(cmake_record_cxx_compile_features) set(_result 0) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 0a510f5..e2739a8 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -8,6 +8,8 @@ if(__COMPILER_GNU) endif() set(__COMPILER_GNU 1) +include(Compiler/CMakeCommonCompilerMacros) + macro(__compiler_gnu lang) # Feature flags. set(CMAKE_${lang}_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 9c67fbd..d583dba 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -30,25 +30,11 @@ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=${_ext}99") 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() - unset(_std) unset(_ext) +__compiler_check_default_language_standard(C 12.1 90 15.0.0 11) + macro(cmake_record_c_compile_features) set(_result 0) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 9c39236..4aef30a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -47,22 +47,11 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) endif() endif() -if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - else() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - endif() - elseif (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif() -endif() - unset(_std) unset(_ext) +__compiler_check_default_language_standard(CXX 12.1 98) + macro(cmake_record_cxx_compile_features) set(_result 0) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index 06d01f1..635ac4d 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -8,6 +8,8 @@ if(__COMPILER_INTEL) endif() set(__COMPILER_INTEL 1) +include(Compiler/CMakeCommonCompilerMacros) + if(CMAKE_HOST_WIN32) # MSVC-like macro(__compiler_intel lang) diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index b4183db..5db7987 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,3 +1,8 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Compiler/SunPro) + set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC) @@ -39,17 +44,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - endif() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif() -endif() +__compiler_check_default_language_standard(CXX 5.13 98) macro(cmake_record_cxx_compile_features) set(_result 0) diff --git a/Modules/Compiler/SunPro.cmake b/Modules/Compiler/SunPro.cmake new file mode 100644 index 0000000..52da39a --- /dev/null +++ b/Modules/Compiler/SunPro.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_SUNPRO) + return() +endif() +set(__COMPILER_SUNPRO 1) + +include(Compiler/CMakeCommonCompilerMacros) 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) diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 98ccb29..b87e923 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -12,32 +12,30 @@ string(APPEND CMAKE_CXX_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.*ppc64") - if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + if (CMAKE_SYSTEM MATCHES "Linux.*ppc64") + if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") + else () + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + endif () else () - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") - endif () - else () - # The non-clang based Linux ppc64 compiler, both big-endian and - # little-endian lacks, the non-extension language level flags - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + # The non-clang based Linux ppc64 compiler, both big-endian and + # little-endian lacks, the non-extension language level flags set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") endif () - endif () -else () - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + else () set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") @@ -45,18 +43,7 @@ else () endif () endif () +__compiler_check_default_language_standard(CXX 10.1 98) + set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") - -if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) - if (NOT CMAKE_CXX_COMPILER_FORCED) - if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") - else () - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) - endif () - elseif (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) - # Compiler id was forced so just guess the default standard level. - set(CMAKE_CXX_STANDARD_DEFAULT 98) - endif () -endif () diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 55f71bd..4783785 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -8,6 +8,8 @@ if(__COMPILER_XL) endif() set(__COMPILER_XL 1) +include(Compiler/CMakeCommonCompilerMacros) + # Find the CreateExportList program that comes with this toolchain. find_program(CMAKE_XL_CreateExportList NAMES CreateExportList |