1# - Returns a list of the file names of all files passed
2#
3#  get_file_list(<listvar> <file path> [<additional file paths>...])
4#
5# Requires CMake 2.6 or newer (uses the 'function' command)
6#
7# Original Author:
8# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
9# http://academic.cleardefinition.com
10# Iowa State University HCI Graduate Program/VRAC
11#
12# Copyright Iowa State University 2009-2010.
13# Distributed under the Boost Software License, Version 1.0.
14# (See accompanying file LICENSE_1_0.txt or copy at
15# http://www.boost.org/LICENSE_1_0.txt)
16
17if(__get_file_list)
18	return()
19endif()
20set(__get_file_list YES)
21
22function(get_file_list _var)
23	# combine variable's current value with additional list items
24	set(_in ${ARGN})
25
26	if(_in)
27		# Initial list cleaning
28		list(REMOVE_DUPLICATES _in)
29
30		# Grab the absolute path of each actual directory
31		set(_out)
32		foreach(_file ${_in})
33			get_filename_component(_fn "${_file}" FILE)
34			list(APPEND _out "${_fn}")
35		endforeach()
36
37		if(_out)
38			# Clean up the output list now
39			list(REMOVE_DUPLICATES _out)
40		endif()
41
42		# return _out
43		set(${_var} "${_out}" PARENT_SCOPE)
44	endif()
45endfunction()
46