vcpkg/ports/vtk/10972.diff

152 lines
6.7 KiB
Diff
Raw Normal View History

diff --git a/CMake/vtk-config.cmake.in b/CMake/vtk-config.cmake.in
index 30479050f9d2e4d3123844debbb807df18905a45..48e0ee709f2dce6f23e2365fe65e5f4f4fa444f2 100644
--- a/CMake/vtk-config.cmake.in
+++ b/CMake/vtk-config.cmake.in
@@ -236,8 +236,18 @@ if (${CMAKE_FIND_PACKAGE_NAME}_WRAP_JAVA)
endif ()
endif ()
+set(_vtk_search_components
+ ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
+if (NOT _vtk_search_components)
+ set(_vtk_search_components
+ ${${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS})
+endif ()
+list(REMOVE_ITEM _vtk_search_components
+ # These components need to always be requested explicitly since they are
+ # not modules.
+ @_vtk_non_module_components@)
set(_vtk_components_to_check)
-foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
+foreach (_vtk_component IN LISTS _vtk_search_components)
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND")
# It was already not-found (likely due to `find-package` failures).
elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}")
@@ -250,6 +260,7 @@ foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
endif ()
endforeach ()
unset(_vtk_component)
+unset(_vtk_search_components)
while (_vtk_components_to_check)
list(GET _vtk_components_to_check 0 _vtk_component)
diff --git a/CMake/vtkModule.cmake b/CMake/vtkModule.cmake
index 7163c690b069c3176a9c921d7799b105bb4b1825..ed7e398aa56cdaa079e688a8bfae96b9b97b6919 100644
--- a/CMake/vtkModule.cmake
+++ b/CMake/vtkModule.cmake
@@ -140,13 +140,10 @@ endfunction ()
.. code-block:: cmake
- _vtk_module_split_module_name(<dependency>
- SATISFIED_VAR <var>
- [PACKAGE <package>])
+ _vtk_module_optional_dependency_exists(<dependency>
+ SATISFIED_VAR <var>)
- The result will be returned in the variable specified by ``SATISFIED_VAR``. If
- ``PACKAGE`` is not given, ``_vtk_build_PACKAGE`` will be used if defined,
- otherwise an error will be raised.
+ The result will be returned in the variable specified by ``SATISFIED_VAR``.
#]==]
function (_vtk_module_optional_dependency_exists dependency)
cmake_parse_arguments(_vtk_optional_dep
@@ -161,16 +158,6 @@ function (_vtk_module_optional_dependency_exists dependency)
"${_vtk_optional_dep_UNPARSED_ARGUMENTS}")
endif ()
- if (NOT _vtk_optional_dep_PACKAGE)
- if (NOT DEFINED _vtk_build_PACKAGE)
- message(FATAL_ERROR
- "The `PACKAGE` argument is required outside of `vtk_module_build` "
- "usage.")
- endif ()
- set(_vtk_optional_dep_PACKAGE
- "${_vtk_build_PACKAGE}")
- endif ()
-
if (NOT _vtk_optional_dep_SATISFIED_VAR)
message(FATAL_ERROR
"The `SATISFIED_VAR` argument is required.")
@@ -178,16 +165,22 @@ function (_vtk_module_optional_dependency_exists dependency)
set(_vtk_optional_dep_satisfied 0)
if (TARGET "${dependency}")
- _vtk_module_split_module_name("${dependency}" _vtk_optional_dep_parse)
- if (_vtk_optional_dep_PACKAGE STREQUAL _vtk_optional_dep_parse_NAMESPACE)
- set(_vtk_optional_dep_satisfied 1)
- else ()
+ # If the target is imported, we check its `_FOUND` variable. If it is not
+ # imported, we assume it is set up properly as a normal target (or an
+ # `ALIAS`).
+ get_property(_vtk_optional_dep_is_imported
+ TARGET "${dependency}"
+ PROPERTY IMPORTED)
+ if (_vtk_optional_dep_is_imported)
+ _vtk_module_split_module_name("${dependency}" _vtk_optional_dep_parse)
set(_vtk_optional_dep_found_var
"${_vtk_optional_dep_parse_NAMESPACE}_${_vtk_optional_dep_parse_TARGET_NAME}_FOUND")
if (DEFINED "${_vtk_optional_dep_found_var}" AND
${_vtk_optional_dep_found_var})
set(_vtk_optional_dep_satisfied 1)
endif ()
+ else ()
+ set(_vtk_optional_dep_satisfied 1)
endif ()
endif ()
diff --git a/Filters/Parallel/Testing/Python/CMakeLists.txt b/Filters/Parallel/Testing/Python/CMakeLists.txt
index a59308d5bda968bbc4864eaae45fa1cfb677e1a3..90db33b578d570d1d8a75ab0d82f29781250c4a8 100644
--- a/Filters/Parallel/Testing/Python/CMakeLists.txt
+++ b/Filters/Parallel/Testing/Python/CMakeLists.txt
@@ -8,9 +8,9 @@ vtk_add_test_python(TestIntegrateAttributes.py NO_OUTPUT NO_VALID NO_RT)
vtk_add_test_python(TestRemoveGhosts.py NO_DATA NO_OUTPUT NO_VALID NO_RT)
vtk_add_test_python(TestResamplingInterpolator.py)
-if(TARGET pvtkpython)
+if(TARGET VTK::pvtkpython)
add_test(NAME vtkFiltersParallelPython-testTransmit
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS}
- $<TARGET_FILE:pvtkpython> ${CMAKE_CURRENT_SOURCE_DIR}/testTransmit.py
+ $<TARGET_FILE:VTK::pvtkpython> ${CMAKE_CURRENT_SOURCE_DIR}/testTransmit.py
${VTK_MPI_POSTFLAGS})
endif()
diff --git a/Rendering/RayTracing/Testing/Cxx/CMakeLists.txt b/Rendering/RayTracing/Testing/Cxx/CMakeLists.txt
index 87033ff51b7631ce556aeef42b94430d467a0549..9fa4fd126e753d025357a41c945f0a4fcbfe9ebc 100644
--- a/Rendering/RayTracing/Testing/Cxx/CMakeLists.txt
+++ b/Rendering/RayTracing/Testing/Cxx/CMakeLists.txt
@@ -121,7 +121,7 @@ vtk_test_cxx_executable(vtkRenderingRayTracingCxxTests all_tests RENDERING_FACTO
# Do we have MPI and parallel support
-if (VTK_ENABLE_OSPRAY AND TARGET vtkRenderingParallel AND TARGET vtkParallelMPI)
+if (VTK_ENABLE_OSPRAY AND TARGET VTK::RenderingParallel AND TARGET VTK::ParallelMPI)
set(vtkRenderingRayTracingCxx-MPI_NUMPROCS 2)
vtk_add_test_mpi(vtkRenderingRayTracingCxx-MPI tests
TESTING_DATA
diff --git a/Testing/External/CMakeLists.txt b/Testing/External/CMakeLists.txt
index 510620f7616f9152f4dfb8f364579a1c3bf1bcdb..8d2de9844d979c3298b8fe337f428dbe12b86191 100644
--- a/Testing/External/CMakeLists.txt
+++ b/Testing/External/CMakeLists.txt
@@ -53,7 +53,6 @@ vtk_module_scan(
# Input information for test build files.
option(VTK_USE_LARGE_DATA "Enable tests requiring \"large\" data" OFF)
-set(_vtk_build_PACKAGE "VTK")
set(_vtk_build_TEST_DATA_TARGET "VTKData")
set(_vtk_build_TEST_INPUT_DATA_DIRECTORY "${VTK_TOP_DIR}/Testing")
set(_vtk_build_TEST_OUTPUT_DATA_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Testing")
diff --git a/Testing/ExternalWheel/CMakeLists.txt b/Testing/ExternalWheel/CMakeLists.txt
index c9c984578b682f1a6a605b3546e826b63f9c88ea..518380d5370a9b0b61e0d0f48ae751a81b595098 100644
--- a/Testing/ExternalWheel/CMakeLists.txt
+++ b/Testing/ExternalWheel/CMakeLists.txt
@@ -82,7 +82,6 @@ endforeach ()
# Input information for test build files.
option(VTK_USE_LARGE_DATA "Enable tests requiring \"large\" data" OFF)
-set(_vtk_build_PACKAGE "VTK")
set(_vtk_build_TEST_DATA_TARGET "VTKData")
set(_vtk_build_TEST_INPUT_DATA_DIRECTORY "${VTK_TOP_DIR}/Testing")
set(_vtk_build_TEST_OUTPUT_DATA_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Testing")