summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake27
1 files changed, 19 insertions, 8 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 6e6b802..3cbb7af 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -1,15 +1,17 @@
# - a pkg-config module for CMake
#
# Usage:
-# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
+# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for all the given modules
#
-# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
+# pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for given modules and uses the first working one
#
# When the 'REQUIRED' argument was set, macros will fail with an error
# when module(s) could not be found
#
+# When the 'QUIET' argument is set, no status messages will be printed.
+#
# It sets the following variables:
# PKG_CONFIG_FOUND ... true if pkg-config works on the system
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
@@ -138,17 +140,22 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro(_pkgconfig_invoke_dyn)
# Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req)
+macro(_pkgconfig_parse_options _result _is_req _is_silent)
set(${_is_req} 0)
+ set(${_is_silent} 0)
foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED")
set(${_is_req} 1)
endif (_pkg STREQUAL "REQUIRED")
+ if (_pkg STREQUAL "QUIET")
+ set(${_is_silent} 1)
+ endif (_pkg STREQUAL "QUIET")
endforeach(_pkg ${ARGN})
set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED")
+ list(REMOVE_ITEM ${_result} "QUIET")
endmacro(_pkgconfig_parse_options)
###
@@ -279,7 +286,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
- message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ if (NOT ${_is_silent})
+ message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ endif (NOT ${_is_silent})
endforeach(_pkg_check_modules_pkg)
# set variables which are combined for multiple modules
@@ -307,8 +316,8 @@ endmacro(_pkg_check_modules_internal)
macro(pkg_check_modules _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
- _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
- _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
+ _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
+ _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
@@ -319,9 +328,11 @@ macro(pkg_search_module _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
- _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
- message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+ if (NOT ${_pkg_is_silent})
+ message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+ endif (NOT ${_pkg_is_silent})
# iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt})