The open source OpenXR runtime
1# - For each given prefix in a list, glob using the prefix+pattern
2#
3#
4# Original Author:
5# 2009-2010 Rylie Pavlik <rylie@ryliepavlik.com>
6# https://ryliepavlik.com/
7# Iowa State University HCI Graduate Program/VRAC
8#
9# Copyright 2009-2010, Iowa State University
10#
11# Distributed under the Boost Software License, Version 1.0.
12# (See accompanying file LICENSE_1_0.txt or copy at
13# http://www.boost.org/LICENSE_1_0.txt)
14#
15# SPDX-License-Identifier: BSL-1.0
16
17if(__prefix_list_glob)
18 return()
19endif()
20set(__prefix_list_glob YES)
21
22function(prefix_list_glob var pattern)
23 set(_out)
24 set(_result)
25 foreach(prefix ${ARGN})
26 file(GLOB _globbed ${prefix}${pattern})
27 if(_globbed)
28 list(SORT _globbed)
29 list(REVERSE _globbed)
30 list(APPEND _out ${_globbed})
31 endif()
32 endforeach()
33 foreach(_name ${_out})
34 get_filename_component(_name "${_name}" ABSOLUTE)
35 list(APPEND _result "${_name}")
36 endforeach()
37
38 set(${var} "${_result}" PARENT_SCOPE)
39endfunction()