1. 程式人生 > >CMakeList.txt 模板

CMakeList.txt 模板

cmake_minimum_required(VERSION 3.2.0)
add_definitions(-std=c++11)
add_definitions(-g -o2)
#define cuda,opencv,cudnn
ADD_DEFINITIONS( -DGPU -DCUDNN ) 
# use opencv
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/share/OpenCV")
find_package(OpenCV 3.2.0 REQUIRED)
if(NOT OpenCV_FOUND)
  message(WARNING "OpenCV not found!")
else()
  include_directories(${OpenCV_INCLUDE_DIRS})
endif()
# CUDA path
include_directories(/usr/local/cuda-8.0/include/)
# headers
include_directories(${PROJECT_SOURCE_DIR}/include)
#sources
set(SRC  ${PROJECT_SOURCE_DIR}/test.cpp)
#lib link
link_directories(${PROJECT_SOURCE_DIR})
#build so
add_library(plate_recognition SHARED ${SRC})
target_link_libraries(plate_recognition ${OpenCV_LIBS})
target_link_libraries(plate_recognition -lxxx -lxxx   -lpthread -lm -lstdc++)