use correct ar and ranlib for cmake

This commit is contained in:
henderkes
2026-05-05 17:56:31 +07:00
parent 5d4bb273ee
commit a0c86c1519
3 changed files with 6 additions and 2 deletions

View File

@@ -216,9 +216,11 @@ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "{$include}")
set(CMAKE_C_STANDARD_LIBRARIES "-ldl -lpthread -lm -lutil")
set(CMAKE_CXX_STANDARD_LIBRARIES "-ldl -lpthread -lm -lutil")
CMAKE;
// Whoops, linux may need CMAKE_AR sometimes
if (PHP_OS_FAMILY === 'Linux') {
$toolchain .= "\nSET(CMAKE_AR \"ar\")";
$ar = getenv('SPC_LINUX_DEFAULT_AR') ?: getenv('AR') ?: 'ar';
$ranlib = getenv('SPC_LINUX_DEFAULT_RANLIB') ?: (getenv('RANLIB') ?: 'ranlib');
$toolchain .= "\nSET(CMAKE_AR \"{$ar}\")";
$toolchain .= "\nSET(CMAKE_RANLIB \"{$ranlib}\")";
}
FileSystem::writeFile(SOURCE_PATH . '/toolchain.cmake', $toolchain);
return $created = realpath(SOURCE_PATH . '/toolchain.cmake');