2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2006-02-27 21:38:22 +00:00
|
|
|
#include "cmFindBase.h"
|
2012-08-13 17:42:58 +00:00
|
|
|
|
2017-05-03 17:56:03 +00:00
|
|
|
#include <deque>
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <iostream>
|
2017-05-03 17:56:03 +00:00
|
|
|
#include <iterator>
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <map>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2015-03-08 12:51:20 +00:00
|
|
|
#include "cmAlgorithms.h"
|
2016-10-25 18:35:04 +00:00
|
|
|
#include "cmMakefile.h"
|
2016-11-05 20:40:14 +00:00
|
|
|
#include "cmSearchPath.h"
|
2016-10-18 19:28:49 +00:00
|
|
|
#include "cmState.h"
|
2016-10-18 19:28:48 +00:00
|
|
|
#include "cmStateTypes.h"
|
2016-10-19 19:59:14 +00:00
|
|
|
#include "cmSystemTools.h"
|
2015-03-08 12:51:20 +00:00
|
|
|
|
2006-02-27 21:38:22 +00:00
|
|
|
cmFindBase::cmFindBase()
|
|
|
|
{
|
|
|
|
this->AlreadyInCache = false;
|
2006-07-18 19:21:26 +00:00
|
|
|
this->AlreadyInCacheWithoutMetaInfo = false;
|
2012-09-24 15:05:10 +00:00
|
|
|
this->NamesPerDir = false;
|
|
|
|
this->NamesPerDirAllowed = false;
|
2010-11-12 15:47:28 +00:00
|
|
|
}
|
|
|
|
|
2006-02-27 21:38:22 +00:00
|
|
|
bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
|
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (argsIn.size() < 2) {
|
2006-02-27 21:38:22 +00:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-04-13 15:00:52 +00:00
|
|
|
|
2006-02-27 21:38:22 +00:00
|
|
|
// copy argsIn into args so it can be modified,
|
2012-08-13 17:42:58 +00:00
|
|
|
// in the process extract the DOC "documentation"
|
2006-02-27 21:38:22 +00:00
|
|
|
size_t size = argsIn.size();
|
|
|
|
std::vector<std::string> args;
|
|
|
|
bool foundDoc = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
for (unsigned int j = 0; j < size; ++j) {
|
|
|
|
if (foundDoc || argsIn[j] != "DOC") {
|
|
|
|
if (argsIn[j] == "ENV") {
|
|
|
|
if (j + 1 < size) {
|
2006-03-16 22:49:16 +00:00
|
|
|
j++;
|
|
|
|
cmSystemTools::GetPath(args, argsIn[j].c_str());
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2006-03-16 22:49:16 +00:00
|
|
|
args.push_back(argsIn[j]);
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
|
|
|
if (j + 1 < size) {
|
2006-02-27 21:38:22 +00:00
|
|
|
foundDoc = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
this->VariableDocumentation = argsIn[j + 1];
|
2006-02-27 21:38:22 +00:00
|
|
|
j++;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (j >= size) {
|
2006-02-27 21:38:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
|
|
|
if (args.size() < 2) {
|
2010-11-30 13:39:16 +00:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-02-27 21:38:22 +00:00
|
|
|
this->VariableName = args[0];
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->CheckForVariableInCache()) {
|
2006-02-27 21:38:22 +00:00
|
|
|
this->AlreadyInCache = true;
|
|
|
|
return true;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2012-08-13 17:42:58 +00:00
|
|
|
this->AlreadyInCache = false;
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2017-08-08 15:22:17 +00:00
|
|
|
this->SelectDefaultNoPackageRootPath();
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
// Find the current root path mode.
|
|
|
|
this->SelectDefaultRootPathMode();
|
|
|
|
|
|
|
|
// Find the current bundle/framework search policy.
|
|
|
|
this->SelectDefaultMacMode();
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 17:20:44 +00:00
|
|
|
|
2006-02-27 21:38:22 +00:00
|
|
|
bool newStyle = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
enum Doing
|
|
|
|
{
|
|
|
|
DoingNone,
|
|
|
|
DoingNames,
|
|
|
|
DoingPaths,
|
|
|
|
DoingPathSuffixes,
|
|
|
|
DoingHints
|
|
|
|
};
|
2008-06-09 19:08:59 +00:00
|
|
|
Doing doing = DoingNames; // assume it starts with a name
|
2016-05-16 14:34:04 +00:00
|
|
|
for (unsigned int j = 1; j < args.size(); ++j) {
|
|
|
|
if (args[j] == "NAMES") {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingNames;
|
2006-02-27 21:38:22 +00:00
|
|
|
newStyle = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (args[j] == "PATHS") {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingPaths;
|
|
|
|
newStyle = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (args[j] == "HINTS") {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingHints;
|
2006-02-27 21:38:22 +00:00
|
|
|
newStyle = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (args[j] == "PATH_SUFFIXES") {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingPathSuffixes;
|
2006-02-27 21:38:22 +00:00
|
|
|
newStyle = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (args[j] == "NAMES_PER_DIR") {
|
2012-09-24 15:05:10 +00:00
|
|
|
doing = DoingNone;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->NamesPerDirAllowed) {
|
2012-09-24 15:05:10 +00:00
|
|
|
this->NamesPerDir = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2012-09-24 15:05:10 +00:00
|
|
|
this->SetError("does not support NAMES_PER_DIR");
|
|
|
|
return false;
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (args[j] == "NO_SYSTEM_PATH") {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingNone;
|
2006-03-16 22:49:16 +00:00
|
|
|
this->NoDefaultPath = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (this->CheckCommonArgument(args[j])) {
|
2008-06-09 19:08:59 +00:00
|
|
|
doing = DoingNone;
|
2008-06-10 17:22:18 +00:00
|
|
|
// Some common arguments were accidentally supported by CMake
|
|
|
|
// 2.4 and 2.6.0 in the short-hand form of the command, so we
|
|
|
|
// must support it even though it is not documented.
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (doing == DoingNames) {
|
2008-06-09 19:08:59 +00:00
|
|
|
this->Names.push_back(args[j]);
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (doing == DoingPaths) {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->UserGuessArgs.push_back(args[j]);
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (doing == DoingHints) {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->UserHintsArgs.push_back(args[j]);
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (doing == DoingPathSuffixes) {
|
2008-06-09 19:08:59 +00:00
|
|
|
this->AddPathSuffix(args[j]);
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-03-28 19:45:22 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->VariableDocumentation.empty()) {
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 17:20:44 +00:00
|
|
|
this->VariableDocumentation = "Where can ";
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->Names.empty()) {
|
2006-02-27 21:38:22 +00:00
|
|
|
this->VariableDocumentation += "the (unknown) library be found";
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (this->Names.size() == 1) {
|
|
|
|
this->VariableDocumentation +=
|
|
|
|
"the " + this->Names[0] + " library be found";
|
|
|
|
} else {
|
2015-01-14 21:23:41 +00:00
|
|
|
this->VariableDocumentation += "one of the ";
|
2015-07-18 08:45:18 +00:00
|
|
|
this->VariableDocumentation +=
|
|
|
|
cmJoin(cmMakeRange(this->Names).retreat(1), ", ");
|
2016-05-16 14:34:04 +00:00
|
|
|
this->VariableDocumentation +=
|
|
|
|
" or " + this->Names[this->Names.size() - 1] + " libraries be found";
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-02-27 21:38:22 +00:00
|
|
|
|
|
|
|
// look for old style
|
|
|
|
// FIND_*(VAR name path1 path2 ...)
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!newStyle) {
|
2008-06-10 17:22:18 +00:00
|
|
|
// All the short-hand arguments have been recorded as names.
|
|
|
|
std::vector<std::string> shortArgs = this->Names;
|
2006-03-05 13:38:24 +00:00
|
|
|
this->Names.clear(); // clear out any values in Names
|
2008-06-10 17:22:18 +00:00
|
|
|
this->Names.push_back(shortArgs[0]);
|
2014-11-22 10:00:45 +00:00
|
|
|
this->UserGuessArgs.insert(this->UserGuessArgs.end(),
|
|
|
|
shortArgs.begin() + 1, shortArgs.end());
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-06-05 22:20:16 +00:00
|
|
|
this->ExpandPaths();
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2011-09-23 18:27:25 +00:00
|
|
|
this->ComputeFinalPaths();
|
2008-06-09 15:57:56 +00:00
|
|
|
|
2006-02-27 21:38:22 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-06-05 22:20:16 +00:00
|
|
|
void cmFindBase::ExpandPaths()
|
2006-02-27 21:38:22 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!this->NoDefaultPath) {
|
2017-05-03 17:56:03 +00:00
|
|
|
if (!this->NoPackageRootPath) {
|
|
|
|
this->FillPackageRootPath();
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!this->NoCMakePath) {
|
2014-10-09 17:52:54 +00:00
|
|
|
this->FillCMakeVariablePath();
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
|
|
|
if (!this->NoCMakeEnvironmentPath) {
|
2014-10-09 17:52:54 +00:00
|
|
|
this->FillCMakeEnvironmentPath();
|
2015-09-09 20:03:04 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2015-09-09 20:03:04 +00:00
|
|
|
this->FillUserHintsPath();
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!this->NoDefaultPath) {
|
|
|
|
if (!this->NoSystemEnvironmentPath) {
|
2014-10-09 17:52:54 +00:00
|
|
|
this->FillSystemEnvironmentPath();
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
|
|
|
if (!this->NoCMakeSystemPath) {
|
2014-10-09 17:52:54 +00:00
|
|
|
this->FillCMakeSystemVariablePath();
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-09 17:52:54 +00:00
|
|
|
this->FillUserGuessPath();
|
2006-03-30 16:55:19 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillCMakeEnvironmentPath()
|
2008-06-05 22:20:16 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeEnvironment];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
// Add CMAKE_*_PATH environment variables
|
|
|
|
std::string var = "CMAKE_";
|
|
|
|
var += this->CMakePathName;
|
|
|
|
var += "_PATH";
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddEnvPrefixPath("CMAKE_PREFIX_PATH");
|
|
|
|
paths.AddEnvPath(var);
|
2014-10-09 17:52:54 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->CMakePathName == "PROGRAM") {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddEnvPath("CMAKE_APPBUNDLE_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddEnvPath("CMAKE_FRAMEWORK_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
|
|
|
|
2017-05-03 17:56:03 +00:00
|
|
|
void cmFindBase::FillPackageRootPath()
|
|
|
|
{
|
|
|
|
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.AddCMakePrefixPath(varName);
|
|
|
|
paths.AddEnvPrefixPath(varName);
|
|
|
|
}
|
2017-07-11 12:50:24 +00:00
|
|
|
|
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2017-05-03 17:56:03 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillCMakeVariablePath()
|
2008-06-05 22:20:16 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMake];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
// Add CMake varibles of the same name as the previous environment
|
|
|
|
// varibles CMAKE_*_PATH to be used most of the time with -D
|
|
|
|
// command line options
|
|
|
|
std::string var = "CMAKE_";
|
|
|
|
var += this->CMakePathName;
|
|
|
|
var += "_PATH";
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePrefixPath("CMAKE_PREFIX_PATH");
|
|
|
|
paths.AddCMakePath(var);
|
2014-10-09 17:52:54 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->CMakePathName == "PROGRAM") {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePath("CMAKE_APPBUNDLE_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePath("CMAKE_FRAMEWORK_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillSystemEnvironmentPath()
|
2006-02-27 21:38:22 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::SystemEnvironment];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
// Add LIB or INCLUDE
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!this->EnvironmentPath.empty()) {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddEnvPath(this->EnvironmentPath);
|
2016-05-09 14:06:22 +00:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
2015-02-18 15:54:45 +00:00
|
|
|
paths.AddEnvPrefixPath("PATH", true);
|
2016-05-09 14:06:22 +00:00
|
|
|
#endif
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2016-07-11 14:21:38 +00:00
|
|
|
// Add PATH
|
|
|
|
paths.AddEnvPath("PATH");
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2008-06-05 22:20:16 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillCMakeSystemVariablePath()
|
2008-06-05 22:20:16 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
std::string var = "CMAKE_SYSTEM_";
|
|
|
|
var += this->CMakePathName;
|
|
|
|
var += "_PATH";
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH");
|
|
|
|
paths.AddCMakePath(var);
|
2014-10-09 17:52:54 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->CMakePathName == "PROGRAM") {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH");
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2008-06-05 22:20:16 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillUserHintsPath()
|
2008-06-09 19:08:59 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::Hints];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2017-09-11 10:40:26 +00:00
|
|
|
for (std::string const& p : this->UserHintsArgs) {
|
|
|
|
paths.AddUserPath(p);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2008-06-09 19:08:59 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void cmFindBase::FillUserGuessPath()
|
2008-06-09 19:08:59 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmSearchPath& paths = this->LabeledPaths[PathLabel::Guess];
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2017-09-11 10:40:26 +00:00
|
|
|
for (std::string const& p : this->UserGuessArgs) {
|
|
|
|
paths.AddUserPath(p);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
paths.AddSuffixes(this->SearchPathSuffixes);
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmFindBase::PrintFindStuff()
|
|
|
|
{
|
2006-03-29 18:33:49 +00:00
|
|
|
std::cerr << "SearchFrameworkLast: " << this->SearchFrameworkLast << "\n";
|
|
|
|
std::cerr << "SearchFrameworkOnly: " << this->SearchFrameworkOnly << "\n";
|
|
|
|
std::cerr << "SearchFrameworkFirst: " << this->SearchFrameworkFirst << "\n";
|
2006-04-13 15:00:52 +00:00
|
|
|
std::cerr << "SearchAppBundleLast: " << this->SearchAppBundleLast << "\n";
|
|
|
|
std::cerr << "SearchAppBundleOnly: " << this->SearchAppBundleOnly << "\n";
|
|
|
|
std::cerr << "SearchAppBundleFirst: " << this->SearchAppBundleFirst << "\n";
|
2006-02-27 21:38:22 +00:00
|
|
|
std::cerr << "VariableName " << this->VariableName << "\n";
|
2016-05-16 14:34:04 +00:00
|
|
|
std::cerr << "VariableDocumentation " << this->VariableDocumentation << "\n";
|
2006-03-16 22:49:16 +00:00
|
|
|
std::cerr << "NoDefaultPath " << this->NoDefaultPath << "\n";
|
2016-05-16 14:34:04 +00:00
|
|
|
std::cerr << "NoCMakeEnvironmentPath " << this->NoCMakeEnvironmentPath
|
|
|
|
<< "\n";
|
2006-03-24 19:16:31 +00:00
|
|
|
std::cerr << "NoCMakePath " << this->NoCMakePath << "\n";
|
2016-05-16 14:34:04 +00:00
|
|
|
std::cerr << "NoSystemEnvironmentPath " << this->NoSystemEnvironmentPath
|
|
|
|
<< "\n";
|
2006-03-24 19:16:31 +00:00
|
|
|
std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n";
|
2006-02-27 21:38:22 +00:00
|
|
|
std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n";
|
|
|
|
std::cerr << "CMakePathName " << this->CMakePathName << "\n";
|
2015-02-12 19:53:43 +00:00
|
|
|
std::cerr << "Names " << cmJoin(this->Names, " ") << "\n";
|
2006-02-27 21:38:22 +00:00
|
|
|
std::cerr << "\n";
|
|
|
|
std::cerr << "SearchPathSuffixes ";
|
2015-02-12 19:53:43 +00:00
|
|
|
std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n";
|
2006-02-27 21:38:22 +00:00
|
|
|
std::cerr << "SearchPaths\n";
|
2015-02-18 21:14:26 +00:00
|
|
|
std::cerr << cmWrap("[", this->SearchPaths, "]", "\n") << "\n";
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmFindBase::CheckForVariableInCache()
|
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (const char* cacheValue =
|
|
|
|
this->Makefile->GetDefinition(this->VariableName)) {
|
2015-04-06 08:52:45 +00:00
|
|
|
cmState* state = this->Makefile->GetState();
|
|
|
|
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
2006-07-18 19:21:26 +00:00
|
|
|
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
2017-08-22 21:42:36 +00:00
|
|
|
bool cached = cacheEntry != nullptr;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (found) {
|
2006-07-18 19:21:26 +00:00
|
|
|
// If the user specifies the entry on the command line without a
|
|
|
|
// type we should add the type and docstring but keep the
|
|
|
|
// original value. Tell the subclass implementations to do
|
|
|
|
// this.
|
2016-05-16 14:34:04 +00:00
|
|
|
if (cached &&
|
|
|
|
state->GetCacheEntryType(this->VariableName) ==
|
2016-10-18 19:28:47 +00:00
|
|
|
cmStateEnums::UNINITIALIZED) {
|
2006-07-18 19:21:26 +00:00
|
|
|
this->AlreadyInCacheWithoutMetaInfo = true;
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
return true;
|
2016-09-16 20:45:24 +00:00
|
|
|
}
|
|
|
|
if (cached) {
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* hs =
|
|
|
|
state->GetCacheEntryProperty(this->VariableName, "HELPSTRING");
|
|
|
|
this->VariableDocumentation = hs ? hs : "(none)";
|
2006-02-27 21:38:22 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-02-27 21:38:22 +00:00
|
|
|
return false;
|
|
|
|
}
|