从下面的例子来看:
\nCMakeList.txt 文件:
\ninclude_directories(inc) \n\n# Grab all the cpp and h files to be compile. \nfile(GLOB SOURCES\n inc/*.h\n inc/*.hpp\n src/*.cpp\n)\n\nadd_library(MyStaticLib STATIC ${SOURCES} )\n\n\ntarget_link_libraries(MyStaticLib PUBLIC "${OPENCV_LIBS}/opencv_world410.lib" )\ntarget_link_libraries(MyStaticLib PUBLIC "${OPENCV_LIBS}/opencv_world410d.lib" )\nRun Code Online (Sandbox Code Playgroud)\n这会创建一个静态库吗?我以为你不能将静态库链接到c++中的静态库?为什么会这样?\n另外,最好的方法是什么?例如,如果我创建一个静态库 API,即 MyStaticLib 且 it\xe2\x80\x99s 依赖于 opencv\xe2\x80\x99s 静态库,那么在 CMake 中设置此库的最佳方法是什么?
\n