I’m experimenting with putting my projects into a monorepo. I have a root CMakeLists.txt with some global config and then a bunch of add_subdirectory
calls. An executable target somewhere in the tree builds in a similar folder hierarchy. That’s nice. For example:
> cmake --build build-debug --target hello
> ./build-debug/MyUI/Samples/HelloWorldMac/hello
Hello world.
That target named hello
was defined in a CMakeLists.txt
in MyUI/Samples/HelloWorldMac
.
add_executable(hello main.cc)
But now I can’t have another ‘hello’ target in some other branch of the tree, and the argument to --target
is bare, like a global variable.
How do you name targets like this, to keep their names from conflicting when you have a big hierarchy of folders and CMakeLists.txt files?