12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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 "Debug")
- # 第三方库
- find_package(PkgConfig REQUIRED)
- # pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
- # find_path(YAML_CPP_INCLUDE_DIR
- # NAMES yaml_cpp.h
- # PATHS ${YAML_CPP_INCLUDE_DIRS})
- # find_library(YAML_CPP_LIBRARY
- # NAMES YAML_CPP
- # PATHS ${YAML_CPP_LIBRARY_DIRS})
- # if (NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
- # add_definitions(-DHAVE_NEW_YAMLCPP)
- # endif (NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
- # add_subdirectory(thirdpart/rs_driver)
- # 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)
- #if(NOT Protobuf_FOUND)
- # find_package(Protobuf REQUIRED)
- #endif()
- find_package(absl REQUIRED)
- set(absl_LIBRARIES
- absl::algorithm
- absl::base
- absl::debugging
- absl::flat_hash_map
- absl::memory
- absl::meta
- absl::numeric
- absl::str_format
- absl::strings
- absl::synchronization
- absl::time
- absl::utility
- )
- #execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/protoc.sh ${CMAKE_CURRENT_LIST_DIR})
- if (EXISTS "${CMAKE_SOURCE_DIR}/include/CMakeLists.txt")
- include_directories(${CMAKE_SOURCE_DIR}/include)
- add_subdirectory(${CMAKE_SOURCE_DIR}/include)
- else ()
- message("Can't find dir: " "${CMAKE_SOURCE_DIR}/include/CMakeLists.txt")
- endif ()
- 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 ()
|