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:…
To build OpenCV as static library you need to set BUILD_SHARED_LIBS flag to false/off: cmake -DBUILD_SHARED_LIBS=OFF .. reference: http://stackoverflow.com/questions/7583172/opencv-as-a-static-library-cmake-options…