@@ -15,29 +15,6 @@ else()
15
15
add_definitions (-Wpedantic )
16
16
endif ()
17
17
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
-
41
18
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
42
19
43
20
#---- project configuration ----
@@ -46,6 +23,36 @@ option(BUILD_SAMPLES "Build sample nodes" ON)
46
23
option (BUILD_UNIT_TESTS "Build the unit tests" ON )
47
24
option (BUILD_TOOLS "Build commandline tools" ON )
48
25
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 ()
49
56
50
57
#---- Find other packages ----
51
58
find_package (Threads )
0 commit comments