Computer Assited Medical Intervention Tool Kit  version 4.0
GetSubdirectoryFiles.h
Go to the documentation of this file.
1 get_subdirectoryfiles(){ Path Filenames)
21  set(Filenames)
22  file(GLOB children ${Path}/*)
23 
24  # continue process only if there is some file to process
25  if (children)
26  # create the copy of children
27  set(childrenSorted)
28  foreach(FILENAME ${children})
29  string(TOLOWER "${FILENAME}" filenameLower)
30  # build a new variable (map) to associate the key filenameLower to the real filename FILENAME
31  set("map_${filenameLower}" "${FILENAME}")
32  # add the key to a specific list
33  set(childrenSorted ${childrenSorted} "${filenameLower}")
34  endforeach()
35 
36  # sort the key list (all lowercase)
37  list(SORT childrenSorted)
38 
39  # message( STATUS children ${children} )
40  # loop on all keys
41  foreach(filenameLower ${childrenSorted})
42  # get the filename from the lower case name
43  set(realFilename ${map_${filenameLower}})
44  if(NOT IS_DIRECTORY ${realFilename})
45  #message( "isfile " ${realFilename} )
46  set(${Filenames} ${${Filenames}} ${realFilename})
47  endif()
48  endforeach()
49  endif()
50 end(){)
get_subdirectoryfiles()
macro get_subdirectoryfiles get the names of all the files (and not directories) contained in a defin...
Definition: GetSubdirectoryFiles.h:20