aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-08-11 10:51:23 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2015-08-11 10:51:23 -0700
commit0dbaf46b5cac9179312c0e9c00e9cc1462322d66 (patch)
tree4ce140ad87238bc87c84169fd70d1a56953a4f09 /host/cmake
parent28327c8e8a810b19da126116d0dc4c26b643baed (diff)
downloaduhd-0dbaf46b5cac9179312c0e9c00e9cc1462322d66.tar.gz
uhd-0dbaf46b5cac9179312c0e9c00e9cc1462322d66.tar.bz2
uhd-0dbaf46b5cac9179312c0e9c00e9cc1462322d66.zip
cmake: added variable to LIBUHD_REGISTER_COMPONENT macro to make required, set LibUHD to required
* If required component's dependencies aren't met, CMake will throw an error unless user specifically disables it
Diffstat (limited to 'host/cmake')
-rw-r--r--host/cmake/Modules/UHDComponent.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake
index bf4a50e33..5a7dd8c86 100644
--- a/host/cmake/Modules/UHDComponent.cmake
+++ b/host/cmake/Modules/UHDComponent.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2011,2013 Ettus Research LLC
+# Copyright 2010-2011,2013,2015 Ettus Research LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,18 +26,31 @@ SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
# - enb the default enable setting
# - deps a list of dependencies
# - dis the default disable setting
+# - req fail if dependencies not met (unless specifically disabled)
########################################################################
-MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis)
+MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis req)
MESSAGE(STATUS "")
MESSAGE(STATUS "Configuring ${name} support...")
FOREACH(dep ${deps})
MESSAGE(STATUS " Dependency ${dep} = ${${dep}}")
ENDFOREACH(dep)
+ #if user specified option, store here
+ IF("${${var}}" STREQUAL "OFF")
+ SET(user_disabled TRUE)
+ ELSE()
+ SET(user_disabled FALSE)
+ ENDIF("${${var}}" STREQUAL "OFF")
+
#setup the dependent option for this component
INCLUDE(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis})
+ #if a required option's dependencies aren't met, fail unless user specifies otherwise
+ IF(NOT ${var} AND ${req} AND NOT user_disabled)
+ MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.")
+ ENDIF(NOT ${var} AND ${req} AND NOT user_disabled)
+
#append the component into one of the lists
IF(${var})
MESSAGE(STATUS " Enabling ${name} support.")