| 1 |
# Reimplementation of native CMake command, |
| 2 |
# for correct handling of leading dot, |
| 3 |
# https://cmake.org/pipermail/cmake-developers/2011-June/013526.html |
| 4 |
function(get_filename_component) |
| 5 |
_get_filename_component (${ARGN}) |
| 6 |
list(GET ARGN 0 VAR) |
| 7 |
list(GET ARGN 2 CMD) |
| 8 |
if(${CMD} STREQUAL "EXT") |
| 9 |
string(REGEX MATCHALL "\\.[^.]*" PARTS ${${VAR}}) |
| 10 |
list(LENGTH PARTS LEN) |
| 11 |
if(LEN GREATER 1) |
| 12 |
math(EXPR LEN "${LEN} - 1") |
| 13 |
list(GET PARTS ${LEN} ${VAR}) |
| 14 |
endif() |
| 15 |
endif() |
| 16 |
set(${VAR} ${${VAR}} PARENT_SCOPE) |
| 17 |
endfunction() |