本文主要是介绍CMakeList 基础写法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#设置cmake 最小版本要求
cmake_minimum_required( VERSION 2.8 )
project( imageBasics )
# 添加c++ 11标准支持
set( CMAKE_CXX_FLAGS "-std=c++11" )
#设置查找opencv 的路径 该路径下放了 FindOpenCV.cmake 文件
set(OpenCV_DIR "/root/work_space/software/opencv3.3.0/share/OpenCV")
find_package( OpenCV 3 REQUIRED )
#添加 include 文件
include_directories( ${OpenCV_INCLUDE_DIRS} "/usr/local/include/eigen3" )
link_directories("./lib")
add_executable( imageBasics imageBasics.cpp )
# 链接OpenCV库
target_link_libraries( imageBasics ${OpenCV_LIBS} )
https://dasuda.top/%E7%A8%8B%E5%BA%8F%E5%91%98%E7%9A%84%E5%9F%BA%E6%9C%AC%E7%B4%A0%E5%85%BB/2018/10/25/CMakeLists%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/#
这篇关于CMakeList 基础写法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!