ALib C++ Library
Library Version: 2402 R1
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 "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" )
32 )
33 MESSAGE( FATAL_ERROR "ALib: Unknown module name \"${modName}\" given!")
34 return()
35 endif()
36endforeach()
37
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" )
42endif()
43
44# resolve "mandatory" module dependencies
45list( FIND ALIB_DISTRIBUTION "ALL" idx )
46if( NOT idx LESS 0 )
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" )
54endif()
55
56#### camp modules ####
57list( FIND ALIB_DISTRIBUTION "ALOX" idx )
58if( NOT idx LESS 0 )
59 list( APPEND ALIB_DISTRIBUTION "CONFIGURATION" )
60endif()
61
62list( FIND ALIB_DISTRIBUTION "EXPRESSIONS" idx )
63if( NOT idx LESS 0 )
64 list( APPEND ALIB_DISTRIBUTION "CAMP" )
65endif()
66
67list( FIND ALIB_DISTRIBUTION "CONFIGURATION" idx )
68if( NOT idx LESS 0 )
69 list( APPEND ALIB_DISTRIBUTION "CAMP" )
70endif()
71
72list( FIND ALIB_DISTRIBUTION "CLI" idx )
73if( NOT idx LESS 0 )
74 list( APPEND ALIB_DISTRIBUTION "CAMP" )
75endif()
76
77list( FIND ALIB_DISTRIBUTION "FILES" idx )
78if( NOT idx LESS 0 )
79 list( APPEND ALIB_DISTRIBUTION "CAMP" )
80endif()
81
82list( FIND ALIB_DISTRIBUTION "CAMP" idx )
83if( NOT idx LESS 0 )
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" )
89endif()
90
91### non-camp modules ###
92list( FIND ALIB_DISTRIBUTION "BITBUFFER" idx )
93if( NOT idx LESS 0 )
94 list( APPEND ALIB_DISTRIBUTION "MONOMEM" )
95 list( APPEND ALIB_DISTRIBUTION "ENUMS" )
96endif()
97
98list( FIND ALIB_DISTRIBUTION "ENUMS" idx )
99if( NOT idx LESS 0 )
100 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
101 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
102endif()
103
104list( FIND ALIB_DISTRIBUTION "THREADS" idx )
105if( NOT idx LESS 0 )
106 list( APPEND ALIB_DISTRIBUTION "STRINGS" )
107endif()
108
109list( FIND ALIB_DISTRIBUTION "STRINGS" idx )
110if( NOT idx LESS 0 )
111 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
112endif()
113
114list( FIND ALIB_DISTRIBUTION "BOXING" idx )
115if( NOT idx LESS 0 )
116 list( APPEND ALIB_DISTRIBUTION "SINGLETONS" )
117 list( APPEND ALIB_DISTRIBUTION "CHARACTERS" )
118endif()
119
120### clean and sort module list
121LIST( REMOVE_DUPLICATES ALIB_DISTRIBUTION )
122LIST( SORT ALIB_DISTRIBUTION )
123
124SET( maxModules 15 )
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!" )
129endif()
130if( length EQUAL ${maxModules} )
131 SET( allModules True )
132endif()