我的Mercurial存储库repo1有一个名为foo
的自定义目标;不要介意它的作用。我还有另一个仓库repo2,我想用它作为repo1的subrepo。 repo2是以与repo1相似的方式开发的,并且还有一个名为foo
的自定义目标,它执行的是相同的事情(但仅适用于repo2目录)。如何处理Mercurial存储库和子库之间的目标名称冲突?
如果我尝试与add_subdirectory(relative/path/to/repo2)
在CMakeLists.txt
运行cmake为repo1,我得到:
CMake Error at CMakeLists.txt:123 (add_custom_target):
add_custom_target cannot create target "foo" because another target with
the same name already exists. The existing target is a custom target
created in source directory
我想我可能只是前面加上库名称自定义目标名称,但是,似乎是粗解决方案对这个问题;我有点喜欢make foo
在概念上在repo1和repo2中做同样的事情。那么有什么更聪明的我可以在这里做?
'我挺喜欢的事实,“让富”做同样的事情,在概念上,无论是在repo1还是repo2中。“ - 您希望repo1中的”make foo“有什么行为?在repo1和repo2中构建'foo'?或者只在repo1中构建'foo'?如果你想要最后一种情况,而不是'add_subdirectory'使用'ExternalProject_Add'。 – Tsyvarev
@Tsyvarev:我不介意它实际上是哪个选项,(实际上,在某些情况下,这可能是相同的事情,例如,如果'foo'类似运行'cloc'或'ctags')。但是阅读这个问题的其他人可能会有偏好。你能把你的建议变成答案吗? – einpoklum