summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-04-29 17:13:08 (GMT)
committerBrad King <brad.king@kitware.com>2009-04-29 17:13:08 (GMT)
commitb6cb11734686eebb7ddbd97b92eaaa5174954667 (patch)
tree006deb2f774a33f1bb277c7489e251ea0257c954
parent6aaa7d45bff3670f9181bcf656076cac2ef407c4 (diff)
downloadCMake-b6cb11734686eebb7ddbd97b92eaaa5174954667.zip
CMake-b6cb11734686eebb7ddbd97b92eaaa5174954667.tar.gz
CMake-b6cb11734686eebb7ddbd97b92eaaa5174954667.tar.bz2
ENH: Teach file(INSTALL) relative paths
This teaches the undocumented file(INSTALL) command to deal with relative paths. Relative input file paths are evaluated with respect to the current source directory. Relative output file paths are evaluated with respect to the current binary directory. While this command is currently used only in cmake_install.cmake scripts (in -P script mode), this cleans up its interface in preparation for a documented signature.
-rw-r--r--Source/cmFileCommand.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 79ade87..c7348b7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1216,10 +1216,27 @@ bool cmFileCopier::CheckValue(std::string const& arg)
switch(this->Doing)
{
case DoingFiles:
- this->Files.push_back(arg);
+ if(arg.empty() || cmSystemTools::FileIsFullPath(arg.c_str()))
+ {
+ this->Files.push_back(arg);
+ }
+ else
+ {
+ std::string file = this->Makefile->GetCurrentDirectory();
+ file += "/" + arg;
+ this->Files.push_back(file);
+ }
break;
case DoingDestination:
- this->Destination = arg;
+ if(arg.empty() || cmSystemTools::FileIsFullPath(arg.c_str()))
+ {
+ this->Destination = arg;
+ }
+ else
+ {
+ this->Destination = this->Makefile->GetCurrentOutputDirectory();
+ this->Destination += "/" + arg;
+ }
this->Doing = DoingNone;
break;
case DoingRegex: