1b815c7f3Sopenharmony_ci# - Find Speex
2b815c7f3Sopenharmony_ci# Find the native Speex includes and libraries
3b815c7f3Sopenharmony_ci#
4b815c7f3Sopenharmony_ci#	 SPEEX_INCLUDE_DIRS - where to find speex.h, etc.
5b815c7f3Sopenharmony_ci#	 SPEEX_LIBRARIES	- List of libraries when using Speex.
6b815c7f3Sopenharmony_ci#	 SPEEX_FOUND		- True if Speex found.
7b815c7f3Sopenharmony_ci
8b815c7f3Sopenharmony_ciif (SPEEX_INCLUDE_DIR)
9b815c7f3Sopenharmony_ci	set (SPEEX_FIND_QUIETLY TRUE)
10b815c7f3Sopenharmony_ciendif ()
11b815c7f3Sopenharmony_ci
12b815c7f3Sopenharmony_cifind_package (PkgConfig QUIET)
13b815c7f3Sopenharmony_cipkg_check_modules (PC_SPEEX QUIET speex)
14b815c7f3Sopenharmony_ci
15b815c7f3Sopenharmony_ciset (SPEEX_VERSION ${PC_SPEEX_VERSION})
16b815c7f3Sopenharmony_ci
17b815c7f3Sopenharmony_cifind_path (SPEEX_INCLUDE_DIR speex/speex.h
18b815c7f3Sopenharmony_ci	HINTS
19b815c7f3Sopenharmony_ci		${PC_SPEEX_INCLUDEDIR}
20b815c7f3Sopenharmony_ci		${PC_SPEEX_INCLUDE_DIRS}
21b815c7f3Sopenharmony_ci		${SPEEX_ROOT}
22b815c7f3Sopenharmony_ci	)
23b815c7f3Sopenharmony_cifind_library (SPEEX_LIBRARY
24b815c7f3Sopenharmony_ci	NAMES
25b815c7f3Sopenharmony_ci		speex
26b815c7f3Sopenharmony_ci		libspeex
27b815c7f3Sopenharmony_ci	HINTS
28b815c7f3Sopenharmony_ci		${PC_SPEEX_LIBDIR}
29b815c7f3Sopenharmony_ci		${PC_SPEEX_LIBRARY_DIRS}
30b815c7f3Sopenharmony_ci		${SPEEX_ROOT}
31b815c7f3Sopenharmony_ci	)
32b815c7f3Sopenharmony_ci
33b815c7f3Sopenharmony_ciinclude (FindPackageHandleStandardArgs)
34b815c7f3Sopenharmony_cifind_package_handle_standard_args (Speex
35b815c7f3Sopenharmony_ci	REQUIRED_VARS
36b815c7f3Sopenharmony_ci		SPEEX_LIBRARY
37b815c7f3Sopenharmony_ci		SPEEX_INCLUDE_DIR
38b815c7f3Sopenharmony_ci	VERSION_VAR
39b815c7f3Sopenharmony_ci		SPEEX_VERSION
40b815c7f3Sopenharmony_ci	)
41b815c7f3Sopenharmony_ci
42b815c7f3Sopenharmony_ciif (SPEEX_FOUND)
43b815c7f3Sopenharmony_ci	set (SPEEX_LIBRARIES ${SPEEX_LIBRARY})
44b815c7f3Sopenharmony_ci	set (SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR})
45b815c7f3Sopenharmony_ci	
46b815c7f3Sopenharmony_ci	if (NOT TARGET Speex::Speex)
47b815c7f3Sopenharmony_ci		add_library (Speex::Speex UNKNOWN IMPORTED)
48b815c7f3Sopenharmony_ci		set_target_properties (Speex::Speex PROPERTIES
49b815c7f3Sopenharmony_ci			INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIRS}"
50b815c7f3Sopenharmony_ci			IMPORTED_LOCATION "${SPEEX_LIBRARIES}"
51b815c7f3Sopenharmony_ci		)
52b815c7f3Sopenharmony_ci	endif ()
53b815c7f3Sopenharmony_ciendif ()
54b815c7f3Sopenharmony_ci
55b815c7f3Sopenharmony_cimark_as_advanced (SPEEX_INCLUDE_DIR SPEEX_LIBRARY)
56