diff options
author | Brad King <brad.king@kitware.com> | 2015-10-02 14:56:52 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-10-02 14:56:52 (GMT) |
commit | 7555babbcf4b2b68bdfe99649be3b6076230518b (patch) | |
tree | d906c055fa2635051c72a07a3a1dd910948c7521 | |
parent | 9b5554cda122e8be179cbc2bbe9ed82ed26b20b0 (diff) | |
parent | 5fdf75947822bc17d30a9e60022a4fc77b4cdf63 (diff) | |
download | CMake-7555babbcf4b2b68bdfe99649be3b6076230518b.zip CMake-7555babbcf4b2b68bdfe99649be3b6076230518b.tar.gz CMake-7555babbcf4b2b68bdfe99649be3b6076230518b.tar.bz2 |
Merge topic 'compiler-features-solaris'
5fdf7594 Tests: Suppress WriteCompilerDetectionHeader failure on SunPro
c824b23d Features: Fix C++98 flags on Oracle SolarisStudio 12.4 on Linux
61bc0f73 Features: Disable support for Oracle SolarisStudio on non-Linux
-rw-r--r-- | Help/manual/cmake-compile-features.7.rst | 2 | ||||
-rw-r--r-- | Modules/Compiler/SunPro-CXX.cmake | 32 | ||||
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 3 |
3 files changed, 22 insertions, 15 deletions
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index caf5bac..2dc67bc 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -308,4 +308,4 @@ versions specified for each: * ``Clang``: Clang compiler versions 2.9 through 3.4. * ``GNU``: GNU compiler versions 4.4 through 5.0. * ``MSVC``: Microsoft Visual Studio versions 2010 through 2015. -* ``SunPro``: Oracle SolarisStudio version 12.4. +* ``SunPro``: Oracle SolarisStudio version 12.4 on a Linux host. diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 50d68ee..0e936ca 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -31,17 +31,21 @@ set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> " "<CMAKE_RANLIB> <TARGET> ") -if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") -endif() +if (CMAKE_SYSTEM_NAME STREQUAL Linux) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++03") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=c++03") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") + 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}") + 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}) endif() - set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) endif() endif() @@ -51,10 +55,12 @@ macro(cmake_record_cxx_compile_features) endmacro() set(_result 0) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) - if (_result EQUAL 0) - _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES) + if (CMAKE_SYSTEM_NAME STREQUAL Linux) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + if (_result EQUAL 0) + _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES) + endif() endif() endif() endmacro() diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index c538280..ffee035 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -25,7 +25,8 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) ) add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") - if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if((UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") include(CheckCXXSourceCompiles) check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" file_include_works |