mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Since commit b6367f723b (Swift/Ninja: Emit modules separately from
compilation, 2026-04-10) the .swiftmodule output moved from the
compile edge to a separate emit-module edge. The link edge does not
depend on the emit-module output, so ninja never runs the emit-module
edge when no other target in the build imports the module (e.g.
install-only targets).
Store the declared .swiftmodule output path during Swift object
statement generation and add it as an implicit dependency of the link
edge.
Issue: #27748
15 lines
645 B
CMake
15 lines
645 B
CMake
# Same as EmitModuleSeparatelyLinkDep but with a custom module directory.
|
|
# The link edge must depend on the actual emit-module output path, not a
|
|
# default that doesn't match the target's configuration.
|
|
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
|
set(path "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/impl-Debug.ninja")
|
|
else()
|
|
set(path "${RunCMake_TEST_BINARY_DIR}/build.ninja")
|
|
endif()
|
|
file(READ "${path}" build_ninja)
|
|
|
|
if(NOT build_ninja MATCHES "build [^\n]*(libL\\.a|L\\.lib)[^\n]*:.*\\|[^\n]*custom(/|\\\\)[^\n]*L\\.swiftmodule")
|
|
string(APPEND RunCMake_TEST_FAILED
|
|
"Link edge for L does not depend on custom/.../L.swiftmodule.\n")
|
|
endif()
|