summaryrefslogtreecommitdiffstats
path: root/Source/cmConfigureFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-16 19:09:29 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-16 19:09:29 (GMT)
commit700cdf393af6aec04917a190122d7d46a1ba720e (patch)
tree2f36d85bbc9ed26876f6ea85a00c055c7ad01af4 /Source/cmConfigureFileCommand.cxx
parentdda0da8b9ef32d4ac36961bb5345988ca502c357 (diff)
downloadCMake-700cdf393af6aec04917a190122d7d46a1ba720e.zip
CMake-700cdf393af6aec04917a190122d7d46a1ba720e.tar.gz
CMake-700cdf393af6aec04917a190122d7d46a1ba720e.tar.bz2
Teach configure_file to handle relative paths
The configure_file() command now converts relative output paths to full paths using the current binary directory. Input relative paths were already converted using the current source directory, but this behavior was not previously documented.
Diffstat (limited to 'Source/cmConfigureFileCommand.cxx')
-rw-r--r--Source/cmConfigureFileCommand.cxx29
1 files changed, 19 insertions, 10 deletions
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 8a03778..051fe28 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -27,8 +27,23 @@ bool cmConfigureFileCommand
this->SetError("called with incorrect number of arguments, expected 2");
return false;
}
- this->InputFile = args[0];
- this->OutputFile = args[1];
+
+ const char* inFile = args[0].c_str();
+ if(!cmSystemTools::FileIsFullPath(inFile))
+ {
+ this->InputFile = this->Makefile->GetCurrentDirectory();
+ this->InputFile += "/";
+ }
+ this->InputFile += inFile;
+
+ const char* outFile = args[1].c_str();
+ if(!cmSystemTools::FileIsFullPath(outFile))
+ {
+ this->OutputFile = this->Makefile->GetCurrentOutputDirectory();
+ this->OutputFile += "/";
+ }
+ this->OutputFile += outFile;
+
if ( !this->Makefile->CanIWriteThisFile(this->OutputFile.c_str()) )
{
std::string e = "attempted to configure a file: " + this->OutputFile
@@ -89,14 +104,8 @@ void cmConfigureFileCommand::FinalPass()
int cmConfigureFileCommand::ConfigureFile()
{
- std::string inFile = this->InputFile;
- if (!cmSystemTools::FileIsFullPath(inFile.c_str()))
- {
- inFile = this->Makefile->GetStartDirectory();
- inFile += "/";
- inFile += this->InputFile;
- }
- return this->Makefile->ConfigureFile(inFile.c_str(),
+ return this->Makefile->ConfigureFile(
+ this->InputFile.c_str(),
this->OutputFile.c_str(),
this->CopyOnly,
this->AtOnly,