Commit 90c03440 authored by Ramon Nou's avatar Ramon Nou
Browse files

modified FindZstd

parent 1546e490
Loading
Loading
Loading
Loading
Loading
+27 −8
Original line number Diff line number Diff line
@@ -31,17 +31,36 @@
# Standard names to search for
set(ZStd_NAMES zstd zstd_static)

if (NOT PKG_CONFIG_FOUND)
    find_package(PkgConfig)
endif ()

if (PKG_CONFIG_FOUND)
    pkg_check_modules(PC_ZSTD QUIET libzstd)

    find_path(ZStd_INCLUDE_DIR
              NAMES zstd.h
              PATHS ${PC_ZSTD_INCLUDE_DIRS}
              PATH_SUFFIXES include)

# Allow ZStd_LIBRARY to be set manually, as the location of the zstd library
if(NOT ZStd_LIBRARY)
    find_library(ZStd_LIBRARY_RELEASE
                 NAMES ${ZStd_NAMES}
                 PATHS ${PC_ZSTD_LIBRARY_DIRS}
                 PATH_SUFFIXES lib)

    set(ZStd_VERSION_STRING ${PC_ZSTD_VERSION})
else()
    find_path(ZStd_INCLUDE_DIR
              NAMES zstd.h
              PATH_SUFFIXES include)

    find_library(ZStd_LIBRARY_RELEASE
                 NAMES ${ZStd_NAMES}
                 PATH_SUFFIXES lib)
endif()

# Allow ZStd_LIBRARY to be set manually, as the location of the zstd library
if(NOT ZStd_LIBRARY)
  include(SelectLibraryConfigurations)
  select_library_configurations(ZStd)
endif()