From dedfb615d58346c41f15a1ae6b4ff295b0f1bc9f Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Fri, 18 Mar 2022 14:47:50 +0000 Subject: [PATCH] build: use GLOB to detect wx dep lib suffixes Use file(GLOB ${lib_name}*.lib) to detect the appropriate suffixes for wx dependency libs, because the suffix keeps changing, sometimes there is a 'd' added for debug builds and sometimes it changes to not adding the suffix, this will make the code more robust and lead to fewer build failures. Signed-off-by: Rafael Kitover --- src/wx/CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 7ea31e9b..562af098 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -150,15 +150,16 @@ if(WIN32 AND CMAKE_TOOLCHAIN_FILE MATCHES vcpkg AND (X86_32 OR X86_64)) set(deb_suffix d) endif() - file(GLOB png_lib ${wxWidgets_LIB_DIR}/libpng*.lib) + foreach(lib_name libpng jpeg lzma tiff libexpat) + file( + GLOB lib_file + ${wxWidgets_LIB_DIR}/${lib_name}*.lib + ) - list(APPEND wxWidgets_LIBRARIES - ${wxWidgets_LIB_DIR}/jpeg.lib - ${wxWidgets_LIB_DIR}/lzma.lib - ${wxWidgets_LIB_DIR}/tiff${deb_suffix}.lib - ${wxWidgets_LIB_DIR}/libexpat${deb_suffix}MD.lib - ${png_lib} - ) + if(lib_file) + list(APPEND wxWidgets_LIBRARIES ${lib_file}) + endif() + endforeach() endif() set(WXRC ${common_prefix}/tools/wxwidgets/wxrc.exe)