1## ---------------------------------------------------------------------
2##
3## Copyright (C) 2013 - 2015 by the deal.II authors
4##
5## This file is part of the deal.II library.
6##
7## The deal.II library is free software; you can use it, redistribute
8## it, and/or modify it under the terms of the GNU Lesser General
9## Public License as published by the Free Software Foundation; either
10## version 2.1 of the License, or (at your option) any later version.
11## The full text of the license can be found in the file LICENSE.md at
12## the top level directory of deal.II.
13##
14## ---------------------------------------------------------------------
15
16#
17# This macro is used for the feature configuration in deal.II. It adds
18# individual FEATURE_* configuration variables to the corresponding
19# DEAL_II_* variables
20#
21# Usage:
22#     REGISTER_FEATURE(feature)
23#
24# This macro will add
25#
26#   <FEATURE>_LIBRARIES (respecting general, optimized, debug keyword)
27#
28# and all other suffixes defined in DEAL_II_LIST_SUFFIXES and
29# DEAL_II_STRING_SUFFIXES to the corresponding DEAL_II_* variables
30#
31
32MACRO(REGISTER_FEATURE _feature)
33
34  IF(DEFINED ${_feature}_LIBRARIES)
35    #
36    # Add ${_feature}_LIBRARIES to
37    #   DEAL_II_LIBRARIES
38    #   DEAL_II_LIBRARIES_DEBUG
39    #   DEAL_II_LIBRARIES_RELEASE
40    # depending on the "optimized", "debug" or "general" keyword
41    #
42    SET(_toggle "general")
43    FOREACH(_tmp ${${_feature}_LIBRARIES})
44      IF( "${_tmp}" STREQUAL "debug" OR
45          "${_tmp}" STREQUAL "optimized" OR
46          "${_tmp}" STREQUAL "general" )
47        SET(_toggle "${_tmp}")
48      ELSE()
49        IF("${_toggle}" STREQUAL "general")
50          LIST(APPEND DEAL_II_LIBRARIES ${_tmp})
51        ELSEIF("${_toggle}" STREQUAL "debug")
52          LIST(APPEND DEAL_II_LIBRARIES_DEBUG ${_tmp})
53        ELSEIF("${_toggle}" STREQUAL "optimized")
54          LIST(APPEND DEAL_II_LIBRARIES_RELEASE ${_tmp})
55        ENDIF()
56      ENDIF()
57    ENDFOREACH()
58  ENDIF()
59
60  FOREACH(_var ${DEAL_II_LIST_SUFFIXES})
61    IF(NOT "${_var}" STREQUAL "LIBRARIES" AND DEFINED ${_feature}_${_var})
62      LIST(APPEND DEAL_II_${_var} ${${_feature}_${_var}})
63    ENDIF()
64  ENDFOREACH()
65
66  FOREACH(_var ${DEAL_II_STRING_SUFFIXES})
67    IF(DEFINED ${_feature}_${_var})
68      ADD_FLAGS(DEAL_II_${_var} "${${_feature}_${_var}}")
69    ENDIF()
70  ENDFOREACH()
71
72ENDMACRO()
73