diff options
author | Aurélien Gâteau <agateau@kde.org> | 2014-03-04 16:51:08 +0100 |
---|---|---|
committer | Aurélien Gâteau <agateau@kde.org> | 2014-03-05 09:59:42 +0100 |
commit | a5e59578725c79cd8f46e261a910223b1d36a738 (patch) | |
tree | 08b5b116a1ec21ee3d0de275e2ce5c403f98d86d /find-modules | |
parent | 3b5c422eff53161b52c8b6549471cd6209af6a24 (diff) | |
download | extra-cmake-modules-a5e59578725c79cd8f46e261a910223b1d36a738.tar.gz extra-cmake-modules-a5e59578725c79cd8f46e261a910223b1d36a738.tar.bz2 |
Check versions for individual components
First part of the diff makes sure find_package_handle_standard_args()
gets a version number to check against.
Second part ensures we get proper results from pkg-config even if not all
components are available. find_package(Wayland COMPONENTS Client Egl)
was failing for me because I have Client installed but not Egl, causing
pkg_check_modules() to not set any PKG_Wayland_${comp} variable.
REVIEW: 116598
Diffstat (limited to 'find-modules')
-rw-r--r-- | find-modules/FindWayland.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/find-modules/FindWayland.cmake b/find-modules/FindWayland.cmake index 21014fc4..a121de9f 100644 --- a/find-modules/FindWayland.cmake +++ b/find-modules/FindWayland.cmake @@ -128,6 +128,7 @@ macro(_wayland_handle_component _comp) set(Wayland_VERSION_STRING ${Wayland_${_comp}_VERSION_STRING}) endif() + set(Wayland_${_comp}_FIND_VERSION "${Wayland_FIND_VERSION}") find_package_handle_standard_args(Wayland_${_comp} FOUND_VAR Wayland_${_comp}_FOUND @@ -158,7 +159,13 @@ if(NOT WIN32) # Use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PKG_Wayland QUIET ${pkgConfigModules}) + # Invoke pkg_check_modules() in a loop because if we call it like this: + # pkg_check_modules(PKG_Wayland QUIET ${pkgConfigModules}) + # and one of the components cannot be found, then it won't set any variable + # at all. + foreach(comp ${pkgConfigModules}) + pkg_check_modules(PKG_Wayland_${comp} QUIET ${comp}) + endforeach() set(Wayland_DEFINITIONS ${PKG_Wayland_CFLAGS_OTHER}) |