CMake继承静态库依赖

时间:2019-12-16 23:42:17

标签: cmake

我有一个可以构建并依赖于其他库的库:

add_library(library1 STATIC main.c)
target_link_libraries(library1 m;pthread)

如果我现在想在其他库中使用刚刚声明的library1,则希望在链接器中传递libmlibpthread来构建library2

    add_library(library2 STATIC main2.c)
    target_link_libraries(library2 library1) # I would expect m and pthread to be linked to library2 but don't
    add_executable(binary library2)

正常行为是否将libm和libpthread传递给编译器以构建binary? 谢谢

0 个答案:

没有答案