From c8e5d1b28d1502285c1adcc1f6eb9eb01b4bbc36 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 21 Aug 2015 16:44:43 -0400
Subject: [PATCH] Pass C++ standard flags to SunPro in standalone build

Pass flags to the SunPro compiler to improve the level of C++ standard
support beyond the default.  Do this only in a standalone build so that
host projects can set flags for us.

Change-Id: Ic9a84debfa939caf00b7ad99887793e885c35371
---
 CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea8c35d0..f063418a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -311,6 +311,15 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
     ENDIF()
   ENDIF()
 ENDIF()
+IF(KWSYS_STANDALONE)
+  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")
+    ELSE()
+      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
+    ENDIF()
+  ENDIF()
+ENDIF()
 
 #-----------------------------------------------------------------------------
 # Configure Large File Support.
-- 
GitLab