C++ 使用cmake将OpenCv作为静态库
我有一个为项目生成NSVC项目的cmake,它包括共享格式的opencv(使用*.dll) 我想更改cmake,以便它可以链接opencv静态库 我的cmake的简单形式如下:C++ 使用cmake将OpenCv作为静态库,c++,opencv,cmake,C++,Opencv,Cmake,我有一个为项目生成NSVC项目的cmake,它包括共享格式的opencv(使用*.dll) 我想更改cmake,以便它可以链接opencv静态库 我的cmake的简单形式如下: find_package(OpenCV REQUIRED) add_executable(test test.cpp) target_link_libraries(test ${OpenCV_LIBS} ${LIBLAS_LIBRARIES} optimized ${LIBE57_LIBRARIE
find_package(OpenCV REQUIRED)
add_executable(test test.cpp)
target_link_libraries(test
${OpenCV_LIBS}
${LIBLAS_LIBRARIES}
optimized ${LIBE57_LIBRARIES}
debug ${LIBE57_LIBRARIES_DEBUG}
optimized ${CERES_LIBRARIES}
debug ${CERES_LIBRARIES_DEBUG})
cmake -G "Visual Studio 11 Win64" path/to/target/project
我称之为cmake,如下所示:
find_package(OpenCV REQUIRED)
add_executable(test test.cpp)
target_link_libraries(test
${OpenCV_LIBS}
${LIBLAS_LIBRARIES}
optimized ${LIBE57_LIBRARIES}
debug ${LIBE57_LIBRARIES_DEBUG}
optimized ${CERES_LIBRARIES}
debug ${CERES_LIBRARIES_DEBUG})
cmake -G "Visual Studio 11 Win64" path/to/target/project
根据我在这里发现的一些问题,我尝试了这些,但没有一个有效:
find_package(OpenCV REQUIRED)
add_executable(test test.cpp)
target_link_libraries(test
${OpenCV_LIBS}
${LIBLAS_LIBRARIES}
optimized ${LIBE57_LIBRARIES}
debug ${LIBE57_LIBRARIES_DEBUG}
optimized ${CERES_LIBRARIES}
debug ${CERES_LIBRARIES_DEBUG})
cmake -G "Visual Studio 11 Win64" path/to/target/project
cmake-G-DBUILD_SHARED_LIBS=OFF“Visual Studio 11 Win64”路径/目标/项目问题是什么?我如何解决它?-G“Visual Studio 11 Win64”//不要将它们分开谢谢。这很有效,但我如何在cmake中设置它?