From 27b83b0f0294656c3b2a612e91c3bea53f4ca209 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 16 Sep 2022 22:21:42 -0700 Subject: [PATCH 1/2] [Unit tests] Use the rpaths determined for unit tests The function that adds runtime link flags overrides RPATH settings via `BUILD_WITH_INSTALL_RPATH`. Stop doing that for unit tests, because they depend on host libraries built into `lib` not `lib/swift/${platformname}`. --- cmake/modules/AddSwiftUnittests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/modules/AddSwiftUnittests.cmake b/cmake/modules/AddSwiftUnittests.cmake index cdb522e9fc464..9dff9f77a2e02 100644 --- a/cmake/modules/AddSwiftUnittests.cmake +++ b/cmake/modules/AddSwiftUnittests.cmake @@ -81,6 +81,7 @@ function(add_swift_unittest test_dirname) if (SWIFT_SWIFT_PARSER) _add_swift_runtime_link_flags(${test_dirname} "../../lib" "") + set_property(TARGET ${test_dirname} PROPERTY BUILD_WITH_INSTALL_RPATH OFF) endif() endfunction() From 2428f6d719954a4372c8f834bdc88d478c925f20 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Fri, 16 Sep 2022 16:36:51 -0700 Subject: [PATCH 2/2] [CMake] Disable the new Swift Swift parser if we can't find its targets file This allows us to more gracefully degrade when a host Swift toolchain can't be found, and the early SwiftSyntax build is skipped as a result. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae55b68378d04..6e8671635a199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -872,8 +872,14 @@ endif() # When we have the early SwiftSyntax build, we can include its parser. if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR) - set(SWIFT_SWIFT_PARSER TRUE) - include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake) + set(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS + ${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake) + if(NOT EXISTS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}") + message(STATUS "Skipping Swift Swift parser integration due to missing early SwiftSyntax") + else() + set(SWIFT_SWIFT_PARSER TRUE) + include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}) + endif() endif()