Warning, /system/qtcurve/cmake/CMakeVarMacros.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 #     cmake_utils_get_global
0028 #     cmake_utils_set_global
0029 #     cmake_utils_get_unique_name
0030 #     cmake_utils_check_and_set_bool
0031 
0032 if(COMMAND cmake_utils_get_global)
0033   return()
0034 endif()
0035 
0036 # cmake_utils_get_global(name ret_var)
0037 #     @name: the name of the global to set
0038 #     @ret_var: the variable to return the value
0039 #
0040 #     This function return a global @name in @ret_var. The global
0041 #     is NOT a variable and can not be access that way.
0042 function(cmake_utils_get_global name var)
0043   set(property_name "___CMAKE_UTILS_GET_GLOBAL_${name}__")
0044   get_property(value GLOBAL PROPERTY "${property_name}")
0045   set("${var}" "${value}" PARENT_SCOPE)
0046 endfunction()
0047 
0048 # cmake_utils_set_global(name value)
0049 #     @name: the name of the global to set
0050 #     @value: the value to set
0051 #
0052 #     This function set a global @name to @value. The global
0053 #     is NOT a variable and can not be access that way.
0054 function(cmake_utils_set_global name value)
0055   set(property_name "___CMAKE_UTILS_GET_GLOBAL_${name}__")
0056   set_property(GLOBAL PROPERTY "${property_name}" "${value}")
0057 endfunction()
0058 
0059 # cmake_utils_get_unique_name(name_hint ret_var)
0060 #     @name_hint: a legal variable and target name acting as a hint for the
0061 #                generated unique name.
0062 #     @ret_var: the variable name to return the generated unique name.
0063 #
0064 #     This function will generate a unique based on the @name_hint and save
0065 #     the result into ret_var. The name can be used as the name of a target,
0066 #     variable, function or macro.
0067 function(cmake_utils_get_unique_name name unique_name)
0068   set(property_name "___CMAKE_UTILS_UNIQUE_COUNTER_${name}")
0069   cmake_utils_get_global("${property_name}" current_counter)
0070   if(NOT current_counter)
0071     set(current_counter 1)
0072   endif()
0073   set(name "cmake_utils_${name}_${current_counter}")
0074   string(MD5 md5sum_name "${name}")
0075   set(${unique_name} "${name}_${md5sum_name}" PARENT_SCOPE)
0076   math(EXPR current_counter "${current_counter} + 1")
0077   cmake_utils_set_global("${property_name}" "${current_counter}")
0078 endfunction()
0079 
0080 # cmake_utils_get_bool(name ret_var)
0081 #     @name: the name of the bool flag to set
0082 #     @ret_var: the variable to return the value
0083 #
0084 #     This function return whether the global bool flag @name is true
0085 #     in @ret_var. The flag is NOT a variable and can not be access that way.
0086 #     See #cmake_utils_set_bool and #cmake_utils_check_and_set_bool for more
0087 #     detail.
0088 function(cmake_utils_get_bool name var)
0089   set(property_name "___CMAKE_UTILS_CHECK_AND_SET_${name}__")
0090   cmake_utils_get_global("${property_name}" value)
0091   if(value)
0092     set("${var}" 1 PARENT_SCOPE)
0093   else()
0094     set("${var}" 0 PARENT_SCOPE)
0095   endif()
0096 endfunction()
0097 
0098 # cmake_utils_set_bool(name value)
0099 #     @name: the name of the bool flag to set
0100 #     @value: bool value to set
0101 #
0102 #     This function set the global bool flag @name to @value.
0103 #     The flag is NOT a variable and can not be access that way.
0104 #     See #cmake_utils_get_bool and #cmake_utils_check_and_set_bool for more
0105 #     detail.
0106 function(cmake_utils_set_bool name value)
0107   set(property_name "___CMAKE_UTILS_CHECK_AND_SET_${name}__")
0108   if(value)
0109     cmake_utils_set_global("${property_name}" 1)
0110   else()
0111     cmake_utils_set_global("${property_name}" 0)
0112   endif()
0113 endfunction()
0114 
0115 # cmake_utils_check_and_set_bool(name ret_var)
0116 #     @name: the name of the bool flag to set
0117 #     @ret_var: the variable to return the value
0118 #
0119 #     This function set the global bool flag @name to true and return
0120 #     whether it was true before in @ret_var. The flag is NOT a variable
0121 #     and can not be access that way.
0122 #     See #cmake_utils_set_bool and #cmake_utils_get_bool for more detail.
0123 function(cmake_utils_check_and_set_bool name var)
0124   cmake_utils_get_bool("${name}" value)
0125   if(value)
0126     set("${var}" 1 PARENT_SCOPE)
0127   else()
0128     cmake_utils_set_bool("${name}" 1)
0129     set("${var}" 0 PARENT_SCOPE)
0130   endif()
0131 endfunction()