Skip to content

Commit 9570bbf

Browse files
committed
cmake: clean bootstrapping modules when compiling with boostrapping-with-hostlibs
In this build mode there must not be a swiftmodule in the bootstrapping directories. In case such a module is there from a previous "bootstrapping" build, give a warning and remove it.
1 parent 720aea4 commit 9570bbf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

libswift/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ else()
4545
DEPENDS "bootstrapping1-all")
4646

4747
if(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
48-
if(EXISTS "${CMAKE_BINARY_DIR}/bootstrapping0/lib/swift/macos/Swift.swiftmodule" OR
49-
EXISTS "${CMAKE_BINARY_DIR}/bootstrapping1/lib/swift/macos/Swift.swiftmodule")
50-
messsage(FATAL_ERROR "Please clean the ${CMAKE_BINARY_DIR}/bootstrapping[01] directories")
51-
endif()
48+
file(GLOB module_dirs "${CMAKE_BINARY_DIR}/bootstrapping*/lib/swift/macosx/*.swiftmodule")
49+
foreach(module_dir ${module_dirs})
50+
message(WARNING "${module_dir} found from a previous 'bootstrapping' build: removing")
51+
file(REMOVE_RECURSE "${module_dir}")
52+
endforeach()
5253
endif()
5354
else()
5455
message(FATAL_ERROR "Unknown LIBSWIFT_BUILD_MODE '${LIBSWIFT_BUILD_MODE}'")

0 commit comments

Comments
 (0)