Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f04827

Browse files
author
Davide Faconti
committed
allow to skip examples and tests
1 parent 87fd888 commit 3f04827

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

CMakeLists.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ project(behavior_tree_core)
33

44
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Werror=return-type -Wall -Wpedantic -Wattributes")
55
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
6+
7+
option(BUILD_EXAMPLES "Build tutorials and examples" ON)
8+
option(BUILD_UNIT_TESTS "Build the unit tests" ON)
9+
610
#############################################################
711
# http://answers.ros.org/question/230877/optionally-build-a-package-with-catkin/
812
#
@@ -30,7 +34,7 @@ else(catkin_FOUND)
3034
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
3135
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
3236
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
33-
37+
3438
find_package(GTest)
3539
include_directories(${GTEST_INCLUDE_DIRS})
3640
if(NOT GTEST_FOUND)
@@ -41,14 +45,14 @@ endif(catkin_FOUND)
4145

4246

4347
set(BT_Source
44-
src/action_node.cpp
48+
src/action_node.cpp
4549
src/basic_types.cpp
4650
src/decorator_node.cpp
47-
src/condition_node.cpp
48-
src/control_node.cpp
49-
src/exceptions.cpp
50-
src/leaf_node.cpp
51-
src/tick_engine.cpp
51+
src/condition_node.cpp
52+
src/control_node.cpp
53+
src/exceptions.cpp
54+
src/leaf_node.cpp
55+
src/tick_engine.cpp
5256
src/tree_node.cpp
5357
src/bt_factory.cpp
5458
src/behavior_tree.cpp
@@ -100,11 +104,11 @@ target_link_libraries(behavior_tree_core dl)
100104
######################################################
101105
# EXAMPLES and TOOLS
102106
######################################################
103-
104-
add_subdirectory(tools)
105-
add_subdirectory(sample_nodes)
106-
add_subdirectory(examples)
107-
107+
if( BUILD_EXAMPLES )
108+
add_subdirectory(tools)
109+
add_subdirectory(sample_nodes)
110+
add_subdirectory(examples)
111+
endif()
108112
######################################################
109113
# TESTS
110114
######################################################
@@ -126,8 +130,8 @@ if(catkin_FOUND AND CATKIN_ENABLE_TESTING)
126130
target_link_libraries(behavior_tree_core_test
127131
${BEHAVIOR_TREE_LIBRARIES} crossdoor_nodes
128132
${catkin_LIBRARIES} )
129-
130-
elseif(GTEST_FOUND)
133+
134+
elseif(GTEST_FOUND AND BUILD_UNIT_TESTS)
131135
include_directories(gtest/include)
132136

133137
add_executable(behavior_tree_core_test ${BT_Tests} )
@@ -136,9 +140,5 @@ elseif(GTEST_FOUND)
136140
${GTEST_LIBRARIES}
137141
${GTEST_MAIN_LIBRARIES}
138142
)
139-
140-
endif()
141-
142-
143-
144143

144+
endif()

0 commit comments

Comments
 (0)