[PATCH] D24046: [compiler-rt] Fix library suffixes on windows

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 11:13:50 PDT 2016


fjricci created this revision.
fjricci added reviewers: beanz, compnerd.
fjricci added a subscriber: llvm-commits.
Herald added a subscriber: dberris.

Make sure that windows libraries contain the suffixes expected by clang.
This is expecially important when compiling the windows builtins with
clang, as cmake will use .a as the suffix by default.

https://reviews.llvm.org/D24046

Files:
  cmake/Modules/AddCompilerRT.cmake
  cmake/base-config-ix.cmake

Index: cmake/base-config-ix.cmake
===================================================================
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -86,6 +86,11 @@
   option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
 endif()
 
+if(WIN32)
+  set(CMAKE_STATIC_LIBRARY_SUFFIX_C ".lib")
+  set(CMAKE_STATIC_LIBRARY_SUFFIX_CXX ".lib")
+endif()
+
 macro(test_targets)
   # Find and run MSVC (not clang-cl) and get its version. This will tell clang-cl
   # what version of MSVC to pretend to be so that the STL works.
Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -195,8 +195,13 @@
     set_target_properties(${libname} PROPERTIES
         OUTPUT_NAME ${output_name_${libname}})
     set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime")
-    if(LIB_LINK_LIBS AND ${type} STREQUAL "SHARED")
-      target_link_libraries(${libname} ${LIB_LINK_LIBS})
+    if(${type} STREQUAL "SHARED")
+      if(LIB_LINK_LIBS)
+        target_link_libraries(${libname} ${LIB_LINK_LIBS})
+      endif()
+      if(WIN32)
+        set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
+      endif()
     endif()
     install(TARGETS ${libname}
       ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24046.69731.patch
Type: text/x-patch
Size: 1401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160830/fcc7ee8e/attachment.bin>


More information about the llvm-commits mailing list