Warning, /system/qtcurve/cmake/CMakeArgumentMacros.cmake is written in an unsupported language. File is not indexed.

0001 # Copyright (C) 2013~2014 by Yichao Yu
0002 # yyc1992@gmail.com
0003 #
0004 # Redistribution and use in source and binary forms, with or without
0005 # modification, are permitted provided that the following conditions
0006 # are met:
0007 #
0008 # 1. Redistributions of source code must retain the above copyright
0009 #    notice, this list of conditions and the following disclaimer.
0010 # 2. Redistributions in binary form must reproduce the above copyright
0011 #    notice, this list of conditions and the following disclaimer in the
0012 #    documentation and/or other materials provided with the distribution.
0013 #
0014 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0015 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0016 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0017 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0018 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0019 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0020 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0021 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0022 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0023 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0024 
0025 # Public functions and macros provided by this file
0026 # (See comment of each for more detail):
0027 
0028 include(CMakeArrayMacros)
0029 
0030 # cmake_parse_array_default(name [prefix] [start | stop | start stop])
0031 macro(cmake_parse_array_default name)
0032   cmake_parse_array("${name}" "${OPTIONS}" "${SINGLES}"
0033     "${MULTIPLES}" "${LISTS}" ${ARGN})
0034 endmacro()
0035 
0036 # cmake_parse_array(name options single_args multi_args multi_lists
0037 #                   [prefix] [start | stop | start stop])
0038 macro(cmake_parse_array name options single_args multi_args multi_lists)
0039   cmake_parse_array_full("${name}" "${options}" "${single_args}"
0040     "${multi_args}" "${multi_lists}" "" ":" "" "[]" ${ARGN})
0041 endmacro()
0042 
0043 # cmake_parse_array_classic_default(name [prefix] [start | stop | start stop])
0044 macro(cmake_parse_array_classic_default name)
0045   cmake_parse_array_classic("${name}" "${OPTIONS}" "${SINGLES}"
0046     "${MULTIPLES}" "${LISTS}" ${ARGN})
0047 endmacro()
0048 
0049 # cmake_parse_array_classic(name options single_args multi_args multi_lists
0050 #                           [prefix] [start | stop | start stop])
0051 macro(cmake_parse_array_classic name options single_args multi_args multi_lists)
0052   cmake_parse_array_full("${name}" "${options}" "${single_args}"
0053     "${multi_args}" "${multi_lists}" "" "" "" "[]" ${ARGN})
0054 endmacro()
0055 
0056 macro(__cmake_parse_array_full_set_state state)
0057   set(__cmake_parse_array_state "${state}")
0058   set(__cmake_parse_array_cur_option "${__cmake_parse_array_option}")
0059 endmacro()
0060 
0061 # cmake_parse_array_full(name options single_args multi_args multi_lists
0062 #                        option_prefix option_suffix array_prefix
0063 #                        array_suffix [prefix] [start | stop | start stop])
0064 macro(cmake_parse_array_full name options single_args multi_args multi_lists
0065     op_pre op_suf ary_pre ary_suf)
0066   macro(__cmake_parse_array_full_multi_list_array_foreach)
0067     cmake_array_copy("${__cmake_parse_array_multi_list_array_value}"
0068       __cmake_parse_array_state)
0069     cmake_array_append("${${name}_${__cmake_parse_array_cur_option}}"
0070       "${__cmake_parse_array_state}")
0071   endmacro()
0072 
0073   # init
0074   foreach(__cmake_parse_array_full_option ${options})
0075     set("${name}_${__cmake_parse_array_full_option}" False)
0076   endforeach()
0077   foreach(__cmake_parse_array_full_option ${single_args})
0078     set("${name}_${__cmake_parse_array_full_option}")
0079   endforeach()
0080   foreach(__cmake_parse_array_full_option ${multi_args} ${multi_lists} UNUSED)
0081     cmake_array_new("${name}_${__cmake_parse_array_full_option}")
0082   endforeach()
0083 
0084   # define local variables in macro
0085   foreach(__cmake_parse_array_state unused)
0086     foreach(__cmake_parse_array_cur_option "")
0087       # Lexical scope used here.
0088       # Do not move the definition out of the parent macro.
0089       macro(__cmake_parse_array_full_foreach)
0090         # handle single argument first
0091         if("${__cmake_parse_array_state}" STREQUAL single)
0092           set("${name}_${__cmake_parse_array_cur_option}"
0093             "${__cmake_parse_array_full_value}")
0094           set(__cmake_parse_array_state unused)
0095           return()
0096         elseif("${__cmake_parse_array_state}" STREQUAL multi_array)
0097           cmake_array_concat("${${name}_${__cmake_parse_array_cur_option}}"
0098             "${__cmake_parse_array_full_value}")
0099           set(__cmake_parse_array_state unused)
0100           return()
0101         elseif("${__cmake_parse_array_state}" STREQUAL list_array)
0102           cmake_array_copy("${__cmake_parse_array_full_value}"
0103             __cmake_parse_array_state)
0104           cmake_array_append("${${name}_${__cmake_parse_array_cur_option}}"
0105             "${__cmake_parse_array_state}")
0106           set(__cmake_parse_array_state unused)
0107           return()
0108         elseif("${__cmake_parse_array_state}" STREQUAL multi_list_array)
0109           cmake_array_foreach(__cmake_parse_array_multi_list_array_value
0110             __cmake_parse_array_full_multi_list_array_foreach
0111             "${__cmake_parse_array_full_value}")
0112           set(__cmake_parse_array_state unused)
0113           return()
0114         endif()
0115         # Check if the argument is one of the options
0116         foreach(__cmake_parse_array_option ${options})
0117           if("x${op_pre}${__cmake_parse_array_option}${op_suf}x" STREQUAL
0118               "x${__cmake_parse_array_full_value}x")
0119             set("${name}_${__cmake_parse_array_option}" True)
0120             set(__cmake_parse_array_state unused)
0121             return()
0122           endif()
0123         endforeach()
0124         # Check if the argument is one of the single value arguments
0125         foreach(__cmake_parse_array_option ${single_args})
0126           if("x${op_pre}${__cmake_parse_array_option}${op_suf}x" STREQUAL
0127               "x${__cmake_parse_array_full_value}x")
0128             __cmake_parse_array_full_set_state(single)
0129             return()
0130           endif()
0131         endforeach()
0132         # Check if the argument is one of the multi value arguments
0133         foreach(__cmake_parse_array_option ${multi_args})
0134           if("x${op_pre}${__cmake_parse_array_option}${op_suf}x" STREQUAL
0135               "x${__cmake_parse_array_full_value}x")
0136             __cmake_parse_array_full_set_state(multi)
0137             return()
0138           endif()
0139           if("x${ary_pre}x" STREQUAL "xx" AND "x${ary_suf}x" STREQUAL "xx")
0140             if("x${op_pre}${__cmake_parse_array_option}[]${op_suf}x" STREQUAL
0141                 "x${__cmake_parse_array_full_value}x")
0142               __cmake_parse_array_full_set_state(multi_array)
0143               return()
0144             endif()
0145           else()
0146             if("x${op_pre}${ary_pre}${__cmake_parse_array_option}${ary_suf}${op_suf}x" STREQUAL "x${__cmake_parse_array_full_value}x")
0147               __cmake_parse_array_full_set_state(multi_array)
0148               return()
0149             endif()
0150           endif()
0151         endforeach()
0152         # Check if the argument is one of the multi list arguments
0153         foreach(__cmake_parse_array_option ${multi_lists})
0154           if("x${op_pre}${__cmake_parse_array_option}${op_suf}x" STREQUAL
0155               "x${__cmake_parse_array_full_value}x")
0156             set(__cmake_parse_array_state list)
0157             cmake_array_new(__cmake_parse_array_cur_option)
0158             cmake_array_append("${${name}_${__cmake_parse_array_option}}"
0159               "${__cmake_parse_array_cur_option}")
0160             return()
0161           endif()
0162           if("x${ary_pre}x" STREQUAL "xx" AND "x${ary_suf}x" STREQUAL "xx")
0163             if("x${op_pre}${__cmake_parse_array_option}[]${op_suf}x" STREQUAL
0164                 "x${__cmake_parse_array_full_value}x")
0165               __cmake_parse_array_full_set_state(list_array)
0166               return()
0167             elseif("x${op_pre}${__cmake_parse_array_option}[][]${op_suf}x"
0168                 STREQUAL "x${__cmake_parse_array_full_value}x")
0169               __cmake_parse_array_full_set_state(multi_list_array)
0170               return()
0171             endif()
0172           elseif("x${op_pre}${ary_pre}${__cmake_parse_array_option}${ary_suf}${op_suf}x" STREQUAL "x${__cmake_parse_array_full_value}x")
0173             __cmake_parse_array_full_set_state(list_array)
0174             return()
0175           elseif("x${op_pre}${ary_pre}${ary_pre}${__cmake_parse_array_option}${ary_suf}${ary_suf}${op_suf}x" STREQUAL "x${__cmake_parse_array_full_value}x")
0176               __cmake_parse_array_full_set_state(multi_list_array)
0177             return()
0178           endif()
0179         endforeach()
0180         if("${__cmake_parse_array_state}" STREQUAL unused)
0181           cmake_array_append("${${name}_UNUSED}"
0182             "${__cmake_parse_array_full_value}")
0183           return()
0184         elseif("${__cmake_parse_array_state}" STREQUAL multi)
0185           cmake_array_append("${${name}_${__cmake_parse_array_cur_option}}"
0186             "${__cmake_parse_array_full_value}")
0187           return()
0188         elseif("${__cmake_parse_array_state}" STREQUAL list)
0189           cmake_array_append("${__cmake_parse_array_cur_option}"
0190             "${__cmake_parse_array_full_value}")
0191         endif()
0192       endmacro()
0193       cmake_array_foreach(__cmake_parse_array_full_value
0194         __cmake_parse_array_full_foreach ${ARGN})
0195     endforeach()
0196   endforeach()
0197 endmacro()