[libc-commits] [libc] [libc][cmake] Cache compile options from config and arch to speed up configuration. (PR #225438)

via libc-commits libc-commits at lists.llvm.org
Mon Oct 12 20:16:18 PDT 2026


================
@@ -201,10 +211,16 @@ function(_get_compile_options_from_config output_var)
     list(APPEND config_options "-DLIBC_COPT_SCANF_PROVIDE_ISOC99_ALIASES")
   endif()
 
+  set(_LIBC_CACHED_COMPILE_OPTIONS_FROM_CONFIG "${config_options}" CACHE INTERNAL "")
   set(${output_var} ${config_options} PARENT_SCOPE)
 endfunction()
 
 function(_get_compile_options_from_arch output_var)
+  if(DEFINED _LIBC_CACHED_COMPILE_OPTIONS_FROM_ARCH)
----------------
lntue wrote:

Good catch!           

I've changed to explicitly compute `LIBC_COMPILE_OPTIONS_FROM_CONFIG`, `LIBC_COMPILE_OPTIONS_FROM_ARCH`, and `LIBC_COMMON_COMPILE_OPTIONS` only once at the beginning.
Then `_get_common_compile_options` only evaluates `_get_compile_options_from_flags`.

https://github.com/llvm/llvm-project/pull/225438


More information about the libc-commits mailing list