Index: ports-mgmt/portlint/src/portlint.pl =================================================================== --- ports-mgmt/portlint/src/portlint.pl +++ ports-mgmt/portlint/src/portlint.pl @@ -1790,7 +1790,7 @@ } # - # while file: check that CMAKE_BOOL just has words + # whole file: check that CMAKE_BOOL just has words # print "OK: checking that *_CMAKE_BOOL only contains words.\n" if ($verbose); if ($whole =~ /\n([\w\d]+)_CMAKE_BOOL[?+:]?=([^\n]+)\n/) { @@ -1802,6 +1802,27 @@ } } + print "OK: checking that *CMAKE* co-occurs with *USES+=cmake.\n" if ($verbose); + while ($whole =~ /\n([\w\d]+_)?CMAKE_(ARGS|BOOL|BOOL_ON|BOOL_OFF|OFF|ON)\b/g) { + my $lineno = &linenumber($`); + my $o = $1; + my $found_cmake = 0; + # Check in global USES and per-option USES + if ($makevar{USES} =~ /\b(cmake\b|cmake:)/) { + $found_cmake = 1; + } + elsif ($o) { + my $option_uses = "${o}USES"; + if ($makevar{$option_uses} && $makevar{$option_uses} =~ /\b(cmake\b|cmake:)/) { + $found_cmake = 1; + } + } + unless ($found_cmake) { + $o = "" unless ($o); + &perror("FATAL", $file, $lineno, "${o}CMAKE_$2 is set without USES+=cmake"); + } + } + # # whole file: NO_CHECKSUM #