1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-13 13:05:03 -05:00

cmake: fix import library name for non-MS compiler on Windows

- Use _imp.lib suffix only for Microsoft's compiler (MSVC).

Prior to this change library suffix _imp.lib was used for the import
library on Windows regardless of compiler.

With this change the other compilers should now use their default
suffix which should be .dll.a.

This change is motivated by the usage of pkg-config on MSYS2.
Indeed, when 'pkg-config --libs libcurl' is used, -lcurl is
passed to ld. The documentation of ld on Windows :

https://sourceware.org/binutils/docs/ld/WIN32.html

lists, in the 'direct linking to a dll' section, the pattern
of the searched import library, and libcurl_imp.lib is not there.

Closes https://github.com/curl/curl/pull/6225
This commit is contained in:
Vincent Torri 2020-11-19 19:34:43 +01:00 committed by Jay Satiro
parent f1e5e49879
commit d4a3b87c13

View File

@ -117,8 +117,11 @@ endif()
if(WIN32) if(WIN32)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib" if(MSVC)
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib") # Add "_imp" as a suffix before the extension to avoid conflicting with
# the statically linked "libcurl.lib"
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
endif()
endif() endif()
endif() endif()