diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 7e68bfbe96a..cd9773beb97 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -399,6 +399,15 @@ if(NOT CYGWIN AND NOT WIN32) endif() endif() +if(CYGWIN OR MINGW) + # Prune --out-implib from executables. It doesn't make sense even + # with --export-all-symbols. + string(REGEX REPLACE "-Wl,--out-implib,[^ ]+ " " " + CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}") + string(REGEX REPLACE "-Wl,--out-implib,[^ ]+ " " " + CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}") +endif() + if(MSVC) # Remove flags here, for exceptions and RTTI. # Each target property or source property should be responsible to control