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 @ 2023-03-29 15:35  小丑_jk  阅读(107)  评论(0编辑  收藏  举报