summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-09 15:37:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-05-09 15:37:35 (GMT)
commitb69e061b8073efbd2c356f4508ea401c85e8dae3 (patch)
treebafe49c2a963cec546634a6c7872a925736cb8b2
parentfcf60ec1bcb0fa3224bfe80f8279c29670cefd19 (diff)
parent2731a91c98ad8b48aaecc2fa3039cc9601d48fbc (diff)
downloadCMake-b69e061b8073efbd2c356f4508ea401c85e8dae3.zip
CMake-b69e061b8073efbd2c356f4508ea401c85e8dae3.tar.gz
CMake-b69e061b8073efbd2c356f4508ea401c85e8dae3.tar.bz2
Merge topic 'suncc-cxx11'
2731a91c Update SunPro flags used for CMake itself to support C++11 86edc5b6 Choose compiler-specific flags earlier in CMake's own build 7b2d529b cmBase32: Cast pointer subtraction result to size explicitly Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !813
-rw-r--r--CMakeLists.txt19
-rw-r--r--CompileFlags.cmake9
-rw-r--r--Source/cmBase32.cxx2
3 files changed, 21 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4dcf2f0..eb46c3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,14 +55,22 @@ 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)
+ # include special compile flags for some compilers
+ include(CompileFlags.cmake)
+
+ # check for available C++ features
include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake)
endif()
@@ -648,9 +656,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
endif()
- # include special compile flags for some compilers
- include(CompileFlags.cmake)
-
# no clue why we are testing for this here
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
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()
diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx
index 091d619..1dac212 100644
--- a/Source/cmBase32.cxx
+++ b/Source/cmBase32.cxx
@@ -58,7 +58,7 @@ std::string cmBase32Encoder::encodeString(const unsigned char* input,
input += blockSize;
}
- size_t remain(end - input);
+ size_t remain = static_cast<size_t>(end - input);
if (remain != 0) {
// Temporary source buffer filled up with 0s
unsigned char extended[blockSize];