目录
0 CMake工程的结构
1 CMakeList.txt语法命令结构
CMake工程的结构
一个基于CMake的c++工程的典型结构为:
project_name/ # 工程文件夹根目录
└── src/ # 存放源码目录
├── xxx.cpp
└── include/ # 存放头文件的目录
├── xxx.hpp
├── CMakeList.txt
CMakeList.txt语法命令结构
cmake_minimum_required(VERSION 3.0)
project(hello)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(hello_world src/hello.cpp)
target_link_libraries(hello_world ${OpenCV_LIBRARIES})