MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0012282 | CMake | CMake | public | 2011-06-15 23:45 | 2016-06-10 14:31 |
Reporter | Andreas Schuh | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | Apple Mac | OS | OS X | OS Version | 10.4.10 |
Product Version | CMake 2.8.4 | ||||
Target Version | Fixed in Version | ||||
Summary | 0012282: get_filename_component interprets first period (.) as start of extension (EXT) | ||||
Description | The get_filename_component (VAR PATH EXT) command returns everything starting with the first encountered period (.) as file name extension. Often, periods are also just used to separate file name components, for example, in the naming of DICOM files. I had expected that only the part starting with the *last* period will be interpreted as file name extension. | ||||
Steps To Reproduce | get_filename_component (VAR "this.is.a.text.file.txt" EXT) if (${VAR} STREQUAL ".txt") message ("GREAT! It is working as expected.") else () message (FATAL_ERROR "Sorry, the returned extensions is \"${EXT}\" != \".txt\"") endif () | ||||
Additional Information | Here is a workaround implemented in CMake itself: function (get_filename_component) _get_filename_component (${ARGN}) list (GET ARGN 0 VAR) list (GET ARGN 2 CMD) if (${CMD} STREQUAL "EXT") string (REGEX MATCHALL "\\.[^.]*" PARTS "${${VAR}}") list (LENGTH PARTS LEN) if (LEN GREATER 1) math (EXPR LEN "${LEN} - 1") list (GET PARTS ${LEN} ${VAR}) endif () else () endif () set (${VAR} "${${VAR}}" PARENT_SCOPE) endfunction () | ||||
Tags | CMake, extension, filename, get_filename_component | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2011-06-15 23:45 | Andreas Schuh | New Issue | |||
2011-06-15 23:46 | Andreas Schuh | Tag Attached: CMake | |||
2011-06-15 23:46 | Andreas Schuh | Tag Attached: extension | |||
2011-06-15 23:46 | Andreas Schuh | Tag Attached: filename | |||
2011-06-15 23:46 | Andreas Schuh | Tag Attached: get_filename_component | |||
2011-06-16 07:09 | David Cole | Note Added: 0026879 | |||
2011-06-16 07:11 | David Cole | Note Edited: 0026879 | bug_revision_view_page.php?bugnote_id=26879#r356 | ||
2012-08-11 11:09 | David Cole | Status | new => backlog | ||
2012-08-11 11:09 | David Cole | Note Added: 0030267 | |||
2016-06-10 14:28 | Kitware Robot | Note Added: 0041851 | |||
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved | ||
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|