38 lines
1.4 KiB
CMake
38 lines
1.4 KiB
CMake
# Minimal Find module for Grantlee5 to allow configure to continue when not installed
|
|
# This intentionally does not attempt to build or provide Qt5-based Grantlee
|
|
# If a Qt6-compatible Grantlee is available, set Grantlee5_DIR or install the package
|
|
|
|
if (TARGET Grantlee5::Templates)
|
|
set(Grantlee5_FOUND TRUE)
|
|
return()
|
|
endif()
|
|
|
|
# Try pkg-config as a best-effort (may fail)
|
|
find_package(PkgConfig QUIET)
|
|
if (PKG_CONFIG_FOUND)
|
|
pkg_check_modules(GRANTLEE5 QUIET grantlee-templates)
|
|
if (GRANTLEE5_FOUND)
|
|
set(Grantlee5_FOUND TRUE)
|
|
# No imported targets provided by this shim
|
|
return()
|
|
endif()
|
|
endif()
|
|
|
|
# Try config-mode: look for Grantlee5Config.cmake in CMAKE_PREFIX_PATH or installed location
|
|
# Try to locate Grantlee5Config.cmake via common locations: CMAKE_PREFIX_PATH, EXTERNAL_DIR, repo/external, and typical install paths
|
|
find_file(_Grantlee5Config NAMES Grantlee5Config.cmake
|
|
PATHS ${CMAKE_PREFIX_PATH} $ENV{EXTERNAL_DIR} /repo/external /repo/external/grantlee
|
|
NO_DEFAULT_PATH
|
|
PATH_SUFFIXES Grantlee5 lib/cmake/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.")
|