Browse Source

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.
pull/55/merge
Vladimír Vondruš 12 years ago
parent
commit
f74e68ec4e
  1. 11
      modules/FindMagnum.cmake

11
modules/FindMagnum.cmake

@ -181,6 +181,15 @@ endif()
find_path(MAGNUM_INCLUDE_DIR find_path(MAGNUM_INCLUDE_DIR
NAMES Magnum/Magnum.h) 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 # Configuration
file(READ ${MAGNUM_INCLUDE_DIR}/Magnum/configure.h _magnumConfigure) file(READ ${MAGNUM_INCLUDE_DIR}/Magnum/configure.h _magnumConfigure)
@ -471,7 +480,7 @@ foreach(component ${Magnum_FIND_COMPONENTS})
endif() endif()
endforeach() endforeach()
include(FindPackageHandleStandardArgs) # Complete the check with also all components
find_package_handle_standard_args(Magnum find_package_handle_standard_args(Magnum
REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR REQUIRED_VARS MAGNUM_LIBRARY MAGNUM_INCLUDE_DIR
HANDLE_COMPONENTS) HANDLE_COMPONENTS)

Loading…
Cancel
Save