1
1
# Updated 2025.05 to 3.10 since compatibility with CMake < 3.10 will be removed from a future version of CMake.
2
- CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
2
+ cmake_minimum_required (VERSION 3.10)
3
3
# https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
4
4
option (BUILD_SHARED_LIBS "Build using shared libraries" ON )
5
5
@@ -8,42 +8,13 @@ if(WIN32)
8
8
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
9
9
endif ()
10
10
11
- PROJECT (dqrobotics)
11
+ project (dqrobotics)
12
12
set (CMAKE_CXX_STANDARD 11)
13
13
14
- INCLUDE_DIRECTORIES (include )
15
-
16
- if (UNIX AND NOT APPLE )
17
- FIND_PACKAGE (Eigen3 REQUIRED)
18
- INCLUDE_DIRECTORIES (${EIGEN3_INCLUDE_DIR} )
19
- ADD_COMPILE_OPTIONS (-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
20
- endif ()
21
-
22
- if (APPLE )
23
- INCLUDE_DIRECTORIES (
24
- /usr/local/include /
25
- /usr/local/include /eigen3
26
- # Most recent versions of brew install here
27
- /opt/homebrew/include
28
- /opt/homebrew/include /eigen3)
29
- ADD_COMPILE_OPTIONS (-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
30
- endif ()
31
-
32
- if (WIN32 )
33
- ADD_DEFINITIONS (-D_USE_MATH_DEFINES)
34
- FIND_PACKAGE (Eigen3 CONFIG REQUIRED)
35
- INCLUDE_DIRECTORIES (${EIGEN3_INCLUDE_DIR} )
36
- endif ()
37
-
38
-
39
- ################################################################
40
- # DEFINE AND INSTALL LIBRARY AND INCLUDE FOLDER
41
- ################################################################
42
-
43
14
# As of 2025.05, Not using GLOB_RECURSE as it's explicitly discouraged.
44
15
# https://stackoverflow.com/questions/3201154/automatically-add-all-files-in-a-folder-to-a-target-using-cmake
45
16
# https://cmake.org/cmake/help/latest/command/file.html#filesystem
46
- ADD_LIBRARY (dqrobotics
17
+ add_library (dqrobotics
47
18
src/DQ.cpp
48
19
49
20
src/internal /_dq_linesegment.cpp
@@ -79,12 +50,38 @@ ADD_LIBRARY(dqrobotics
79
50
src/robots/FrankaEmikaPandaRobot.cpp
80
51
)
81
52
82
- SET_TARGET_PROPERTIES (dqrobotics
53
+ target_include_directories (
54
+ include
55
+ )
56
+
57
+ if (UNIX AND NOT APPLE )
58
+ find_package (Eigen3 REQUIRED)
59
+ include_directories (${EIGEN3_INCLUDE_DIR} )
60
+ add_compile_options (-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
61
+ endif ()
62
+
63
+ if (APPLE )
64
+ include_directories (
65
+ /usr/local/include /
66
+ /usr/local/include /eigen3
67
+ # Most recent versions of brew install here
68
+ /opt/homebrew/include
69
+ /opt/homebrew/include /eigen3)
70
+ add_compile_options (-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
71
+ endif ()
72
+
73
+ if (WIN32 )
74
+ add_definitions (-D_USE_MATH_DEFINES)
75
+ find_package (Eigen3 CONFIG REQUIRED)
76
+ include_directories (${EIGEN3_INCLUDE_DIR} )
77
+ endif ()
78
+
79
+ set_target_properties (dqrobotics
83
80
PROPERTIES PUBLIC_HEADER
84
81
include /dqrobotics/DQ.h
85
82
)
86
83
87
- INSTALL (TARGETS dqrobotics
84
+ install (TARGETS dqrobotics
88
85
# https://stackoverflow.com/questions/21592361/cmake-install-is-not-installing-libraries-on-windows
89
86
RUNTIME DESTINATION "bin"
90
87
LIBRARY DESTINATION "lib"
@@ -96,14 +93,14 @@ INSTALL(TARGETS dqrobotics
96
93
# INSTALL HEADERS IN SUBFOLDERS
97
94
################################################################
98
95
99
- INSTALL (DIRECTORY
96
+ install (DIRECTORY
100
97
include /
101
98
DESTINATION "include" )
102
99
103
100
################################################################
104
101
# INSTALL SOURCE FILES (So that the debugger can find them)
105
102
################################################################
106
103
107
- INSTALL (DIRECTORY
104
+ install (DIRECTORY
108
105
src/
109
106
DESTINATION "src/dqrobotics" )
0 commit comments