From: Tobias Hieta Date: Tue, 10 Nov 2020 09:45:31 +0000 (+0100) Subject: cmake: correctly handle linker flags for static libs X-Git-Tag: curl-7_74_0~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=760e854348196d0c62afc7a5b023c62eced45b92;p=thirdparty%2Fcurl.git cmake: correctly handle linker flags for static libs 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f51d0331e..29c588bcd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8f5121b27e..ca4710e068 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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()