Commit f915a546 authored by Brad King's avatar Brad King

BUG: Fix vtk_module_config for repeated calls

Fix use of _${ns}_${mod}_USED settings to block reporting a module more
than once in a single vtk_module_config call.  Do not leak the
_${ns}_${mod}_USED settings outside a single call to vtk_module_config
so that a future call to the macro with the same ${ns} will use a fresh
set of modules.
Reported-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
Reported-by: Marcus D. Hanwell's avatarMarcus D. Hanwell <marcus.hanwell@kitware.com>
Change-Id: Ib37717f5724ad94e20c14165886a0d023fcecd9c
parent 491b1e6d
......@@ -4,8 +4,9 @@
# Private helper macros.
macro(_vtk_module_config_recurse ns mod)
if(NOT _${ns}_${dep}_USED)
if(NOT _${ns}_${mod}_USED)
set(_${ns}_${mod}_USED 1)
list(APPEND _${ns}_USED_MODULES ${mod})
vtk_module_load("${mod}")
list(APPEND ${ns}_LIBRARIES ${${mod}_LIBRARIES})
list(APPEND ${ns}_INCLUDE_DIRS ${${mod}_INCLUDE_DIRS})
......@@ -108,9 +109,16 @@ macro(vtk_module_config ns)
set(${ns}_INCLUDE_DIRS "")
set(${ns}_LIBRARY_DIRS "")
set(_${ns}_AUTOINIT "")
set(_${ns}_USED_MODULES "")
foreach(mod ${ARGN})
_vtk_module_config_recurse("${ns}" "${mod}")
endforeach()
foreach(mod ${_${ns}_USED_MODULES})
unset(_${ns}_${mod}_USED)
endforeach()
unset(_${ns}_USED_MODULES)
foreach(v ${ns}_LIBRARIES ${ns}_INCLUDE_DIRS ${ns}_LIBRARY_DIRS
_${ns}_AUTOINIT)
if(${v})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment