diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2013-06-09 11:38:28 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2013-06-09 19:20:26 +0300 |
commit | ad7e163fc7ec1548c52b04297febfbf8eecbf15f (patch) | |
tree | 5d0a59d5c25009399ede268a8c55b4c9e3320ea2 /cmake | |
parent | 9c1df56f4b2d7ac47371e7d6b44885e9e4ea18eb (diff) |
cmake: Improve QtGStreamerConfig.cmake
* Honor QUIET
* Fail when dependencies are not found, without using the nasty REQUIRED keyword
* Unset useless variables when done
* Do not require Qt5Widgets as a dependency
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/QtGStreamerConfig.cmake.in | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/cmake/modules/QtGStreamerConfig.cmake.in b/cmake/modules/QtGStreamerConfig.cmake.in index 9fa50cb..1a01629 100644 --- a/cmake/modules/QtGStreamerConfig.cmake.in +++ b/cmake/modules/QtGStreamerConfig.cmake.in @@ -8,6 +8,7 @@ get_filename_component(_QTGSTREAMER_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH find_file(_QTGSTREAMER_TARGETS_FILE @QTGSTREAMER_PACKAGE_NAME@Targets.cmake PATHS ${_QTGSTREAMER_CONFIG_DIR} NO_DEFAULT_PATH) include(${_QTGSTREAMER_TARGETS_FILE}) +unset(_QTGSTREAMER_TARGETS_FILE) set(QTGLIB_LIBRARY @QTGLIB_LIBRARY@) set(QTGSTREAMER_LIBRARY @QTGSTREAMER_LIBRARY@) @@ -15,25 +16,57 @@ set(QTGSTREAMER_UI_LIBRARY @QTGSTREAMER_UI_LIBRARY@) set(QTGSTREAMER_UTILS_LIBRARY @QTGSTREAMER_UTILS_LIBRARY@) set_and_check(QTGSTREAMER_INCLUDE_DIR @PACKAGE_QTGSTREAMER_INCLUDES_INSTALL_DIR@) +if (@QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET) + set(_QTGSTREAMER_FIND_DEPS_ARGS QUIET) +endif() + # Find dependencies, if not already found if ("@QTGSTREAMER_PACKAGE_NAME@" STREQUAL "Qt5GStreamer") - if (NOT DEFINED Qt5Widgets_INCLUDE_DIRS) - message(STATUS "Qt5 hasn't been found yet. Looking...") - find_package(Qt5Widgets) + if (NOT DEFINED Qt5Core_INCLUDE_DIRS) + if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET) + message(STATUS "Qt5 hasn't been found yet. Looking...") + endif() + + find_package(Qt5Core ${_QTGSTREAMER_FIND_DEPS_ARGS}) + + # import targets for linking to QtGStreamerUi, but don't fail + # if they are not found. One may only want QtGStreamer (no Ui). + find_package(Qt5Widgets QUIET) + + if (NOT Qt5Core_FOUND) + set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE) + endif() endif() else() if (NOT DEFINED QT_INCLUDE_DIR) - message(STATUS "Qt4 hasn't been found yet. Looking...") - find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED) + if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET) + message(STATUS "Qt4 hasn't been found yet. Looking...") + endif() + + find_package(Qt4 COMPONENTS QtCore ${_QTGSTREAMER_FIND_DEPS_ARGS}) + + if (NOT Qt4_FOUND) + set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE) + endif() endif() endif() if (NOT DEFINED Boost_INCLUDE_DIRS) - message(STATUS "Boost hasn't been found yet. Looking...") - find_package(Boost REQUIRED) + if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET) + message(STATUS "Boost hasn't been found yet. Looking...") + endif() + + find_package(Boost ${_QTGSTREAMER_FIND_DEPS_ARGS}) + + if (NOT Boost_FOUND) + set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE) + endif() endif() +unset(_QTGSTREAMER_FIND_DEPS_ARGS) + # include QtGStreamerConfigCommon.cmake from the same directory find_file(_QTGSTREAMER_CONFIG_COMMON_FILE QtGStreamerConfigCommon.cmake PATHS ${_QTGSTREAMER_CONFIG_DIR} NO_DEFAULT_PATH) include(${_QTGSTREAMER_CONFIG_COMMON_FILE}) +unset(_QTGSTREAMER_CONFIG_COMMON_FILE) |