summaryrefslogtreecommitdiff
path: root/cmake/libutils.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/libutils.cmake')
-rw-r--r--cmake/libutils.cmake25
1 files changed, 18 insertions, 7 deletions
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index bb90f7d2a6c..7c13df05ca4 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -305,16 +305,27 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result)
ENDFUNCTION()
MACRO(RESTRICT_SYMBOL_EXPORTS target)
+ SET(VISIBILITY_HIDDEN_FLAG)
+
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
IF(HAVE_VISIBILITY_HIDDEN)
- GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
- IF(NOT COMPILE_FLAGS)
- # Avoid COMPILE_FLAGS-NOTFOUND
- SET(COMPILE_FLAGS)
- ENDIF()
- SET_TARGET_PROPERTIES(${target} PROPERTIES
- COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
+ SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
+ ENDIF()
+ ENDIF()
+
+ IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+ SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+ ENDIF()
+
+ IF(VISIBILITY_HIDDEN_FLAG)
+ GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
+ IF(NOT COMPILE_FLAGS)
+ # Avoid COMPILE_FLAGS-NOTFOUND
+ SET(COMPILE_FLAGS)
ENDIF()
+ SET_TARGET_PROPERTIES(${target} PROPERTIES
+ COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}")
ENDIF()
+
ENDMACRO()