Skip to content

Commit

Permalink
Merge topic 'swift-install-names' into release-3.29
Browse files Browse the repository at this point in the history
8669176 Swift: Fix INSTALL_NAME_DIR under CMP0157 NEW behavior

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9692
  • Loading branch information
bradking committed Aug 2, 2024
2 parents 651fa9e + 8669176 commit 931dd7d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Modules/CMakeSwiftInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if(CMAKE_Swift_COMPILATION_MODE_DEFAULT)
endif()

if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> ${CMAKE_Swift_PARALLEL_FLAGS} -emit-library <CMAKE_SHARED_LIBRARY_Swift_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <SONAME_FLAG> <TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> ${CMAKE_Swift_PARALLEL_FLAGS} -emit-library <CMAKE_SHARED_LIBRARY_Swift_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
endif()

if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.*swiftc(.exe)? [^
]* -parse-as-library -static -emit-module [^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? [^
]* -parse-as-library -emit-module [^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? [^
]* -emit-library [^
]* -Xlinker -install_name -Xlinker @rpath/libDynamicLibrary.dylib -o ([A-Za-z]+/)?libDynamicLibrary.dylib [^
]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.*swiftc(.exe)? [^
]* -parse-as-library -static -emit-module [^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? [^
]* -parse-as-library -emit-module [^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? [^
]* -emit-library [^
]* -Xlinker -implib:DynamicLibrary.lib +-o ([A-Za-z]+/)?DynamicLibrary.dll [^
]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
14 changes: 11 additions & 3 deletions Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.*swiftc(.exe)? .* -parse-as-library -static -emit-module .* -module-name StaticLibrary [^
.*swiftc(.exe)? [^
]* -parse-as-library -static -emit-module [^
]* -module-name StaticLibrary [^
]*
.*swiftc(.exe)? .* -parse-as-library -emit-module .* -module-name DynamicLibrary [^
.*swiftc(.exe)? [^
]* -parse-as-library -emit-module [^
]* -module-name DynamicLibrary [^
]*
.*swiftc(.exe)? .* -j [0-9]* -num-threads [0-9]* -c -module-name Executable
.*swiftc(.exe)? [^
]* -emit-library [^
]* -Xlinker -soname -Xlinker libDynamicLibrary.so -o ([A-Za-z]+/)?libDynamicLibrary.so [^
]*
.*swiftc(.exe)? -j [0-9]+ -num-threads [0-9]+ -c -module-name Executable
1 change: 1 addition & 0 deletions Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enable_language(Swift)

add_library(StaticLibrary STATIC L.swift)
add_library(DynamicLibrary SHARED L.swift)
set_target_properties(DynamicLibrary PROPERTIES INSTALL_NAME_DIR "@rpath")
add_executable(Executable E.swift)

add_dependencies(DynamicLibrary StaticLibrary)
Expand Down

0 comments on commit 931dd7d

Please sign in to comment.