Skip to content

Commit 0d9b364

Browse files
committed
cmake: Fix a dependency problem when compiling swift modules
There was only an ordering dependency between modules but not a file dependency. This caused missing re-compiles of depending modules in incremental builds.
1 parent bf4dfe6 commit 0d9b364

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ function(add_swift_compiler_modules_library name)
119119
if (dependencies)
120120
foreach(dep_module ${dependencies})
121121
if (DEFINED "${dep_module}_dep_target")
122-
list(APPEND deps "${${dep_module}_dep_target}")
122+
# We have to add the module target for the ordering dependency
123+
# and the output file for the file dependency (otherwise the dependent
124+
# module wouldn't be rebuilt if the current module changes)
125+
list(APPEND deps "${${dep_module}_dep_target}" "${build_dir}/${dep_module}.o")
123126
else()
124127
message(FATAL_ERROR "module dependency ${module} -> ${dep_module} not found. Make sure to add modules in dependency order")
125128
endif()

0 commit comments

Comments
 (0)