ENH: Added NO_CMAKE_ENVIRONMENT_PATH, NO_CMAKE_PATH, NO_SYSTEM_ENVIRONMENT_PATH, and NO_CMAKE_SYSTEM_PATH options back to allow more granularity than NO_DEFAULT_PATH.
This commit is contained in:
parent
a59dd5d4c3
commit
3731dff127
|
@ -20,6 +20,10 @@ cmFindBase::cmFindBase()
|
||||||
{
|
{
|
||||||
this->AlreadyInCache = false;
|
this->AlreadyInCache = false;
|
||||||
this->NoDefaultPath = false;
|
this->NoDefaultPath = false;
|
||||||
|
this->NoCMakePath = false;
|
||||||
|
this->NoCMakeEnvironmentPath = false;
|
||||||
|
this->NoSystemEnvironmentPath = false;
|
||||||
|
this->NoCMakeSystemPath = false;
|
||||||
// default is to search frameworks first on apple
|
// default is to search frameworks first on apple
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
this->SearchFrameworkFirst = true;
|
this->SearchFrameworkFirst = true;
|
||||||
|
@ -40,6 +44,10 @@ cmFindBase::cmFindBase()
|
||||||
" [PATH_SUFFIXES suffix1 [suffix2 ...]]\n"
|
" [PATH_SUFFIXES suffix1 [suffix2 ...]]\n"
|
||||||
" [DOC \"cache documentation string\"]\n"
|
" [DOC \"cache documentation string\"]\n"
|
||||||
" [NO_DEFAULT_PATH]\n"
|
" [NO_DEFAULT_PATH]\n"
|
||||||
|
" [NO_CMAKE_ENVIRONMENT_PATH]\n"
|
||||||
|
" [NO_CMAKE_PATH]\n"
|
||||||
|
" [NO_SYSTEM_ENVIRONMENT_PATH]\n"
|
||||||
|
" [NO_CMAKE_SYSTEM_PATH]\n"
|
||||||
" )\n"
|
" )\n"
|
||||||
""
|
""
|
||||||
"This command is used to find a SEARCH_XXX_DESC. "
|
"This command is used to find a SEARCH_XXX_DESC. "
|
||||||
|
@ -59,22 +67,26 @@ cmFindBase::cmFindBase()
|
||||||
"If NO_DEFAULT_PATH is specified, then no additional paths are "
|
"If NO_DEFAULT_PATH is specified, then no additional paths are "
|
||||||
"added to the search. "
|
"added to the search. "
|
||||||
"If NO_DEFAULT_PATH is not specified, the search process is as follows:\n"
|
"If NO_DEFAULT_PATH is not specified, the search process is as follows:\n"
|
||||||
"1. Search cmake specific environment variables."
|
"1. Search cmake specific environment variables. This "
|
||||||
|
"can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n"
|
||||||
""
|
""
|
||||||
" CMAKE_FRAMEWORK_PATH\n"
|
" CMAKE_FRAMEWORK_PATH\n"
|
||||||
" CMAKE_XXX_PATH\n"
|
" CMAKE_XXX_PATH\n"
|
||||||
"2. Search cmake variables with the same names as "
|
"2. Search cmake variables with the same names as "
|
||||||
"the cmake specific environment variables. These "
|
"the cmake specific environment variables. These "
|
||||||
"are intended to be used on the command line with a "
|
"are intended to be used on the command line with a "
|
||||||
"-DVAR=value. \n"
|
"-DVAR=value. This can be skipped if NO_CMAKE_PATH "
|
||||||
|
"is passed.\n"
|
||||||
""
|
""
|
||||||
" CMAKE_FRAMEWORK_PATH\n"
|
" CMAKE_FRAMEWORK_PATH\n"
|
||||||
" CMAKE_XXX_PATH\n"
|
" CMAKE_XXX_PATH\n"
|
||||||
"3. Search the standard system environment variables. "
|
"3. Search the standard system environment variables. "
|
||||||
|
"This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.\n"
|
||||||
" PATH\n"
|
" PATH\n"
|
||||||
" XXX_SYSTEM\n" // replace with "", LIB, or INCLUDE
|
" XXX_SYSTEM\n" // replace with "", LIB, or INCLUDE
|
||||||
"4. Search cmake variables defined in the Platform files "
|
"4. Search cmake variables defined in the Platform files "
|
||||||
"for the current system. \n"
|
"for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH "
|
||||||
|
"is passed.\n"
|
||||||
" CMAKE_SYSTEM_FRAMEWORK_PATH\n"
|
" CMAKE_SYSTEM_FRAMEWORK_PATH\n"
|
||||||
" CMAKE_SYSTEM_XXX_PATH\n"
|
" CMAKE_SYSTEM_XXX_PATH\n"
|
||||||
"5. Search the paths specified after PATHS or in the short-hand version "
|
"5. Search the paths specified after PATHS or in the short-hand version "
|
||||||
|
@ -169,19 +181,40 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
|
||||||
doingNames = false;
|
doingNames = false;
|
||||||
doingPaths = false;
|
doingPaths = false;
|
||||||
}
|
}
|
||||||
else if (args[j] == "NO_SYSTEM_PATH")
|
else if (args[j] == "NO_DEFAULT_PATH" || args[j] == "NO_SYSTEM_PATH")
|
||||||
{
|
{
|
||||||
doingPaths = false;
|
doingPaths = false;
|
||||||
doingPathSuf = false;
|
doingPathSuf = false;
|
||||||
doingNames = false;
|
doingNames = false;
|
||||||
this->NoDefaultPath = true;
|
this->NoDefaultPath = true;
|
||||||
}
|
}
|
||||||
else if (args[j] == "NO_DEFAULT_PATH")
|
else if (args[j] == "NO_CMAKE_ENVIRONMENT_PATH")
|
||||||
{
|
{
|
||||||
doingPaths = false;
|
doingPaths = false;
|
||||||
doingPathSuf = false;
|
doingPathSuf = false;
|
||||||
doingNames = false;
|
doingNames = false;
|
||||||
this->NoDefaultPath = true;
|
this->NoCMakeEnvironmentPath = true;
|
||||||
|
}
|
||||||
|
else if (args[j] == "NO_CMAKE_PATH")
|
||||||
|
{
|
||||||
|
doingPaths = false;
|
||||||
|
doingPathSuf = false;
|
||||||
|
doingNames = false;
|
||||||
|
this->NoCMakePath = true;
|
||||||
|
}
|
||||||
|
else if (args[j] == "NO_SYSTEM_ENVIRONMENT_PATH")
|
||||||
|
{
|
||||||
|
doingPaths = false;
|
||||||
|
doingPathSuf = false;
|
||||||
|
doingNames = false;
|
||||||
|
this->NoSystemEnvironmentPath = true;
|
||||||
|
}
|
||||||
|
else if (args[j] == "NO_CMAKE_SYSTEM_PATH")
|
||||||
|
{
|
||||||
|
doingPaths = false;
|
||||||
|
doingPathSuf = false;
|
||||||
|
doingNames = false;
|
||||||
|
this->NoCMakeSystemPath = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -241,18 +274,30 @@ void cmFindBase::ExpandPaths(std::vector<std::string> userPaths)
|
||||||
// if NO Default paths was not specified add the
|
// if NO Default paths was not specified add the
|
||||||
// standard search paths.
|
// standard search paths.
|
||||||
if(!this->NoDefaultPath)
|
if(!this->NoDefaultPath)
|
||||||
|
{
|
||||||
|
if(!this->NoCMakeEnvironmentPath)
|
||||||
{
|
{
|
||||||
// Add CMAKE_*_PATH environment variables
|
// Add CMAKE_*_PATH environment variables
|
||||||
this->AddEnvironmentVairables();
|
this->AddEnvironmentVairables();
|
||||||
|
}
|
||||||
|
if(!this->NoCMakePath)
|
||||||
|
{
|
||||||
// Add CMake varibles of the same name as the previous environment
|
// Add CMake varibles of the same name as the previous environment
|
||||||
// varibles CMAKE_*_PATH to be used most of the time with -D
|
// varibles CMAKE_*_PATH to be used most of the time with -D
|
||||||
// command line options
|
// command line options
|
||||||
this->AddCMakeVairables();
|
this->AddCMakeVairables();
|
||||||
|
}
|
||||||
|
if(!this->NoSystemEnvironmentPath)
|
||||||
|
{
|
||||||
// add System environment PATH and (LIB or INCLUDE)
|
// add System environment PATH and (LIB or INCLUDE)
|
||||||
this->AddSystemEnvironmentVairables();
|
this->AddSystemEnvironmentVairables();
|
||||||
|
}
|
||||||
|
if(!this->NoCMakeSystemPath)
|
||||||
|
{
|
||||||
// Add CMAKE_SYSTEM_*_PATH variables which are defined in platform files
|
// Add CMAKE_SYSTEM_*_PATH variables which are defined in platform files
|
||||||
this->AddCMakeSystemVariables();
|
this->AddCMakeSystemVariables();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// add the paths specified in the FIND_* call
|
// add the paths specified in the FIND_* call
|
||||||
for(unsigned int i =0; i < userPaths.size(); ++i)
|
for(unsigned int i =0; i < userPaths.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -386,6 +431,10 @@ void cmFindBase::PrintFindStuff()
|
||||||
std::cerr << "VariableName " << this->VariableName << "\n";
|
std::cerr << "VariableName " << this->VariableName << "\n";
|
||||||
std::cerr << "VariableDocumentation " << this->VariableDocumentation << "\n";
|
std::cerr << "VariableDocumentation " << this->VariableDocumentation << "\n";
|
||||||
std::cerr << "NoDefaultPath " << this->NoDefaultPath << "\n";
|
std::cerr << "NoDefaultPath " << this->NoDefaultPath << "\n";
|
||||||
|
std::cerr << "NoCMakeEnvironmentPath " << this->NoCMakeEnvironmentPath << "\n";
|
||||||
|
std::cerr << "NoCMakePath " << this->NoCMakePath << "\n";
|
||||||
|
std::cerr << "NoSystemEnvironmentPath " << this->NoSystemEnvironmentPath << "\n";
|
||||||
|
std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n";
|
||||||
std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n";
|
std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n";
|
||||||
std::cerr << "CMakePathName " << this->CMakePathName << "\n";
|
std::cerr << "CMakePathName " << this->CMakePathName << "\n";
|
||||||
std::cerr << "Names ";
|
std::cerr << "Names ";
|
||||||
|
|
|
@ -66,6 +66,10 @@ protected:
|
||||||
|
|
||||||
bool AlreadyInCache;
|
bool AlreadyInCache;
|
||||||
bool NoDefaultPath;
|
bool NoDefaultPath;
|
||||||
|
bool NoCMakePath;
|
||||||
|
bool NoCMakeEnvironmentPath;
|
||||||
|
bool NoSystemEnvironmentPath;
|
||||||
|
bool NoCMakeSystemPath;
|
||||||
|
|
||||||
bool SearchFrameworkFirst;
|
bool SearchFrameworkFirst;
|
||||||
bool SearchFrameworkOnly;
|
bool SearchFrameworkOnly;
|
||||||
|
|
Loading…
Reference in New Issue