Same lib name in different subdirectories: conflics when calls `add_subdirectory` in parent level

45 views Asked by At

the simple folder structure is like

Root
    CMakeLists.txt
    SubA
        CMakeLists.txt
        some files to be built...
    SubB
        CMakeLists.txt
        some files to be built...

Assuming I have add_library(SubDirLib fooX.cpp) in both SubA/CMakeLists.txt and SubB/CMakeLists.txt where X is A and B respectively, how can I link two libraries SubA/SubDirLib and SubB/SubDirLib in Root/CMakeLists.txt? Note that it will be name conflicted if I call

add_subdirectory(SubA)
add_subdirectory(SubB)

in Root/CMakeLists.txt

0

There are 0 answers