As highlighted recently in another thread, there are inconsistencies in lower/uppercase and naming between generators for some of the targets that CMake automatically defines. In particular, we have
ALL_BUILD, we have
PACKAGE and we have
RUN_TESTS and maybe others. It looks like Xcode and Visual Studio are the ones that have the special cases, with Makefiles and Ninja usually being consistent with each other.
I’d like to float the idea that we create a consistent set of build target names across all generators. This would make documentation and examples simpler and potentially simplify scripts that are intended to work across different generator types. We have a couple of options:
Add the missing
testtargets to Xcode and Visual Studio. The existing targets would also need to be retained for backward compatibility, but we should be able to create dummy targets with dependencies to forward to the canonical targets. The main downside that I can see with this strategy is that projects would end up with both targets showing in the IDE. Not sure if there’s a way to hide a target in each IDE or not.
Add special handling for the
cmake --buildcommand so that it recognises the special cases
packageand translates them into the generator-specific targets where required.
What do people think? Is this worth exploring?