11### MIGRATE-NO-ACTION
2+ #[================================================================[.rst:
3+ X
4+ =
5+ #]================================================================]
26# art_make
37#
48# Identify the files in the current source directory and build
100104#
101105########################################################################
102106
103- include_guard (DIRECTORY )
107+ include_guard ()
104108
105109cmake_policy (PUSH)
106110cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
@@ -138,22 +142,25 @@ endmacro()
138142# art_make
139143####################################
140144function (art_make)
141- set (flags BASENAME_ONLY LIB_ONLY NO_DICTIONARY NO_INSTALL NO_LIB NO_PLUGINS
142- USE_PRODUCT_NAME USE_PROJECT_NAME)
145+ set (flags LIB_ONLY NO_LIB NO_PLUGINS USE_PRODUCT_NAME USE_PROJECT_NAME)
143146 cet_regex_escape(VAR flags_regex ${flags} )
144147 list (JOIN flags_regex "|" tmp)
145148 set (flags_regex "^(${tmp} )$" )
146149 set (seen_art_make_flags "${ARGV} " )
147150 list (FILTER seen_art_make_flags INCLUDE REGEX "${flags_regex} " )
148- list (REMOVE_DUPLICATES seen_art_make_flags)
149- list (TRANSFORM ARGV REPLACE "${flags_regex} " "NOP" )
150151 if ("USE_PRODUCT_NAME" IN_LIST seen_art_make_flags AND
151152 "USE_PROJECT_NAME" IN_LIST seen_art_make_flags)
152153 message (WARNING "USE_PRODUCT_NAME and USE_PROJECT_NAME are synonymous" )
153- list (REMOVE_ITEM seen_art_make_flags "USE_PRODUCT_NAME" )
154+ endif ()
155+ list (TRANSFORM seen_art_make_flags REPLACE "^USE_PRODUCT_NAME$" "USE_PROJECT_NAME" )
156+ list (REMOVE_DUPLICATES seen_art_make_flags)
157+ list (TRANSFORM ARGN REPLACE "${flags_regex} " "NOP" )
158+ if ("USE_PROJECT_NAME" IN_LIST seen_art_make_flags)
159+ list (APPEND ARGN "USE_PROJECT_NAME" )
160+ list (REMOVE_ITEM seen_art_make_flags "USE_PROJECT_NAME" )
154161 endif ()
155162 foreach (flag IN LISTS seen_art_make_flags)
156- set (AM_${flag} ${flag} )
163+ set (AM_${flag} TRUE )
157164 endforeach ()
158165 if (AM_LIB_ONLY AND AM_NO_LIB)
159166 # Nothing to do except hold up tea and no tea to confuse the GPP door
@@ -169,8 +176,9 @@ function(art_make)
169176 set (flags "${flag_keywords_dict} " )
170177 set (one_arg_options "${one_arg_option_keywords_dict} " )
171178 set (list_options "${list_option_keywords_dict} " )
172- list (APPEND flags ${_cet_make_flags} )
173- list (APPEND one_arg_options ${_cet_make_one_arg_options} )
179+ list (APPEND flags ${_cet_make_flags} ALLOW_UNDERSCORES BASENAME_ONLY
180+ NO_DICTIONARY NO_EXPORT NO_INSTALL USE_BOOST_UNIT USE_PROJECT_NAME VERSION )
181+ list (APPEND one_arg_options ${_cet_make_one_arg_options} EXPORT_SET LIB_TYPE SOVERSION )
174182 list (APPEND list_options ${_cet_make_list_options} )
175183
176184 # Identify caller-specified plugin types.
@@ -185,7 +193,10 @@ function(art_make)
185193 list (TRANSFORM plugin_types REPLACE "^(.+)$" "*_\\ 1.cc"
186194 OUTPUT_VARIABLE plugin_glob)
187195 list (TRANSFORM plugin_types TOUPPER OUTPUT_VARIABLE plugin_prefixes)
188- set (flags_plugin USE_BOOST_UNIT VERSION )
196+
197+ # Identify plugin-specific options and add them to the parsing lists.
198+ set (flags_plugin ALLOW_UNDERSCORES BASENAME_ONLY USE_BOOST_UNIT
199+ USE_PRODUCT_NAME USE_PROJECT_NAME VERSION )
189200 set (one_arg_options_plugin EXPORT_SET LIB_TYPE SOVERSION )
190201 set (list_options_plugin LIBRARIES)
191202 foreach (option_type IN ITEMS flags one_arg_options list_options)
@@ -196,10 +207,12 @@ function(art_make)
196207 endforeach ()
197208 list (REMOVE_DUPLICATES ${option_type} )
198209 endforeach ()
210+
199211 # We have to parse everything at once and pass through to the right
200212 # place if we need to otherwise we could get confused with argument /
201213 # option boundaries with multiple parsing passes.
202- cmake_parse_arguments (PARSE_ARGV 0 AM "${flags} " "${one_arg_options} " "${list_options} " )
214+ cmake_parse_arguments (AM "${flags} " "${one_arg_options} "
215+ "${list_options} " ${ARGN} )
203216 # Identify plugin sources.
204217 set (plugins_glob ${plugin_glob} )
205218 foreach (subdir IN LISTS AM_SUBDIRS)
@@ -214,6 +227,7 @@ function(art_make)
214227 # whether we're making the plugin.
215228 cet_passthrough(APPEND KEYWORD EXCLUDE plugin_sources AM_EXCLUDE)
216229 set (flag_flag FLAG) # Flags are handled differently to the others.
230+ set (cet_make_args)
217231 foreach (option_type IN ITEMS flag one_arg_option list_option)
218232 # Dictionaries.
219233 foreach (keyword opt IN ZIP_LISTS ${option_type} _keywords_dict ${option_type} s_dict)
@@ -234,16 +248,24 @@ function(art_make)
234248 # Common options.
235249 foreach (type IN ITEMS dict LISTS plugin_types)
236250 string (TOUPPER "${type} " TYPE )
237- cet_passthrough(FLAG APPEND AM_NO_INSTALL ${type} _args)
238- if (NOT VERSION IN_LIST ${type} _args)
239- cet_passthrough(FLAG APPEND AM_VERSION ${type} _args)
240- endif ()
241- if (NOT (AM_NO_INSTALL OR EXPORT_SET IN_LIST ${type} _args))
242- cet_passthrough(APPEND AM_EXPORT_SET ${type} _args)
251+ foreach (common_opt IN ITEMS NO_EXPORT NO_INSTALL USE_PROJECT_NAME VERSION )
252+ if (AM_${common_opt} AND NOT "${common_opt} " IN_LIST ${type} _args)
253+ list (APPEND ${type} _args "${common_opt} " )
254+ endif ()
255+ endforeach ()
256+ if (DEFINED AM_EXPORT_SET AND
257+ NOT (AM_NO_INSTALL OR EXPORT_SET IN_LIST ${type} _args))
258+ list (APPEND ${type} _args EXPORT_SET ${AM_EXPORT_SET} )
243259 endif ()
244- cet_passthrough(FLAG APPEND AM_USE_PROJECT_NAME ${type} _args)
245260 if (NOT type STREQUAL "dict" )
246- cet_passthrough(FLAG APPEND AM_BASENAME_ONLY ${type} _args)
261+ foreach (plugin_opt IN ITEMS ALLOW_UNDERSCORES BASENAME_ONLY USE_BOOST_UNIT)
262+ if (AM_${plugin_opt} AND NOT ${plugin_opt} IN_LIST ${type} _args)
263+ list (APPEND ${type} _args ${plugin_opt} )
264+ endif ()
265+ endforeach ()
266+ if (DEFINED AM_SOVERSION AND NOT SOVERSION IN_LIST ${type} _args)
267+ list (APPEND ${type} _args SOVERSION ${AM_SOVERSION} )
268+ endif ()
247269 endif ()
248270 endforeach ()
249271
0 commit comments