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 "CONTAINERS" )
24 AND NOT ( ${modName} STREQUAL "ENUMS" )
25 AND NOT ( ${modName} STREQUAL "EXPRESSIONS" )
26 AND NOT ( ${modName} STREQUAL "FILES" )
27 AND NOT ( ${modName} STREQUAL "MONOMEM" )
28 AND NOT ( ${modName} STREQUAL "SINGLETONS" )
29 AND NOT ( ${modName} STREQUAL "STRINGS" )
30 AND NOT ( ${modName} STREQUAL "CAMP" )
31 AND NOT ( ${modName} STREQUAL "THREADMODEL" )
32 AND NOT ( ${modName} STREQUAL "THREADS" )
33 AND NOT ( ${modName} STREQUAL "TIME" )
35 MESSAGE( FATAL_ERROR "ALib: Unknown module name \"${modName}\" given!")
40# if nothing is given, ALL is chosen
41if( NOT ALIB_DISTRIBUTION )
42 MESSAGE( "ALib: No module specified with list variable \"ALIB_DISTRIBUTION\". Setting default \"ALL\".")
43 list( APPEND ALIB_DISTRIBUTION "ALL" )
46# resolve "mandatory" module dependencies
47list( FIND ALIB_DISTRIBUTION "ALL" idx )
49 LIST( REMOVE_AT ALIB_DISTRIBUTION ${idx} )
50 list( APPEND ALIB_DISTRIBUTION "ALOX" )
51 list( APPEND ALIB_DISTRIBUTION "BITBUFFER" )
52 list( APPEND ALIB_DISTRIBUTION "CLI" )
53 list( APPEND ALIB_DISTRIBUTION "EXPRESSIONS" )
54 list( APPEND ALIB_DISTRIBUTION "FILES" )
55 list( APPEND ALIB_DISTRIBUTION "THREADMODEL" )
56 list( APPEND ALIB_DISTRIBUTION "THREADS" )
60list( FIND ALIB_DISTRIBUTION "ALOX" idx )
62 list( APPEND ALIB_DISTRIBUTION "CONFIGURATION" )
65list( FIND ALIB_DISTRIBUTION "EXPRESSIONS" idx )
67 list( APPEND ALIB_DISTRIBUTION "CAMP" )
70list( FIND ALIB_DISTRIBUTION "CONFIGURATION" idx )
72 list( APPEND ALIB_DISTRIBUTION "CAMP" )
75list( FIND ALIB_DISTRIBUTION "CLI" idx )
77 list( APPEND ALIB_DISTRIBUTION "CAMP" )
80list( FIND ALIB_DISTRIBUTION "FILES" idx )
82 list( APPEND ALIB_DISTRIBUTION "CAMP" )
85list( FIND ALIB_DISTRIBUTION "CAMP" idx )
87 list( APPEND ALIB_DISTRIBUTION "BOXING" )
88 list( APPEND ALIB_DISTRIBUTION "CONTAINERS" )
89 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
90 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
91 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
92 list( APPEND ALIB_DISTRIBUTION "TIME" )
95### non-camp modules ###
96list( FIND ALIB_DISTRIBUTION "BITBUFFER" idx )
98 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
99 list( APPEND ALIB_DISTRIBUTION "CONTAINERS" )
100 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
103list( FIND ALIB_DISTRIBUTION "THREADMODEL" idx )
105 list( APPEND ALIB_DISTRIBUTION "BOXING" )
106 list( APPEND ALIB_DISTRIBUTION "CONTAINERS" )
107 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
108 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
109 list( APPEND ALIB_DISTRIBUTION "THREADS" )
112list( FIND ALIB_DISTRIBUTION "ENUMS" idx )
114 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
115 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
118list( FIND ALIB_DISTRIBUTION "THREADS" idx )
120 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
121 list( APPEND ALIB_DISTRIBUTION "TIME" )
124list( FIND ALIB_DISTRIBUTION "STRINGS" idx )
126 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
129list( FIND ALIB_DISTRIBUTION "BOXING" idx )
131 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
132 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
135### clean and sort module list
136LIST( REMOVE_DUPLICATES ALIB_DISTRIBUTION )
137LIST( SORT ALIB_DISTRIBUTION )
140list( LENGTH ALIB_DISTRIBUTION length)
141if( length GREATER ${maxModules} )
142 message( "More ALib modules than the known in: ${ALIB_DISTRIBUTION}" )
143 message( FATAL_ERROR " ${length} > ${maxModules}. Script is inconsistent!" )
145if( length EQUAL ${maxModules} )
146 SET( allModules True )