diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGetFilenameComponentCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmGetFilenameComponentCommand.h | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index d06efe8..8502e57 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -75,7 +75,8 @@ bool cmGetFilenameComponentCommand { result = cmSystemTools::GetFilenameWithoutExtension(filename); } - else if (args[2] == "ABSOLUTE") + else if (args[2] == "ABSOLUTE" || + args[2] == "REALPATH") { // If the path given is relative evaluate it relative to the // current source directory. @@ -92,6 +93,11 @@ bool cmGetFilenameComponentCommand // Collapse the path to its simplest form. result = cmSystemTools::CollapseFullPath(filename.c_str()); + if(args[2] == "REALPATH") + { + // Resolve symlinks if possible + result = cmSystemTools::GetRealPath(filename.c_str()); + } } else { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index e058e0b..65cf1a2 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -68,11 +68,12 @@ public: { return " get_filename_component(VarName FileName\n" - " PATH|ABSOLUTE|NAME|EXT|NAME_WE\n" + " PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH\n" " [CACHE])\n" "Set VarName to be the path (PATH), file name (NAME), file " "extension (EXT), file name without extension (NAME_WE) of FileName, " - "or the full path (ABSOLUTE). " + "the full path (ABSOLUTE), or the full path with all symlinks " + "resolved (REALPATH). " "Note that the path is converted to Unix slashes format and has no " "trailing slashes. The longest file extension is always considered. " "If the optional CACHE argument is specified, the result variable is " |