Skip to content
Snippets Groups Projects
Commit 49a1993a authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

Enable customization of find_package().

`vtk_module_export_code_find_package` now supports passing arguments to
the exported `find_package` call e.g. to pick specific components to
load from the package.
parent 41fab4e9
No related branches found
No related tags found
No related merge requests found
......@@ -211,7 +211,14 @@ endmacro()
# The VTK_INSTALL_FIND_PACKAGE_<name>_DIR variable may be set
# to an alternative location for the install tree to reference,
# or to a false value to remove any default location.
#
# Additional arguments for find_package() call added to the module config
# can be provided as extra arguments to this macro e.g.
#
# vtk_module_export_code_find_package(Qt5 COMPONENTS Widgets)
#
macro(vtk_module_export_code_find_package _name)
string(REPLACE ";" " " _argn "${ARGN}")
if(${_name}_DIR)
if(DEFINED VTK_INSTALL_FIND_PACKAGE_${_name}_DIR)
set(_dir "${VTK_INSTALL_FIND_PACKAGE_${_name}_DIR}")
......@@ -225,13 +232,13 @@ if(NOT ${_name}_DIR)
endif()")
endif()
set(${vtk-module}_EXPORT_CODE_INSTALL "${${vtk-module}_EXPORT_CODE_INSTALL}
find_package(${_name} REQUIRED QUIET)
find_package(${_name} REQUIRED QUIET ${_argn})
")
set(${vtk-module}_EXPORT_CODE_BUILD "${${vtk-module}_EXPORT_CODE_BUILD}
if(NOT ${_name}_DIR)
set(${_name}_DIR \"${${_name}_DIR}\")
endif()
find_package(${_name} REQUIRED QUIET)
find_package(${_name} REQUIRED QUIET ${_argn})
")
endif()
endmacro()
......
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