我这里有一个外部库:
${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)
I get the error:
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.
我该如何执行Makefile并链接.a文件呢?
make[3]: *** No rule to make target '../thirdparty/yaml-cpp/build/libyaml-cpp.a', needed by '../bin/load_balancer_node'. Stop.
有什么想法吗? - Christian Stewartadd_dependencies(load_balancer_node yaml-cpp)
来覆盖。要么是这样,要么第三方makefile将.a文件转储到不同的位置... - IdeaHat