summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-21 12:47:22 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-21 12:47:29 (GMT)
commitd1aa2e11092acdcc22b333e219187026d38549a5 (patch)
treeeaba8a9e22decb92d4af7427667ec5e07fe0fe87 /Source
parentfefae527c8c54d249c44313d9b09cdb0157e2f5d (diff)
parentb773e58099b2fc8ebdf8319172fb018d0139396d (diff)
downloadCMake-d1aa2e11092acdcc22b333e219187026d38549a5.zip
CMake-d1aa2e11092acdcc22b333e219187026d38549a5.tar.gz
CMake-d1aa2e11092acdcc22b333e219187026d38549a5.tar.bz2
Merge topic 'find-package-resolve-symlinks'
b773e58099 find_package: add test coverage for CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS a5e948a36f find_package: optionally resolve symlinks when discovering packages Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2798
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFindPackageCommand.cxx10
-rw-r--r--Source/cmFindPackageCommand.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 8dc7ca2..2567b7a 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -95,6 +95,7 @@ cmFindPackageCommand::cmFindPackageCommand()
this->UseLib32Paths = false;
this->UseLib64Paths = false;
this->UseLibx32Paths = false;
+ this->UseRealPath = false;
this->PolicyScope = true;
this->VersionMajor = 0;
this->VersionMinor = 0;
@@ -195,6 +196,11 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->NoSystemRegistry = true;
}
+ // Check whether we should resolve symlinks when finding packages
+ if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS")) {
+ this->UseRealPath = true;
+ }
+
// Check if Sorting should be enabled
if (const char* so =
this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_ORDER")) {
@@ -1502,6 +1508,10 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
fprintf(stderr, "Checking file [%s]\n", file.c_str());
}
if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) {
+ // Allow resolving symlinks when the config file is found through a link
+ if (this->UseRealPath) {
+ file = cmSystemTools::GetRealPath(file);
+ }
return true;
}
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 05bad49..83d8431 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -178,6 +178,7 @@ private:
bool UseLib32Paths;
bool UseLib64Paths;
bool UseLibx32Paths;
+ bool UseRealPath;
bool PolicyScope;
std::string LibraryArchitecture;
std::vector<std::string> Names;