mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[test] Propagate CMake shared linker flags for tests to use (#85623)
The same that some setups needs the `CMAKE_EXE_LINKER_FLAGS` propagated for the test to compile plugins in the same configuration as the compiler was using, the `CMAKE_SHARED_LINKER_FLAGS` needs to be propagated if one wants to match the configuration used by CMake to create libraries during the tests. Add a new `config` value derived from `CMAKE_EXE_LINKER_FLAGS`, turn that value into a substitution for the `Macros` tests, and use the substibution in one test that creates a shared object. This allows the shared object to be linked in the same way that it has been configured in CMake.
This commit is contained in:
committed by
GitHub
parent
51d2f2b61d
commit
83a9913ac1
@@ -31,3 +31,4 @@ else:
|
||||
)
|
||||
config.substitutions.append(('%c-flags', config.c_flags))
|
||||
config.substitutions.append(('%exe-linker-flags', config.exe_linker_flags))
|
||||
config.substitutions.append(('%shared-linker-flags', config.shared_linker_flags))
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
// RUN: %cmake-c-compiler \
|
||||
// RUN: %c-flags -target %host_triple -isysroot %host_sdk \
|
||||
// RUN: %shared-linker-flags \
|
||||
// RUN: -shared -o %t/plugins/libCrashOnLoad.dylib \
|
||||
// RUN: %t/CrashOnLoad.c
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ config.cmake_c_compiler = r'''@CMAKE_C_COMPILER@'''
|
||||
config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@'''
|
||||
config.c_flags = r'''@CMAKE_C_FLAGS@'''
|
||||
config.exe_linker_flags = r'''@CMAKE_EXE_LINKER_FLAGS@'''
|
||||
config.shared_linker_flags = r'''@CMAKE_SHARED_LINKER_FLAGS@'''
|
||||
|
||||
# --- Darwin ---
|
||||
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
|
||||
|
||||
Reference in New Issue
Block a user