[libc-commits] [PATCH] D105643: [libc] Specificying compilation flags for Windows

Caitlyn Cano via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 8 13:58:59 PDT 2021


caitlyncano updated this revision to Diff 357350.
caitlyncano added a comment.

[libc] Fixing flag overwrites

Previous amendment overwrote the output by not including the flags set outside
the if block


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105643/new/

https://reviews.llvm.org/D105643

Files:
  libc/cmake/modules/LLVMLibCObjectRules.cmake


Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -1,7 +1,12 @@
 set(OBJECT_LIBRARY_TARGET_TYPE "OBJECT_LIBRARY")
 
 function(_get_common_compile_options output_var)
-  set(${output_var} -fpie ${LLVM_CXX_STD_default} -ffreestanding ${LIBC_COMPILE_OPTIONS_DEFAULT} ${ARGN} PARENT_SCOPE)
+  set(${output_var} ${LLVM_CXX_STD_default} ${LIBC_COMPILE_OPTIONS_DEFAULT} ${ARGN} PARENT_SCOPE)
+  if(${LIBC_TARGET_OS} STREQUAL "windows")
+    set(${output_var} ${output_var} /Qfreestanding PARENT_SCOPE)
+  else()
+   set(${output_var} ${output_var} -fpie -ffreestanding PARENT_SCOPE)
+  endif()
 endfunction()
 
 # Rule which is essentially a wrapper over add_library to compile a set of


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105643.357350.patch
Type: text/x-patch
Size: 851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210708/fb2d7eba/attachment.bin>


More information about the libc-commits mailing list