ENH: add IF(IS_ABSOLUTE path), so no regex matching is required in the cmake scripts
Alex
This commit is contained in:
parent
1358009382
commit
c9f1af3913
@ -287,6 +287,22 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
|
|||||||
IncrementArguments(newArgs,argP1,argP2);
|
IncrementArguments(newArgs,argP1,argP2);
|
||||||
reducible = 1;
|
reducible = 1;
|
||||||
}
|
}
|
||||||
|
// is the given path an absolute path ?
|
||||||
|
if (*arg == "IS_ABSOLUTE" && argP1 != newArgs.end())
|
||||||
|
{
|
||||||
|
if(cmSystemTools::FileIsFullPath((argP1)->c_str()))
|
||||||
|
{
|
||||||
|
*arg = "1";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*arg = "0";
|
||||||
|
}
|
||||||
|
newArgs.erase(argP1);
|
||||||
|
argP1 = arg;
|
||||||
|
IncrementArguments(newArgs,argP1,argP2);
|
||||||
|
reducible = 1;
|
||||||
|
}
|
||||||
// does a command exist
|
// does a command exist
|
||||||
if (*arg == "COMMAND" && argP1 != newArgs.end())
|
if (*arg == "COMMAND" && argP1 != newArgs.end())
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,8 @@ public:
|
|||||||
" IF(IS_DIRECTORY directory-name)\n"
|
" IF(IS_DIRECTORY directory-name)\n"
|
||||||
"True if the given name is a directory. "
|
"True if the given name is a directory. "
|
||||||
"Behavior is well-defined only for full paths.\n"
|
"Behavior is well-defined only for full paths.\n"
|
||||||
|
" IF(IS_ABSOLUTE path)\n"
|
||||||
|
"True if the given path is an absolute path.\n "
|
||||||
" IF(variable MATCHES regex)\n"
|
" IF(variable MATCHES regex)\n"
|
||||||
" IF(string MATCHES regex)\n"
|
" IF(string MATCHES regex)\n"
|
||||||
"True if the given string or variable's value matches the given "
|
"True if the given string or variable's value matches the given "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user