File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Supplemental/cmake/modules Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ function(emit_swift_interface target)
1818 if (NOT module_name)
1919 set (module_name ${target} )
2020 endif ()
21- file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
21+ # Account for an existing swiftmodule file
22+ # generated with the previous logic
23+ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule"
24+ AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
25+ message (STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule to support nested swiftmodule generation" )
26+ file (REMOVE "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
27+ endif ()
2228 target_compile_options (${target} PRIVATE
2329 "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule/${SwiftCore_MODULE_TRIPLE} .swiftmodule>" )
2430 if (SwiftCore_VARIANT_MODULE_TRIPLE)
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ function(emit_swift_interface target)
1818 if (NOT module_name)
1919 set (module_name ${target} )
2020 endif ()
21- file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
21+ # Account for an existing swiftmodule file
22+ # generated with the previous logic
23+ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule"
24+ AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
25+ message (STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule to support nested swiftmodule generation" )
26+ file (REMOVE "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
27+ endif ()
2228 target_compile_options (${target} PRIVATE
2329 "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule/${SwiftOverlay_MODULE_TRIPLE} .swiftmodule>" )
2430 if (SwiftOverlay_VARIANT_MODULE_TRIPLE)
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ function(emit_swift_interface target)
1818 if (NOT module_name)
1919 set (module_name ${target} )
2020 endif ()
21- file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
21+ # Account for an existing swiftmodule file
22+ # generated with the previous logic
23+ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule"
24+ AND NOT IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
25+ message (STATUS "Removing regular file ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule to support nested swiftmodule generation" )
26+ file (REMOVE "${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule" )
27+ endif ()
2228 target_compile_options (${target} PRIVATE
2329 "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-module-path ${CMAKE_CURRENT_BINARY_DIR} /${module_name} .swiftmodule/${${PROJECT_NAME} _MODULE_TRIPLE}.swiftmodule>" )
2430 if (${PROJECT_NAME} _VARIANT_MODULE_TRIPLE)
You can’t perform that action at this time.
0 commit comments