CMakeList配置OpenCV

https://blog.csdn.net/qq_28368377/article/details/124843943

 

复制代码
cmake_minimum_required(VERSION 3.18.1)

project(focus_stack )

message("##################")
message(${CMAKE_SOURCE_DIR})
message("##################")


# focus stack
include_directories(${CMAKE_SOURCE_DIR}/../)
message("---------------")
message(${CMAKE_SOURCE_DIR})
message("---------------")

message("project_name:", ${PROJECT_NAME})

file(GLOB_RECURSE FOCUS_SRCS ${CMAKE_SOURCE_DIR}/../*.cc)

# 查找、配置 opencv 
find_package(OpenCV  REQUIRED )
message("opencv_include_dirs:  ", ${OpenCV_INCLUDE_DIRS})
message("opencv_libs_name: ", ${OpenCV_LIBS})
include_directories(${OpenCV_INCLUDE_DIRS})

add_library(focus_library  STATIC  ${FOCUS_SRCS} )
message(${FOCUS_SRCS})


target_include_directories(
focus_library
PUBLIC
${CMAKE_SOURCE_DIR}/../
)

message("##############")
message(${CMAKE_SOURCE_DIR}/../)
message("##############")

add_executable(
focus_binary
${CMAKE_SOURCE_DIR}/../src/main.cc
)
# 链接库
target_link_libraries(focus_binary focus_library)
target_link_libraries(focus_binary  ${OpenCV_LIBS})
复制代码

 

posted @   小丑_jk  阅读(114)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2022-03-29 Linux下使用Eclipse开发C/C++程序
2022-03-29 如何在 Linux 下利用 Vim 搭建 C/C++ 开发环境?
2022-03-29 模型量化调优
点击右上角即可分享
微信分享提示