lib: include files using known path

by including headers using "../[header]" when done from C files in
subdirectories, we do not need to specify the lib source dir as an
include path and we reduce the risk of header name collisions with
headers in the SDK using the same file names.

Idea-by: Kai Pastor

Ref: #16949
Closes #16991
This commit is contained in:
Daniel Stenberg 2025-04-08 08:00:12 +02:00
parent 7e4d516bcb
commit 625f2c1644
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
71 changed files with 580 additions and 587 deletions

View file

@ -35,6 +35,8 @@ if(!@ARGV) {
die "Usage: $0 [<c-sources>] [--exclude <exclude-c-sources>]\n";
}
my $srcdir = shift @ARGV;
# Specific sources to exclude or add as an extra source file
my @src;
my %exclude;
@ -58,6 +60,11 @@ HEADER
foreach my $src (@src) {
if($src =~ /\.c$/g && !exists $exclude{$src}) {
print "#include \"$src\"\n";
if(-e "$srcdir/$src") {
print "#include \"$srcdir/$src\"\n";
}
else {
print "#include \"$src\"\n";
}
}
}