`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library. Update includes
to satisfy IWYU for our CI job under Debian 12.
The `FindPythonInterp` and `FindPythonLibs` modules have been deprecated
since CMake 3.12. Add a policy to pretend they do not exist in order to
encourage projects to port to `FindPython` or `FindPython{2,3}`.
The `FindCUDA` module has been deprecated since CMake 3.10.
Add a policy to pretend it doesn't exist in order to encourage
projects to port away from it.
Extend commit eb35d8884b (find_package: Use PackageName_ROOT variables
as search prefixes, 2018-03-15, v3.12.0-rc1~349^2) to also check
upper-case `<PACKAGENAME>_ROOT` variables. Add policy `CMP0144` to
enable the behavior in a compatible way.
Fixes: #24403
Extend the LCC warning suppression from commit 08e7fb3cfa
(cmFindPackageCommand: Compile-time path generator expressions,
2022-07-05, v3.25.0-rc1~361^2~5) to cover a new number for the
same warning, now produced by LCC 1.26.15.
The `PREFIX/(Foo|foo|FOO).*/(cmake|CMake)/(Foo|foo|FOO).*/` search
path is the similar to the one already exists
`PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/`.
The point is that `cmFileListBlahBlahGenerator` actually "generate"
directory names and never files.
The `cmBlahBlahStringGenerators` produce paths in fact. Ok, paths
nowadays are also strings but...
The `cmFileListGeneratorProject` and `cmFileListGeneratorMacProject`
was look very similar 'cept few lines.
Now they have a base class and the generator-specific logic has moved
to overrides.
Original code had path generators built at run-time using a linked list
of dynamically allocated nodes each of which was responsible to generate
a path segment.
However, the combination of used generators is totally well known at
compile time.
The `cmFindPackageFileList` instances always constructed w/ the only
parameter. The boolean flag is always `true` (default value).
Also, `cmFindPackageCommand::InitialPass` adds an empty string
to the `cmFindPackageCommand::SearchPathSuffixes` vector. Meaning
that `cmFindPackageCommand::CheckDirectory()` gonna be called for
the suffix-less path, so `cmFindPackageFileList::Visit` may call
only `cmFindPackageCommand::SearchDirectory` and get the same result.
They are unique by design. I.e., when the algorithm iterates over
args doing only one push per iteration indices gonna be unique ;-)
So, no need for `std::set` here.
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.
Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
During argument parsing in InitialPass(), Makefile variables were
being added for components. Most other such variables were set
in the call to SetModuleVariables(), which happens much later.
Both sets of variables were then restored to their previous values
as part of a call to AppendSuccessInformation(), but that is not an
obvious nor robust place to undo those variable changes.
InitialPass() also pushes a new item to the package root stack, but
the corresponding pop was in AppendSuccessInformation().
Again, this puts a symmetric operation in an asymmetric place.
Refactor the code slightly such that Makefile variables are set in
one clear location, then restored later in the same function.
Also move the package root stack pop into the same function as
the push. AppendSuccessInformation() now has one clear
responsibility and doesn't perform any unrelated cleanup on
behalf of InitialPass().
Allow FetchContent_MakeAvailable() to try a call to
find_package() first, or redirect a find_package() call to
FetchContent_MakeAvailable(). The user can set variables
to control which of these are allowed or tried by default.
Fixes: #21687