FindZstd.cmake 966 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#sudo apt install libzstd-dev


set(Zstd_FOUND FALSE)

find_path(Zstd_INCLUDE_DIR zstd.h
	PATHS /usr/local/include /usr/include
	PATH_SUFFIXES libzstd ENV PATH)


find_library(Zstd_LIBRARY NAMES zstd)


if(Zstd_INCLUDE_DIR AND Zstd_LIBRARY)

	mark_as_advanced(Zstd_INCLUDE_DIR)
	mark_as_advanced(Zstd_LIBRARY)

	message(STATUS "~~~~~~~~~~~~~ ${_LIBRARY} ~~~~~~~~~~~~~~~")

	set(Zstd_FOUND TRUE)

endif()


if(Zstd_FOUND)


    set(Zstd_INCLUDE_DIRS ${Zstd_INCLUDE_DIR})
    set(Zstd_LIBRARIES ${Zstd_LIBRARY})
    if(NOT TARGET Zstd::Zstd)
        add_library(Zstd::Zstd UNKNOWN IMPORTED)
        set_target_properties(Zstd::Zstd PROPERTIES
            IMPORTED_LOCATION             "${Zstd_LIBRARY}"
            INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIR}")
    endif()

else()

	if(Zstd_FIND_REQUIRED)

		message(FATAL_ERROR "Could not find Zstd_LIBRARY. Please do specify the
		Zstd_INCLUDE_DIR and Zstd_LIBRARY variables using cmake!")

	endif()

endif()