diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-01 09:20:17 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-01 09:20:17 +0100 |
commit | 5a2ddaf39cf5ad86cf43d8a01f51989b5e3afa49 (patch) | |
tree | fa1fa28985c649bd25195f800bb8d2ba25bb37cb | |
parent | 0497f57268e8be7af69d37e24fa356e441c0d5f6 (diff) |
cmake: export only needed symbols
-rw-r--r-- | cmake/opentrack-macros.cmake | 22 | ||||
-rw-r--r-- | csv/CMakeLists.txt | 2 | ||||
-rw-r--r-- | opentrack-compat/CMakeLists.txt | 2 | ||||
-rw-r--r-- | pose-widget/CMakeLists.txt | 2 | ||||
-rw-r--r-- | qxt-mini/CMakeLists.txt | 2 | ||||
-rw-r--r-- | spline-widget/CMakeLists.txt | 2 |
6 files changed, 20 insertions, 12 deletions
diff --git a/cmake/opentrack-macros.cmake b/cmake/opentrack-macros.cmake index 46cf3c61..9be09397 100644 --- a/cmake/opentrack-macros.cmake +++ b/cmake/opentrack-macros.cmake @@ -32,7 +32,7 @@ endfunction() macro(opentrack_library n dir) cmake_parse_arguments(opentrack-foolib - "NO-LIBRARY;STATIC;NO-COMPAT;NO-LINKER-SCRIPT" + "NO-LIBRARY;STATIC;NO-COMPAT;NO-LINKER-SCRIPT;LINKAGE" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN} @@ -54,17 +54,25 @@ macro(opentrack_library n dir) endif() target_link_libraries(${n} ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT opentrack-foolib_NO-LINKER-SCRIPT) - SET_TARGET_PROPERTIES(${n} PROPERTIES + set_target_properties(${n} PROPERTIES LINK_FLAGS "${opentrack-foolib_LINK} ${opentrack-foolib_GNU-LINK} -Wl,--as-needed -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack-compat/${version-script}-version-script.txt\"" COMPILE_FLAGS "${opentrack-foolib_COMPILE} ${opentrack-foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() - set(link-flags) - if(MSVC) - set(link-flags "${msvc-subsystem} /DEBUG /OPT:ICF") + set(c-props) + set(l-props) + if(opentrack-foolib_LINKAGE AND CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + set(c-props "${opentrack-foolib_COMPILE} ${opentrack-foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden") + set(l-props "${opentrack-foolib_LINK} ${opentrack-foolib_GNU-LINK} -Wl,--as-needed") + else() + if(MSVC) + set(l-props "${msvc-subsystem} /DEBUG /OPT:ICF") + endif() endif() - set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${opentrack-foolib_LINK}" COMPILE_FLAGS "${opentrack-foolib_COMPILE}") - set(link-flags) + set_target_properties(${n} PROPERTIES + LINK_FLAGS "${l-props} ${opentrack-foolib_LINK}" + COMPILE_FLAGS "${c-props} ${opentrack-foolib_COMPILE}" + ) endif() string(REGEX REPLACE "^opentrack-" "" n_ ${n}) string(REPLACE "-" "_" n_ ${n_}) diff --git a/csv/CMakeLists.txt b/csv/CMakeLists.txt index 7e80317c..7bafc7ff 100644 --- a/csv/CMakeLists.txt +++ b/csv/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-csv NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-csv NO-LINKER-SCRIPT LINKAGE) diff --git a/opentrack-compat/CMakeLists.txt b/opentrack-compat/CMakeLists.txt index a92f4f31..37d53e6c 100644 --- a/opentrack-compat/CMakeLists.txt +++ b/opentrack-compat/CMakeLists.txt @@ -1,4 +1,4 @@ -opentrack_boilerplate(opentrack-compat NO-COMPAT NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-compat NO-COMPAT NO-LINKER-SCRIPT LINKAGE) if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() diff --git a/pose-widget/CMakeLists.txt b/pose-widget/CMakeLists.txt index 66cafef7..e48660d7 100644 --- a/pose-widget/CMakeLists.txt +++ b/pose-widget/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-pose-widget NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-pose-widget NO-LINKER-SCRIPT LINKAGE) diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 5de29cd1..a8b8fb1d 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -1,5 +1,5 @@ if(UNIX OR APPLE) - opentrack_boilerplate(opentrack-qxt-mini NO-LINKER-SCRIPT NO-COMPAT) + opentrack_boilerplate(opentrack-qxt-mini NO-LINKER-SCRIPT NO-COMPAT LINKAGE) if(NOT APPLE) target_link_libraries(opentrack-qxt-mini X11) else() diff --git a/spline-widget/CMakeLists.txt b/spline-widget/CMakeLists.txt index 93958f50..4d951f92 100644 --- a/spline-widget/CMakeLists.txt +++ b/spline-widget/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-spline-widget NO-LINKER-SCRIPT NO-COMPAT) +opentrack_boilerplate(opentrack-spline-widget NO-LINKER-SCRIPT NO-COMPAT LINKAGE) |