相同的库名称在不同的子目录中:在父级调用`add_subdirectory`时冲突

时间:2019-02-24 18:44:45

标签: cmake cmake-modules cmake-format

简单的文件夹结构就像

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/SubDirLibSubB/SubDirLib Root/CMakeLists.txt?请注意,如果我拨打电话,它将名称冲突

add_subdirectory(SubA)
add_subdirectory(SubB)

Root/CMakeLists.txt

0 个答案:

没有答案