blob: e00ed226cf20bfe99eeddc44dfa41c025000245e [file] [log] [blame]
From d6647680612276f2321cc6a83964e9264fca42a1 Mon Sep 17 00:00:00 2001
From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
Date: Wed, 15 Jan 2020 17:23:08 +0100
Subject: [PATCH] add boost unit_test_framework required only when
ENABLE_TESTING=ON
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
---
CMakeLists.txt | 7 +++----
cmake/Modules/GnuradioConfig.cmake.in | 16 +++++++++++++---
cmake/Modules/GrBoost.cmake | 5 ++++-
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a47a945f9..58add6136 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,9 @@ GR_CHECK_BUILD_TYPE(${CMAKE_BUILD_TYPE})
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
+include(GrComponent)
+GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING)
+
# Set the version information here
SET(VERSION_MAJOR 3)
SET(VERSION_API 8)
@@ -377,10 +380,6 @@ GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON
SIX_FOUND
)
-GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING
- Boost_FOUND
-)
-
if(${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
include(CodeCoverage)
setup_target_for_coverage(coverage "ctest || exit 0" coverage)
diff --git a/cmake/Modules/GnuradioConfig.cmake.in b/cmake/Modules/GnuradioConfig.cmake.in
index 1e5ad20ec..f59e74b8b 100644
--- a/cmake/Modules/GnuradioConfig.cmake.in
+++ b/cmake/Modules/GnuradioConfig.cmake.in
@@ -24,15 +24,25 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
find_dependency(LOG4CPP)
find_dependency(MPLIB)
-find_dependency(Boost "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" COMPONENTS
+
+set(BOOST_REQUIRED_COMPONENTS
date_time
program_options
filesystem
system
regex
thread
- unit_test_framework
- )
+)
+
+if (NOT ENABLE_TESTING)
+ set(ENABLE_TESTING @ENABLE_TESTING@ CACHE BOOL "Enable testing support")
+endif()
+
+if(ENABLE_TESTING)
+ list(APPEND BOOST_REQUIRED_COMPONENTS unit_test_framework)
+endif(ENABLE_TESTING)
+
+find_dependency(Boost "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
find_dependency(Volk)
set(ENABLE_PYTHON @ENABLE_PYTHON@ CACHE BOOL "Enable Python & SWIG")
if(${ENABLE_PYTHON})
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
index cd4b120f7..670e61054 100644
--- a/cmake/Modules/GrBoost.cmake
+++ b/cmake/Modules/GrBoost.cmake
@@ -33,9 +33,12 @@ set(BOOST_REQUIRED_COMPONENTS
system
regex
thread
- unit_test_framework
)
+if(ENABLE_TESTING)
+ list(APPEND BOOST_REQUIRED_COMPONENTS unit_test_framework)
+endif(ENABLE_TESTING)
+
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
--
2.24.1