diff --git a/cmake/FindGrantlee5.cmake b/cmake/FindGrantlee5.cmake index 2d2977208..04521b6ec 100644 --- a/cmake/FindGrantlee5.cmake +++ b/cmake/FindGrantlee5.cmake @@ -18,6 +18,16 @@ if (PKG_CONFIG_FOUND) endif() endif() +# Try config-mode: look for Grantlee5Config.cmake in CMAKE_PREFIX_PATH or installed location +find_file(_Grantlee5Config NAMES Grantlee5Config.cmake PATHS ${CMAKE_PREFIX_PATH} NO_DEFAULT_PATH PATH_SUFFIXES Grantlee5) +if(_Grantlee5Config) + include(${_Grantlee5Config}) + if(TARGET Grantlee5::Templates) + set(Grantlee5_FOUND TRUE) + return() + endif() +endif() + # Not found: provide helpful message and stop. Downstream CMakeLists check TARGET Grantlee5::Templates set(Grantlee5_FOUND FALSE) message(STATUS "Grantlee5 not found (shim cmake/FindGrantlee5.cmake); codegen_grantlee will be skipped if present.")