File: FindFLAC.cmake

package info (click to toggle)
audacity 3.7.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 125,252 kB
  • sloc: cpp: 358,238; ansic: 75,458; lisp: 7,761; sh: 3,410; python: 1,503; xml: 1,385; perl: 854; makefile: 122
file content (68 lines) | stat: -rw-r--r-- 1,623 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
67
68
#[[
A module to look for FLAC
]]

if( NOT FLAC_FOUND )
   include( FindPackageHandleStandardArgs )

   find_package( Ogg QUIET )

   find_package( PkgConfig QUIET )
   pkg_check_modules( PC_FLAC QUIET flac >= 1.3.1 )

   find_path( FLAC_INCLUDE_DIR FLAC/stream_decoder.h
      HINTS
		   ${PC_FLAC_INCLUDE_DIRS}
         ${FLAC_ROOT}
   )

   find_library( FLAC_LIBRARIES
      NAMES
         FLAC
         FLAC_static
      HINTS
         ${PC_FLAC_LIBRARY_DIRS}
         ${FLAC_ROOT}
   )

   find_path( FLACPP_INCLUDE_DIR FLAC++/decoder.h
      HINTS
		   ${PC_FLAC_INCLUDE_DIRS}
         ${FLAC_ROOT}
   )

   find_library( FLACPP_LIBRARIES
      NAMES
         FLAC++
         FLAC++_static
      HINTS
         ${PC_FLAC_LIBRARY_DIRS}
         ${FLAC_ROOT}
   )

   find_package_handle_standard_args( FLAC DEFAULT_MSG Ogg_FOUND FLAC_INCLUDE_DIR FLAC_LIBRARIES )

   if( FLAC_FOUND )
      if( NOT TARGET FLAC::FLAC )
         add_library( FLAC::FLAC INTERFACE IMPORTED GLOBAL )

         target_include_directories( FLAC::FLAC INTERFACE ${FLAC_INCLUDE_DIR} )
         target_link_libraries( FLAC::FLAC INTERFACE ${FLAC_LIBRARIES} Ogg::ogg )
      endif()

      if( NOT TARGET FLAC::FLAC++ )
         add_library( FLAC::FLAC++ INTERFACE IMPORTED GLOBAL )

         target_include_directories( FLAC::FLAC++ INTERFACE ${FLACPP_INCLUDE_DIR} )
         target_link_libraries( FLAC::FLAC++ INTERFACE ${FLACPP_LIBRARIES} FLAC::FLAC)
      endif()

      mark_as_advanced(
         FLAC_FOUND
         FLAC_INCLUDE_DIR
         FLAC_LIBRARIES
         FLACPP_INCLUDE_DIR
         FLACPP_LIBRARIES
      )
   endif()
endif()