vcpkg/ports/wxwidgets/vcpkg-cmake-wrapper.cmake
Kai Pastor 88b3aedb3b
[wxwidgets] Update and fix (#25572)
* Revert "[wxwidgets] Remove debug asserts from Release build. (#25240)"

This reverts commit 6e16931acd.

* Update to 3.1.7

* Update installation layout

* Upstream CMake export is not ready for use

* Update versions

* Remove obsolete patch

* Use msvc layout for mingw on windows

* Add debug-support feature

* Update versions

* Fix condition

* Update versions

* Restore symlink patch

* Update versions

* Remove trace option from test port

* Enable testing without feature debug-support

* Fixup defaults for using without debug support

* Expect wxrc-3.1 for mingw cross builds ("unix" layout)

* Update versions
2022-07-11 14:06:54 -07:00

70 lines
2.6 KiB
CMake

cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
get_filename_component(_vcpkg_wx_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
set(wxWidgets_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
set(WX_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
unset(_vcpkg_wx_root)
if(WIN32 AND CMAKE_HOST_WIN32)
# FindwxWidgets.cmake win32 mode, multi-config
# Force FindwxWidgets.cmake win32 mode for all windows targets built on windows
set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
set(CMAKE_CROSSCOMPILING 0)
# Get cache variables for debug libs
set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/debug/lib" CACHE INTERNAL "")
set(WX_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "")
_find_package(${ARGS})
# Reset for regular lookup
unset(wxWidgets_CONFIGURATION CACHE)
unset(wxWidgets_USE_REL_AND_DBG CACHE)
set(WX_CONFIGURATION_LIST "")
set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
else()
# FindwxWidgets.cmake unix mode, single-config
if(MINGW)
# Force FindwxWidgets.cmake unix mode for mingw cross builds
set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
set(CMAKE_CROSSCOMPILING 1)
endif()
set(_vcpkg_wxconfig "")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "Debug" IN_LIST MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE})
# Debug
set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/debug/lib" CACHE INTERNAL "")
file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
endif()
if(NOT _vcpkg_wxconfig)
# Release or fallback
set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
endif()
set(wxWidgets_CONFIG_EXECUTABLE "${_vcpkg_wxconfig}" CACHE INTERNAL "")
unset(_vcpkg_wxconfig)
endif()
set(WX_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "")
_find_package(${ARGS})
if(DEFINED _vcpkg_wxwidgets_backup_crosscompiling)
set(CMAKE_CROSSCOMPILING "${_vcpkg_wxwidgets_backup_crosscompiling}")
unset(_vcpkg_wxwidgets_backup_crosscompiling)
endif()
if(WIN32 AND CMAKE_HOST_WIN32 AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
find_package(EXPAT QUIET)
find_package(JPEG QUIET)
find_package(PNG QUIET)
find_package(TIFF QUIET)
find_package(ZLIB QUIET)
list(APPEND wxWidgets_LIBRARIES
${EXPAT_LIBRARIES}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${TIFF_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
cmake_policy(POP)