2
0

FindZstd.cmake 730 B

12345678910111213141516171819202122232425
  1. mark_as_advanced(ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
  2. find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
  3. find_library(ZSTD_LIBRARY NAMES zstd)
  4. if(ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
  5. # Check that the API we use exists
  6. include(CheckSymbolExists)
  7. unset(HAVE_ZSTD_INITCSTREAM CACHE)
  8. set(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
  9. set(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
  10. check_symbol_exists(ZSTD_initCStream zstd.h HAVE_ZSTD_INITCSTREAM)
  11. unset(CMAKE_REQUIRED_INCLUDES)
  12. unset(CMAKE_REQUIRED_LIBRARIES)
  13. if(NOT HAVE_ZSTD_INITCSTREAM)
  14. unset(ZSTD_INCLUDE_DIR CACHE)
  15. unset(ZSTD_LIBRARY CACHE)
  16. endif()
  17. endif()
  18. include(FindPackageHandleStandardArgs)
  19. find_package_handle_standard_args(Zstd DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)