1# #################################################################################################
2# ALibModules.cmake - CMake file for projects using ALib
4# Copyright 2015-2024 A-Worx GmbH, Germany
5# Published under 'Boost Software License' (a free software license, see LICENSE.txt)
8# This script resolves dependencies between ALib modules and lists selected plus necessary
9# modules in variable ALIB_DISTRIBUTION.
10# This CMake file is included by "ALib.cmake" automatically and is not intended for manual
11# inclusion. Its contents was separated into a separated cmake file solely for clarity.
12# #################################################################################################
14# check for unknown module name
15foreach (modName ${ALIB_DISTRIBUTION})
16 if( NOT ( ${modName} STREQUAL "ALL" )
17 AND NOT ( ${modName} STREQUAL "ALOX" )
18 AND NOT ( ${modName} STREQUAL "BITBUFFER" )
19 AND NOT ( ${modName} STREQUAL "BOXING" )
20 AND NOT ( ${modName} STREQUAL "CHARACTERS" )
21 AND NOT ( ${modName} STREQUAL "CLI" )
22 AND NOT ( ${modName} STREQUAL "CONFIGURATION" )
23 AND NOT ( ${modName} STREQUAL "ENUMS" )
24 AND NOT ( ${modName} STREQUAL "EXPRESSIONS" )
25 AND NOT ( ${modName} STREQUAL "FILES" )
26 AND NOT ( ${modName} STREQUAL "MONOMEM" )
27 AND NOT ( ${modName} STREQUAL "SINGLETONS" )
28 AND NOT ( ${modName} STREQUAL "STRINGS" )
29 AND NOT ( ${modName} STREQUAL "CAMP" )
30 AND NOT ( ${modName} STREQUAL "THREADS" )
31 AND NOT ( ${modName} STREQUAL "TIME" )
33 MESSAGE( FATAL_ERROR "ALib: Unknown module name \"${modName}\" given!")
38# if nothing is given, ALL is chosen
39if( NOT ALIB_DISTRIBUTION )
40 MESSAGE( "ALib: No module specified with list variable \"ALIB_DISTRIBUTION\". Setting default \"ALL\".")
41 list( APPEND ALIB_DISTRIBUTION "ALL" )
44# resolve "mandatory" module dependencies
45list( FIND ALIB_DISTRIBUTION "ALL" idx )
47 LIST( REMOVE_AT ALIB_DISTRIBUTION ${idx} )
48 list( APPEND ALIB_DISTRIBUTION "ALOX" )
49 list( APPEND ALIB_DISTRIBUTION "BITBUFFER" )
50 list( APPEND ALIB_DISTRIBUTION "CLI" )
51 list( APPEND ALIB_DISTRIBUTION "EXPRESSIONS" )
52 list( APPEND ALIB_DISTRIBUTION "FILES" )
53 list( APPEND ALIB_DISTRIBUTION "THREADS" )
57list( FIND ALIB_DISTRIBUTION "ALOX" idx )
59 list( APPEND ALIB_DISTRIBUTION "CONFIGURATION" )
62list( FIND ALIB_DISTRIBUTION "EXPRESSIONS" idx )
64 list( APPEND ALIB_DISTRIBUTION "CAMP" )
67list( FIND ALIB_DISTRIBUTION "CONFIGURATION" idx )
69 list( APPEND ALIB_DISTRIBUTION "CAMP" )
72list( FIND ALIB_DISTRIBUTION "CLI" idx )
74 list( APPEND ALIB_DISTRIBUTION "CAMP" )
77list( FIND ALIB_DISTRIBUTION "FILES" idx )
79 list( APPEND ALIB_DISTRIBUTION "CAMP" )
82list( FIND ALIB_DISTRIBUTION "CAMP" idx )
84 list( APPEND ALIB_DISTRIBUTION "BOXING" )
85 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
86 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
87 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
88 list( APPEND ALIB_DISTRIBUTION "TIME" )
91### non-camp modules ###
92list( FIND ALIB_DISTRIBUTION "BITBUFFER" idx )
94 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
95 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
98list( FIND ALIB_DISTRIBUTION "ENUMS" idx )
100 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
101 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
104list( FIND ALIB_DISTRIBUTION "THREADS" idx )
106 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
109list( FIND ALIB_DISTRIBUTION "STRINGS" idx )
111 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
114list( FIND ALIB_DISTRIBUTION "BOXING" idx )
116 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
117 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
120### clean and sort module list
121LIST( REMOVE_DUPLICATES ALIB_DISTRIBUTION )
122LIST( SORT ALIB_DISTRIBUTION )
125list( LENGTH ALIB_DISTRIBUTION length)
126if( length GREATER ${maxModules} )
127 message( "More ALib modules than the known in: ${ALIB_DISTRIBUTION}" )
128 message( FATAL_ERROR " ${length} > ${maxModules}. Script is inconsistent!" )
130if( length EQUAL ${maxModules} )
131 SET( allModules True )