1# Copyright 2022 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15include(FetchContent) 16 17if(CMAKE_VERSION VERSION_LESS 3.14) 18 # Simple implementation for CMake 3.13, which is missing this. 19 macro(FetchContent_MakeAvailable) 20 foreach(content_name IN ITEMS ${ARGV}) 21 string(TOLOWER ${content_name} content_name_lower) 22 FetchContent_GetProperties(${content_name}) 23 if(NOT ${content_name_lower}_POPULATED) 24 FetchContent_Populate(${content_name}) 25 if(EXISTS ${${content_name_lower}_SOURCE_DIR}/CMakeLists.txt) 26 add_subdirectory(${${content_name_lower}_SOURCE_DIR} 27 ${${content_name_lower}_BINARY_DIR}) 28 endif() 29 endif() 30 endforeach() 31 endmacro() 32endif() 33