summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-02-01 16:15:40 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-02-01 16:15:40 +0100
commit31558bdc1b196375fd5e87e13bc62cd4b1ba710a (patch)
tree60aa40d70005e1e7a3b1fa3131107b5e3ca316af
parent0e6ebd5dd953126ccf9d1afdf24059a4f9e90a25 (diff)
downloadpianobar-31558bdc1b196375fd5e87e13bc62cd4b1ba710a.tar.gz
pianobar-31558bdc1b196375fd5e87e13bc62cd4b1ba710a.tar.bz2
pianobar-31558bdc1b196375fd5e87e13bc62cd4b1ba710a.zip
Add cmake switches USE_MAD and USE_FAAD
-rw-r--r--src/CMakeLists.txt31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c7f6998..f871b7b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,10 @@
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_C_FLAGS -Wall)
+set (ENABLE_MAD 0)
+set (ENABLE_FAAD 0)
+
+option (USE_FAAD "Use libfaad for aac decoding (if available)" on)
+option (USE_MAD "Use libmad for mp3 decoding (if available)" on)
find_package (LibXml2 REQUIRED)
find_package (CURL REQUIRED)
@@ -21,17 +26,29 @@ endif (NOT LIBM)
# check for audio decoding library
find_package (Faad)
find_package (Mad)
-if (NOT FAAD_FOUND AND NOT MAD_FOUND)
- message (FATAL_ERROR "libmad and/or libfaad are required.")
-endif (NOT FAAD_FOUND AND NOT MAD_FOUND)
-if (FAAD_FOUND)
+
+if (FAAD_FOUND AND USE_FAAD)
message (STATUS "Found libfaad, enabling aac decoding")
set (ENABLE_FAAD 1)
-endif (FAAD_FOUND)
-if (MAD_FOUND)
+elseif (FAAD_FOUND AND NOT USE_FAAD)
+ message (STATUS "Found libfaad, but disabling aac decoding by request")
+elseif (NOT FAAD_FOUND AND USE_FAAD)
+ message (STATUS "libfaad not found but requested")
+endif (FAAD_FOUND AND USE_FAAD)
+
+if (MAD_FOUND AND USE_MAD)
message (STATUS "Found libmad, enabling mp3 decoding")
set (ENABLE_MAD 1)
-endif (MAD_FOUND)
+elseif (MAD_FOUND AND NOT USE_MAD)
+ message (STATUS "Found libmad, but disabling mp3 decoding by request")
+elseif (NOT MAD_FOUND AND USE_MAD)
+ message (STATUS "libmad not found but requested")
+endif (MAD_FOUND AND USE_MAD)
+
+# check whether faad and/or mad are available and enabled
+if (NOT ENABLE_FAAD AND NOT ENABLE_MAD)
+ message (FATAL_ERROR "libmad and/or libfaad are required.")
+endif (NOT ENABLE_FAAD AND NOT ENABLE_MAD)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)