Skip to content

Commit

Permalink
[VTK] fix cmake patches not recycling targets already defined (#20074)
Browse files Browse the repository at this point in the history
* [VTK] recycle alias targets if already defined

* [VTK] bump port version

* [VTK] fix references

* [VTK] fix other patches for target recycling

* [VTK] fix references

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
  • Loading branch information
cenit and BillyONeal authored Sep 14, 2021
1 parent 045c1ca commit 333e0d4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
17 changes: 12 additions & 5 deletions ports/vtk/FindHDF5.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#The original VTK file is overdoing it and still prdouces errors that the target hdf5::hdf5_hl-shared cannot be found in dynamic builds
find_package(hdf5 QUIET NO_MODULE)
if(TARGET hdf5::hdf5-shared)
set_target_properties(hdf5::hdf5-shared PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(hdf5::hdf5 ALIAS hdf5::hdf5-shared)
if(NOT TARGET hdf5::hdf5)
add_library(hdf5::hdf5 ALIAS hdf5::hdf5-shared)
endif()
elseif(TARGET hdf5::hdf5-static)
set_target_properties(hdf5::hdf5-static PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(hdf5::hdf5 ALIAS hdf5::hdf5-static)
if(NOT TARGET hdf5::hdf5)
add_library(hdf5::hdf5 ALIAS hdf5::hdf5-static)
endif()
else()
message(FATAL_ERROR "HDF5 target not found")
endif()
if(TARGET hdf5::hdf5_hl-shared)
set_target_properties(hdf5::hdf5_hl-shared PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-shared)
if(NOT TARGET hdf5::hdf5_hl)
add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-shared)
endif()
elseif(TARGET hdf5::hdf5_hl-static)
set_target_properties(hdf5::hdf5_hl-static PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-static)
if(NOT TARGET hdf5::hdf5_hl)
add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-static)
endif()
else()
message(FATAL_ERROR "HDF5 HL target not found")
endif()
Expand Down
4 changes: 3 additions & 1 deletion ports/vtk/FindLZ4.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/CMake/FindLZ4.cmake b/CMake/FindLZ4.cmake
index 8c94e3bcd..ade3f9451 100644
--- a/CMake/FindLZ4.cmake
+++ b/CMake/FindLZ4.cmake
@@ -1,38 +1,3 @@
@@ -1,38 +1,5 @@
-find_path(LZ4_INCLUDE_DIR
- NAMES lz4.h
- DOC "lz4 include directory")
Expand Down Expand Up @@ -43,5 +43,7 @@ index 8c94e3bcd..ade3f9451 100644
-endif ()
+find_package(LZ4 CONFIG REQUIRED)
+set_target_properties(lz4::lz4 PROPERTIES IMPORTED_GLOBAL TRUE)
+if(NOT TARGET LZ4::LZ4)
+add_library(LZ4::LZ4 ALIAS lz4::lz4)
+endif()
\ No newline at end of file
4 changes: 3 additions & 1 deletion ports/vtk/pegtl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/CMake/FindPEGTL.cmake b/CMake/FindPEGTL.cmake
index 73eee02f7..22d8bc159 100644
--- a/CMake/FindPEGTL.cmake
+++ b/CMake/FindPEGTL.cmake
@@ -19,31 +19,40 @@
@@ -19,31 +19,42 @@
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.

Expand All @@ -16,7 +16,9 @@ index 73eee02f7..22d8bc159 100644
+if(TARGET taocpp::pegtl)
+ message(STATUS "Searching for PEGTL - found target taocpp::pegtl")
+ set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE)
+ if(NOT TARGET PEGTL::PEGTL)
+ add_library(PEGTL::PEGTL ALIAS taocpp::pegtl)
+ endif()
+else()
+ find_path(PEGTL_INCLUDE_DIR
+ NAMES pegtl/version.hpp
Expand Down
1 change: 1 addition & 0 deletions ports/vtk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "vtk",
"version-semver": "9.0.3-pv5.9.1",
"port-version": 1,
"description": "Software system for 3D computer graphics, image processing, and visualization",
"homepage": "https://github.com/Kitware/VTK",
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6750,7 +6750,7 @@
},
"vtk": {
"baseline": "9.0.3-pv5.9.1",
"port-version": 0
"port-version": 1
},
"vtk-dicom": {
"baseline": "0.8.12",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vtk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "413d7fcbff9b50e57e486d1249c841a5e25c0def",
"version-semver": "9.0.3-pv5.9.1",
"port-version": 1
},
{
"git-tree": "87526609113852b1b1c4a1fdc40c96a61b7c0b47",
"version-semver": "9.0.3-pv5.9.1",
Expand Down

0 comments on commit 333e0d4

Please sign in to comment.