Do not search for the built-in libraries when compiling with MINGW

This commit is contained in:
LAGonauta 2020-05-02 21:05:14 -03:00
parent 5f5b8fdfa0
commit 1841b348f1
2 changed files with 12 additions and 8 deletions

View file

@ -13,16 +13,18 @@ function(find_pkg_config_with_fallback name)
# Found via pkg-config, using its result values # Found via pkg-config, using its result values
set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND}) 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 # Try to find real file name of libraries
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
mark_as_advanced(${name}_${lib}_LIBRARY) mark_as_advanced(${name}_${lib}_LIBRARY)
if(NOT ${name}_${lib}_LIBRARY) if(NOT ${name}_${lib}_LIBRARY)
find_library(${name}_${lib}_LIBRARY ${lib} HINTS "C:/msys64/mingw64/x86_64-w64-mingw32/lib") message(${name} ": " ${lib} " library not found")
if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND) unset(${name}_FOUND)
endif(NOT ${name}_${lib}_LIBRARY) endif(NOT ${name}_${lib}_LIBRARY)
endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib) endforeach(lib)
if(${name}_FOUND) if(${name}_FOUND)
set(${name}_LIBRARIES "") set(${name}_LIBRARIES "")

View file

@ -13,16 +13,18 @@ function(find_pkg_config_with_fallback_on_config_script name)
# Found via pkg-config, using it's result values # Found via pkg-config, using it's result values
set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND}) 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 # Try to find real file name of libraries
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
mark_as_advanced(${name}_${lib}_LIBRARY) mark_as_advanced(${name}_${lib}_LIBRARY)
if(NOT ${name}_${lib}_LIBRARY) if(NOT ${name}_${lib}_LIBRARY)
find_library(${name}_${lib}_LIBRARY ${lib} HINTS "C:/msys64/mingw64/x86_64-w64-mingw32/lib") message(${name} ": " ${lib} " library not found")
if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND) unset(${name}_FOUND)
endif(NOT ${name}_${lib}_LIBRARY) endif(NOT ${name}_${lib}_LIBRARY)
endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib) endforeach(lib)
if(${name}_FOUND) if(${name}_FOUND)
set(${name}_LIBRARIES "") set(${name}_LIBRARIES "")