ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ALibModules.cmake
1# #################################################################################################
2# ALibModules.cmake - CMake file for projects using ALib
3#
4# Copyright 2015-2024 A-Worx GmbH, Germany
5# Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6#
7# Notes:
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# #################################################################################################
13
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" )
34 )
35 MESSAGE( FATAL_ERROR "ALib: Unknown module name \"${modName}\" given!")
36 return()
37 endif()
38endforeach()
39
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" )
44endif()
45
46# resolve "mandatory" module dependencies
47list( FIND ALIB_DISTRIBUTION "ALL" idx )
48if( NOT idx LESS 0 )
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" )
57endif()
58
59#### camp modules ####
60list( FIND ALIB_DISTRIBUTION "ALOX" idx )
61if( NOT idx LESS 0 )
62 list( APPEND ALIB_DISTRIBUTION "CONFIGURATION" )
63endif()
64
65list( FIND ALIB_DISTRIBUTION "EXPRESSIONS" idx )
66if( NOT idx LESS 0 )
67 list( APPEND ALIB_DISTRIBUTION "CAMP" )
68endif()
69
70list( FIND ALIB_DISTRIBUTION "CONFIGURATION" idx )
71if( NOT idx LESS 0 )
72 list( APPEND ALIB_DISTRIBUTION "CAMP" )
73endif()
74
75list( FIND ALIB_DISTRIBUTION "CLI" idx )
76if( NOT idx LESS 0 )
77 list( APPEND ALIB_DISTRIBUTION "CAMP" )
78endif()
79
80list( FIND ALIB_DISTRIBUTION "FILES" idx )
81if( NOT idx LESS 0 )
82 list( APPEND ALIB_DISTRIBUTION "CAMP" )
83endif()
84
85list( FIND ALIB_DISTRIBUTION "CAMP" idx )
86if( NOT idx LESS 0 )
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" )
93endif()
94
95### non-camp modules ###
96list( FIND ALIB_DISTRIBUTION "BITBUFFER" idx )
97if( NOT idx LESS 0 )
98 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
99 list( APPEND ALIB_DISTRIBUTION "CONTAINERS" )
100 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
101endif()
102
103list( FIND ALIB_DISTRIBUTION "THREADMODEL" idx )
104if( NOT idx LESS 0 )
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" )
110endif()
111
112list( FIND ALIB_DISTRIBUTION "ENUMS" idx )
113if( NOT idx LESS 0 )
114 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
115 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
116endif()
117
118list( FIND ALIB_DISTRIBUTION "THREADS" idx )
119if( NOT idx LESS 0 )
120 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
121 list( APPEND ALIB_DISTRIBUTION "TIME" )
122endif()
123
124list( FIND ALIB_DISTRIBUTION "STRINGS" idx )
125if( NOT idx LESS 0 )
126 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
127endif()
128
129list( FIND ALIB_DISTRIBUTION "BOXING" idx )
130if( NOT idx LESS 0 )
131 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
132 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
133endif()
134
135### clean and sort module list
136LIST( REMOVE_DUPLICATES ALIB_DISTRIBUTION )
137LIST( SORT ALIB_DISTRIBUTION )
138
139SET( maxModules 17 )
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!" )
144endif()
145if( length EQUAL ${maxModules} )
146 SET( allModules True )
147endif()