Ninja: Add prefix/suffix variable for internal target names
When combining multiple builds using CMAKE_NINJA_OUTPUT_PATH_PREFIX
and including them with subninja
, it can happen that both sub-builds can contain targets with the same name. When internal targets are generated (e.g. cmake_object_order_depends_target_{target}
), those target definitions collide and the build can fail.
Therefore, I propose a variable, e.g. CMAKE_INTERNAL_TARGET_PREFIX
which is added to all internal targets. This variable can then be set to different values for different invocations of CMake.
It may also be possible to use CMAKE_NINJA_OUTPUT_PATH_PREFIX
for these targets as well, but I am not sure how well this plays with potential slashes in non-file targets.
See also https://discourse.cmake.org/t/build-same-lib-with-identical-names-in-subninjas/6296