Skip to content

Commit 91ffb07

Browse files
committed
[CMake] Don't install macros from the main CMake invocation
1 parent 2753f4d commit 91ffb07

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

Sources/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if(SwiftTesting_MACRO STREQUAL "<auto>")
4141
endif()
4242

4343
# Build and install the plugin into the current build directry.
44-
set(SwiftTesting_MACRO_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/plugin")
44+
set(SwiftTesting_MACRO_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
4545

4646
ExternalProject_Add(TestingMacros
4747
PREFIX "tm"
@@ -65,17 +65,11 @@ if(SwiftTesting_MACRO STREQUAL "<auto>")
6565
# properties of its targets here.
6666
if(NOT SwiftTesting_BuildMacrosAsExecutables)
6767
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
68-
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/lib/libTestingMacros.dylib")
69-
install(PROGRAMS "${SwiftTesting_MACRO_PATH}"
70-
DESTINATION lib/swift/host/plugins/testing)
68+
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/lib/swift/host/plugins/testing/libTestingMacros.dylib")
7169
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
72-
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/lib/libTestingMacros.so")
73-
install(PROGRAMS "${SwiftTesting_MACRO_PATH}"
74-
DESTINATION lib/swift/host/plugins)
70+
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/lib/swift/host/plugins/libTestingMacros.so")
7571
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
7672
set(SwiftTesting_MACRO_PATH "${SwiftTesting_MACRO_INSTALL_PREFIX}/bin/TestingMacros.dll")
77-
install(PROGRAMS "${SwiftTesting_MACRO_PATH}"
78-
DESTINATION bin)
7973
else()
8074
message(FATAL_ERROR "Unable to determine the library name for TestingMacros based on system name: ${CMAKE_HOST_SYSTEM_NAME}")
8175
endif()

Sources/TestingMacros/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ else()
6565
set_property(TARGET TestingMacros PROPERTY INSTALL_RPATH)
6666
set_property(TARGET TestingMacros PROPERTY BUILD_WITH_INSTALL_RPATH YES)
6767

68-
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
69-
install(TARGETS TestingMacros
70-
RUNTIME DESTINATION bin)
68+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
69+
set(plugin_destination_dir "lib/swift/host/plugins/testing")
7170
else()
72-
# Other platforms, TestingMacros is installed by the parent project.
73-
install(TARGETS TestingMacros)
71+
set(plugin_destination_dir "lib/swift/host/plugins")
7472
endif()
73+
74+
install(TARGETS TestingMacros
75+
LIBRARY DESTINATION "${plugin_destination_dir}"
76+
RUNTIME DESTINATION bin)
7577
endif()
7678

7779
target_sources(TestingMacros PRIVATE

0 commit comments

Comments
 (0)