1
1
cmake_minimum_required (VERSION 2.8.12 ) # version on Ubuntu Trusty
2
2
project (behaviortree_cpp_v3 )
3
3
4
+ #---- Add the subdirectory cmake ----
5
+ set (CMAKE_CONFIG_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR} /cmake" )
6
+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CONFIG_PATH} " )
7
+
8
+ #---- Enable C++11 ----
4
9
if (NOT CMAKE_VERSION VERSION_LESS 3.1 )
5
10
set (CMAKE_CXX_STANDARD 11 )
6
11
set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -12,37 +17,36 @@ if(MSVC)
12
17
add_definitions (-D_CRT_SECURE_NO_WARNINGS )
13
18
endif ()
14
19
15
- find_package ( Boost COMPONENTS coroutine2 QUIET )
16
-
20
+ # ---- Include boost to add coroutines ----
21
+ find_package ( Boost COMPONENTS coroutine QUIET )
17
22
if (Boost_FOUND )
18
23
include_directories (${Boost_INCLUDE_DIRS} )
19
- message (STATUS "Found boost::coroutine2." )
20
- add_definitions (-DBT_BOOST_COROUTINE2 )
21
- set (BT_COROUTINES true )
22
- else ()
23
- find_package (Boost COMPONENTS coroutine QUIET )
24
- if (Boost_FOUND )
25
- message (STATUS "Found boost::coroutine." )
26
- include_directories (${Boost_INCLUDE_DIRS} )
27
- add_definitions (-DBT_BOOST_COROUTINE )
28
- set (BT_COROUTINES true )
29
- else ()
30
- add_definitions (-DBT_NO_COROUTINES )
31
- endif ()
24
+ if (Boost_VERSION VERSION_GREATER_EQUAL 105900 )
25
+ message (STATUS "Found boost::coroutine2." )
26
+ add_definitions (-DBT_BOOST_COROUTINE2 )
27
+ set (BT_COROUTINES true )
28
+ elseif (Boost_VERSION_STRING VERSION_GREATER_EQUAL 105300 )
29
+ message (STATUS "Found boost::coroutine." )
30
+ include_directories (${Boost_INCLUDE_DIRS} )
31
+ add_definitions (-DBT_BOOST_COROUTINE )
32
+ set (BT_COROUTINES true )
33
+ endif ()
32
34
endif ()
33
35
34
- set (CMAKE_POSITION_INDEPENDENT_CODE ON )
36
+ if (NOT DEFINED BT_COROUTINES )
37
+ message (STATUS "Coroutines disabled. Install Boost to enable them (version 1.59+ recommended)." )
38
+ add_definitions (-DBT_NO_COROUTINES )
39
+ endif ()
35
40
36
- set (CMAKE_CONFIG_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR} /cmake" )
37
- list (APPEND CMAKE_MODULE_PATH "${CMAKE_CONFIG_PATH} " )
41
+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
38
42
43
+ #---- project configuration ----
39
44
option (BUILD_EXAMPLES "Build tutorials and examples" ON )
40
45
option (BUILD_UNIT_TESTS "Build the unit tests" ON )
41
46
option (BUILD_TOOLS "Build commandline tools" ON )
42
47
option (BUILD_SHARED_LIBS "Build shared libraries" ON )
43
48
44
- #############################################################
45
- # Find packages
49
+ #---- Find other packages ----
46
50
find_package (Threads )
47
51
find_package (ZMQ )
48
52
@@ -62,7 +66,6 @@ endif()
62
66
63
67
set (BEHAVIOR_TREE_LIBRARY ${PROJECT_NAME} )
64
68
65
-
66
69
# Update the policy setting to avoid an error when loading the ament_cmake package
67
70
# at the current cmake version level
68
71
if (POLICY CMP0057 )
@@ -230,7 +233,7 @@ endif()
230
233
231
234
######################################################
232
235
# INSTALL
233
- set (PROJECT_NAMESPACE BehaviorTree )
236
+ set (PROJECT_NAMESPACE BehaviorTreeV3 )
234
237
set (PROJECT_CONFIG ${PROJECT_NAMESPACE} Config )
235
238
236
239
INSTALL (TARGETS ${BEHAVIOR_TREE_LIBRARY}
0 commit comments