Skip to content

Commit 16763c8

Browse files
committed
Merge branch 'master' of github.com:BehaviorTree/BehaviorTree.CPP
2 parents e3c3aa7 + 40b5cc9 commit 16763c8

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

CMakeLists.txt

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,6 @@ else()
1515
add_definitions(-Wpedantic)
1616
endif()
1717

18-
#---- Include boost to add coroutines ----
19-
find_package(Boost COMPONENTS coroutine QUIET)
20-
21-
if(Boost_FOUND)
22-
string(REPLACE "." "0" Boost_VERSION_NODOT ${Boost_VERSION})
23-
if(NOT Boost_VERSION_NODOT VERSION_LESS 105900)
24-
message(STATUS "Found boost::coroutine2.")
25-
add_definitions(-DBT_BOOST_COROUTINE2)
26-
set(BT_COROUTINES true)
27-
elseif(NOT Boost_VERSION_NODOT VERSION_LESS 105300)
28-
message(STATUS "Found boost::coroutine.")
29-
add_definitions(-DBT_BOOST_COROUTINE)
30-
set(BT_COROUTINES true)
31-
endif()
32-
include_directories(${Boost_INCLUDE_DIRS})
33-
endif()
34-
35-
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()
40-
4118
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4219

4320
#---- project configuration ----
@@ -46,6 +23,36 @@ option(BUILD_SAMPLES "Build sample nodes" ON)
4623
option(BUILD_UNIT_TESTS "Build the unit tests" ON)
4724
option(BUILD_TOOLS "Build commandline tools" ON)
4825
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
26+
option(ENABLE_COROUTINES "Enable boost coroutines" ON)
27+
28+
#---- Include boost to add coroutines ----
29+
if(ENABLE_COROUTINES)
30+
find_package(Boost COMPONENTS coroutine QUIET)
31+
32+
if(Boost_FOUND)
33+
string(REPLACE "." "0" Boost_VERSION_NODOT ${Boost_VERSION})
34+
if(NOT Boost_VERSION_NODOT VERSION_LESS 105900)
35+
message(STATUS "Found boost::coroutine2.")
36+
add_definitions(-DBT_BOOST_COROUTINE2)
37+
set(BT_COROUTINES true)
38+
elseif(NOT Boost_VERSION_NODOT VERSION_LESS 105300)
39+
message(STATUS "Found boost::coroutine.")
40+
add_definitions(-DBT_BOOST_COROUTINE)
41+
set(BT_COROUTINES true)
42+
endif()
43+
include_directories(${Boost_INCLUDE_DIRS})
44+
endif()
45+
46+
if(NOT DEFINED BT_COROUTINES)
47+
message(STATUS "Boost coroutines disabled. Install Boost (version 1.59+ recommended).")
48+
endif()
49+
else()
50+
message(STATUS "Boost coroutines disabled by CMake option.")
51+
endif()
52+
53+
if(NOT DEFINED BT_COROUTINES)
54+
add_definitions(-DBT_NO_COROUTINES)
55+
endif()
4956

5057
#---- Find other packages ----
5158
find_package(Threads)

0 commit comments

Comments
 (0)