From afbbfe51090e5575e11c4e3cdbddfa55c76d9966 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Jan 2020 13:31:01 -0500 Subject: MinGW: Update find_library to not find plain .dll files Modern distributions of packages built with MinGW tools provide `.dll.a` import libraries. Prefer those instead of finding plain `.dll` files. This avoids accidentally finding unrelated Windows `.dll` files. Fixes: #20019 --- Help/release/dev/mingw-find-no-dll.rst | 6 ++++++ Modules/Platform/Windows-Clang.cmake | 2 +- Modules/Platform/Windows-GNU.cmake | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/mingw-find-no-dll.rst diff --git a/Help/release/dev/mingw-find-no-dll.rst b/Help/release/dev/mingw-find-no-dll.rst new file mode 100644 index 0000000..84e7431 --- /dev/null +++ b/Help/release/dev/mingw-find-no-dll.rst @@ -0,0 +1,6 @@ +mingw-find-no-dll +----------------- + +* When using MinGW tools, the :command:`find_library` command no longer + finds ``.dll`` files by default. Instead it expects ``.dll.a`` import + libraries to be available. diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 02864c6..c17cf6d 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -24,7 +24,7 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT -MF ") set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1) set (CMAKE_LINK_DEF_FILE_FLAG "-Xlinker /DEF:") diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 235d9ce..38a8cf4 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -25,7 +25,7 @@ endif() if(MINGW) set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") endif() -- cgit v0.12