CMake/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
Evan Wilde 8669176576 Swift: Fix INSTALL_NAME_DIR under CMP0157 NEW behavior
Setting `CMAKE_INSTALL_NAME_DIR` or the `INSTALL_NAME_DIR` on Swift
targets had no effect when CMP0157 was set to `NEW`.  This was a result
of missing the `<TARGET_INSTALLNAME_DIR>` before the `<TARGET_SONAME>`.
Fix that and add a test to verify that the install name directory is
included in the install name.

Fixes: #26175
2024-08-01 10:49:36 -04:00

14 lines
371 B
CMake

if(POLICY CMP0157)
cmake_policy(SET CMP0157 NEW)
endif()
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)
add_dependencies(Executable DynamicLibrary)