Merge branch 'cmake-fixes'
[qtgstreamer:qtgstreamer.git] / CMakeLists.txt
1 project(QtGstreamer)
2 cmake_minimum_required(VERSION 2.6)
3 enable_testing()
4
5 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
6 set(BUILDING_QTGSTREAMER TRUE)
7 set(QTGSTREAMER_VERSION 0.1)
8 set(QTGSTREAMER_SOVERSION 0)
9
10 option(QTGSTREAMER_STATIC "Build QtGStreamer as a static library" ON)
11 option(QTGSTREAMER_TESTS "Build QtGStreamer's tests" OFF)
12 option(QTGSTREAMER_EXAMPLES "Build QtGStreamer's examples" ON)
13
14 find_package(Qt4 COMPONENTS QtCore QtGui QtTest REQUIRED)
15 find_package(QtGstreamer REQUIRED)
16 find_package(Automoc4 REQUIRED)
17 find_package(GStreamer REQUIRED)
18 find_package(GStreamerPlugins)
19 find_package(GLIB2 REQUIRED)
20 find_package(GObject REQUIRED)
21 find_package(FLEX REQUIRED)
22 find_package(BISON REQUIRED)
23
24 if (${GSTREAMER_VERSION} VERSION_LESS "0.10.30")
25     message(FATAL_ERROR "QtGstreamer requires Gstreamer >= 0.10.30")
26 endif()
27
28 if (CMAKE_COMPILER_IS_GNUCXX)
29     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security -Wundef -Wpointer-arith -Wcast-align -fno-common")
30 endif ()
31
32 add_subdirectory(codegen)
33 add_subdirectory(src)
34 add_subdirectory(elements)
35
36 if (QTGSTREAMER_TESTS)
37     add_subdirectory(tests)
38 endif()
39
40 if (QTGSTREAMER_EXAMPLES)
41     add_subdirectory(examples)
42 endif()
43
44 # Add uninstall target. Taken from the KDE4 scripts
45 configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
46 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
47
48 # Add doc target
49 include(UseDoxygen)