Commit 12e5b539 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Generalizing module config files importing logic.

For applications based on VTK, they themselves might add additional modules. In
that case the module config files locating code needs to look in multiple
locations, those for VTK's modules and those for the extra modules added by the
project. To enable that, we extend vtkModuleAPI to look for the config files in
the VTK_MODULES_DIR as well as any location in the CMAKE_MODULE_PATH. Now, such
applications can simply extend the CMAKE_MODULE_PATH and the module-config files
can be easily imported.

Change-Id: I1b94c96512eae6822e366df06b1e3cdbd363c790
parent c2eeaa2d
......@@ -33,7 +33,13 @@ endmacro()
# <module>_LIBRARY_DIRS = Library search path (for outside dependencies)
macro(vtk_module_load mod)
if(NOT ${mod}_LOADED)
include("${VTK_MODULES_DIR}/${mod}.cmake" OPTIONAL)
include("${VTK_MODULES_DIR}/${mod}.cmake" OPTIONAL RESULT_VARIABLE _found)
if (NOT _found)
# When building applications outside VTK, they can provide extra module
# config files by simply adding the corresponding locations to the
# CMAKE_MODULE_PATH
include(${mod} OPTIONAL)
endif()
if(NOT ${mod}_LOADED)
message(FATAL_ERROR "No such module: \"${mod}\"")
endif()
......@@ -62,7 +68,13 @@ endmacro()
# <module>_CLASS_<class>_WRAP_SPECIAL
macro(vtk_module_classes_load mod)
if(NOT ${mod}_CLASSES_LOADED)
include("${VTK_MODULES_DIR}/${mod}-Classes.cmake" OPTIONAL)
include("${VTK_MODULES_DIR}/${mod}-Classes.cmake" OPTIONAL RESULT_VARIABLE _found)
if (NOT _found)
# When building applications outside VTK, they can provide extra module
# config files by simply adding the corresponding locations to the
# CMAKE_MODULE_PATH
include(${mod}-Classes OPTIONAL)
endif()
if(NOT ${mod}_CLASSES_LOADED)
message(FATAL_ERROR "No such module: \"${mod}\"")
endif()
......
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