]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: Use -Wl,-export_dynamic when building for macOS
authorAlex Richardson <arichardson.kde@gmail.com>
Sat, 19 Mar 2022 19:23:32 +0000 (19:23 +0000)
committerSimon McVittie <smcv@collabora.com>
Tue, 13 Sep 2022 11:24:05 +0000 (12:24 +0100)
The macOS linker does not accept --export-dynamic, so use this
alternate spelling.

(cherry picked from commit c7f6d072522702a505de71b3faa2ff160bde848e)
Backported-from: dbus!278

CMakeLists.txt

index 2eb4b52c514c77359ec77b0d8b899a553924aa4b..ae9700db60da372a8cb7c6cde54a4f06bbb79cdb 100644 (file)
@@ -377,8 +377,13 @@ endif()
 
 if(UNIX AND NOT DBUS_DISABLE_ASSERT)
     # required for backtrace
-    string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-dynamic")
-    string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--export-dynamic")
+    if (APPLE)
+        string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-export_dynamic")
+        string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-export_dynamic")
+    else()
+        string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-dynamic")
+        string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--export-dynamic")
+    endif()
     set(DBUS_BUILT_R_DYNAMIC 1)
 endif()