diff options
author | Brad King <brad.king@kitware.com> | 2017-05-08 14:26:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-08 14:53:46 (GMT) |
commit | 2731a91c98ad8b48aaecc2fa3039cc9601d48fbc (patch) | |
tree | 8380a837b0e22ccef3e360567a133c33da08b311 | |
parent | 86edc5b6a5f9ef74d8807a6b90d209cce4e3a2d7 (diff) | |
download | CMake-2731a91c98ad8b48aaecc2fa3039cc9601d48fbc.zip CMake-2731a91c98ad8b48aaecc2fa3039cc9601d48fbc.tar.gz CMake-2731a91c98ad8b48aaecc2fa3039cc9601d48fbc.tar.bz2 |
Update SunPro flags used for CMake itself to support C++11
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | CompileFlags.cmake | 9 |
2 files changed, 16 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b88538..eb46c3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,11 +55,15 @@ if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD) endif() endif() if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) - include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake) - if(NOT CMake_CXX14_CSTDIO_BROKEN) - set(CMAKE_CXX_STANDARD 14) + if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14) + set(CMAKE_CXX_STANDARD 98) else() - set(CMAKE_CXX_STANDARD 11) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake) + if(NOT CMake_CXX14_CSTDIO_BROKEN) + set(CMAKE_CXX_STANDARD 14) + else() + set(CMAKE_CXX_STANDARD 11) + endif() endif() endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/CompileFlags.cmake b/CompileFlags.cmake index d70e3af..d1f4f13 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -61,7 +61,14 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + elseif(CMAKE_VERSION VERSION_LESS 3.8.20170502) + # CMake knows how to add this flag for compilation as C++11, + # but has not been taught that SunPro needs it for linking too. + # Add it in a place that will be used for both. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") endif() |