cmakelist

example 1:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(helloworld)

SET(CMAKE_BUILD_TYPE Debug)

#cuda
include_directories(/usr/local/cuda-8.0/include/)
link_directories(/usr/local/cuda/lib64)

find_package(Boost REQUIRED COMPONENTS system thread)
include_directories(${Boost_INCLUDE_DIRS})

#set(CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/3rdparty/opencv-3.2.0)
##set(CMAKE_PREFIX_PATH "/home/yhl/software_install/opencv3.2")
#find_package(OpenCV REQUIRED)

# OpenCv
set(OPENCV_ROOT ${CMAKE_SOURCE_DIR}/3rdparty/opencv-3.2.0)
include_directories(${OPENCV_ROOT}/include)
link_directories(${OPENCV_ROOT}/lib)

# protobuf
set(PROTOBUF_ROOT ${CMAKE_SOURCE_DIR}/3rdparty/protobuf)
#set(PROTOBUF_ROOT "/data_1/Yang/project/2019/chejian/3rdparty/protobuf")
include_directories(${PROTOBUF_ROOT}/include)
link_directories(${PROTOBUF_ROOT}/lib)

# caffe
set(CAFFE_ROOT ${CMAKE_SOURCE_DIR}/3rdparty/caffe)
#set(CAFFE_ROOT "/data_1/Yang/project/2019/chejian/3rdparty/caffe")
include_directories(${CAFFE_ROOT}/include)
link_directories(${CAFFE_ROOT}/lib)

aux_source_directory(caffe_dir CAFFE_DIR_SRC)#文件夹名字
aux_source_directory(correction CORRECTION_SRC)#文件夹名字
add_executable(main main.cpp ${CAFFE_DIR_SRC} ${CORRECTION_SRC})

target_link_libraries(main ${Boost_LIBRARIES})
target_link_libraries(main opencv_core  opencv_imgcodecs opencv_highgui opencv_imgproc opencv_videoio )
target_link_libraries(main caffe glog gflags protobuf)
set_property(TARGET main PROPERTY CXX_STANDARD 11)

你可能感兴趣的:(cmakelist)