aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25fd546d..8e0f9dae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@ INCLUDE(CheckSymbolExists)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckTypeSize)
+INCLUDE(FindPkgConfig)
PROJECT(OpenAL C)
@@ -56,6 +57,8 @@ OPTION(WERROR "Treat compile warnings as errors" OFF)
OPTION(UTILS "Build and install utility programs" ON)
+OPTION(EXAMPLES "Build and install example programs" ON)
+
OPTION(ALSOFT_CONFIG "Install alsoft.conf configuration file" OFF)
@@ -730,3 +733,20 @@ IF(UTILS)
MESSAGE(STATUS "Building utility programs")
MESSAGE(STATUS "")
ENDIF()
+
+IF(EXAMPLES)
+ PKG_CHECK_MODULES(FFMPEG libavcodec libavformat)
+ IF(FFMPEG_FOUND)
+ ADD_EXECUTABLE(alstream examples/alhelpers.c examples/alffmpeg.c examples/alstream.c)
+ TARGET_LINK_LIBRARIES(alstream ${FFMPEG_LIBRARIES} ${LIBNAME})
+ SET_TARGET_PROPERTIES(alstream PROPERTIES COMPILE_FLAGS "${FFMPEG_CFLAGS}")
+ INSTALL(TARGETS alstream
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION "lib${LIB_SUFFIX}"
+ ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
+ )
+
+ MESSAGE(STATUS "Building ffmpeg example programs")
+ MESSAGE(STATUS "")
+ ENDIF()
+ENDIF()