blob: b8ab75b8affd5a5d684eddcdb29391104e72993f (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# This file is part of Mixxx, Digital DJ'ing software.
# Copyright (C) 2001-2020 Mixxx Development Team
# Distributed under the GNU General Public Licence (GPL) version 2 or any later
# later version. See the LICENSE file for details.
#[=======================================================================[.rst:
FindSndFile
-----------
Finds the SndFile library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``SndFile::SndFile``
The SndFile library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``SndFile_FOUND``
True if the system has the SndFile library.
``SndFile_INCLUDE_DIRS``
Include directories needed to use SndFile.
``SndFile_LIBRARIES``
Libraries needed to link to SndFile.
``SndFile_DEFINITIONS``
Compile definitions needed to use SndFile.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``SndFile_INCLUDE_DIR``
The directory containing ``sndfile.h``.
``SndFile_LIBRARY``
The path to the SndFile library.
#]=======================================================================]
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_SndFile QUIET sndfile)
endif()
find_path(SndFile_INCLUDE_DIR
NAMES sndfile.h
PATHS ${PC_SndFile_INCLUDE_DIRS}
PATH_SUFFIXES sndfile
DOC "SndFile include directory")
mark_as_advanced(SndFile_INCLUDE_DIR)
find_library(SndFile_LIBRARY
NAMES sndfile sndfile-1
PATHS ${PC_SndFile_LIBRARY_DIRS}
DOC "SndFile library"
)
mark_as_advanced(SndFile_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
SndFile
DEFAULT_MSG
SndFile_LIBRARY
SndFile_INCLUDE_DIR
)
file(STRINGS "${SndFile_INCLUDE_DIR}/sndfile.h" SndFile_SUPPORTS_SET_COMPRESSION_LEVEL REGEX ".*SFC_SET_COMPRESSION_LEVEL.*")
if(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL)
set(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL ON)
else()
set(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL OFF)
endif()
mark_as_advanced(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL)
if(SndFile_FOUND)
set(SndFile_LIBRARIES "${SndFile_LIBRARY}")
set(SndFile_INCLUDE_DIRS "${SndFile_INCLUDE_DIR}")
set(SndFile_DEFINITIONS ${PC_SndFile_CFLAGS_OTHER})
if(NOT TARGET SndFile::sndfile)
add_library(SndFile::sndfile UNKNOWN IMPORTED)
set_target_properties(SndFile::sndfile
PROPERTIES
IMPORTED_LOCATION "${SndFile_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}"
)
endif()
endif()
|