Skip to content

Commit 2fc20bf

Browse files
authored
Merge pull request #286 from Libvisual/fix-lv-compile-link-options
Core (Build): Fix LV .so compile and link options.
2 parents e6841ab + 14c2635 commit 2fc20bf

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

libvisual-plugins/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
7777
# Assembly
7878
#AM_PROG_AS
7979

80+
# Resolve all external symbols when linking SOs.
81+
OPTION(ENABLE_SO_UNRESOLVED_SYMBOL_CHECKS "Enable resolution of external symbols when linking SOs" yes)
82+
8083
# Internationalization
8184
SET(GETTEXT_PACKAGE "libvisual-plugins-${LV_PLUGINS_VERSION_SUFFIX}")
8285
OPTION(ENABLE_NLS "Enable internationalization" yes)

libvisual-plugins/cmake/LVBuildPlugin.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ FUNCTION(LV_BUILD_PLUGIN PLUGIN_NAME PLUGIN_TYPE)
5252
${PARSE_ARGS_LINK_OPTIONS}
5353
)
5454

55-
SET_TARGET_PROPERTIES(${SO_NAME} PROPERTIES
56-
LINK_FLAGS -Wl,--unresolved-symbols,ignore-in-shared-libs
57-
)
55+
IF(ENABLE_SO_UNRESOLVED_SYMBOL_CHECKS)
56+
TARGET_LINK_OPTIONS(${SO_NAME}
57+
PRIVATE
58+
-Wl,--unresolved-symbols,ignore-in-shared-libs
59+
)
60+
ENDIF()
5861

5962
TARGET_LINK_LIBRARIES(${SO_NAME}
6063
PRIVATE

libvisual/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ IF(IS_SYSTEM_DIR STREQUAL "-1")
134134
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
135135
ENDIF()
136136

137+
# Resolve all external symbols when linking SOs.
138+
OPTION(ENABLE_SO_UNRESOLVED_SYMBOL_CHECKS "Enable resolution of external symbols when linking SOs" yes)
139+
137140
# Compiler optimizations
138141
OPTION(ENABLE_EXTRA_OPTIMIZATIONS "Enable extra optimizations" no)
139142
IF(ENABLE_EXTRA_OPTIMIZATIONS)

libvisual/libvisual/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ SET_TARGET_PROPERTIES(libvisual
146146
OUTPUT_NAME visual-${LV_VERSION_SUFFIX}
147147
VERSION 0.0.0
148148
SOVERSION 0
149-
COMPILE_OPTIONS -fvisibility=hidden
150-
LINK_FLAGS -Wl,--no-undefined
151149
)
152150

151+
TARGET_COMPILE_OPTIONS(libvisual PRIVATE -fvisibility=hidden)
152+
153153
IF(ENABLE_TESTS)
154154
TARGET_COMPILE_DEFINITIONS(libvisual PRIVATE _LV_BUILD_PRIVATE_TEST_FUNCS)
155155
ENDIF()
@@ -163,6 +163,10 @@ TARGET_INCLUDE_DIRECTORIES(libvisual
163163
${CMAKE_CURRENT_BINARY_DIR}
164164
)
165165

166+
IF(ENABLE_SO_UNRESOLVED_SYMBOL_CHECKS)
167+
TARGET_LINK_OPTIONS(libvisual PRIVATE -Wl,--no-undefined)
168+
ENDIF()
169+
166170
TARGET_LINK_LIBRARIES(libvisual
167171
PRIVATE
168172
PkgConfig::ORC

0 commit comments

Comments
 (0)