工程目录结构:
mycv作为静态库进行编译,所以也需要一个CMakeLists.txt文件
cmake_minimum_required(VERSION 3.15)
project(OpenCvTest)
set(CMAKE_CXX_STANDARD 11)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# 查找当前目录下的所有源文件, 并将名称保存到 DIR_SRCS 变量
aux_source_directory(. SRC_DIR)
aux_source_directory(./transform SRC_DIR)
aux_source_directory(./noff SRC_DIR)
# 添加 math 子目录
add_subdirectory(mycv)
add_executable(OpenCvTest ${SRC_DIR})
target_link_libraries(OpenCvTest ${OpenCV_LIBS} MyCV)
message(${SRC_DIR})
message(${OpenCvTest_SOURCE_DIR})
message(${CMAKE_SOURCE_DIR})
message(${CMAKE_BINARY_DIR})
message(${OpenCV_INCLUDE_DIRS})
message(${OpenCV_LIBS})
# https://blog.csdn.net/libaineu2004/article/details/78995740