diff --git a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake index 8efd59710305b..53b61093591cf 100644 --- a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake +++ b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake @@ -245,17 +245,6 @@ macro(add_sourcekit_executable name) target_link_libraries(${name} PRIVATE ${LLVM_COMMON_LIBS}) set_target_properties(${name} PROPERTIES FOLDER "SourceKit executables") - if (NOT SWIFT_ASAN_BUILD) - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - set_target_properties(${name} - PROPERTIES - LINK_FLAGS "-Wl,-exported_symbol,_main") - endif() - if(SWIFT_ANALYZE_CODE_COVERAGE) - set_property(TARGET "${name}" APPEND_STRING PROPERTY - LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping") - endif() - endif() add_sourcekit_default_compiler_flags("${name}") endmacro() diff --git a/tools/SourceKit/tools/complete-test/CMakeLists.txt b/tools/SourceKit/tools/complete-test/CMakeLists.txt index 71a9ffde2c46d..ec3437650a0bb 100644 --- a/tools/SourceKit/tools/complete-test/CMakeLists.txt +++ b/tools/SourceKit/tools/complete-test/CMakeLists.txt @@ -13,12 +13,12 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) BlocksRuntime) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set_target_properties(complete-test - PROPERTIES - LINK_FLAGS "-Wl,-rpath -Wl,@executable_path/../lib") +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set_target_properties(complete-test PROPERTIES + INSTALL_RPATH "@executable_path/../lib") + target_link_options(complete-test PRIVATE + "LINKER:-exported_symbol,_main") endif() - if(SWIFT_ANALYZE_CODE_COVERAGE) set_property(TARGET complete-test APPEND_STRING PROPERTY LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping") @@ -26,6 +26,4 @@ endif() add_dependencies(tools complete-test) swift_install_in_component(TARGETS complete-test - RUNTIME - DESTINATION bin - COMPONENT tools) + RUNTIME DESTINATION bin COMPONENT tools) diff --git a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt index fe2bc449a0ab5..fda10b01d5b78 100644 --- a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt +++ b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt @@ -17,10 +17,11 @@ target_include_directories(sourcekitd-repl PRIVATE target_link_libraries(sourcekitd-repl PRIVATE ${LibEdit_LIBRARIES}) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set_target_properties(sourcekitd-repl - PROPERTIES - LINK_FLAGS "-Wl,-rpath -Wl,@executable_path/../lib") +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set_target_properties(sourcekitd-repl PROPERTIES + INSTALL_RPATH "@executable_path/../lib") + target_link_options(sourcekitd-repl PRIVATE + "LINKER:-exported_symbol,_main") endif() if(SWIFT_ANALYZE_CODE_COVERAGE) set_property(TARGET sourcekitd-repl APPEND_STRING PROPERTY @@ -29,6 +30,4 @@ endif() add_dependencies(tools sourcekitd-repl) swift_install_in_component(TARGETS sourcekitd-repl - RUNTIME - DESTINATION bin - COMPONENT tools) + RUNTIME DESTINATION bin COMPONENT tools) diff --git a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt index b2cd4056e599a..cf69c7b9c6e82 100644 --- a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt +++ b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt @@ -25,12 +25,12 @@ endif() add_dependencies(sourcekitd-test sourcekitdTestOptionsTableGen) -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set_target_properties(sourcekitd-test - PROPERTIES - LINK_FLAGS "-Wl,-rpath -Wl,@executable_path/../lib") +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set_target_properties(sourcekitd-test PROPERTIES + INSTALL_RPATH "@executable_path/../lib") + target_link_options(sourcekitd-test PRIVATE + "LINKER:-exported_symbol,_main") endif() - if(SWIFT_ANALYZE_CODE_COVERAGE) set_property(TARGET sourcekitd-test APPEND_STRING PROPERTY LINK_FLAGS " -fprofile-instr-generate -fcoverage-mapping") @@ -38,6 +38,4 @@ endif() add_dependencies(tools sourcekitd-test) swift_install_in_component(TARGETS sourcekitd-test - RUNTIME - DESTINATION bin - COMPONENT tools) + RUNTIME DESTINATION bin COMPONENT tools)