FindZstd.cmake 846 Bytes
Newer Older
1
2
find_path(Zstd_INCLUDE_DIRS zstd.h
  PATHS /usr/local/include /usr/include)
3
4


5
6
find_library(Zstd_LIBRARY NAMES zstd
  HINTS /usr/lib /usr/local/lib)
7

8
if(Zstd_INCLUDE_DIRS AND Zstd_LIBRARY)
9

10
11
  mark_as_advanced(Zstd_INCLUDE_DIRS)
  mark_as_advanced(Zstd_LIBRARY)
12

13
  set(Zstd_FOUND TRUE)
14

15
endif()
16

17
if(Zstd_FOUND)
18

19
20
21
  if(NOT Zstd_FIND_QUIETLY)
    message(STATUS "Found Zstd_LIBRARY: ${Zstd_LIBRARY}")
  endif()
22

23
  if(NOT TARGET Zstd::Zstd)
24

25
    add_library(Zstd::Zstd UNKNOWN IMPORTED)
26

27
28
29
    set_target_properties(Zstd::Zstd PROPERTIES
      IMPORTED_LOCATION             "${Zstd_LIBRARY}"
      INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIRS}")
30

31
  endif()
32
33
34

else()

35
  if(Zstd_FIND_REQUIRED)
36

37
38
    message(FATAL_ERROR "Could not find libzstd. Please do specify the
    Zstd_INCLUDE_DIRS and Zstd_LIBRARY variables using cmake!")
39

40
  endif()
41
42

endif()
43