Skip to content
Snippets Groups Projects
Commit 04460f5b authored by Jean-Christophe Fillion-Robin's avatar Jean-Christophe Fillion-Robin
Browse files

vtkModuleAPI: Update vtk_module_config to avoid overwriting _module

This commit prevents the variable "_module" from being overwritten
in vtk_module_config() after being set in "pv_process_modules()".

In the particular project where the error was investigated, it fixes
a failure to link the plugin against wslink and wslinkCS.

The pseudo code reported below illustrates the scenario leading to
the link error:

//-----------------------------
pv_process_modules()                                          [/path/to/Plugins/<NameOfPlugin>/CMakeLists.txt]
  -> foreach(_module IN LISTS current_module_set_sorted)      [ParaViewPlugins.cmake         :pv_process_modules]
     ############################################################################################################
     # NOTE: _module is set here
     ############################################################################################################
     [...]
     -> vtk_add_cs_wrapping(${_module})                       [ParaViewPlugins.cmake         :pv_process_modules]
       -> vtk_add_cs_wrapping                                 [vtkClientServerWrapping.cmake :vtk_add_cs_wrapping]
          [...]
          -> vtk_module_dep_includes(${module})               [vtkClientServerWrapping.cmake :vtk_add_cs_wrapping]
            -> vtk_module_config( ... )                       [vtlModuleAPI.cmake            :vtk_module_dep_includes]
            #####################################################################################################
            # NOTE: This commit make sure _module is *NOT* overwritten !
            #####################################################################################################
     -> list(APPEND plugin_cs_modules ${_module})             [ParaViewPlugins.cmake         :pv_process_modules]
     -> set (${pv-plugin}_CS_MODULES ${plugin_cs_modules})    [ParaViewPlugins.cmake         :pv_process_modules]


# This is the code path leading to the link error

ADD_PARAVIEW_PLUGIN(...)                                      [/path/to/Plugins/<NameOfPlugin>/ParaViewPlugin/CMakeLists.txt]
  -> if (pv-plugin AND ${pv-plugin}_CS_MODULES)               [ParaViewPlugins.cmake         :ADD_PARAVIEW_PLUGIN]
    -> foreach(module ${${pv-plugin}_CS_MODULES})             [ParaViewPlugins.cmake         :ADD_PARAVIEW_PLUGIN]
    [...]
      -> list(APPEND extradependencies ${module} ${module}CS) [ParaViewPlugins.cmake         :ADD_PARAVIEW_PLUGIN]

  [...]

  if (extradependencies)                                      [ParaViewPlugins.cmake         :ADD_PARAVIEW_PLUGIN]
    target_link_libraries(${NAME} LINK_PUBLIC ${extradependencies})

  ################################################################################################################
  # NOTE: Without this commit, the plugin was linked either against incorrect libraries or against nonexistent one
  ################################################################################################################

//-----------------------------
parent ec634dae
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment