From a775640b027b1b541bd682300c1fe69d7f816a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Mar 2024 13:43:19 +0100 Subject: [PATCH] modules: use a unique name to find MAGNUMBINDINGS_INCLUDE_DIR. Otherwise it just picked the include dir of Magnum itself, causing strange problems when Magnum and Magnum Bindings are installed to different locations. Also, in this case the hint was wrong, which *maybe* was what made it work compared to Magnum Integration. --- modules/FindMagnumBindings.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/FindMagnumBindings.cmake b/modules/FindMagnumBindings.cmake index 9199630..d3f1cb1 100644 --- a/modules/FindMagnumBindings.cmake +++ b/modules/FindMagnumBindings.cmake @@ -58,9 +58,15 @@ find_package(Magnum REQUIRED) -# Global bindings include dir -find_path(MAGNUMBINDINGS_INCLUDE_DIR Magnum - HINTS ${MAGNUMBINDINGS_INCLUDE_DIR}) +# Global include dir that's unique to Magnum Bindings. Often they will be +# installed alongside Magnum, which is why the hint, but if not, it shouldn't +# just pick MAGNUM_INCLUDE_DIR because then _MAGNUMBINDINGS_*_INCLUDE_DIR will +# fail to be found. In case of CMake subprojects the versionBindings.h is +# generated inside the build dir so this won't find it, instead +# src/CMakeLists.txt forcibly sets MAGNUMBINDINGS_INCLUDE_DIR as an internal +# cache value to make that work. +find_path(MAGNUMBINDINGS_INCLUDE_DIR Magnum/versionBindings.h + HINTS ${MAGNUM_INCLUDE_DIR}) mark_as_advanced(MAGNUMBINDINGS_INCLUDE_DIR) # Component distinction (listing them explicitly to avoid mistakes with finding