~ubuntu-branches/ubuntu/wily/pianobar/wily-proposed

« back to all changes in this revision

Viewing changes to src/CMakeLists.txt

  • Committer: Bazaar Package Importer
  • Author(s): Luke Faraone
  • Date: 2010-10-07 09:15:49 UTC
  • mfrom: (1.3.1 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101007091549-sscxdr1kud0d4hyl
Tags: 2010.10.07-1
* New upstream version. 
  - XMLRPC api version bump (v28) (closes: #599338)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
2
 
set (CMAKE_C_FLAGS -Wall)
3
 
set (ENABLE_MAD 0)
4
 
set (ENABLE_FAAD 0)
5
 
set (BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bin path")
6
 
set (MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man CACHE PATH "man path")
7
 
 
8
 
# This removes a warning on newer versions of cmake
9
 
if(COMMAND cmake_policy)
10
 
  cmake_policy(SET CMP0003 NEW)
11
 
endif(COMMAND cmake_policy)
12
 
 
13
 
option (USE_FAAD "Use libfaad for aac decoding (if available)" on)
14
 
option (USE_MAD "Use libmad for mp3 decoding (if available)" on)
15
 
 
16
 
find_package (LibAo REQUIRED)
17
 
 
18
 
# find threading implementation
19
 
find_package (Threads REQUIRED)
20
 
if (NOT CMAKE_USE_PTHREADS_INIT)
21
 
        message (FATAL_ERROR "pthread is currently required")
22
 
endif (NOT CMAKE_USE_PTHREADS_INIT)
23
 
 
24
 
# check for libm
25
 
find_library (LIBM m)
26
 
if (NOT LIBM)
27
 
        message (FATAL_ERROR "libm is required")
28
 
endif (NOT LIBM)
29
 
 
30
 
# check for audio decoding library
31
 
find_package (Faad)
32
 
find_package (Mad)
33
 
 
34
 
if (FAAD_FOUND AND USE_FAAD)
35
 
        message (STATUS "Found libfaad, enabling aac decoding")
36
 
        set (ENABLE_FAAD 1)
37
 
elseif (FAAD_FOUND AND NOT USE_FAAD)
38
 
        message (STATUS "Found libfaad, but disabling aac decoding by request")
39
 
elseif (NOT FAAD_FOUND AND USE_FAAD)
40
 
        message (STATUS "libfaad not found but requested")
41
 
endif (FAAD_FOUND AND USE_FAAD)
42
 
 
43
 
if (MAD_FOUND AND USE_MAD)
44
 
        message (STATUS "Found libmad, enabling mp3 decoding")
45
 
        set (ENABLE_MAD 1)
46
 
elseif (MAD_FOUND AND NOT USE_MAD)
47
 
        message (STATUS "Found libmad, but disabling mp3 decoding by request")
48
 
elseif (NOT MAD_FOUND AND USE_MAD)
49
 
        message (STATUS "libmad not found but requested")
50
 
endif (MAD_FOUND AND USE_MAD)
51
 
 
52
 
# check whether faad and/or mad are available and enabled
53
 
if (NOT ENABLE_FAAD AND NOT ENABLE_MAD)
54
 
        message (FATAL_ERROR "libmad and/or libfaad are required.")
55
 
endif (NOT ENABLE_FAAD AND NOT ENABLE_MAD)
56
 
 
57
 
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
58
 
        ${CMAKE_CURRENT_BINARY_DIR}/config.h)
59
 
 
60
 
include_directories (
61
 
        ${pianobar_SOURCE_DIR}/libpiano/src
62
 
        ${pianobar_SOURCE_DIR}/libwaitress/src
63
 
        ${CMAKE_CURRENT_BINARY_DIR}
64
 
        ${FAAD_INCLUDE_DIRS} ${LIBAO_INCLUDE_DIRS}
65
 
        ${MAD_INCLUDE_DIRS})
66
 
 
67
 
add_executable (pianobar main.c terminal.c settings.c player.c ui.c ui_act.c
68
 
        ui_readline.c)
69
 
target_link_libraries (pianobar piano waitress ${FAAD_LIBRARIES}
70
 
        ${LIBAO_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MAD_LIBRARIES} ${LIBM})
71
 
 
72
 
install (TARGETS pianobar RUNTIME DESTINATION ${BIN_INSTALL_DIR})
73
 
install (FILES pianobar.1 DESTINATION ${MAN_INSTALL_DIR}/man1)