forked from strasdat/Sophus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
91 lines (70 loc) · 2.72 KB
/
CMakeLists.txt
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
SET(PROJECT_NAME sophus)
PROJECT(${PROJECT_NAME})
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET (CMAKE_VERBOSE_MAKEFILE ON)
################################################################################
# Describe as a Catkin package
FIND_PACKAGE(catkin)
IF(catkin_FOUND)
catkin_package(
INCLUDE_DIRS "."
)
ENDIF(catkin_FOUND)
# Release by default
# Turn on Debug with "-DCMAKE_BUILD_TYPE=Debug"
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Release )
ENDIF()
IF (CMAKE_COMPILER_IS_GNUCXX )
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ")
ADD_DEFINITIONS("-Wall -Werror -Wno-unused-variable
-Wno-unused-but-set-variable -Wno-unknown-pragmas ")
ENDIF()
################################################################################
# Add local path for finding packages, set the local version first
list( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules" )
################################################################################
# Create variables used for exporting in SophusConfig.cmake
set( Sophus_LIBRARIES "" )
set( Sophus_INCLUDE_DIR ${PROJECT_SOURCE_DIR} )
################################################################################
find_package( Eigen3 REQUIRED )
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
SET( Sophus_INCLUDE_DIR ${Sophus_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} )
SET (SOURCE_DIR "sophus")
SET (TEMPLATES tests
so2
se2
so3
se3
rxso3
sim3
)
SET (SOURCES ${SOURCE_DIR}/sophus.hpp)
FOREACH(templ ${TEMPLATES})
LIST(APPEND SOURCES ${SOURCE_DIR}/${templ}.hpp)
ENDFOREACH(templ)
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
# Added ${SOURCES} to executables so they show up in QtCreator (and possibly
# other IDEs).
ADD_EXECUTABLE(test_so2 sophus/test_so2.cpp ${SOURCES})
ADD_EXECUTABLE(test_se2 sophus/test_se2.cpp ${SOURCES})
ADD_EXECUTABLE(test_so3 sophus/test_so3.cpp ${SOURCES})
ADD_EXECUTABLE(test_se3 sophus/test_se3.cpp ${SOURCES})
ADD_EXECUTABLE(test_rxso3 sophus/test_rxso3.cpp ${SOURCES})
ADD_EXECUTABLE(test_sim3 sophus/test_sim3.cpp ${SOURCES})
ENABLE_TESTING()
ADD_TEST(test_so2 test_so2)
ADD_TEST(test_se2 test_se2)
ADD_TEST(test_so3 test_so3)
ADD_TEST(test_se3 test_se3)
ADD_TEST(test_rxso3 test_rxso3)
ADD_TEST(test_sim3 test_sim3)
################################################################################
# Create the SophusConfig.cmake file for other cmake projects.
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/SophusConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/SophusConfig.cmake @ONLY IMMEDIATE )
export( PACKAGE Sophus )
INSTALL(DIRECTORY sophus DESTINATION ${CMAKE_INSTALL_PREFIX}/include
FILES_MATCHING PATTERN "*.hpp" )