Commit 8fb12ce7 authored by Brad King's avatar Brad King
Browse files

Merge branch 'add-package_root-to-find_package' into release-3.9

Merge-request: !1082
parents 9d09d1a9 4a207116
......@@ -1090,6 +1090,9 @@ void cmFindPackageCommand::AppendSuccessInformation()
void cmFindPackageCommand::ComputePrefixes()
{
if (!this->NoDefaultPath) {
if (!this->NoPackageRootPath) {
this->FillPrefixesPackageRoot();
}
if (!this->NoCMakePath) {
this->FillPrefixesCMakeVariable();
}
......@@ -1117,6 +1120,23 @@ void cmFindPackageCommand::ComputePrefixes()
this->ComputeFinalPaths();
}
void cmFindPackageCommand::FillPrefixesPackageRoot()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot];
// Add package specific search prefixes
// NOTE: This should be using const_reverse_iterator but HP aCC and
// Oracle sunCC both currently have standard library issues
// with the reverse iterator APIs.
for (std::deque<std::string>::reverse_iterator pkg =
this->Makefile->FindPackageModuleStack.rbegin();
pkg != this->Makefile->FindPackageModuleStack.rend(); ++pkg) {
std::string varName = *pkg + "_ROOT";
paths.AddCMakePath(varName);
paths.AddEnvPath(varName);
}
}
void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeEnvironment];
......
......@@ -100,6 +100,7 @@ private:
void StoreVersionFound();
void ComputePrefixes();
void FillPrefixesPackageRoot();
void FillPrefixesCMakeEnvironment();
void FillPrefixesCMakeVariable();
void FillPrefixesSystemEnvironment();
......
----------
Foo_ROOT :
ENV{Foo_ROOT} :
find_package\(Foo\)
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
Foo_ROOT :
ENV{Foo_ROOT} :
Bar_ROOT :
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND
BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND
BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND
BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND
BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
Bar_ROOT :
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
Foo_ROOT :
ENV{Foo_ROOT} :
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
Foo_ROOT :
ENV{Foo_ROOT} :
Bar_ROOT :
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
Foo_ROOT :
ENV{Foo_ROOT} :
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
----------
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
Bar_ROOT :
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
----------
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/env_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/env_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
----------
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Bar_ROOT :.*/PackageRoot/bar/cmake_root
ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
......@@ -5,73 +5,33 @@ set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
unset(Bar_ROOT)
unset(ENV{Bar_ROOT})
unset(FOO_TEST_FILE_FOO)
unset(FOO_TEST_FILE_ZOT)
unset(FOO_TEST_PATH_FOO)
unset(FOO_TEST_PATH_ZOT)
unset(FOO_TEST_PROG_FOO)
unset(BAR_TEST_FILE_FOO)
unset(BAR_TEST_FILE_BAR)
unset(BAR_TEST_PATH_FOO)
unset(BAR_TEST_PATH_BAR)
unset(BAR_TEST_PROG_FOO)
unset(BAR_TEST_PROG_BAR)
unset(FOO_TEST_FILE_FOO CACHE)
unset(FOO_TEST_FILE_ZOT CACHE)
unset(FOO_TEST_PATH_FOO CACHE)
unset(FOO_TEST_PATH_ZOT CACHE)
unset(FOO_TEST_PROG_FOO CACHE)
unset(BAR_TEST_FILE_FOO CACHE)
unset(BAR_TEST_FILE_BAR CACHE)
unset(BAR_TEST_PATH_FOO CACHE)
unset(BAR_TEST_PATH_BAR CACHE)
unset(BAR_TEST_PROG_FOO CACHE)
unset(BAR_TEST_PROG_BAR CACHE)
endmacro()
macro(RunPackageRootTest)
set(orig_foo_cmake_root ${Foo_ROOT})
set(orig_foo_env_root $ENV{Foo_ROOT})
set(orig_bar_cmake_root ${Bar_ROOT})
set(orig_bar_env_root $ENV{Bar_ROOT})
find_package(Foo)
message("----------")
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
CleanUpPackageRootTest()
message("")
set(Foo_ROOT ${orig_foo_cmake_root})
set(ENV{Foo_ROOT} ${orig_foo_env_root})
set(Bar_ROOT ${orig_bar_cmake_root})
set(ENV{Bar_ROOT} ${orig_bar_env_root})
find_package(Foo COMPONENTS Bar)
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
message("Bar_ROOT :${Bar_ROOT}")
message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}")
find_package(Foo)
message("find_package(Foo)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
unset(orig_foo_cmake_root)
unset(orig_foo_env_root)
unset(orig_bar_cmake_root)
unset(orig_bar_env_root)
endmacro()
RunPackageRootTest()
......@@ -85,63 +45,3 @@ RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
RunPackageRootTest()
##
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
find_file(BAR_TEST_FILE_FOO foo.h)
find_file(BAR_TEST_FILE_BAR bar.h)
find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
find_path(BAR_TEST_PATH_FOO foo.h)
find_path(BAR_TEST_PATH_BAR bar.h)
find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
find_program(BAR_TEST_PROG_FOO foo.exe)
find_program(BAR_TEST_PROG_BAR bar.exe)
set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
find_file(BAR_TEST_FILE_FOO foo.h)
find_file(BAR_TEST_FILE_BAR bar.h)
find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
......
......@@ -4,6 +4,8 @@ find_path(FOO_TEST_PATH_FOO foo.h)
find_path(FOO_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
find_program(FOO_TEST_PROG_FOO foo.exe)
if ("Bar" IN_LIST Foo_FIND_COMPONENTS)
if ("BarModule" IN_LIST Foo_FIND_COMPONENTS)
find_package(Bar)
elseif ("BarConfig" IN_LIST Foo_FIND_COMPONENTS)
find_package(Bar CONFIG)
endif ()