]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: correctly handle linker flags for static libs
authorTobias Hieta <tobias@plex.tv>
Tue, 10 Nov 2020 09:45:31 +0000 (10:45 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 10 Nov 2020 22:41:29 +0000 (23:41 +0100)
curl CMake was setting the the EXE flags for static libraries which made
the /manifest:no flag ended up when linking the static library, which is
not a valid flag for lib.exe or llvm-lib.exe and caused llvm-lib to exit
with an error.

The better way to handle this is to make sure that we pass the correct
linker flags to CMAKE_STATIC_LINKER_FLAGS instead.

Reviewed-by: Jakub Zakrzewski
Closes #6195

CMakeLists.txt
lib/CMakeLists.txt

index 7f51d0331e6fe94486a53e4a35a821fd6924fbc8..29c588bcd70c1726d5e9568d2accbfec9353b825 100644 (file)
@@ -776,6 +776,7 @@ if(CMAKE_USE_GSSAPI)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_COMPILER_FLAGS}")
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GSS_LINKER_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GSS_LINKER_FLAGS}")
+    set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${GSS_LINKER_FLAGS}")
     list(APPEND CURL_LIBS ${GSS_LIBRARIES})
 
   else()
index 8f5121b27e64c5c3e5d98bb979338e9b8af558b6..ca4710e06844845dbe3ab30a6929a263dd34be97 100644 (file)
@@ -88,10 +88,6 @@ add_library(
   ALIAS ${LIB_NAME}
   )
 
-if(MSVC AND NOT BUILD_SHARED_LIBS)
-  set_target_properties(${LIB_NAME} PROPERTIES STATIC_LIBRARY_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
-endif()
-
 if(NOT BUILD_SHARED_LIBS)
     set_target_properties(${LIB_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS CURL_STATICLIB)
 endif()