我在这里有一个外部库:
${PROJECT_SOURCE_DIR}/thirdparty/yaml-cpp/
它是由 Makefile: 制作的thirdparty/Makefile
。我正在执行该makefile,如下所示:
add_custom_target(
yaml-cpp
COMMAND make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/thirdparty
)
然后,我尝试将构建的库链接到thirdparty/yaml-cpp/build/libyaml-cpp.a
. 这是不工作的部分:
target_link_libraries(load_balancer_node ${CMAKE_SOURCE_DIR}/thirdparty/yaml-cpp/build/libyaml-cpp.a)
我得到错误:
Target "yaml-cpp" of type UTILITY may not be linked into another target.
One may link only to STATIC or SHARED libraries, or to executables with the
ENABLE_EXPORTS property set.
如何执行该生成文件并链接该.a
文件?