mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
Merge topic 'pkg-root-var'
1a16e4fc69
Merge branch 'backport-pkg-root-var' into pkg-root-var87a661a916
find_package: Fix regression on `<PackageName>_ROOT` relative to CWDfc059e1978
Merge branch 'backport-pkg-root-var' into pkg-root-varab0a44a0a0
find_package: Fix regression on `<PackageName>_ROOT` relative to CWDd029b828b2
find_package: Avoid repeating search for lower-case .cps filefc4d238d7a
Tests: Match RunCMake.find_package-CPS version candidates more precisely Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !11277
This commit is contained in:
@@ -1376,7 +1376,7 @@ bool cmFindPackageCommand::FindPackageUsingConfigMode()
|
||||
this->Configs.emplace_back(std::move(config), pdt::Cps);
|
||||
|
||||
config = cmStrCat(cmSystemTools::LowerCase(n), ".cps");
|
||||
if (config != this->Configs.front().Name) {
|
||||
if (config != this->Configs.back().Name) {
|
||||
this->Configs.emplace_back(std::move(config), pdt::Cps);
|
||||
}
|
||||
}
|
||||
@@ -2917,14 +2917,13 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
|
||||
this->DebugBuffer = cmStrCat(this->DebugBuffer, " ", file, '\n');
|
||||
}
|
||||
if (cmSystemTools::FileExists(file, true)) {
|
||||
// Allow resolving symlinks when the config file is found through a link
|
||||
if (this->UseRealPath) {
|
||||
file = cmSystemTools::GetRealPath(file);
|
||||
} else {
|
||||
file = cmSystemTools::ToNormalizedPathOnDisk(file);
|
||||
}
|
||||
if (this->CheckVersion(file)) {
|
||||
// Allow resolving symlinks when the config file is found through a
|
||||
// link
|
||||
if (this->UseRealPath) {
|
||||
file = cmSystemTools::GetRealPath(file);
|
||||
} else {
|
||||
file = cmSystemTools::ToNormalizedPathOnDisk(file);
|
||||
}
|
||||
foundMode = cmFindPackageCommand::FoundMode(config.Type);
|
||||
return true;
|
||||
}
|
||||
|
@@ -3,11 +3,15 @@ CMake Error at MissingVersion1\.cmake:[0-9]+ \(find_package\):
|
||||
with requested version "1\.2\.7"\.
|
||||
|
||||
The following configuration files were considered but not accepted:
|
||||
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/sample\.cps, version: 1\.5\.0\+niven
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/sample\.cps, version: 1\.4\.2\+adams
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/sample\.cps, version: 1\.2\.3\+clarke
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/sample\.cps, version: 1\.1\.0\+asimov
|
||||
(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/[Ss]ample\.cps, version: 1\.5\.0\+niven)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/[Ss]ample\.cps, version: 1\.4\.2\+adams)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/[Ss]ample\.cps, version: 1\.2\.3\+clarke)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/[Ss]ample\.cps, version: 1\.1\.0\+asimov)+
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
|
@@ -3,11 +3,15 @@ CMake Error at MissingVersion2\.cmake:[0-9]+ \(find_package\):
|
||||
with requested version "1\.4\.9"\.
|
||||
|
||||
The following configuration files were considered but not accepted:
|
||||
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/sample\.cps, version: 1\.5\.0\+niven
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/sample\.cps, version: 1\.4\.2\+adams
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/sample\.cps, version: 1\.2\.3\+clarke
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/sample\.cps, version: 1\.1\.0\+asimov
|
||||
(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/[Ss]ample\.cps, version: 1\.5\.0\+niven)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/[Ss]ample\.cps, version: 1\.4\.2\+adams)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/[Ss]ample\.cps, version: 1\.2\.3\+clarke)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/[Ss]ample\.cps, version: 1\.1\.0\+asimov)+
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
|
@@ -3,11 +3,15 @@ CMake Error at VersionLimit3\.cmake:[0-9]+ \(find_package\):
|
||||
with requested version range "1\.2\.0\.\.\.1\.2\.2"\.
|
||||
|
||||
The following configuration files were considered but not accepted:
|
||||
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/sample\.cps, version: 1\.5\.0\+niven
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/sample\.cps, version: 1\.4\.2\+adams
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/sample\.cps, version: 1\.2\.3\+clarke
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/sample\.cps, version: 1\.1\.0\+asimov
|
||||
(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/[Ss]ample\.cps, version: 1\.5\.0\+niven)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/[Ss]ample\.cps, version: 1\.4\.2\+adams)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/[Ss]ample\.cps, version: 1\.2\.3\+clarke)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/[Ss]ample\.cps, version: 1\.1\.0\+asimov)+
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
|
@@ -3,11 +3,15 @@ CMake Error at VersionLimit4\.cmake:[0-9]+ \(find_package\):
|
||||
with requested version range "1\.2\.0\.\.\.<1\.2\.3"\.
|
||||
|
||||
The following configuration files were considered but not accepted:
|
||||
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/sample\.cps, version: 1\.5\.0\+niven
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/sample\.cps, version: 1\.4\.2\+adams
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/sample\.cps, version: 1\.2\.3\+clarke
|
||||
.*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/sample\.cps, version: 1\.1\.0\+asimov
|
||||
(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.5\.0/[Ss]ample\.cps, version: 1\.5\.0\+niven)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.4\.2/[Ss]ample\.cps, version: 1\.4\.2\+adams)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.2\.3/[Ss]ample\.cps, version: 1\.2\.3\+clarke)+(
|
||||
[^
|
||||
]*/Tests/RunCMake/find_package-CPS/cps/sample/1\.1\.0/[Ss]ample\.cps, version: 1\.1\.0\+asimov)+
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
|
@@ -0,0 +1,2 @@
|
||||
-- Relative_ROOT='root'
|
||||
-- Relative_DIR='[^']*/Tests/RunCMake/find_package/PackageRootRelative-build/root'
|
7
Tests/RunCMake/find_package/PackageRootRelative.cmake
Normal file
7
Tests/RunCMake/find_package/PackageRootRelative.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
set(Relative_ROOT root)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/root/RelativeConfig.cmake" "")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/root/RelativeConfigVersion.cmake" "set(PACKAGE_VERSION 1)")
|
||||
find_package(Relative)
|
||||
message(STATUS "Relative_ROOT='${Relative_ROOT}'")
|
||||
message(STATUS "Relative_DIR='${Relative_DIR}'")
|
@@ -39,6 +39,7 @@ run_cmake_with_options(ModuleModeDebugPkg --debug-find-pkg=Foo,Zot)
|
||||
run_cmake(PackageRoot)
|
||||
run_cmake(PackageRootNestedConfig)
|
||||
run_cmake(PackageRootNestedModule)
|
||||
run_cmake(PackageRootRelative)
|
||||
run_cmake(PackageVarOverridesOptional)
|
||||
run_cmake(PolicyPush)
|
||||
run_cmake(PolicyPop)
|
||||
|
Reference in New Issue
Block a user