From 0b8f544bf2238bbff0fbc296eafcf8f4fb867711 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Thu, 29 Dec 2016 10:43:22 +0000
Subject: [PATCH] Add a cache variable to allow not running tests.

---
 CMakeLists.txt | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb20fae8..1604d7c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,8 +56,16 @@ if (EIGEN3_FOUND)
   endif (FCL_HAVE_EIGEN)
 endif (EIGEN3_FOUND)
 
+# Add a cache variable to allow not compiling and running tests
+set (RUN_TESTS TRUE CACHE BOOL "compile and run unit tests")
+
 # Required dependencies
-set(BOOST_COMPONENTS thread date_time filesystem system unit_test_framework)
+if (RUN_TESTS)
+  set(BOOST_COMPONENTS thread date_time filesystem system unit_test_framework)
+else ()
+  set(BOOST_COMPONENTS thread date_time system)
+endif ()
+
 search_for_boost()
 # Optional dependencies
 add_optional_dependency("octomap >= 1.6")
@@ -170,7 +178,9 @@ SET(${PROJECT_NAME}_HEADERS
   )
 
 add_subdirectory(src)
-add_subdirectory(test)
+if (RUN_TESTS)
+  add_subdirectory(test)
+endif ()
 
 pkg_config_append_libs("hpp-fcl")
 PKG_CONFIG_APPEND_BOOST_LIBS(thread date_time filesystem system)
-- 
GitLab