From 9031103c9adec8f92da6f77d304d9786676b38cf Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sun, 15 Sep 2024 19:53:27 +0000 Subject: [PATCH] build: fix linking non-debug pcre for debug wx Remove the cmake code that adds the pcre library because the wxWidgets cmake code correctly includes it now, on both vcpkg and MSYS2. Also fix up `wxWidgets_ROOT_DIR` and `wxWidgets_LIB_DIR` for debug builds. Signed-off-by: Rafael Kitover --- src/wx/CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 039f6d49..b095bb3e 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -141,7 +141,7 @@ endif() # wxWidgets configuration. set(wxWidgets_USE_UNICODE ON) -if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(wxWidgets_USE_DEBUG ON) # noop if wx is compiled with --disable-debug, like in Mac Homebrew atm endif() if(VBAM_STATIC) @@ -162,6 +162,13 @@ if(NOT wxWidgets_FOUND) set(ENABLE_OPENGL FALSE) endif() +# Fixup wxWidgets paths for vcpkg debug builds. +if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg") + set(wxWidgets_ROOT_DIR "${wxWidgets_ROOT_DIR}/debug" CACHE INTERNAL "wxWidgets root directory" FORCE) + string(REGEX REPLACE "/lib$" "/debug/lib" wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}") + set(wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "wxWidgets library directory" FORCE) +endif() + # Find OpenAL (required). find_package(OpenAL REQUIRED) @@ -380,10 +387,6 @@ if(WIN32) # Disable the auto-generated manifest from CMake. target_link_options(visualboyadvance-m PRIVATE "/MANIFEST:NO") endif() - - # wxWidgets fails to bring in its dependency. - find_library(PCRE_LIB pcre2-16 REQUIRED) - target_link_libraries(visualboyadvance-m ${PCRE_LIB}) endif() if(APPLE)