Skip to content

Truly independent web browser

Meta: Give the executables of static builds no runpath

Jelle Raaijmakers482892f1de48
diff --git a/Meta/CMake/lagom_install_options.cmake b/Meta/CMake/lagom_install_options.cmake
index 4f97f6c73b6..4cee4ba8121 100644
--- a/Meta/CMake/lagom_install_options.cmake
+++ b/Meta/CMake/lagom_install_options.cmake
@@ -32,9 +32,15 @@ endif()
if (APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_NAME_DIR "@rpath")
- set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
-else()
- set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
+endif()
+
+# Static builds install no libraries of their own, so their executables have nothing to look for next to them.
+if (BUILD_SHARED_LIBS)
+ if (APPLE)
+ set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
+ else()
+ set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
+ endif()
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)