1*bb86c7edSAndroid Build Coastguard Worker# Copyright 2020 Google LLC 2*bb86c7edSAndroid Build Coastguard Worker# 3*bb86c7edSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*bb86c7edSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*bb86c7edSAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*bb86c7edSAndroid Build Coastguard Worker# 7*bb86c7edSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*bb86c7edSAndroid Build Coastguard Worker# 9*bb86c7edSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*bb86c7edSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*bb86c7edSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*bb86c7edSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*bb86c7edSAndroid Build Coastguard Worker# limitations under the License. 14*bb86c7edSAndroid Build Coastguard Worker 15*bb86c7edSAndroid Build Coastguard Worker# Forked from IREE's iree_add_all_subdirs.cmake. 16*bb86c7edSAndroid Build Coastguard Worker 17*bb86c7edSAndroid Build Coastguard Worker# add_all_subidrs 18*bb86c7edSAndroid Build Coastguard Worker# 19*bb86c7edSAndroid Build Coastguard Worker# CMake function to add all subdirectories of the current directory that contain 20*bb86c7edSAndroid Build Coastguard Worker# a CMakeLists.txt file 21*bb86c7edSAndroid Build Coastguard Worker# 22*bb86c7edSAndroid Build Coastguard Worker# Takes no arguments. 23*bb86c7edSAndroid Build Coastguard Workerfunction(ruy_add_all_subdirs) 24*bb86c7edSAndroid Build Coastguard Worker FILE(GLOB _CHILDREN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) 25*bb86c7edSAndroid Build Coastguard Worker SET(_DIRLIST "") 26*bb86c7edSAndroid Build Coastguard Worker foreach(_CHILD ${_CHILDREN}) 27*bb86c7edSAndroid Build Coastguard Worker if((NOT(subdir MATCHES third_party)) AND 28*bb86c7edSAndroid Build Coastguard Worker (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_CHILD}) AND 29*bb86c7edSAndroid Build Coastguard Worker (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_CHILD}/CMakeLists.txt)) 30*bb86c7edSAndroid Build Coastguard Worker LIST(APPEND _DIRLIST ${_CHILD}) 31*bb86c7edSAndroid Build Coastguard Worker endif() 32*bb86c7edSAndroid Build Coastguard Worker endforeach() 33*bb86c7edSAndroid Build Coastguard Worker 34*bb86c7edSAndroid Build Coastguard Worker foreach(subdir ${_DIRLIST}) 35*bb86c7edSAndroid Build Coastguard Worker add_subdirectory(${subdir}) 36*bb86c7edSAndroid Build Coastguard Worker endforeach() 37*bb86c7edSAndroid Build Coastguard Workerendfunction() 38