From 0bc7556cc1e35810782acb5d26891d2b0e7bb199 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Tue, 29 Sep 2020 17:53:52 +1000 Subject: [PATCH] cmake: add a BUILD_TESTS option --- CMakeLists.txt | 3 +++ Core/MOOSDB/CMakeLists.txt | 5 +++-- Core/libMOOS/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8607e16..4ed7c53a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,9 @@ if(ENABLE_DOXYGEN) include(UseDoxygen) endif() +# Option to enable building of tests +option(BUILD_TESTS "Build tests" ON) + # Option to enable CDash testing option(CDASH_SUPPORT "Turn on testing targets that upload results to CDash" OFF) diff --git a/Core/MOOSDB/CMakeLists.txt b/Core/MOOSDB/CMakeLists.txt index 7b1a9034..229ac618 100644 --- a/Core/MOOSDB/CMakeLists.txt +++ b/Core/MOOSDB/CMakeLists.txt @@ -27,5 +27,6 @@ install(TARGETS ${EXECNAME} ARCHIVE DESTINATION lib ) -add_subdirectory(testing) - +if(BUILD_TESTS) + add_subdirectory(testing) +endif() diff --git a/Core/libMOOS/CMakeLists.txt b/Core/libMOOS/CMakeLists.txt index c55d65e3..be634100 100644 --- a/Core/libMOOS/CMakeLists.txt +++ b/Core/libMOOS/CMakeLists.txt @@ -207,5 +207,7 @@ install(TARGETS MOOS ARCHIVE DESTINATION lib ) -add_subdirectory(testing) +if(BUILD_TESTS) + add_subdirectory(testing) +endif()