-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
88 lines (72 loc) · 1.88 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
# Rotations Conversion Library project
cmake_minimum_required(VERSION 2.8.12)
project(rotconv)
# Enable C++11
message(STATUS "Enabling C++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_compile_options(-Wall -Wextra -Wpedantic)
# Find Eigen
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
# Include directories
include_directories(${PROJECT_SOURCE_DIR}/include)
#
# Build libraries
#
# Build a static library
add_library(rotconvstatic STATIC
src/rot_conv.cpp
src/rot_conv_extras.cpp
)
# Build a shared library
add_library(rotconvshared SHARED
src/rot_conv.cpp
src/rot_conv_extras.cpp
)
#
# Build sample executables
#
# Build the sample target directly with the source files
add_executable(rot_conv_sample_direct
test/rot_conv_sample.cpp
src/rot_conv.cpp
src/rot_conv_extras.cpp
)
# Build the sample target with the static library
add_executable(rot_conv_sample_static
test/rot_conv_sample.cpp
)
target_link_libraries(rot_conv_sample_static
rotconvstatic
)
# Build the sample target with the shared library
add_executable(rot_conv_sample_shared
test/rot_conv_sample.cpp
)
target_link_libraries(rot_conv_sample_shared
rotconvshared
)
#
# Build unit tests
#
# To enable the building of the unit tests do (in the project source directory):
# git clone https://github.com/google/googletest googletest
# Then re-run cmake and perform a make and run test_rot_conv.
# Build the unit tests if the google test framework is locally found
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/googletest)
# Import google test directory
add_subdirectory(googletest)
enable_testing()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
# Build and add the required unit test
add_executable(test_rot_conv
test/test_rot_conv.cpp
)
target_link_libraries(test_rot_conv
rotconvstatic
gtest_main
gtest
)
add_test(test_rot_conv test_rot_conv)
endif()
# EOF