summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/XL-CXX.cmake
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2017-05-01 13:29:03 (GMT)
committerChuck Atkins <chuck.atkins@kitware.com>2017-05-02 13:49:23 (GMT)
commit87b9d6d93f2e5e6076992cae7395647359de306d (patch)
treebaa1bb65a89c21138efa3993b9db44adeb35874e /Modules/Compiler/XL-CXX.cmake
parentccd7d98b38de3246ac238777aa7e592693a22e4c (diff)
downloadCMake-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-CXX.cmake')
-rw-r--r--Modules/Compiler/XL-CXX.cmake53
1 files changed, 20 insertions, 33 deletions
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 ()