2017-04-18 03:32:16 +08:00
|
|
|
#
|
|
|
|
# Copyright by The HDF Group.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
|
|
|
#
|
2019-06-18 20:46:25 +08:00
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake
|
|
|
|
# FindSZIP
|
2015-08-21 01:03:29 +08:00
|
|
|
|
|
|
|
# Find the native SZIP includes and library
|
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# Imported targets
|
|
|
|
##################
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# This module defines the following :prop_tgt:`IMPORTED` targets:
|
2015-08-21 01:03:29 +08:00
|
|
|
#
|
2019-06-18 20:46:25 +08:00
|
|
|
# SZIP::SZIP
|
|
|
|
# The SZIP library, if found.
|
2015-08-21 01:03:29 +08:00
|
|
|
#
|
2019-06-18 20:46:25 +08:00
|
|
|
# Result variables
|
|
|
|
###################
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-19 06:10:46 +08:00
|
|
|
# This module will set the following variables in your project:
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# SZIP_FOUND, true if the SZIP headers and libraries were found.
|
|
|
|
# SZIP_INCLUDE_DIR, the directory containing the SZIP headers.
|
|
|
|
# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers.
|
|
|
|
# SZIP_LIBRARIES, libraries to link against to use SZIP.
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# Cache variables
|
|
|
|
#################
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# The following variables may also be set:
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# SZIP_LIBRARY, where to find the SZIP library.
|
|
|
|
# SZIP_LIBRARY_DEBUG - Debug version of SZIP library
|
|
|
|
# SZIP_LIBRARY_RELEASE - Release Version of SZIP library
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
# message (STATUS "Finding SZIP library and headers..." )
|
|
|
|
#########################################################################
|
2015-08-21 01:03:29 +08:00
|
|
|
|
2019-06-18 20:46:25 +08:00
|
|
|
|
|
|
|
find_path(SZIP_INCLUDE_DIR szlib.h)
|
|
|
|
|
|
|
|
set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static)
|
|
|
|
foreach(name ${szip_names})
|
2020-02-22 06:16:06 +08:00
|
|
|
list (APPEND szip_names_debug "${name}d")
|
2019-06-18 20:46:25 +08:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(NOT SZIP_LIBRARY)
|
|
|
|
find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names})
|
|
|
|
find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug})
|
2019-07-10 23:32:43 +08:00
|
|
|
include(SelectLibraryConfigurations)
|
2019-06-18 20:46:25 +08:00
|
|
|
select_library_configurations(SZIP)
|
|
|
|
mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG)
|
|
|
|
endif()
|
|
|
|
unset(szip_names)
|
|
|
|
unset(szip_names_debug)
|
|
|
|
|
|
|
|
if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h")
|
|
|
|
file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str
|
|
|
|
REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*")
|
|
|
|
|
|
|
|
string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*"
|
|
|
|
"\\1" SZIP_VERSION "${szip_version_str}")
|
|
|
|
unset(szip_version_str)
|
|
|
|
endif()
|
|
|
|
|
2019-07-13 23:11:49 +08:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2019-06-18 20:46:25 +08:00
|
|
|
find_package_handle_standard_args(SZIP
|
|
|
|
REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR
|
|
|
|
VERSION_VAR SZIP_VERSION)
|
|
|
|
|
|
|
|
if(SZIP_FOUND)
|
|
|
|
set(SZIP_LIBRARIES ${SZIP_LIBRARY})
|
|
|
|
set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}")
|
|
|
|
|
|
|
|
if(NOT TARGET SZIP::SZIP)
|
|
|
|
add_library(SZIP::SZIP UNKNOWN IMPORTED)
|
|
|
|
if(SZIP_INCLUDE_DIRS)
|
|
|
|
set_target_properties(SZIP::SZIP PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${SZIP_LIBRARY}")
|
|
|
|
set_target_properties(SZIP::SZIP PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${SZIP_LIBRARY}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${SZIP_LIBRARY_RELEASE}")
|
|
|
|
set_property(TARGET SZIP::SZIP APPEND PROPERTY
|
|
|
|
IMPORTED_CONFIGURATIONS RELEASE)
|
|
|
|
set_target_properties(SZIP::SZIP PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
|
|
|
IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${SZIP_LIBRARY_DEBUG}")
|
|
|
|
set_property(TARGET SZIP::SZIP APPEND PROPERTY
|
|
|
|
IMPORTED_CONFIGURATIONS DEBUG)
|
|
|
|
set_target_properties(SZIP::SZIP PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
|
|
|
IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR)
|
2015-08-21 01:03:29 +08:00
|
|
|
|
|
|
|
# Report the results.
|
|
|
|
if (NOT SZIP_FOUND)
|
|
|
|
set (SZIP_DIR_MESSAGE
|
|
|
|
"SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable."
|
|
|
|
)
|
|
|
|
if (NOT SZIP_FIND_QUIETLY)
|
|
|
|
message (STATUS "${SZIP_DIR_MESSAGE}")
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2015-08-21 01:03:29 +08:00
|
|
|
if (SZIP_FIND_REQUIRED)
|
|
|
|
message (FATAL_ERROR "SZip was NOT found and is Required by this project")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|