[PATCH] D39274: Fix -fuse-ld feature detection error.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 14:20:26 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316958: Fix -fuse-ld feature detection error. (authored by ruiu).

Changed prior to commit:
  https://reviews.llvm.org/D39274?vs=120174&id=120889#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39274

Files:
  llvm/trunk/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
@@ -194,10 +194,13 @@
 endif()
 
 if( LLVM_USE_LINKER )
-  check_cxx_compiler_flag("-fuse-ld=${LLVM_USE_LINKER}" CXX_SUPPORTS_CUSTOM_LINKER)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fuse-ld=${LLVM_USE_LINKER}")
+  check_cxx_source_compiles("int main() { return 0; }" CXX_SUPPORTS_CUSTOM_LINKER)
   if ( NOT CXX_SUPPORTS_CUSTOM_LINKER )
 	  message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'")
   endif()
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
   append("-fuse-ld=${LLVM_USE_LINKER}"
     CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39274.120889.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171030/3961e3cf/attachment.bin>


More information about the llvm-commits mailing list