11include (macCatalystUtils)
22
33# Workaround a cmake bug, see the corresponding function in swift-syntax
4- function (force_target_link_libraries TARGET )
5- target_link_libraries (${TARGET} ${ARGN} )
6-
7- cmake_parse_arguments (ARGS "PUBLIC;PRIVATE;INTERFACE" "" "" ${ARGN} )
8- foreach (DEPENDENCY ${ARGS_UNPARSED_ARGUMENTS} )
4+ function (force_add_dependencies TARGET )
5+ foreach (DEPENDENCY ${ARGN} )
96 string (REGEX REPLACE [<>:\"/\\|?*] _ sanitized ${DEPENDENCY} )
107 add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /forced-${sanitized} -dep.swift
118 COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR} /forced-${sanitized} -dep.swift
@@ -17,6 +14,13 @@ function(force_target_link_libraries TARGET)
1714 endforeach ()
1815endfunction ()
1916
17+ function (force_target_link_libraries TARGET )
18+ target_link_libraries (${TARGET} ${ARGN} )
19+
20+ cmake_parse_arguments (ARGS "PUBLIC;PRIVATE;INTERFACE" "" "" ${ARGN} )
21+ force_add_dependencies(${TARGET} ${ARGS_UNPARSED_ARGUMENTS} )
22+ endfunction ()
23+
2024# Add compile options shared between libraries and executables.
2125function (_add_host_swift_compile_options name )
2226 # Avoid introducing an implicit dependency on the string-processing library.
@@ -175,6 +179,9 @@ function(add_pure_swift_host_library name)
175179 add_dependencies (${name} ${LLVM_COMMON_DEPENDS} )
176180 endif ()
177181
182+ # Depends on all '*.h' files in 'include/module.modulemap'.
183+ force_add_dependencies(${name} importedHeaderDependencies)
184+
178185 # Workaround to touch the library and its objects so that we don't
179186 # continually rebuild (again, see corresponding change in swift-syntax).
180187 add_custom_command (
@@ -334,6 +341,9 @@ function(add_pure_swift_host_tool name)
334341 add_dependencies (${name} ${LLVM_COMMON_DEPENDS} )
335342 endif ()
336343
344+ # Depends on all '*.h' files in 'include/module.modulemap'.
345+ force_add_dependencies(${name} importedHeaderDependencies)
346+
337347 # Link against dependencies.
338348 target_link_libraries (${name} PUBLIC
339349 ${APSHT_DEPENDENCIES}
0 commit comments