File: FindVorbis.cmake

package info (click to toggle)
libsfml 3.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,704 kB
  • sloc: cpp: 52,754; ansic: 24,944; objc: 668; sh: 172; xml: 25; makefile: 18
file content (69 lines) | stat: -rw-r--r-- 2,505 bytes parent folder | download
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
#
# Try to find Ogg/Vorbis libraries and include paths.
# Once done this will define
#
# VORBIS_FOUND
# VORBIS_INCLUDE_DIRS
# VORBIS_LIBRARIES
#

find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)

find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
find_library(VORBISENC_LIBRARY NAMES vorbisenc)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(Vorbis DEFAULT_MSG
    OGG_INCLUDE_DIR
    OGG_LIBRARY
    VORBIS_INCLUDE_DIR
    VORBIS_LIBRARY)
mark_as_advanced(
    OGG_INCLUDE_DIR
    OGG_LIBRARY
    VORBIS_INCLUDE_DIR
    VORBIS_LIBRARY
    VORBISFILE_LIBRARY
    VORBISENC_LIBRARY)

add_library(Ogg::ogg IMPORTED UNKNOWN)
set_target_properties(Ogg::ogg PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${OGG_INCLUDE_DIR})
if(OGG_LIBRARY MATCHES "/([^/]+)\\.framework$")
    set_target_properties(Ogg::ogg PROPERTIES IMPORTED_LOCATION ${OGG_LIBRARY}/${CMAKE_MATCH_1})
else()
    set_target_properties(Ogg::ogg PROPERTIES IMPORTED_LOCATION ${OGG_LIBRARY})
endif()

add_library(Vorbis::vorbis IMPORTED UNKNOWN)
set_target_properties(Vorbis::vorbis PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES ${VORBIS_INCLUDE_DIR}
    INTERFACE_LINK_LIBRARIES Ogg::ogg)
if(VORBIS_LIBRARY MATCHES "/([^/]+)\\.framework$")
    set_target_properties(Vorbis::vorbis PROPERTIES IMPORTED_LOCATION ${VORBIS_LIBRARY}/${CMAKE_MATCH_1})
else()
    set_target_properties(Vorbis::vorbis PROPERTIES IMPORTED_LOCATION ${VORBIS_LIBRARY})
endif()

if(VORBISFILE_LIBRARY)
    add_library(Vorbis::vorbisfile IMPORTED UNKNOWN)
    set_target_properties(Vorbis::vorbisfile PROPERTIES INTERFACE_LINK_LIBRARIES Vorbis::vorbis)
    if(VORBISFILE_LIBRARY MATCHES "/([^/]+)\\.framework$")
        set_target_properties(Vorbis::vorbisfile PROPERTIES IMPORTED_LOCATION ${VORBISFILE_LIBRARY}/${CMAKE_MATCH_1})
    else()
        set_target_properties(Vorbis::vorbisfile PROPERTIES IMPORTED_LOCATION ${VORBISFILE_LIBRARY})
    endif()
endif()

if(VORBISENC_LIBRARY)
    add_library(Vorbis::vorbisenc IMPORTED UNKNOWN)
    set_target_properties(Vorbis::vorbisenc PROPERTIES INTERFACE_LINK_LIBRARIES Vorbis::vorbis)
    if(VORBISENC_LIBRARY MATCHES "/([^/]+)\\.framework$")
        set_target_properties(Vorbis::vorbisenc PROPERTIES IMPORTED_LOCATION ${VORBISENC_LIBRARY}/${CMAKE_MATCH_1})
    else()
        set_target_properties(Vorbis::vorbisenc PROPERTIES IMPORTED_LOCATION ${VORBISENC_LIBRARY})
    endif()
endif()