我的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