From f74e68ec4e3623fe611bc826f45a4aaad3ea9c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 21 Jul 2014 20:58:38 +0200 Subject: [PATCH] modules: bail out with proper message if Magnum is not found. Currently it failed on "error when trying to open configure.h", which is NOT a helpful message at all. Now we check for existence of the include dir before trying to open the file, thus failing with proper "Could NOT find Magnum" message. --- modules/FindMagnum.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 55addc7aa..2c3552184 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -181,6 +181,15 @@ endif() find_path(MAGNUM_INCLUDE_DIR NAMES Magnum/Magnum.h) +# We need to open configure.h file from MAGNUM_INCLUDE_DIR before we check for +# the components. Bail out with proper error message if it wasn't found. The +# complete check with all components is further below. +if(NOT MAGNUM_INCLUDE_DIR) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Magnum + REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR) +endif() + # Configuration file(READ ${MAGNUM_INCLUDE_DIR}/Magnum/configure.h _magnumConfigure) @@ -471,7 +480,7 @@ foreach(component ${Magnum_FIND_COMPONENTS}) endif() endforeach() -include(FindPackageHandleStandardArgs) +# Complete the check with also all components find_package_handle_standard_args(Magnum REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR HANDLE_COMPONENTS)