mirror of
https://github.com/curl/curl.git
synced 2026-08-09 11:34:19 +03:00
cmake: add test for DISABLE options, add CURL_DISABLE_HEADERS_API
- tests: verify CMake `DISABLE` options. Make an exception for 2 CMake-only ones, and one more that's using a different naming scheme, also in autotools and source. - cmake: add support for `CURL_DISABLE_HEADERS_API`. Suggested-by: Daniel Stenberg Ref: https://github.com/curl/curl/pull/12345#pullrequestreview-1736238641 Closes #12353
This commit is contained in:
parent
b9b50f3193
commit
33493db2af
3 changed files with 46 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ use warnings;
|
|||
|
||||
# the DISABLE options that can be set by configure
|
||||
my %disable;
|
||||
# the DISABLE options that can be set by CMakeLists.txt
|
||||
my %disable_cmake;
|
||||
# the DISABLE options that are used in C files
|
||||
my %file;
|
||||
# the DISABLE options that are documented
|
||||
|
|
@ -61,6 +63,24 @@ sub scan_configure {
|
|||
}
|
||||
}
|
||||
|
||||
sub scanconf_cmake {
|
||||
my ($f)=@_;
|
||||
open S, "<$f";
|
||||
while(<S>) {
|
||||
if(/(CURL_DISABLE_[A-Z_]+)/g) {
|
||||
my ($sym)=($1);
|
||||
if(not $sym =~ /(CURL_DISABLE_INSTALL|CURL_DISABLE_TESTS|CURL_DISABLE_SRP)/) {
|
||||
$disable_cmake{$sym} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close S;
|
||||
}
|
||||
|
||||
sub scan_cmake {
|
||||
scanconf_cmake("$root/CMakeLists.txt");
|
||||
}
|
||||
|
||||
sub scan_file {
|
||||
my ($source)=@_;
|
||||
open F, "<$source";
|
||||
|
|
@ -104,6 +124,7 @@ sub scan_docs {
|
|||
}
|
||||
|
||||
scan_configure();
|
||||
scan_cmake();
|
||||
scan_sources();
|
||||
scan_docs();
|
||||
|
||||
|
|
@ -121,12 +142,28 @@ for my $s (sort keys %disable) {
|
|||
}
|
||||
}
|
||||
|
||||
# Check the CMakeLists.txt symbols for use in code
|
||||
for my $s (sort keys %disable_cmake) {
|
||||
if(!$file{$s}) {
|
||||
printf "Present in CMakeLists.txt, not used by code: %s\n", $s;
|
||||
$error++;
|
||||
}
|
||||
if(!$docs{$s}) {
|
||||
printf "Present in CMakeLists.txt, not documented in $DOCS: %s\n", $s;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
# Check the code symbols for use in configure
|
||||
for my $s (sort keys %file) {
|
||||
if(!$disable{$s}) {
|
||||
printf "Not set by configure: %s (%s)\n", $s, $file{$s};
|
||||
$error++;
|
||||
}
|
||||
if(!$disable_cmake{$s}) {
|
||||
printf "Not set by CMakeLists.txt: %s (%s)\n", $s, $file{$s};
|
||||
$error++;
|
||||
}
|
||||
if(!$docs{$s}) {
|
||||
printf "Used in code, not documented in $DOCS: %s\n", $s;
|
||||
$error++;
|
||||
|
|
@ -139,6 +176,10 @@ for my $s (sort keys %docs) {
|
|||
printf "Documented but not in configure: %s\n", $s;
|
||||
$error++;
|
||||
}
|
||||
if(!$disable_cmake{$s}) {
|
||||
printf "Documented but not in CMakeLists.txt: %s\n", $s;
|
||||
$error++;
|
||||
}
|
||||
if(!$file{$s}) {
|
||||
printf "Documented, but not used by code: %s\n", $s;
|
||||
$error++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue