Skip to content

Commit a90e8c5

Browse files
authored
Merge pull request #616 from rintaro/macros-rpath
[CMake/Macros] Set correct RPATH
2 parents ade1954 + 21c7d76 commit a90e8c5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Sources/TestingMacros/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ else()
6060
add_library(TestingMacros SHARED)
6161

6262
target_link_options(TestingMacros PRIVATE "-no-toolchain-stdlib-rpath")
63-
# Not setting RPATH means it requires all the dependencies are already loaded
64-
# in the process, because 'plugin' directory wouldn't contain any dependencies.
65-
set_property(TARGET TestingMacros PROPERTY INSTALL_RPATH)
6663
set_property(TARGET TestingMacros PROPERTY BUILD_WITH_INSTALL_RPATH YES)
6764

6865
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6966
set(plugin_destination_dir "lib/swift/host/plugins/testing")
67+
set_property(TARGET TestingMacros PROPERTY INSTALL_RPATH)
7068
else()
7169
set(plugin_destination_dir "lib/swift/host/plugins")
70+
# RPATH 'lib/swift/{system}' and 'lib/swift/host'
71+
set_property(TARGET TestingMacros PROPERTY
72+
INSTALL_RPATH "$ORIGIN/../../<LOWER_CASE:${CMAKE_SYSTEM_NAME}>;$ORIGIN/..")
7273
endif()
7374

7475
install(TARGETS TestingMacros
@@ -103,6 +104,10 @@ target_sources(TestingMacros PRIVATE
103104
TestDeclarationMacro.swift
104105
TestingMacrosMain.swift)
105106

107+
target_compile_options(TestingMacros PRIVATE
108+
"SHELL:-Xfrontend -disable-implicit-string-processing-module-import"
109+
"SHELL:-Xfrontend -disable-implicit-backtracing-module-import")
110+
106111
target_link_libraries(TestingMacros PRIVATE
107112
SwiftSyntax::SwiftSyntax
108113
SwiftSyntax::SwiftSyntaxMacroExpansion

0 commit comments

Comments
 (0)