1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-12 16:52:44 +08:00

344 Commits

Author SHA1 Message Date
Brad King
e0355c4ea9 FindBoost: Add policy to remove this module
Upstream Boost 1.70 and above provide a proper `BoostConfig.cmake`
package configuration file.  Packages for all major distros now
provide it in at least one LTS release.  Add a policy to pretend
that the `FindBoost` module does not exist so that projects calling
`find_package(Boost)` use the upstream package directly.

Closes: #19402
2024-05-03 10:30:23 -04:00
Brad King
8b3d48ab94 Merge topic 'save-restore-PACKAGE_PREFIX_DIR'
41f4e1c457 CMakePackageConfigHelpers: Document PACKAGE_PREFIX_DIR for public use
c5231ba29e find_package: Save/restore PACKAGE_PREFIX_DIR
8ac7958e3a generate_apple_*_selection_file: Save/restore PACKAGE_PREFIX_DIR
bf88879f1f generate_apple_architecture_selection_file: Avoid early returns
a4ac2c92f4 Help: Add missing section heading for apple architecture selection
b7fcc44be9 Help: Fix CMakePackageConfigHelpers typos, grammar and formatting
f1cacaa830 Tests/RunCMake/CMakePackage: Define variable closer to where it is used

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9430
2024-04-22 08:42:13 -04:00
Craig Scott
c5231ba29e find_package: Save/restore PACKAGE_PREFIX_DIR
Package configuration files generated by `configure_package_config_file`
set this variable in `@PACKAGE_INIT@` and then use it later.  There may
be intervening calls to `find_package`, e.g., via `find_dependency`.
If the loaded package also used `configure_package_config_file`, it
may change the value of `PACKAGE_PREFIX_DIR`.  Explicitly save and
restore the value to avoid this.

