You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

3 years ago
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "Please create a separate directory for build files.")
endif()
cmake_minimum_required(VERSION 3.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
3 years ago
project(ISNS C CXX)
set(CMAKE_VERBOSE_MAKEFILE OFF)
# ---[ Options
option(build_modules "build modules" ON)
# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/source/bin/)
if(build_modules)
add_subdirectory(modules)
endif()
set(ENABLE_MYSQL ON CACHE BOOL "enable mysql")
3 years ago
#查找mysql是否安装
find_package(MYSQL QUIET)
if(MYSQL_FOUND AND ENABLE_MYSQL)
message(STATUS "找到mysqlclient库:\"${MYSQL_INCLUDE_DIR}\",ENABLE_MYSQL宏已打开")
include_directories(${MYSQL_INCLUDE_DIR})
include_directories(${MYSQL_INCLUDE_DIR}/mysql)
add_definitions(-DENABLE_MYSQL)
list(APPEND 3RDPARTY_LIBS ${MYSQL_LIBRARIES})
endif()
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/rapidjson/include/)
include_directories(/usr/local/include/hv)
include_directories(${PROJECT_SOURCE_DIR}/modules/UserApp/include/)
include_directories(${PROJECT_SOURCE_DIR}/modules/dataType/include/)
include_directories(${PROJECT_SOURCE_DIR}/modules/Disposition/include/)
include_directories(${PROJECT_SOURCE_DIR}/modules/TcpProxySession/include/)
3 years ago
# 寻找当前目录下所有源文件
aux_source_directory(./source/src DIR_SRCS)
add_compile_options(-Wall -std=c++11 -O2 -g)
link_directories(${PROJECT_SOURCE_DIR}/lib)
link_directories(/usr/local/lib)
list(APPEND ALL_LINKER_LIBS mk_api ZLToolKit dl ${3RDPARTY_LIBS} ${OpenCV_LIBS} pthread hv models)
# 指定生成的目标
add_executable(main ${DIR_SRCS})
# 链接
target_link_libraries(main ${ALL_LINKER_LIBS})