[libc-commits] [libc] [libc] Add libc_set_definition and libc_add_definition to properly pass definitions to MSVC. (PR #189664)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 31 19:18:53 PDT 2026


================
@@ -10,6 +10,31 @@ if(NOT DEFINED LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
   endif()
 endif()
 
+function(libc_add_definition output_var def)
+  if(MSVC)
+    list(APPEND ${output_var} "/D${def}")
+  else()
+    list(APPEND ${output_var} "-D${def}")
+  endif()
+
+  set(${output_var} ${${output_var}} PARENT_SCOPE)
+endfunction()
----------------
lntue wrote:

Sorry I was attempting to fix some linking issues with MSVC and clang-cl.  And I think in the end the root cause was https://github.com/llvm/llvm-project/pull/189664/changes/d5eb02d38277c6fccb70e35a2d0ed89210622d1f
Would you like me to roll back the flag definition changes?

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


More information about the libc-commits mailing list