mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Ninja: Since commit2d85779126(Ninja: Account for explicit target dependencies via CODEGEN, 2026-09-15, v4.5.0-rc1~162^2), a directory's codegen phony depends on the full build of every add_dependencies target (which caused their non-CODEGEN commands to run). Instead, depend only on those targets' CODEGEN outputs, and follow their own codegen dependencies in turn. Makefiles: Since commit197cb419d1(add_custom_command: Add CODEGEN support, 2024-05-27, v3.31.0-rc1~394^2), a target's `<target>/codegen` rule used to depend on `<dep>/all` for every add_dependencies target, which fully built them. Instead, depend on `<dep>/codegen`, except when the target has CODEGEN commands of its own, in which case it should still depend on `<dep>/all` as the commands may need the dependency's outputs. Shape up the prior `no-codegen` test case, which wasn't verifying much of anything. Fixes: #28205
15 lines
357 B
CMake
15 lines
357 B
CMake
add_executable(main
|
|
main.c
|
|
)
|
|
|
|
add_custom_command(
|
|
OUTPUT generated.h
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/generated.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated.h
|
|
# no CODEGEN
|
|
)
|
|
|
|
add_custom_target(h_creator DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/generated.h)
|
|
|
|
add_dependencies(main h_creator)
|