From 26c0a3c2c5b923fcdd08d26a87e520a58fe6dbb9 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 2 Dec 2016 15:49:10 -0500 Subject: [PATCH] cmake: Check dependencies one by one It was currently done all at once. Therefore, the error message was: CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:415 (message): A required package was not found With no further information besides the full dependency list. With this change, it will print the missing package. Closes https://github.com/awesomeWM/awesome/pull/1253. --- awesomeConfig.cmake | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 0dade3bb..5bcb6ba2 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -115,7 +115,7 @@ endif() pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED xcb>=1.6) -pkg_check_modules(AWESOME_REQUIRED REQUIRED +set(AWESOME_DEPENDENCIES glib-2.0 gdk-pixbuf-2.0 cairo @@ -137,11 +137,20 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED libstartup-notification-1.0>=0.10 xproto>=7.0.15 libxdg-basedir>=1.0.0 - xcb-xrm) + xcb-xrm +) -if(NOT AWESOME_REQUIRED_FOUND OR NOT AWESOME_COMMON_REQUIRED_FOUND) - message(FATAL_ERROR) -endif() +# Check the deps one by one +foreach(dependency ${AWESOME_DEPENDENCIES}) + pkg_check_modules(TMP_DEP REQUIRED ${dependency}) + + if(NOT TMP_DEP_FOUND) + message(FATAL_ERROR) + endif() +endforeach() + +# Do it again, but this time with the CFLAGS/LDFLAGS +pkg_check_modules(AWESOME_REQUIRED REQUIRED ${AWESOME_DEPENDENCIES}) # On Mac OS X, the executable of Awesome has to be linked against libiconv # explicitly. Unfortunately, libiconv doesn't have its pkg-config file,