File: FindVorbisEnc.cmake

package info (click to toggle)
colobot 0.2.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 415,536 kB
  • sloc: cpp: 129,246; ansic: 8,872; python: 2,158; sh: 672; awk: 91; xml: 35; makefile: 31
file content (66 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# - Find vorbisenc
# Find the native vorbisenc includes and libraries
#
#  VORBISENC_INCLUDE_DIRS - where to find vorbisenc.h, etc.
#  VORBISENC_LIBRARIES    - List of libraries when using vorbisenc.
#  VORBISENC_FOUND        - True if vorbisenc found.

# From https://github.com/erikd/libsndfile/

if (VORBISENC_INCLUDE_DIR)
	# Already in cache, be silent
	set (VORBISENC_FIND_QUIETLY TRUE)
endif ()

find_package (Vorbis QUIET)

find_package (PkgConfig QUIET)
pkg_check_modules (PC_VORBISENC QUIET vorbisenc)

set (VORBISENC_VERSION ${PC_VORBISENC_VERSION})

find_path (VORBISENC_INCLUDE_DIR vorbis/vorbisenc.h
	HINTS
		${PC_VORBISENC_INCLUDEDIR}
		${PC_VORBISENC_INCLUDE_DIRS}
		${VORBISENC_ROOT}
	)

find_library (VORBISENC_LIBRARY
	NAMES
		vorbisenc
		vorbisenc_static
		libvorbisenc
		libvorbisenc_static
	HINTS
		${PC_VORBISENC_LIBDIR}
		${PC_VORBISENC_LIBRARY_DIRS}
		${VORBISENC_ROOT}
	)

# Handle the QUIETLY and REQUIRED arguments and set VORBISENC_FOUND
# to TRUE if all listed variables are TRUE.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (VorbisEnc
	REQUIRED_VARS
		VORBISENC_LIBRARY
		VORBISENC_INCLUDE_DIR
		VORBIS_FOUND
	VERSION_VAR
        VORBISENC_VERSION
	)

if (VORBISENC_FOUND)
	set (VORBISENC_INCLUDE_DIRS ${VORBISENC_INCLUDE_DIR})
	set (VORBISENC_LIBRARIES ${VORBISENC_LIBRARY} ${VORBIS_LIBRARIES})
    if (NOT TARGET Vorbis::VorbisEnc)
		add_library (Vorbis::VorbisEnc UNKNOWN IMPORTED)
		set_target_properties (Vorbis::VorbisEnc PROPERTIES
			INTERFACE_INCLUDE_DIRECTORIES "${VORBISENC_INCLUDE_DIR}"
			IMPORTED_LOCATION "${VORBISENC_LIBRARY}"
			INTERFACE_LINK_LIBRARIES Vorbis::vorbis
		)
	endif ()
endif ()

mark_as_advanced (VORBISENC_INCLUDE_DIR VORBISENC_LIBRARY)