cmake 指定OpenCV版本/指定查找路径

 

opencv4.5.0/opencv3.4.16

 

一、

set(OpenCV_DIR "/usr/local/share/OpenCV")  #OpenCVConfig.cmake所在的文件目录
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(orb orb.cpp)
target_link_libraries(orb ${OpenCV_LIBS})

 

二、

set(OpenCV_INCLUDE_DIRS "/usr/local/opencv3.4.2/include")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(orb orb.cpp)
target_link_libraries(orb ${OpenCV_LIBS})

 三、指定查找路径

list(APPEND CMAKE_PREFIX_PATH "/usr/local/include/open3d_090")
open3d_090包含lib/Open3D/*.cmake
posted @ 2021-11-01 23:30  小小灰迪  阅读(1684)  评论(0编辑  收藏  举报