summaryrefslogtreecommitdiff
path: root/Toolchain/CMake/Platform/SerenityOS.cmake
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-01-02 23:59:17 -0700
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-03 11:08:45 +0000
commiteb672aef31391d1709378eb3d6b2a57492ca9291 (patch)
tree629a7d1d66bc1e3e24066d0ff746a28c34fc823d /Toolchain/CMake/Platform/SerenityOS.cmake
parent4dc538da0eb5c6fa2627f1d666f6cfaeac583e58 (diff)
downloadserenity-eb672aef31391d1709378eb3d6b2a57492ca9291.zip
Toolchain: Add CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME to Platform
This property tells CMake that if a library is missing a SONAME field, the link editor(s) we use will insert the full path to the library into the binary. This is the behaivor of GNU ld compatible linkers, so let's avoid that possiblity by telling CMake that it really doesn't want to let the linker embed the full path to the lib. This is especially important when cross-compiling things for ports and such, as the full path to the lib will have absolutely nothing to do with the runtime path
Diffstat (limited to 'Toolchain/CMake/Platform/SerenityOS.cmake')
-rw-r--r--Toolchain/CMake/Platform/SerenityOS.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Toolchain/CMake/Platform/SerenityOS.cmake b/Toolchain/CMake/Platform/SerenityOS.cmake
index fecf81df92..dbcd210978 100644
--- a/Toolchain/CMake/Platform/SerenityOS.cmake
+++ b/Toolchain/CMake/Platform/SerenityOS.cmake
@@ -8,6 +8,10 @@ set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code")
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
# to other libraries to select whether to use the static or shared