add_executable(main main.cpp) target_link_libraries(main ${CMAKE_SOURCE_DIR}/libbingitup.a)
静态库和动态库共存时,cmake会默认先链接静态库,如果要强制使用静态库,在CMakeLists.txt中如此直接指明
或者这样做也可以
So, if you want to link to a static library, you need to search for that static library: find_library(SOMELIB libsomelib.a) instead of: find_library(SOMELIB somelib)
时间: 2024-11-08 14:21:39