CMakeLists.txt 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. cmake_minimum_required(VERSION 3.5)
  2. project(AllProject)
  3. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  4. if (NOT DEFINED ${CMAKE_BUILD_TYPE} OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  5. add_definitions(-DETC_PATH="${CMAKE_SOURCE_DIR}/etc/")
  6. else ()
  7. add_definitions(-DETC_PATH="${CMAKE_INSTALL_PREFIX}/etc/")
  8. endif ()
  9. set(CMAKE_BUILD_TYPE "Release")
  10. # 第三方库
  11. find_package(PkgConfig REQUIRED)
  12. # pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
  13. # find_path(YAML_CPP_INCLUDE_DIR
  14. # NAMES yaml_cpp.h
  15. # PATHS ${YAML_CPP_INCLUDE_DIRS})
  16. # find_library(YAML_CPP_LIBRARY
  17. # NAMES YAML_CPP
  18. # PATHS ${YAML_CPP_LIBRARY_DIRS})
  19. # if (NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
  20. # add_definitions(-DHAVE_NEW_YAMLCPP)
  21. # endif (NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
  22. # add_subdirectory(thirdpart/rs_driver)
  23. # Don't search with REQUIRED as we can continue without gflags.
  24. find_package(gflags 2.2.0)
  25. if (gflags_FOUND)
  26. if (TARGET gflags)
  27. message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}")
  28. message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${GFLAGS_LIBRARIES}")
  29. else()
  30. message("-- Detected version of gflags: ${gflags_VERSION} does not define "
  31. "expected gflags CMake target which should be exported by gflags 2.2+. "
  32. "Building without gflags.")
  33. update_cache_variable(GFLAGS OFF)
  34. endif()
  35. else (gflags_FOUND)
  36. message("-- Did not find Google Flags (gflags), Building without gflags.")
  37. update_cache_variable(GFLAGS OFF)
  38. endif (gflags_FOUND)
  39. find_package(Glog)
  40. find_package(PCL REQUIRED)
  41. find_package(Eigen3 REQUIRED)
  42. find_package(OpenCV REQUIRED)
  43. find_package(Protobuf CONFIG)
  44. #if(NOT Protobuf_FOUND)
  45. # find_package(Protobuf REQUIRED)
  46. #endif()
  47. find_package(absl REQUIRED)
  48. set(absl_LIBRARIES
  49. absl::algorithm
  50. absl::base
  51. absl::debugging
  52. absl::flat_hash_map
  53. absl::memory
  54. absl::meta
  55. absl::numeric
  56. absl::str_format
  57. absl::strings
  58. absl::synchronization
  59. absl::time
  60. absl::utility
  61. )
  62. #execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/protoc.sh ${CMAKE_CURRENT_LIST_DIR})
  63. if (EXISTS "${CMAKE_SOURCE_DIR}/include/CMakeLists.txt")
  64. include_directories(${CMAKE_SOURCE_DIR}/include)
  65. add_subdirectory(${CMAKE_SOURCE_DIR}/include)
  66. else ()
  67. message("Can't find dir: " "${CMAKE_SOURCE_DIR}/include/CMakeLists.txt")
  68. endif ()
  69. if (EXISTS "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt")
  70. add_subdirectory(${CMAKE_SOURCE_DIR}/project)
  71. else ()
  72. message("Can't find dir: " "${CMAKE_SOURCE_DIR}/project/CMakeLists.txt")
  73. endif ()