最近用到一个算法,但是实现是用的c++,为此我安装clion,配置了opencv3.2....
cmake_minimum_required(VERSION 3.0)
PROJECT(opencv_idz)
INCLUDE_DIRECTORIES(include)
AUX_SOURCE_DIRECTORY(src DIR_SRCS)
# aux_source_directory 命令,该命令会查找指定目录(这里是src)下的所有源文件,然后将结果存进指定
#变量名(这里是DIR_SRCS)
SET(TEST ${DIR_SRCS})
#设置变量名TEST ..
ADD_EXECUTABLE(${PROJECT_NAME} ${TEST})
#将src中的文件编译成可执行文件,文件名为 PROJECT_NAME 这个变量名代指的名字,也就是
# PROJECT(opencv_idz) 这句话将工程名设置为 opencv_idz,所以可执行文件名就是 opencv_idz
FIND_PACKAGE(OpenCV REQUIRED)
IF (OpenCV_FOUND)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(opencv_idz ${OpenCV_LIBS})
ELSE (OpenCV_FOUND)
MESSAGE(FATAL_ERROR "OpenCV library not found")
ENDIF (OpenCV_FOUND)