[PATCH] D125827: [cmake] Don't try creating an executable when detecting the linker

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 11:37:07 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf28e48f3ef5a: [cmake] Don't try creating an executable when detecting the linker (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125827

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -177,11 +177,17 @@
     set(version_flag "-Wl,--version")
   endif()
 
+  if (CMAKE_HOST_WIN32)
+    set(DEVNULL "NUL")
+  else()
+    set(DEVNULL "/dev/null")
+  endif()
+
   if(LLVM_USE_LINKER)
-    set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} ${version_flag})
+    set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} ${version_flag} -o ${DEVNULL})
   else()
     separate_arguments(flags UNIX_COMMAND "${CMAKE_EXE_LINKER_FLAGS}")
-    set(command ${CMAKE_C_COMPILER} ${flags} ${version_flag})
+    set(command ${CMAKE_C_COMPILER} ${flags} ${version_flag} -o ${DEVNULL})
   endif()
   execute_process(
     COMMAND ${command}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125827.435272.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220608/41abff1d/attachment.bin>


More information about the llvm-commits mailing list