force minimum version 3.12 for cmake policies in freetype, only when cmake >= 4

This commit is contained in:
DubbleClick
2025-06-04 21:18:44 +07:00
parent dabf52511f
commit ef7ebdfd1f
4 changed files with 34 additions and 15 deletions

View File

@@ -192,3 +192,21 @@ function f_putenv(string $env): bool
logger()->debug('Setting env: ' . $env);
return putenv($env);
}
/**
* Get the installed CMake version
*
* @return string|null The CMake version or null if it couldn't be determined
*/
function get_cmake_version(): ?string
{
try {
[,$output] = shell()->execWithResult('cmake --version', false);
if (preg_match('/cmake version ([\d.]+)/i', $output[0], $matches)) {
return $matches[1];
}
} catch (Exception $e) {
logger()->warning('Failed to get CMake version: ' . $e->getMessage());
}
return null;
}