From 1841b348f1c3a127c89961f4c438b96023169b60 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Sat, 2 May 2020 21:05:14 -0300 Subject: [PATCH] Do not search for the built-in libraries when compiling with MINGW --- cmake/PkgConfigWithFallback.cmake | 10 ++++++---- cmake/PkgConfigWithFallbackOnConfigScript.cmake | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/PkgConfigWithFallback.cmake b/cmake/PkgConfigWithFallback.cmake index 5522d830..71041710 100644 --- a/cmake/PkgConfigWithFallback.cmake +++ b/cmake/PkgConfigWithFallback.cmake @@ -13,15 +13,17 @@ function(find_pkg_config_with_fallback name) # Found via pkg-config, using its result values set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND}) + if(MINGW) + list(FILTER ${name}_PKG_CONFIG_LIBRARIES EXCLUDE REGEX "(ole32)|(gdi32)|(imm32)|(shell32)|(winmm)|(dwmapi)|(setupapi)|(cfgmgr32)|(ws2_32)") + endif(MINGW) + # Try to find real file name of libraries foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) mark_as_advanced(${name}_${lib}_LIBRARY) if(NOT ${name}_${lib}_LIBRARY) - find_library(${name}_${lib}_LIBRARY ${lib} HINTS "C:/msys64/mingw64/x86_64-w64-mingw32/lib") - if(NOT ${name}_${lib}_LIBRARY) - unset(${name}_FOUND) - endif(NOT ${name}_${lib}_LIBRARY) + message(${name} ": " ${lib} " library not found") + unset(${name}_FOUND) endif(NOT ${name}_${lib}_LIBRARY) endforeach(lib) if(${name}_FOUND) diff --git a/cmake/PkgConfigWithFallbackOnConfigScript.cmake b/cmake/PkgConfigWithFallbackOnConfigScript.cmake index c8d751ce..378ec0a1 100644 --- a/cmake/PkgConfigWithFallbackOnConfigScript.cmake +++ b/cmake/PkgConfigWithFallbackOnConfigScript.cmake @@ -13,15 +13,17 @@ function(find_pkg_config_with_fallback_on_config_script name) # Found via pkg-config, using it's result values set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND}) + if(MINGW) + list(FILTER ${name}_PKG_CONFIG_LIBRARIES EXCLUDE REGEX "(ole32)|(gdi32)|(imm32)|(shell32)|(winmm)|(dwmapi)|(setupapi)|(cfgmgr32)|(ws2_32)") + endif(MINGW) + # Try to find real file name of libraries foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) mark_as_advanced(${name}_${lib}_LIBRARY) if(NOT ${name}_${lib}_LIBRARY) - find_library(${name}_${lib}_LIBRARY ${lib} HINTS "C:/msys64/mingw64/x86_64-w64-mingw32/lib") - if(NOT ${name}_${lib}_LIBRARY) - unset(${name}_FOUND) - endif(NOT ${name}_${lib}_LIBRARY) + message(${name} ": " ${lib} " library not found") + unset(${name}_FOUND) endif(NOT ${name}_${lib}_LIBRARY) endforeach(lib) if(${name}_FOUND)