summaryrefslogtreecommitdiffstats
path: root/Source/cmGetFilenameComponentCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-01-31 15:46:29 (GMT)
committerBrad King <brad.king@kitware.com>2006-01-31 15:46:29 (GMT)
commit0dbe4edcfc2bc07692142567a21f90fafbf88183 (patch)
tree2ee312c1fd030292f728e13dc5e547361bc13ba4 /Source/cmGetFilenameComponentCommand.cxx
parentbfa972a2f97c71d85b53c52d7b4a147a1918fee8 (diff)
downloadCMake-0dbe4edcfc2bc07692142567a21f90fafbf88183.zip
CMake-0dbe4edcfc2bc07692142567a21f90fafbf88183.tar.gz
CMake-0dbe4edcfc2bc07692142567a21f90fafbf88183.tar.bz2
BUG: ABSOLUTE option should evaluate relative paths with respect to CMAKE_CURRENT_SOURCE_DIR. This addresses bug#2797.
Diffstat (limited to 'Source/cmGetFilenameComponentCommand.cxx')
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 4cd6098..4f88c4c 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -75,6 +75,20 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
}
else if (args[2] == "ABSOLUTE")
{
+ // If the path given is relative evaluate it relative to the
+ // current source directory.
+ if(!cmSystemTools::FileIsFullPath(filename.c_str()))
+ {
+ std::string fname = m_Makefile->GetCurrentDirectory();
+ if(!fname.empty())
+ {
+ fname += "/";
+ fname += filename;
+ filename = fname;
+ }
+ }
+
+ // Collapse the path to its simplest form.
result = cmSystemTools::CollapseFullPath(filename.c_str());
}
else