File: PrefixListGlob.cmake

package info (click to toggle)
ponyprog 3.1.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,904 kB
  • sloc: cpp: 35,932; python: 981; sh: 565; xml: 67; makefile: 45; ansic: 38
file content (37 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (4)
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()