diff options
author | Joerg Hofrichter <joerg.hofrichter@ni.com> | 2020-01-22 17:19:04 +0100 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2020-01-22 12:54:54 -0800 |
commit | 608c8a3ab33db629596c37fc8b00902a77900e20 (patch) | |
tree | ab6148290c351ebcced70fa6ed4299ba2bc10a9f /mpm | |
parent | 84bb89878ce6fb08ed512532a0e934d89ca4b7d3 (diff) | |
download | uhd-608c8a3ab33db629596c37fc8b00902a77900e20.tar.gz uhd-608c8a3ab33db629596c37fc8b00902a77900e20.tar.bz2 uhd-608c8a3ab33db629596c37fc8b00902a77900e20.zip |
mpm: fixed cmake macro for enabling modules
The macro MPM_REGISTER_COMPONENT did not work as described: in case
the default enable was set to ON and all dependencies were met, the
module was still not enabled.
Also made the status prints more helpful:
- print the default value,
- print the user override (if one was provided)
- print the resulting VAR = VALUE
- print the override hint only if the user did not
already specify an override
Example of old incorrect behavior:
-- Configuring Mykonos support...
-- Dependency ENABLE_LIBMPM = ON
-- Disabling Mykonos support.
-- Override with -DENABLE_MYKONOS=ON/OFF
Example of new correct behavior (also with changed prints):
-- Configuring Mykonos support...
-- Default value ENABLE_MYKONOS = ON
-- Dependency ENABLE_LIBMPM = ON
-- Enabling Mykonos support (ENABLE_MYKONOS = ON)
-- Override with -DENABLE_MYKONOS=ON/OFF
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/cmake/Modules/MPMComponent.cmake | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/mpm/cmake/Modules/MPMComponent.cmake b/mpm/cmake/Modules/MPMComponent.cmake index 461d95185..216e86f3d 100644 --- a/mpm/cmake/Modules/MPMComponent.cmake +++ b/mpm/cmake/Modules/MPMComponent.cmake @@ -24,9 +24,6 @@ set(_mpm_disabled_components "" CACHE INTERNAL "" FORCE) macro(MPM_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. Note: If the user doesn't specify # this option on the cmake command line, both user_enabled and @@ -44,11 +41,17 @@ macro(MPM_REGISTER_COMPONENT name var enb deps dis req) # Override default if user set if(user_enabled OR user_disabled) + message(STATUS " User forced ${var} = ${${var}}") set(option "${${var}}") else(user_enabled OR user_disabled) - set(option ${req}) + message(STATUS " Default value ${var} = ${enb}") + set(option ${enb}) endif() + foreach(dep ${deps}) + message(STATUS " Dependency ${dep} = ${${dep}}") + endforeach(dep) + # setup the dependent option for this component include(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${option} "${deps}" ${dis}) @@ -67,13 +70,15 @@ macro(MPM_REGISTER_COMPONENT name var enb deps dis req) #append the component into one of the lists if(${var}) - message(STATUS " Enabling ${name} support.") + message(STATUS " Enabling ${name} support (${var} = ${${var}})") list(APPEND _mpm_enabled_components ${name}) else(${var}) - message(STATUS " Disabling ${name} support.") + message(STATUS " Disabling ${name} support (${var} = ${${var}})") list(APPEND _mpm_disabled_components ${name}) endif(${var}) - message(STATUS " Override with -D${var}=ON/OFF") + if(NOT user_enabled AND NOT user_disabled) + message(STATUS " Override with -D${var}=ON/OFF") + endif(NOT user_enabled AND NOT user_disabled) #make components lists into global variables set(_mpm_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) |