cmake_minimum_required(VERSION 3.5) project(AllProject) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if (NOT DEFINED ${CMAKE_BUILD_TYPE} OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_definitions(-DETC_PATH="${CMAKE_SOURCE_DIR}/etc/") else () add_definitions(-DETC_PATH="${CMAKE_INSTALL_PREFIX}/etc/") endif () set(CMAKE_BUILD_TYPE "Release") # 第三方库 find_package(PkgConfig REQUIRED) # Don't search with REQUIRED as we can continue without gflags. find_package(gflags 2.2.0) if (gflags_FOUND) if (TARGET gflags) message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}") message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${GFLAGS_LIBRARIES}") else() message("-- Detected version of gflags: ${gflags_VERSION} does not define " "expected gflags CMake target which should be exported by gflags 2.2+. " "Building without gflags.") update_cache_variable(GFLAGS OFF) endif() else (gflags_FOUND) message("-- Did not find Google Flags (gflags), Building without gflags.") update_cache_variable(GFLAGS OFF) endif (gflags_FOUND) find_package(Glog) find_package(PCL REQUIRED) find_package(Eigen3 REQUIRED) find_package(OpenCV REQUIRED) find_package(Protobuf CONFIG) include_directories( ${CMAKE_SOURCE_DIR}/include ) add_subdirectory(${CMAKE_SOURCE_DIR}/include/rabbitmq) add_subdirectory(${CMAKE_SOURCE_DIR}/include/thread) add_subdirectory(${CMAKE_SOURCE_DIR}/include/message) add_subdirectory(${CMAKE_SOURCE_DIR}/include/pahoc) #execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/protoc.sh ${CMAKE_CURRENT_LIST_DIR}) if (EXISTS "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt") add_subdirectory(${CMAKE_SOURCE_DIR}/project) else () message("Can't find dir: " "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt") endif ()