Skip to content

Commit 3c51b6a

Browse files
committed
depends: Set CMAKE_INSTALL_RPATH for native packages
After #19685 started setting LDFLAGS, the INSTALL_RPATH_USE_LINK_PATH cmake option used in the libmultiprocess build no longer works, so it is neccessary to set CMAKE_INSTALL_RPATH as a fallback. It's unclear currently whether the bad interaction between INSTALL_RPATH_USE_LINK_PATH and LDFLAGS is a bug, but the issue is reported: #19981 (comment) https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892 Fixes #19981
1 parent 72affcb commit 3c51b6a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

depends/funcs.mk

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,16 @@ $(1)_cmake=env CC="$$($(1)_cc)" \
163163
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
164164
LDFLAGS="$$($(1)_ldflags)" \
165165
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)"
166+
$(1)_cmake_conf_native=-DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
167+
$(1)_cmake_conf_cross=-DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system) -DCMAKE_C_COMPILER_TARGET=$(host) -DCMAKE_CXX_COMPILER_TARGET=$(host)
166168
ifneq ($($(1)_type),build)
167169
ifneq ($(host),$(build))
168-
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
169-
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
170-
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
170+
$(1)_cmake += $$($(1)_cmake_conf_cross)
171+
else
172+
$(1)_cmake += $$($(1)_cmake_conf_native)
171173
endif
174+
else
175+
$(1)_cmake += $$($(1)_cmake_conf_native)
172176
endif
173177
endef
174178

0 commit comments

Comments
 (0)