[MinGW] Use lib prefix for libraries
authorMateusz Mikuła <mati865@gmail.com>
Sat, 12 Sep 2020 19:00:42 +0000 (22:00 +0300)
committerMartin Storsjö <martin@martin.st>
Sat, 12 Sep 2020 19:01:29 +0000 (22:01 +0300)
In MinGW world, UNIX like lib prefix is preferred for the libraries.
This patch adjusts CMake files to do that.

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

clang/tools/libclang/CMakeLists.txt
lldb/source/API/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/tools/llvm-config/llvm-config.cpp

index c3b9ab6..88279ff 100644 (file)
@@ -101,7 +101,7 @@ if (WIN32 AND ENABLE_SHARED AND ENABLE_STATIC)
   unset(ENABLE_STATIC)
 endif()
 
-if(WIN32)
+if(MSVC)
   set(output_name "libclang")
 else()
   set(output_name "clang")
index 8a7f28c..aeb1f15 100644 (file)
@@ -182,10 +182,10 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+if (MSVC)
   # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
   # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (MSVC AND LLDB_ENABLE_PYTHON)
+  if (LLDB_ENABLE_PYTHON)
     target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
   endif()
 else()
index a40cf17..e57abea 100644 (file)
@@ -567,7 +567,7 @@ function(llvm_add_library name)
   endif()
 
   if(ARG_SHARED)
-    if(WIN32)
+    if(MSVC)
       set_target_properties(${name} PROPERTIES
         PREFIX ""
         )
index a9d3f64..1a2f045 100644 (file)
@@ -381,6 +381,7 @@ int main(int argc, char **argv) {
     SharedExt = "dll";
     SharedVersionedExt = LLVM_DYLIB_VERSION ".dll";
     if (HostTriple.isOSCygMing()) {
+      SharedPrefix = "lib";
       StaticExt = "a";
       StaticPrefix = "lib";
     } else {