Skip to content

Commit 2fb407d

Browse files
committed
build: add export targets for XCTest
This enables the export targets for XCTest to tie it together with the other projects.
1 parent a78715b commit 2fb407d

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ if(ENABLE_TESTING)
9797
endif()
9898

9999

100+
set_property(GLOBAL APPEND PROPERTY XCTest_EXPORTS XCTest)
100101
get_swift_host_arch(swift_arch)
101102
install(TARGETS XCTest
102103
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
@@ -106,3 +107,5 @@ install(FILES
106107
${CMAKE_CURRENT_BINARY_DIR}/swift/XCTest.swiftdoc
107108
${CMAKE_CURRENT_BINARY_DIR}/swift/XCTest.swiftmodule
108109
DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>/${swift_arch})
110+
111+
add_subdirectory(cmake/modules)

cmake/modules/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
set(XCTest_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/XCTestExports.cmake)
3+
configure_file(XCTestConfig.cmake.in
4+
${CMAKE_CURRENT_BINARY_DIR}/XCTestConfig.cmake)
5+
6+
get_property(XCTest_EXPORTS GLOBAL PROPERTY XCTest_EXPORTS)
7+
export(TARGETS ${XCTest_EXPORTS} FILE ${XCTest_EXPORTS_FILE})

cmake/modules/XCTestConfig.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
if(NOT TARGET XCTest)
3+
include(@XCTest_EXPORTS_FILE@)
4+
endif()

0 commit comments

Comments
 (0)