简单的文件夹结构就像
Root
CMakeLists.txt
SubA
CMakeLists.txt
some files to be built...
SubB
CMakeLists.txt
some files to be built...
假设我分别在add_library(SubDirLib fooX.cpp)
和SubA/CMakeLists.txt
中都拥有SubB/CMakeLists.txt
,其中X分别是A和B,那么如何在其中链接两个库SubA/SubDirLib
和SubB/SubDirLib
Root/CMakeLists.txt
?请注意,如果我拨打电话,它将名称冲突
add_subdirectory(SubA)
add_subdirectory(SubB)
在Root/CMakeLists.txt