21 lines
435 B
CMake
21 lines
435 B
CMake
|
# 声明要求的 cmake 最低版本
|
|||
|
cmake_minimum_required(VERSION 2.8)
|
|||
|
|
|||
|
# 声明一个 cmake 工程
|
|||
|
project(test)
|
|||
|
|
|||
|
find_package(OpenCV REQUIRED)
|
|||
|
# 设置编译模式
|
|||
|
set(CMAKE_CXX_STANDARD 11)
|
|||
|
|
|||
|
# 添加一个可执行程序
|
|||
|
# 语法:add_executable( 程序名 源代码文件 )
|
|||
|
|
|||
|
set(SOURCES
|
|||
|
src/main.cpp
|
|||
|
)
|
|||
|
add_executable(test ${SOURCES})
|
|||
|
|
|||
|
|
|||
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|||
|
target_link_libraries(test ${OpenCV_LIBS})
|