@@ -200,43 +200,49 @@ function(_properties_expand_value value return_value namespace)
200
200
return ()
201
201
endif ()
202
202
203
- # Get the variables list
204
- string (REGEX MATCHALL "{[^{}/]+}" _var_list "${_value} " )
205
- if (NOT "${_var_list} " STREQUAL "" )
206
- list (REMOVE_DUPLICATES _var_list )
207
- endif ()
208
- foreach (_var_str IN LISTS _var_list )
209
-
210
- # Get the variable name
211
- string (REGEX MATCH "^{(.*)}$" _match "${_var_str} " )
212
- set (_var_name "${CMAKE_MATCH_1} " )
213
-
214
- # Check if not resolved already
215
- if (NOT DEFINED "/prop_int_resolved.${_var_name} " )
216
- # If such a variable is not in the namespace, no need to resolve
217
- if (NOT DEFINED "${namespace} .${_var_name} " )
218
- properties_set_value ("/prop_int_unresolved" ${_var_name} "" )
219
- continue ()
220
- endif ()
221
-
222
- # Temporarily resolve it to the same variable to handle recursive
223
- # references
224
- properties_set_value ("/prop_int_resolved" "${_var_name} "
225
- "{${_var_name} }" )
226
-
227
- # message("=> Resolve *** ${_var_name} *** : "
228
- # "${${namespace}.${_var_name}}")
229
- _properties_expand_value ("${${namespace} .${_var_name} }"
230
- _var_value "${namespace} " )
231
- properties_set_value ("/prop_int_resolved" "${_var_name} "
232
- "${_var_value} " )
233
- # message("=> EXPANDED ${_var_name}: ${_var_value}")
203
+ # Set previous value to nothing so that there is at least one iteration
204
+ set (_previous_value "" )
205
+ while (NOT "${_previous_value} " STREQUAL "${_value} " )
206
+ set (_previous_value "${_value} " )
207
+
208
+ # Get the variables list
209
+ string (REGEX MATCHALL "{[^{}/]+}" _var_list "${_value} " )
210
+ if (NOT "${_var_list} " STREQUAL "" )
211
+ list (REMOVE_DUPLICATES _var_list )
234
212
endif ()
213
+ foreach (_var_str IN LISTS _var_list )
214
+
215
+ # Get the variable name
216
+ string (REGEX MATCH "^{(.*)}$" _match "${_var_str} " )
217
+ set (_var_name "${CMAKE_MATCH_1} " )
218
+
219
+ # Check if not resolved already
220
+ if (NOT DEFINED "/prop_int_resolved.${_var_name} " )
221
+ # If such a variable is not in the namespace, no need to resolve
222
+ if (NOT DEFINED "${namespace} .${_var_name} " )
223
+ properties_set_value ("/prop_int_unresolved" ${_var_name} "" )
224
+ continue ()
225
+ endif ()
226
+
227
+ # Temporarily resolve it to the same variable to handle recursive
228
+ # references
229
+ properties_set_value ("/prop_int_resolved" "${_var_name} "
230
+ "{${_var_name} }" )
231
+
232
+ # message("=> Resolve *** ${_var_name} *** : "
233
+ # "${${namespace}.${_var_name}}")
234
+ _properties_expand_value ("${${namespace} .${_var_name} }"
235
+ _var_value "${namespace} " )
236
+ properties_set_value ("/prop_int_resolved" "${_var_name} "
237
+ "${_var_value} " )
238
+ # message("=> EXPANDED ${_var_name}: ${_var_value}")
239
+ endif ()
235
240
236
- string (REPLACE "${_var_str} " "${/prop_int_resolved.${_var_name} }"
237
- _value "${_value} " )
241
+ string (REPLACE "${_var_str} " "${/prop_int_resolved.${_var_name} }"
242
+ _value "${_value} " )
238
243
239
- endforeach ()
244
+ endforeach ()
245
+ endwhile ()
240
246
241
247
properties_set_parent_scope ("/prop_int_resolved" )
242
248
properties_set_parent_scope ("/prop_int_unresolved" )
0 commit comments