[Chore] (CMake): Support using check_c*_compiler_flag to detect LTO capability.

This commit is contained in:
BZLZHH
2026-02-05 00:55:42 +08:00
parent 07638b8577
commit 319806c48a
+4 -1
View File
@@ -20,7 +20,10 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" OR MOBILEGL_FORCE_RELEASE_OPT)
check_ipo_supported(RESULT LTOSupported OUTPUT LTOError)
if (LTOSupported)
check_c_compiler_flag("-flto" HAS_LTO_C)
check_cxx_compiler_flag("-flto" HAS_LTO_CXX)
if (LTOSupported OR (HAS_LTO_C AND HAS_LTO_CXX))
# Check ThinLTO
check_c_compiler_flag("-flto=thin" HAS_THINLTO_C)
check_cxx_compiler_flag("-flto=thin" HAS_THINLTO_CXX)