From: Gerhard Sittig Date: Tue, 3 Jul 2018 14:46:57 +0000 (+0200) Subject: cmake: help users by pointing out libsigrok build depencendies X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=844c4619ddbbab7d05ed01961f6b5957a3db75c5;p=pulseview.git cmake: help users by pointing out libsigrok build depencendies It appears that users have trouble to relate failed PulseView builds to missing dependencies during libsigrok configuration. Although the error occurs early and is stated in the build output, it only gets noticed late and users forgot about the earlier step, or never bothered to check. Explicitly test for the availability of the C++ bindings, and print a message that points to libsigrok's(!) configuration phase. Another check for the full set of libraries will fail in fatal ways as before. An unfortunate implementation detail of the cmake check leaves all parts of the lookup result empty when either(!) of the tested libs is missing. So we cannot tell with certainty which test failed when the test result is negative while a list of libraries was passed to the test. That's why the "soft" individual test with QUIET and without REQUIRED is the least intrusive adjustment to existing CMake rules, where other locations depend on the PKGDEPS_* variables. This change addresses bug #1199. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d1198aa..050e8a35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,8 @@ endif() list(APPEND PKGDEPS glib-2.0>=2.28.0) list(APPEND PKGDEPS glibmm-2.4>=2.28.0) -list(APPEND PKGDEPS libsigrokcxx>=0.6.0) +set(LIBSR_CXX_BINDING "libsigrokcxx>=0.6.0") +list(APPEND PKGDEPS "${LIBSR_CXX_BINDING}") if(ENABLE_DECODE) list(APPEND PKGDEPS libsigrokdecode>=0.6.0) @@ -80,6 +81,10 @@ if(ANDROID) endif() find_package(PkgConfig) +pkg_check_modules(LIBSRCXX QUIET ${LIBSR_CXX_BINDING}) +if(NOT LIBSRCXX_FOUND OR NOT LIBSRCXX_VERSION) + message(FATAL_ERROR "libsigrok C++ bindings missing, check libsigrok's 'configure' output (missing dependencies?)") +endif() pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) set(CMAKE_AUTOMOC TRUE)