mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 05:50:42 +00:00
XL: Use common compiler macros for language standard default
This commit is contained in:
parent
ccd7d98b38
commit
87b9d6d93f
@ -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)
|
||||
|
@ -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 ()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user