mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adjust the build rules to add a build RPATH into the executable to ensure that `lib_InternalSwiftSyntaxParser.so` is properly found when running the tests. This also should ensure that we always use the correct version, irrespective of the setting of `LD_LIBRARY_PATH`. This RPATH is marked as a `BUILD_RPATH` and will be stripped if the tool is installed. Adjust the dependencies to be clearer using generator expressions and use the `target_compile_options` rather than the more fragile `set_target_properties` to add `-fblocks` to the compilation. This is now possible as we are ensured that we are using CMake 3.15+.
28 lines
922 B
CMake
28 lines
922 B
CMake
include(SwiftWindowsSupport)
|
|
swift_swap_compiler_if_needed("SwiftSyntaxParserTest")
|
|
|
|
add_swift_host_tool(swift-syntax-parser-test
|
|
swift-syntax-parser-test.cpp
|
|
LLVM_LINK_COMPONENTS
|
|
Support
|
|
SWIFT_COMPONENT tools
|
|
)
|
|
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|
set_target_properties(swift-syntax-parser-test PROPERTIES
|
|
BUILD_WITH_INSTALL_RPATH YES
|
|
INSTALL_RPATH @executable_path/../lib)
|
|
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
set_target_properties(swift-syntax-parser-test PROPERTIES
|
|
BUILD_WITH_INSTALL_RPATH YES
|
|
INSTALL_RPATH ${SWIFT_LIBRARY_OUTPUT_INTDIR})
|
|
endif()
|
|
target_compile_options(swift-syntax-parser-test PRIVATE
|
|
-fblocks)
|
|
target_link_libraries(swift-syntax-parser-test PRIVATE
|
|
$<$<NOT:$<PLATFORM_ID:Darwin>>:BlocksRuntime>
|
|
libSwiftSyntaxParser)
|
|
|
|
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
|
|
add_dependencies(swift-syntax-parser-test clang)
|
|
endif()
|