From 1754474df11a707b111e24e49dfe58048b4b8c6d Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Thu, 28 Mar 2013 22:33:37 +0100 Subject: [PATCH] Give better diagnostics in case probe fails The standard argument handling report which item that failed (_INCLUDE_DIR, _LIBRARY og HAVE_) but it doesn't provide information about the root that was used to search for these. Given that we now automatically search a lot of other places, the _ROOT variables should be reported before the error is raised. --- cmake/Modules/OpmPackage.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index 1e4c991c..79ffb5a0 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -239,9 +239,24 @@ macro (find_opm_package module deps header lib defs prog conf) include (FindPackageHandleStandardArgs) if ("${lib}" STREQUAL "") set (_lib_var "") + set (_and_lib_var) else ("${lib}" STREQUAL "") set (_lib_var "${module}_LIBRARY") + set (_and_lib_var AND ${_lib_var}) endif ("${lib}" STREQUAL "") + # if the search is going to fail, then write these variables to + # the console as well as a diagnostics + if (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}) + AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY)) + if (DEFINED ${module}_DIR) + message ("${module}_DIR = ${${module}_DIR}") + elseif (DEFINED ${module}_ROOT) + message ("${module}_ROOT = ${${module}_ROOT}") + elseif (DEFINED ${MODULE}_ROOT) + message ("${MODULE}_ROOT = ${${MODULE}_ROOT}") + endif (DEFINED ${module}_DIR) + endif (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}) + AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY)) find_package_handle_standard_args ( ${module} DEFAULT_MSG