diff Plugins/Samples/Common/OrthancPlugins.cmake @ 1647:fe458dde986e

hide symbols in plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Sep 2015 11:02:26 +0200
parents 97268448bdfc
children a412ad57f0f9
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPlugins.cmake	Thu Sep 24 16:01:09 2015 +0200
+++ b/Plugins/Samples/Common/OrthancPlugins.cmake	Fri Sep 25 11:02:26 2015 +0200
@@ -6,6 +6,7 @@
   link_libraries(uuid)
   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
   SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
+
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
   link_libraries(rpcrt4 ws2_32 secur32)
   if (CMAKE_COMPILER_IS_GNUCXX)
@@ -21,8 +22,16 @@
 endif ()
 
 
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${SAMPLES_ROOT}/Common/VersionScript.map -Wl,--no-undefined")
+elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/Plugins/Samples/Common/ExportedSymbols.list")
+endif()
+
+
 if (CMAKE_COMPILER_IS_GNUCXX)
-  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${SAMPLES_ROOT}/Common/VersionScript.map -Wl,--no-undefined")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
 endif()
@@ -34,7 +43,6 @@
   link_libraries(dl rt)
 endif()
 
-
 include_directories(${SAMPLES_ROOT}/../Include/)
 
 if (MSVC)