Skip to content

Commit 7ecd25e

Browse files
committed
[CMake] Add padding to RUNPATH in linux
Shared libraries RUNPATH will be updated when they are copied to swift build directory. CMake's 'file(SET_RPATH ...)' requires RUNPATH field have enough lengh before updating.
1 parent 2e3c42c commit 7ecd25e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ function(add_swift_host_library name)
7171
)
7272

7373
get_target_property(lib_type ${name} TYPE)
74-
if(lib_type STREQUAL SHARED_LIBRARY AND CMAKE_SYSTEM_NAME STREQUAL Darwin)
75-
# Allow install_name_tool to update paths (for rdar://109473564)
76-
set_property(TARGET ${name} APPEND_STRING PROPERTY
77-
LINK_FLAGS " -Xlinker -headerpad_max_install_names")
74+
if(lib_type STREQUAL SHARED_LIBRARY)
75+
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
76+
# Allow install_name_tool to update paths (for rdar://109473564)
77+
set_property(TARGET ${name} APPEND_STRING PROPERTY
78+
LINK_FLAGS " -Xlinker -headerpad_max_install_names")
79+
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
80+
# Make some room to update paths.
81+
set_property(TARGET ${name} APPEND PROPERTY
82+
INSTALL_RPATH ":::::::::::::::::::::::::::::::::::::::::::::::::::::::")
83+
endif()
7884
endif()
7985

8086
# Install this target

0 commit comments

Comments
 (0)