Make example programs optional.
[libam7xxx.git] / examples / CMakeLists.txt
1 add_definitions("-D_POSIX_C_SOURCE=2") # for getopt()
2 add_definitions("-D_POSIX_SOURCE") # for sigaction
3 add_definitions("-D_BSD_SOURCE") # for strdup
4
5 include_directories(${CMAKE_SOURCE_DIR}/src/)
6
7 # Build a test app that sends a single picture
8 option(BUILD_PICOPROJ "Build a test app that sends a single picture" TRUE)
9 if(BUILD_PICOPROJ)
10   add_executable(picoproj picoproj.c)
11   target_link_libraries(picoproj am7xxx)
12   install(TARGETS picoproj
13     DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
14 endif()
15
16 # Build a more complete example
17 option(BUILD_AM7XXX-PLAY "Build a more complete example: am7xxx-play" TRUE)
18 if(BUILD_AM7XXX-PLAY)
19   find_package(FFmpeg REQUIRED)
20
21   include_directories(${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS})
22   include_directories(${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
23   include_directories(${FFMPEG_LIBSWSCALE_INCLUDE_DIRS})
24
25   # xcb is used to retrieve the full screen dimensions when using x11grab
26   # as input format
27   find_package(XCB)
28   if (XCB_FOUND)
29     add_definitions("${LIBXCB_DEFINITIONS} -DHAVE_XCB")
30     include_directories(${LIBXCB_INCLUDE_DIRS})
31   endif()
32
33   add_executable(am7xxx-play am7xxx-play.c)
34
35   target_link_libraries(am7xxx-play am7xxx
36     ${FFMPEG_LIBRARIES}
37     ${FFMPEG_LIBSWSCALE_LIBRARIES}
38     ${LIBXCB_LIBRARIES})
39   install(TARGETS am7xxx-play
40     DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
41 endif()