-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (50 loc) · 1.64 KB
/
Copy pathCMakeLists.txt
File metadata and controls
59 lines (50 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.10)
project(Task_03)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-std=c++17")
# 查找OpenCV
find_package(OpenCV REQUIRED)
if(OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
else()
message(FATAL_ERROR "OpenCV not found!")
endif()
# 查找Ceres
find_package(Ceres REQUIRED)
if(Ceres_FOUND)
include_directories(${CERES_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Ceres not found!")
endif()
# 查找Eigen3
find_package(Eigen3 REQUIRED)
if(EIGEN3_FOUND)
include_directories(${EIGEN3_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Eigen3 not found!")
endif()
# 查找Glog - 注意包名通常是小写的glog
find_package(glog REQUIRED)
if(glog_FOUND)
include_directories(${GLOG_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Glog not found!")
endif()
# 查找Gflags - 注意包名通常是小写的gflags
find_package(gflags REQUIRED)
if(gflags_FOUND)
include_directories(${GFLAGS_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Gflags not found!")
endif()
# 输出调试信息
message("CERES_INCLUDE_DIRS: ${CERES_INCLUDE_DIRS}")
message("EIGEN3_INCLUDE_DIRS: ${EIGEN3_INCLUDE_DIRS}")
message("GLOG_INCLUDE_DIRS: ${GLOG_INCLUDE_DIRS}")
message("GFLAGS_INCLUDE_DIRS: ${GFLAGS_INCLUDE_DIRS}")
add_executable(main src/main.cpp)
target_link_libraries(main ${OpenCV_LIBS} ${CERES_LIBRARIES} glog::glog ${G2O_LIBS} ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY})
add_executable(verify_draw src/verify_draw.cpp)
target_link_libraries(verify_draw ${OpenCV_LIBS} ${CERES_LIBRARIES} glog::glog ${G2O_LIBS} ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build)