jk-arm | 957cfea | 2021-06-18 15:52:12 +0530 | [diff] [blame^] | 1 | #/** @file |
| 2 | # * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. |
| 3 | # * SPDX-License-Identifier : Apache-2.0 |
| 4 | # * |
| 5 | # * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # * you may not use this file except in compliance with the License. |
| 7 | # * You may obtain a copy of the License at |
| 8 | # * |
| 9 | # * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # * |
| 11 | # * Unless required by applicable law or agreed to in writing, software |
| 12 | # * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # * See the License for the specific language governing permissions and |
| 15 | # * limitations under the License. |
| 16 | #**/ |
| 17 | |
| 18 | # Function to CMake arguments |
| 19 | function(_check_arguments) |
| 20 | foreach(_ARG IN LISTS ARGV) |
| 21 | if(NOT DEFINED ${_ARG}) |
| 22 | message(FATAL_ERROR "[PSA] : ${_ARG} is not passed! Please specify -D${_ARG}=<...> to CMake.") |
| 23 | endif() |
| 24 | endforeach() |
| 25 | endfunction(_check_arguments) |
| 26 | |
| 27 | # Function to get all the folders inside given parent directory |
| 28 | function(_get_sub_dir_list result parent_dir) |
| 29 | file(GLOB parent_dir_items RELATIVE ${parent_dir} ${parent_dir}/*) |
| 30 | set(dir_list "") |
| 31 | foreach(item ${parent_dir_items}) |
| 32 | if(IS_DIRECTORY ${parent_dir}/${item}) |
| 33 | list(APPEND dir_list ${item}) |
| 34 | endif() |
| 35 | endforeach() |
| 36 | set(${result} ${dir_list} PARENT_SCOPE) |
| 37 | endfunction(_get_sub_dir_list) |