11cmake_minimum_required (VERSION 2.8.12) # version on Ubuntu Trusty
22project (behaviortree_cpp_v3)
33
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 ----
49if (NOT CMAKE_VERSION VERSION_LESS 3.1)
510 set (CMAKE_CXX_STANDARD 11)
611 set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -12,37 +17,36 @@ if(MSVC)
1217 add_definitions (-D_CRT_SECURE_NO_WARNINGS)
1318endif ()
1419
15- find_package (Boost COMPONENTS coroutine2 QUIET )
16-
20+ #---- Include boost to add coroutines ----
21+ find_package (Boost COMPONENTS coroutine QUIET )
1722if (Boost_FOUND)
1823 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 ()
3234endif ()
3335
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 ()
3540
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 )
3842
43+ #---- project configuration ----
3944option (BUILD_EXAMPLES "Build tutorials and examples" ON )
4045option (BUILD_UNIT_TESTS "Build the unit tests" ON )
4146option (BUILD_TOOLS "Build commandline tools" ON )
4247option (BUILD_SHARED_LIBS "Build shared libraries" ON )
4348
44- #############################################################
45- # Find packages
49+ #---- Find other packages ----
4650find_package (Threads)
4751find_package (ZMQ)
4852
@@ -62,7 +66,6 @@ endif()
6266
6367set (BEHAVIOR_TREE_LIBRARY ${PROJECT_NAME} )
6468
65-
6669# Update the policy setting to avoid an error when loading the ament_cmake package
6770# at the current cmake version level
6871if (POLICY CMP0057)
@@ -230,7 +233,7 @@ endif()
230233
231234######################################################
232235# INSTALL
233- set (PROJECT_NAMESPACE BehaviorTree )
236+ set (PROJECT_NAMESPACE BehaviorTreeV3 )
234237set (PROJECT_CONFIG ${PROJECT_NAMESPACE} Config)
235238
236239INSTALL (TARGETS ${BEHAVIOR_TREE_LIBRARY}
0 commit comments