[compiler-rt] r280854 - [compiler-rt] Fix library suffixes on windows

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 13:32:48 PDT 2016


Author: fjricci
Date: Wed Sep  7 15:32:48 2016
New Revision: 280854

URL: http://llvm.org/viewvc/llvm-project?rev=280854&view=rev
Log:
[compiler-rt] Fix library suffixes on windows

Summary:
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.

Reviewers: beanz, compnerd

Subscribers: llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D24046

Modified:
    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/trunk/cmake/base-config-ix.cmake

Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=280854&r1=280853&r2=280854&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Sep  7 15:32:48 2016
@@ -195,8 +195,14 @@ function(add_compiler_rt_runtime name ty
     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 AND NOT CYGWIN AND NOT MINGW)
+        set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
+        set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
+      endif()
     endif()
     install(TARGETS ${libname}
       ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}

Modified: compiler-rt/trunk/cmake/base-config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/base-config-ix.cmake?rev=280854&r1=280853&r2=280854&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/base-config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/base-config-ix.cmake Wed Sep  7 15:32:48 2016
@@ -86,6 +86,15 @@ if(APPLE)
   option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
 endif()
 
+if(WIN32 AND NOT MINGW AND NOT CYGWIN)
+  set(CMAKE_SHARED_LIBRARY_PREFIX_C "")
+  set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "")
+  set(CMAKE_STATIC_LIBRARY_PREFIX_C "")
+  set(CMAKE_STATIC_LIBRARY_PREFIX_CXX "")
+  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.




More information about the llvm-commits mailing list