Commit Graph

5 Commits

Author SHA1 Message Date
Moritz Haase
61d8fae116 find_package: Use deterministic search order by default
Historically, find_package() does not guarantee the order in which directories
matching a search path containing a glob expression are processed in - the
"first valid package" will be selected if there are multiple candidates. In such
cases, which package is chosen is completely random and can change, potentially
leading to build failures and reproducibility issues. This is rather unexpected
and confusing for developers.

Now that CMake has bumped its major version, it's a good time to change default
sort order and direction could be changed to natural sorting with a descending
order. That will result in the newest version of a library being picked in case
there are multiple ones available.
2025-06-18 06:34:59 +02:00
Hongxu Xu
0e2b87244c find_package: Fix CMAKE_FIND_PACKAGE_SORT_DIRECTION documented default
Previously the documentation said the default was `DEC`,
but the implementation has always defaulted to `ASC`.

Fixes: #22728
2025-02-24 15:03:34 -05:00
Brad King
d74210a8bd CMP0017: Remove support for OLD behavior 2025-01-18 09:51:44 -05:00
Matthew Woehlke
c10e1ea979 Tests: Better isolate find_package tests
Tweak find_package test to turn off as much searching of the host
environment as possible. This should make the tests less likely to be
affected in case the host system happens to have a package with the same
name as one of the test packages.
2024-12-09 10:52:55 -05:00
Matthew Woehlke
521190a38d Tests: Rename find_package test
We are working on adding CPS support to find_package, which will
obviously require tests (ideally, and especially in the long term, a
non-trivial number thereof). While it would be possibly to lump these
into the already rather lengthy FindPackageTest, it seems likely they
can be kept separate. Therefore, rename FindPackageTest to
FindPackageCMakeTest so that the name FindPackageCpsTest will be
available.
2024-11-23 16:41:44 -05:00