Statistics
| Branch: | Tag: | Revision:

root / host / config / Component.cmake @ 47c92a2a

History | View | Annotate | Download (3.49 KB)

1
#
2
# Copyright 2010 Ettus Research LLC
3
#
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
#
17

    
18
########################################################################
19
SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE)
20
SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
21

    
22
########################################################################
23
# Register a component into the system
24
# Usage: LIBUHD_REGISTER_COMPONENT(<name> <var> <enb> <deps> <dis>)
25
########################################################################
26
FUNCTION(LIBUHD_REGISTER_COMPONENT name var)
27
    INCLUDE(CMakeDependentOption)
28
    MESSAGE(STATUS "")
29
    MESSAGE(STATUS "Configuring ${name} support...")
30
    IF(DEFINED ${var})
31
        MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
32
    ELSE(DEFINED ${var}) #not defined: automatic enabling of component
33
        MESSAGE(STATUS "${name} support configured automatically")
34
    ENDIF(DEFINED ${var})
35

    
36
    #setup the dependent option for this component
37
    CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ARGN})
38

    
39
    #remove previous occurrence of component in either list
40
    IF(DEFINED _uhd_enabled_components)
41
        LIST(REMOVE_ITEM _uhd_enabled_components ${name})
42
    ENDIF(DEFINED _uhd_enabled_components)
43
    IF(DEFINED _uhd_disabled_components)
44
        LIST(REMOVE_ITEM _uhd_disabled_components ${name})
45
    ENDIF(DEFINED _uhd_disabled_components)
46

    
47
    #append the component into one of the lists
48
    IF(${var})
49
        MESSAGE(STATUS "  Enabling ${name} support.")
50
        LIST(APPEND _uhd_enabled_components ${name})
51
    ELSE(${var})
52
        MESSAGE(STATUS "  Disabling ${name} support.")
53
        LIST(APPEND _uhd_disabled_components ${name})
54
    ENDIF(${var})
55

    
56
    #make components lists into global variables
57
    SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE)
58
    SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE)
59
ENDFUNCTION(LIBUHD_REGISTER_COMPONENT)
60

    
61
########################################################################
62
# Print the registered component summary
63
########################################################################
64
FUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
65
    MESSAGE(STATUS "")
66
    MESSAGE(STATUS "######################################################")
67
    MESSAGE(STATUS "# LibUHD enabled components                           ")
68
    MESSAGE(STATUS "######################################################")
69
    FOREACH(comp ${_uhd_enabled_components})
70
        MESSAGE(STATUS "  * ${comp}")
71
    ENDFOREACH(comp)
72

    
73
    MESSAGE(STATUS "")
74
    MESSAGE(STATUS "######################################################")
75
    MESSAGE(STATUS "# LibUHD disabled components                          ")
76
    MESSAGE(STATUS "######################################################")
77
    FOREACH(comp ${_uhd_disabled_components})
78
        MESSAGE(STATUS "  * ${comp}")
79
    ENDFOREACH(comp)
80

    
81
    MESSAGE(STATUS "")
82
ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY)