From 0dbe4edcfc2bc07692142567a21f90fafbf88183 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Jan 2006 10:46:29 -0500 Subject: [PATCH] BUG: ABSOLUTE option should evaluate relative paths with respect to CMAKE_CURRENT_SOURCE_DIR. This addresses bug#2797. --- Source/cmGetFilenameComponentCommand.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 4cd609859..4f88c4c25 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -75,6 +75,20 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector 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