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 <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2024-09-15 19:53:27 +00:00
parent 557f897ead
commit 9031103c9a
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 8 additions and 5 deletions

View File

@ -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)