Fixes: #25827
2024-04-19 11:44:09 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Kyle Edwards
c6e6861e63 install(EXPORT): Export find_dependency() calls
Issue: #20511
Co-Authored-by: Brad King <brad.king@kitware.com>
Co-Authored-by: Robert Maynard <rmaynard@nvidia.com>
2023-11-13 11:07:52 -05:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`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.
2023-07-28 09:14:08 -04:00
Marc Chevrier
4fc322bab4 AddCacheEntry: Suppress raw pointer usage 2023-05-30 16:41:59 +02:00
Marc Chevrier
aa5fed5052 SetProperty: suppress raw pointer usage 2023-05-26 14:48:22 +02:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Brad King
a4c5b91f80 FindPython{Interp,Libs}: Add policy to remove these modules
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}`.
2023-03-30 12:05:09 -04:00
Craig Scott
716ce4402a
find_package: Ensure root path stack and module vars are restored
Fixes: #24595
2023-03-17 21:35:30 +11:00
Brad King
d45992e633 Merge topic 'recursion-limit'
49167cf68f Source: Adjust stack sizes and recursion limits to work together
9504cef8c4 Tests: Allow RunCMake.MaxRecursionDepth to test public-facing default limit
60ef076bac find_package: Enforce maximum nesting depth below maximum recursion depth
89b69bf1ad Add CMAKE_MAXIMUM_RECURSION_DEPTH environment variable
395895bda7 cmMakefile: Factor out helper to get recursion depth limit
88bc8dfc14 cmMakefile: Store recursion depth limit as size_t
fcad8d0630 cmMakefile: Improve parsing of CMAKE_MAXIMUM_RECURSION_DEPTH variable
497f7d5c1a Tests: Simplify option passing to RunCMake.MaxRecursionDepth cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8307
2023-03-14 09:35:45 -04:00
Brad King
60ef076bac find_package: Enforce maximum nesting depth below maximum recursion depth
The stack usage for nested `find_package` calls is much larger than for
other kinds of recursion, so enforce a lower limit to avoid stack
overflow.
2023-03-13 11:48:19 -04:00
Brad King
2c146a7fc5 FindCUDA: Add policy to remove this module
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.
2023-03-09 07:39:36 -05:00
Brad King
2e469212c8 Dart,FindDart: Add policy to remove these modules
These modules and the "DART" tool they support have long been replaced
by CTest.
2023-02-28 08:43:45 -05:00
Brad King
df9c4b1872 find_package: Use <PACKAGENAME>_ROOT variables as search prefixes
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
2023-02-23 09:15:14 -05:00
Brad King
bfeb16bd5b cmFindPackageCommand: Refactor CMP0074 logic to de-duplicate lookups 2023-02-23 09:12:29 -05:00
Brad King
c0fcd07e6f cmFindPackageCommand: Factor out methods for package root stack management 2023-02-23 09:12:28 -05:00
Vitaly Stakhovsky
b3edfcf46e cmValue: Use operator* explicitly to convert to std::string; avoid extra call 2023-01-15 23:39:02 -05:00
makise-homura
b1577f7a6a LCC: Update -Wunused-variable warning number as of LCC 1.26.16 2022-12-08 20:34:58 +03:00
Brad King
0dfd939077 cmFindPackageCommand: Suppress LCC false-positive warning
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.
2022-10-13 10:40:23 -04:00
Alex Turbov
19366408fe cmFindPackageCommand: Protect overrides of cmDirectoryListGenerator
Move virtual function overrides into a protected section of class.
2022-08-04 09:41:59 -04:00
Alex Turbov
e55c154c5b cmFindPackageCommand: Add one more search path
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).*/`.
2022-08-04 09:41:59 -04:00
Alex Turbov
2f69c0233c cmFindPackageCommand: Optimize the last calls to TryGeneratedPaths 2022-08-02 09:46:52 -04:00
Alex Turbov
076a4b44b0 cmFindPackageCommand: Path generators are actually reusable 2022-08-02 09:46:52 -04:00
Alex Turbov
664abd486f cmFindPackageCommand: Better names for template parameters 2022-08-02 09:46:52 -04:00
Alex Turbov
c862797a40 cmFindPackageCommand: Rename some generators
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...
2022-08-02 09:46:52 -04:00
Alex Turbov
fdd14b1744 cmFindPackageCommand: Deduplicate directory listing code
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.
2022-08-02 09:46:52 -04:00
Alex Turbov
08e7fb3cfa cmFindPackageCommand: Compile-time path generator expressions
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.
2022-08-02 09:46:48 -04:00
Alex Turbov
61eb5d4de5 cmFindPackageCommand: Avoid friendship between command class and generator 2022-07-11 17:14:02 +04:00
Alex Turbov
ef62f213f8 cmFindPackageCommand: Drop dead code
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.
2022-07-11 17:14:02 +04:00
Alex Turbov
468d04ef14 cmFindPackageCommand: Move methods implementation into the class definition 2022-07-11 17:14:02 +04:00
Alex Turbov
898ba76d1b cmFindPackageCommand: Drop redundant std::ostream::operator<< calls 2022-07-11 17:14:02 +04:00
Alex Turbov
5be13907a0 cmFindPackageCommand: Use vector instead of set to store arg indices
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.
2022-07-11 17:14:02 +04:00
Alex Turbov
66c3932e58 cmFindPackageCommand: Move comment inside the else if block 2022-07-11 17:14:02 +04:00
Alex Turbov
285c994905 cmFindPackageCommand: Named lambda w/o capture to normal function 2022-07-11 17:14:02 +04:00
Alex Turbov
f9f4e104b0 cmFindPackageCommand: Constness 2022-07-11 17:14:02 +04:00
Alex Turbov
c67b82c998 cmFindPackageCommand: Enclose file list generators into anonymous ns 2022-07-11 17:14:01 +04:00
Alex Turbov
f71b88c4c1 cmFindPackageCommand: Move cmFindPackageCommandHoldFile to anonymous ns
Also, avoid `#include` in the middle of the module.
2022-07-11 17:14:01 +04:00
Alex Turbov
865cfaa492 cmFindPackageCommand: Move collectPathsForDebug() to anonymous namespace 2022-07-11 17:14:01 +04:00
Alex Turbov
6a95ab97e7 cmFindPackageCommand: Deduplicate version string comparator code 2022-07-11 17:14:01 +04:00
Alex Turbov
c6d3ef1c95 cmFindPackageCommand: Replace empty string literal w/ default std::string{} 2022-07-11 17:14:01 +04:00
Alex Turbov
f2a4e4f6fa cmFindPackageCommand: Simplify if-return-else-return into single return stmt 2022-07-11 17:14:01 +04:00
Alex Turbov
a3fe1aca0c cmFindPackageCommand: Replace strcmp with array subscription 2022-07-11 17:14:01 +04:00
Alex Turbov
b5f880d5c6 cmFindPackageCommand: Deduplicate code to exclude . and .. dir entries 2022-07-11 17:14:01 +04:00
Alex Turbov
045e36fe36 cmFindPackageCommand: Replace single-char string literals with char literals 2022-07-11 17:14:01 +04:00
Alex Turbov
1bed0be2cd cmFindPackageCommand: Use std::any_of instead of "manual" for loops 2022-07-11 17:14:01 +04:00
Sean McBride
d5694e4623 Source: Replace uses of sprintf with safer snprintf 2022-06-22 08:59:40 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
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.
2022-06-13 09:05:24 -04:00