@@ -77,7 +77,8 @@ endfunction()
7777# handle_gyb_sources(
7878# dependency_out_var_name
7979# sources_var_name
80- # arch)
80+ # [ARCH arch]
81+ # [DEPENDS [depends ...]])
8182#
8283# Replace, in ${sources_var_name}, the given .gyb-suffixed sources with
8384# their un-suffixed intermediate files, which will be generated by processing
@@ -93,11 +94,21 @@ endfunction()
9394# false, the files are architecture-independent and will be emitted
9495# into ${CMAKE_CURRENT_BINARY_DIR} instead of an architecture-specific
9596# destination; this is useful for generated include files.
96- function (handle_gyb_sources dependency_out_var_name sources_var_name arch)
97+ #
98+ # depends
99+ # Additional file dependencies beyond the standard dependencies that all gyb
100+ # invocations get.
101+ function (handle_gyb_sources dependency_out_var_name sources_var_name)
102+ set (options )
103+ set (single_value_args ARCH)
104+ set (multi_value_args DEPENDS )
105+ cmake_parse_arguments (GYB
106+ "${options} " "${single_value_args} " "${multi_value_args} " ${ARGN} )
107+
97108 set (extra_gyb_flags "" )
98- if (arch )
109+ if (GYB_ARCH )
99110 set_if_arch_bitness(ptr_size
100- ARCH "${arch } "
111+ ARCH "${GYB_ARCH } "
101112 CASE_32_BIT "4"
102113 CASE_64_BIT "8" )
103114 set (extra_gyb_flags "-DCMAKE_SIZEOF_VOID_P=${ptr_size} " )
@@ -141,7 +152,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
141152 set (dir_root ${CMAKE_CURRENT_BINARY_DIR} )
142153 endif ()
143154
144- if (arch )
155+ if (GYB_ARCH )
145156 set (dir "${dir_root} /${ptr_size} " )
146157 else ()
147158 set (dir "${dir_root} " )
@@ -154,7 +165,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
154165 SOURCE "${src} "
155166 OUTPUT "${output_file_name} "
156167 FLAGS ${extra_gyb_flags}
157- DEPENDS "${gyb_extra_sources} "
168+ DEPENDS "${GYB_DEPENDS} " " ${ gyb_extra_sources} "
158169 COMMENT "with ptr size = ${ptr_size} " )
159170 list (APPEND dependency_targets "${dependency_target} " )
160171 endforeach ()
@@ -163,13 +174,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
163174endfunction ()
164175
165176function (add_gyb_target target sources )
166- set (options )
167- set (single_value_args ARCH)
168- set (multi_value_args)
169- cmake_parse_arguments (GYB
170- "${options} " "${single_value_args} " "${multi_value_args} " ${ARGN} )
171-
172- handle_gyb_sources(gyb_sources_depends sources "${GYB_ARCH} " )
177+ handle_gyb_sources(gyb_sources_depends sources ${ARGN} )
173178
174179 add_custom_target (${target}
175180 DEPENDS "${gyb_sources_depends} " )
0 commit comments