-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
56 lines (40 loc) · 1.38 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
cmake_minimum_required(VERSION 3.5)
project(motor_controllers)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SHARED_COMPILE_OPTIONS -Wall -Wextra -Wpedantic -O3)
endif()
# Dependencies
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ament_cmake REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
option(BUILD_SHARED_LIBS "Builds the library as SHARED. This is required to have the python wrapper." OFF)
option(BUILD_3RDPARTY "Download and install the 3rdparty libraries. Will do so at configure time." ON)
if(BUILD_3RDPARTY)
add_subdirectory(3rdparty)
endif()
# Add source subdirectory
set(motor_controllers_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(src)
# SWIG wrapping
option(BUILD_PYTHON_WRAPPER "Build a library wrapper for python" OFF)
if (BUILD_PYTHON_WRAPPER)
if (NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "Cannot build the Python wrapper with STATIC libraries. Set BUILD_SHARED_LIBS to ON.")
endif()
add_subdirectory(swig-python)
endif()
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()