vcpkg/ports/vtk/FindLZMA.patch
Alexander Neumann 3e2409f47d
[VTK/vtk-m] Update VTK to 9.0 and add vtk-m (#11148)
* [vtk-m] new port vtk-m

* [VTK] Update to 9.0

* include local buildtree changes

* [pcl] disable VTK due to API changes in VTK 9.0

* [vtk-m] add supports field to be only x64

* [vtk-dicom] add python executable.

* fix vtkm dependency

* [vtk-dicom] fix missing std:: namespace

* [vtk-m] add uwp to unsupported triplets

* [vtk] add pegtl include patch, reenable IOMotionFX

* remove hdf5 changes for testing

* use different pgetl patch which redirects to the installed config of pegtl

* [pegtl-2] version file needs renaming too

* [vtk] change dependency to pgetl-2 and fix the patch

* [vtk] put in hdf5 fix again and correct manually installed include files

* remove deprecated function to retrigger CI

* [lz4] correctly lowercase the lz4 config

* [vtk] remove unnecessary code

* [pegtl-2] add homepage

* [pegtl] modernize portfiles

* [vtk-dicom] add homepage

* [vtk-dicom] modernize portfile

* [vtk-m] remove empty build depends

* [vtk] try fixing the permission issue

* bump control

* Update FindHDF5.cmake

* Update pegtl.patch

* Update ports/vtk/pegtl.patch

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* [vtk] refactor portfile, added a few deps on [core] and added feature cuda

* [vtk] pegtl.patch: Add additional found message

* [vtk-m] add more documentation comments

* [vtk] fix string replacement

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2020-05-11 13:39:50 -07:00

86 lines
3.2 KiB
Diff

diff --git a/CMake/FindLZMA.cmake b/CMake/FindLZMA.cmake
index 0c8c7943c..d60669484 100644
--- a/CMake/FindLZMA.cmake
+++ b/CMake/FindLZMA.cmake
@@ -1,9 +1,17 @@
find_path(LZMA_INCLUDE_DIR
NAMES lzma.h
DOC "lzma include directory")
-find_library(LZMA_LIBRARY
+# Note LZMA_LIBRARY is set somewhere else. Maybe one of the configs/wrappers installed by VCPKG defines it.
+# The original FindLZMA chokes on it since it contains optimized/debug keywords
+# VTK should probably switch to FindLibLZMA from CMake
+find_library(LZMA_LIBRARY_RELEASE
NAMES lzma
DOC "lzma library")
+find_library(LZMA_LIBRARY_DEBUG
+ NAMES lzmad lzma NAMES_PER_DIR
+ DOC "lzma library")
+ include(SelectLibraryConfigurations)
+ select_library_configurations( LZMA )
if (LZMA_INCLUDE_DIR)
file(STRINGS "${LZMA_INCLUDE_DIR}/lzma/version.h" _lzma_version_lines
@@ -20,22 +26,50 @@ endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZMA
- REQUIRED_VARS LZMA_LIBRARY LZMA_INCLUDE_DIR
+ REQUIRED_VARS LZMA_LIBRARY LZMA_LIBRARY_RELEASE LZMA_LIBRARY_DEBUG LZMA_INCLUDE_DIR
VERSION_VAR LZMA_VERSION)
if (LZMA_FOUND)
set(LZMA_LIBRARIES "${LZMA_LIBRARY}")
set(LZMA_INCLUDE_DIRS "${LZMA_INCLUDE_DIR}")
-
+
if (NOT TARGET LZMA::LZMA)
include(vtkDetectLibraryType)
- vtk_detect_library_type(lzma_library_type
- PATH "${LZMA_LIBRARY}")
- add_library(LZMA::LZMA "${lzma_library_type}" IMPORTED)
- unset(lzma_library_type)
- set_target_properties(LZMA::LZMA PROPERTIES
- IMPORTED_LOCATION "${LZMA_LIBRARY}"
- IMPORTED_IMPLIB "${LZMA_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${LZMA_INCLUDE_DIR}")
- endif ()
+ if(LZMA_LIBRARY_RELEASE)
+ vtk_detect_library_type(lzma_library_type
+ PATH "${LZMA_LIBRARY_RELEASE}")
+ elseif(LZMA_LIBRARY_DEBUG)
+ vtk_detect_library_type(lzma_library_type
+ PATH "${LZMA_LIBRARY_DEBUG}")
+ else()
+ vtk_detect_library_type(lzma_library_type
+ PATH "${LZMA_LIBRARY}")
+ endif()
+
+ add_library(LZMA::LZMA "${lzma_library_type}" IMPORTED)
+ set_target_properties(LZMA::LZMA PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LZMA_INCLUDE_DIR}")
+ if(LZMA_LIBRARY_RELEASE)
+ set_target_properties(LZMA::LZMA PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${LZMA_LIBRARY_RELEASE}"
+ IMPORTED_IMPLIB_RELEASE "${LZMA_LIBRARY_RELEASE}")
+ endif()
+ if(LZMA_LIBRARY_DEBUG)
+ set_target_properties(LZMA::LZMA PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${LZMA_LIBRARY_DEBUG}"
+ IMPORTED_IMPLIB_DEBUG "${LZMA_LIBRARY_DEBUG}")
+ endif()
+
+ # Guard against possible stupidity of VTK reading only LOCATION without configuration
+ if(CMAKE_BUILD_TYPE MATCHES "Debug")
+ set_target_properties(LZMA::LZMA PROPERTIES
+ IMPORTED_LOCATION "${LZMA_LIBRARY_DEBUG}"
+ IMPORTED_IMPLIB "${LZMA_LIBRARY_DEBUG}")
+ else()
+ set_target_properties(LZMA::LZMA PROPERTIES
+ IMPORTED_LOCATION "${LZMA_LIBRARY_RELEASE}"
+ IMPORTED_IMPLIB "${LZMA_LIBRARY_RELEASE}")
+ endif()
+ endif()
+ #set_target_properties(LZMA::LZMA PROPERTIES IMPORTED_GLOBAL TRUE)
endif ()