cmake: Only pass -Wl,--export-dynamic when linking

Otherwise we get the following warnings when building .o files with Clang:
clang-13: warning: -Wl,--export-dynamic: 'linker' input unused [-Wunused-command-line-argument]

This is required to allow the -Werror build to pass on FreeBSD.

(cherry picked from commit 1a8fd7a382)
Backported-from: dbus!278
This commit is contained in:
Alex Richardson 2022-03-19 17:56:54 +00:00 committed by Simon McVittie
parent 8c05bdc586
commit 41d2026fbd

View file

@ -377,8 +377,8 @@ endif()
if(UNIX AND NOT DBUS_DISABLE_ASSERT)
# required for backtrace
string(APPEND CMAKE_C_FLAGS_DEBUG " -Wl,--export-dynamic")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wl,--export-dynamic")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-dynamic")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--export-dynamic")
set(DBUS_BUILT_R_DYNAMIC 1)
endif()