1# Copyright 2019 The libgav1 Authors 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# http://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 15if(LIBGAV1_CMAKE_LIBGAV1_OPTIONS_CMAKE_) 16 return() 17endif() # LIBGAV1_CMAKE_LIBGAV1_OPTIONS_CMAKE_ 18set(LIBGAV1_CMAKE_LIBGAV1_OPTIONS_CMAKE_) 19 20# Simple wrapper for CMake's builtin option command that tracks libgav1's build 21# options in the list variable $libgav1_options. 22macro(libgav1_option) 23 unset(option_NAME) 24 unset(option_HELPSTRING) 25 unset(option_VALUE) 26 unset(optional_args) 27 unset(multi_value_args) 28 set(single_value_args NAME HELPSTRING VALUE) 29 cmake_parse_arguments(option "${optional_args}" "${single_value_args}" 30 "${multi_value_args}" ${ARGN}) 31 32 if(NOT (option_NAME AND option_HELPSTRING AND DEFINED option_VALUE)) 33 message(FATAL_ERROR "libgav1_option: NAME HELPSTRING and VALUE required.") 34 endif() 35 36 option(${option_NAME} ${option_HELPSTRING} ${option_VALUE}) 37 38 if(LIBGAV1_VERBOSE GREATER 2) 39 message("--------- libgav1_option ---------\n" 40 "option_NAME=${option_NAME}\n" 41 "option_HELPSTRING=${option_HELPSTRING}\n" 42 "option_VALUE=${option_VALUE}\n" 43 "------------------------------------------\n") 44 endif() 45 46 list(APPEND libgav1_options ${option_NAME}) 47 list(REMOVE_DUPLICATES libgav1_options) 48endmacro() 49 50# Dumps the $libgav1_options list via CMake message command. 51macro(libgav1_dump_options) 52 foreach(option_name ${libgav1_options}) 53 message("${option_name}: ${${option_name}}") 54 endforeach() 55endmacro() 56