@@ -350,47 +350,32 @@ endmacro()
350
350
################################################################################
351
351
352
352
macro (itk_auto_load_submodules )
353
+ # Global vars used: WRAPPER_LIBRARY_SOURCE_DIR
354
+ # Global vars modified: WRAPPER_SUBMODULE_ORDER
353
355
354
356
# Include the *.wrap files in WRAPPER_LIBRARY_SOURCE_DIR. This causes
355
357
# corresponding wrap_*.cxx files to be generated WRAPPER_LIBRARY_OUTPUT_DIR,
356
358
# and added to the WRAPPER_LIBRARY_SWIG_INPUTS list.
357
359
# In addition, this causes the other required wrap_*.cxx files for the entire
358
360
# library and each wrapper language to be created.
359
- # Finally, this macro causes the language support files for the templates and
361
+ # This macro causes the language support files for the templates and
360
362
# library here defined to be created.
361
363
362
- # Next, include modules already in WRAPPER_SUBMODULE_ORDER, because those are
363
- # guaranteed to be processed first.
364
- foreach (module ${WRAPPER_SUBMODULE_ORDER} )
365
- itk_load_submodule ("${module} " )
366
- endforeach ()
367
-
368
364
# Now search for other *.wrap files to include
369
- file (GLOB wrap_cmake_files "${WRAPPER_LIBRARY_SOURCE_DIR} /*.wrap" )
365
+ file (GLOB _wrap_cmake_files "${WRAPPER_LIBRARY_SOURCE_DIR} /*.wrap" )
370
366
# sort the list of files so we are sure to always get the same order on all system
371
367
# and for all builds. That's important for several reasons:
372
368
# - the order is important for the order of creation of python template
373
369
# - the typemaps files are always the same, and the rebuild can be avoided
374
- list (SORT wrap_cmake_files )
375
- foreach (_file ${wrap_cmake_files } )
370
+ list (SORT _wrap_cmake_files )
371
+ foreach (_file ${_wrap_cmake_files } )
376
372
# get the module name from module.wrap
377
- get_filename_component (module "${_file} " NAME_WE )
378
-
379
- # if the module is already in the list, it means that it is already included
380
- # ... and do not include excluded modules
381
- set (will_include 1 )
382
- foreach (already_included ${WRAPPER_SUBMODULE_ORDER} )
383
- if ("${already_included} " STREQUAL "${module} " )
384
- set (will_include 0 )
385
- endif ()
386
- endforeach ()
387
-
388
- if (${will_include} )
389
- # Add the module name to the list. WRITE_MODULE_FILES uses this list
390
- # to create the master library wrapper file.
391
- list (APPEND WRAPPER_SUBMODULE_ORDER "${module} " )
392
- itk_load_submodule ("${module} " )
393
- endif ()
373
+ get_filename_component (_module "${_file} " NAME_WE )
374
+ list (APPEND WRAPPER_SUBMODULE_ORDER "${_module} " )
375
+ endforeach ()
376
+ list (REMOVE_DUPLICATES WRAPPER_SUBMODULE_ORDER )
377
+ foreach (_module ${WRAPPER_SUBMODULE_ORDER} )
378
+ itk_load_submodule ("${_module} " )
394
379
endforeach ()
395
380
endmacro ()
396
381
0 commit comments