Commit ccd87157 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

paraview-config: help find dependency packages if possible

Fixes: #18992
parent 688de12f
......@@ -80,6 +80,12 @@ foreach (paraview_cmake_module_file IN LISTS paraview_cmake_module_files)
"${paraview_cmake_module_file}")
endforeach ()
include(ParaViewInstallCMakePackageHelpers)
if (NOT PARAVIEW_RELOCATABLE_INSTALL)
list(APPEND paraview_cmake_files_to_install
"${paraview_cmake_build_dir}/paraview-find-package-helpers.cmake")
endif ()
foreach (paraview_cmake_file IN LISTS paraview_cmake_files_to_install)
get_filename_component(subdir "${paraview_cmake_file}" DIRECTORY)
install(
......
function (_paraview_package_append_variables)
set(_paraview_package_variables)
foreach (var IN LISTS ARGN)
if (NOT ${var})
continue ()
endif ()
string(APPEND _paraview_package_variables
"if (NOT DEFINED \"${var}\")
set(\"${var}\" \"${${var}}\")
list(APPEND _paraview_find_package_variables \"${var}\")
endif ()
")
endforeach ()
set(paraview_find_package_code
"${paraview_find_package_code}${_paraview_package_variables}"
PARENT_SCOPE)
endfunction ()
get_property(_paraview_packages GLOBAL
PROPERTY _vtk_module_find_packages_paraview)
if (_paraview_packages)
list(REMOVE_DUPLICATES _paraview_packages)
endif ()
set(paraview_find_package_code)
foreach (_paraview_package IN LISTS _paraview_packages)
_paraview_package_append_variables(
# Standard CMake `find_package` mechanisms.
"${package}_DIR"
"${package}_ROOT"
# Per-package custom variables.
${${package}_find_package_vars})
endforeach ()
file(GENERATE
OUTPUT "${paraview_cmake_build_dir}/paraview-find-package-helpers.cmake"
CONTENT "${paraview_find_package_code}")
......@@ -48,8 +48,18 @@ unset(_paraview_use_external_vtk)
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake")
set(_paraview_find_package_variables)
include("${CMAKE_CURRENT_LIST_DIR}/paraview-find-package-helpers.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake")
foreach (_paraview_find_package_variable IN LISTS _paraview_find_package_variables)
unset("${_paraview_find_package_variable}")
endforeach ()
unset(_paraview_find_package_variable)
unset(_paraview_find_package_variables)
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewClient.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPlugin.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewServerManager.cmake")
......
......@@ -179,6 +179,8 @@ option(PARAVIEW_ENABLE_LOGGING "Enable logging support." ON)
mark_as_advanced(PARAVIEW_ENABLE_LOGGING)
option(PARAVIEW_INSTALL_DEVELOPMENT_FILES "Install development files to the install tree" ON)
mark_as_advanced(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
option(PARAVIEW_RELOCATABLE_INSTALL "Do not embed hard-coded paths into the install" ON)
mark_as_advanced(PARAVIEW_RELOCATABLE_INSTALL)
option(PARAVIEW_ENABLE_PYTHON "Enable/Disable Python scripting support" OFF)
......@@ -849,6 +851,8 @@ else ()
"${paraview_cmake_destination}/vtk")
set(vtk_cmake_build_dir
"${CMAKE_CURRENT_BINARY_DIR}/${vtk_cmake_destination}")
set(VTK_RELOCATABLE_INSTALL
"${PARAVIEW_RELOCATABLE_INSTALL}")
include("${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake/vtkInstallCMakePackage.cmake")
endif ()
endif ()
......
......@@ -275,6 +275,11 @@ More advanced options:
effect on initial configures or newly added plugins.
* `PARAVIEW_INSTALL_DEVELOPMENT_FILES` (default `ON`): If set, ParaView will
install its headers, CMake API, etc. into its install tree for use.
* `PARAVIEW_RELOCATABLE_INSTALL` (default `ON`): If set, the install tree
will be relocatable to another path. If unset, the install tree may be tied
to the build machine with absolute paths, but finding dependencies in
non-standard locations may require work without passing extra information
when consuming ParaView.
<!--
These variables should be documented once they're effective again.
......
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