Ninja Multi-Config: targets passed for add_custom_target's DEPENDS parameter do not build for all configs
In a multi-config project, when a target is passed for the add_custom_target DEPENDS parameter, there is no certainty what configurations that target dependency will be built for. For example:
add_custom_target(
custom_target_1
COMMAND ${CMAKE_COMMAND} -E echo Custom target 1: $<CONFIG>
)
add_custom_target(
custom_target_2
DEPENDS custom_target_1
COMMAND ${CMAKE_COMMAND} -E echo Custom target 2: $<CONFIG>
)
With this code, if I run cmake --build <build-dir> --target custom_target_2
, the output is
Custom target 1: Release
Custom target 2: Release
Custom target 2: Debug
So, target 1 only built for the Release config. Shouldn't all configs build in this case? Or perhaps this use-case should be dis-allowed?