-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathPrefixListGlob.cmake
37 lines (34 loc) · 980 Bytes
/
PrefixListGlob.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# - For each given prefix in a list, glob using the prefix+pattern
#
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright 2009-2010, Iowa State University
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
if(__prefix_list_glob)
return()
endif()
set(__prefix_list_glob YES)
function(prefix_list_glob var pattern)
set(_out)
set(_result)
foreach(prefix ${ARGN})
file(GLOB _globbed ${prefix}${pattern})
if(_globbed)
list(SORT _globbed)
list(REVERSE _globbed)
list(APPEND _out ${_globbed})
endif()
endforeach()
foreach(_name ${_out})
get_filename_component(_name "${_name}" ABSOLUTE)
list(APPEND _result "${_name}")
endforeach()
set(${var} "${_result}" PARENT_SCOPE)
endfunction()