【发布时间】:2019-10-22 22:57:55
【问题描述】:
使用 Cmake 我想知道如何创建一个包装库并让用户只将他们的应用程序与这个库链接。用户无需在其链接器标志中指定原始库。
例如,我为 libwebsockets 创建了一个包装库,名为 libcustomws。
add_library(customws main.c)
target_link_libraries(customws websockets)
我希望用户(未安装 libwebsockets)能够做到:
add_executable(user_app user_app.c)
target_link_libraries(user_app customws pthread)
【问题讨论】:
-
"未安装 libwebsockets" - 这是否意味着
user_app可执行文件将无法编译?