cmake get_filename_component
get_filename_component(<var> <FileName> <mode> [BASE_DIR <dir>]
- var : outputValue
- FileName: inputValue
mode
DIRECTORY = Directory without file name
NAME = File name without directory
EXT = File name longest extension (.b.c from d/a.b.c)
NAME_WE = File name with neither the directory nor the longest extension
LAST_EXT = File name last extension (.c from d/a.b.c)
NAME_WLE = File name with neither the directory nor the last extension
PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)
ABSOLUTE = Full path to file
REALPATH = Full path to existing file with symlinks resolved
BASE_DIR
If no base directory is provided, the default base directory will be CMAKE_CURRENT_SOURCE_DIR
.
result
Paths are returned with forward slashes
and have no trailing slashes
.
example
get_filename_component(outputResult "${inputPath}" PATH ABSOLUTE)