monado/cmake/PrefixListGlob.cmake

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
956 B
CMake
Raw Normal View History

2020-05-28 19:41:38 +00:00
# - For each given prefix in a list, glob using the prefix+pattern
#
#
# Original Author:
2023-11-15 17:09:51 +00:00
# 2009-2010 Rylie Pavlik <rylie@ryliepavlik.com>
# https://ryliepavlik.com/
2020-05-28 19:41:38 +00:00
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright 2009-2010, Iowa State University
#
2020-05-28 19:41:38 +00:00
# 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)
#
2020-10-30 22:04:55 +00:00
# SPDX-License-Identifier: BSL-1.0
2020-05-28 19:41:38 +00:00
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()