'Build configuration for C projects
Any suggestion of Build system that can add or remove functions from C files based what is selected in Build , without the typical use of #ifdef.
Config.cfg
<Feature1>
func1
func2
func3
structA:varB ( Variable B is specific to Feature1)
</Feature1>
<Feature2>
func4
func5
func6
structA:varD ( Variable D is specific to Feature2)
</Feature2>
So if in Build system i want to select Feature2 it should only INclude Func4,5,6 for compilation and remove other variables and Function not selected.
Typical C way #ifdef will be
#ifdef Feature1
func1() {
}
func2() {
}
func3() {
}
#endif
StructA {
#ifdef Feature1
var B
#endif
}
I want to avoid excessive use of Ifdef , is there any better way to do so.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
