CMakeLists.txt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. cmake_minimum_required(VERSION 3.5)
  2. project(AllProject)
  3. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
  4. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
  5. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  6. if (NOT DEFINED ${CMAKE_BUILD_TYPE} OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  7. add_definitions(-DETC_PATH="${CMAKE_SOURCE_DIR}/etc/")
  8. else ()
  9. add_definitions(-DETC_PATH="${CMAKE_INSTALL_PREFIX}/etc/")
  10. endif ()
  11. set(CMAKE_BUILD_TYPE "Release")
  12. # 第三方库
  13. find_package(PkgConfig REQUIRED)
  14. # Don't search with REQUIRED as we can continue without gflags.
  15. find_package(gflags 2.2.0)
  16. if (gflags_FOUND)
  17. if (TARGET gflags)
  18. message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}")
  19. message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${GFLAGS_LIBRARIES}")
  20. else()
  21. message("-- Detected version of gflags: ${gflags_VERSION} does not define "
  22. "expected gflags CMake target which should be exported by gflags 2.2+. "
  23. "Building without gflags.")
  24. update_cache_variable(GFLAGS OFF)
  25. endif()
  26. else (gflags_FOUND)
  27. message("-- Did not find Google Flags (gflags), Building without gflags.")
  28. update_cache_variable(GFLAGS OFF)
  29. endif (gflags_FOUND)
  30. find_package(Glog)
  31. find_package(PCL REQUIRED)
  32. find_package(Eigen3 REQUIRED)
  33. find_package(OpenCV REQUIRED)
  34. find_package(Protobuf CONFIG)
  35. include_directories(
  36. ${CMAKE_SOURCE_DIR}/include
  37. )
  38. add_subdirectory(${CMAKE_SOURCE_DIR}/include/rabbitmq)
  39. add_subdirectory(${CMAKE_SOURCE_DIR}/include/thread)
  40. add_subdirectory(${CMAKE_SOURCE_DIR}/include/message)
  41. add_subdirectory(${CMAKE_SOURCE_DIR}/include/pahoc)
  42. #execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/protoc.sh ${CMAKE_CURRENT_LIST_DIR})
  43. if (EXISTS "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt")
  44. add_subdirectory(${CMAKE_SOURCE_DIR}/project)
  45. else ()
  46. message("Can't find dir: " "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt")
  47. endif ()