FindwxWidgets.cmake on Windows on ARM support is broken

wxWidgets installs the librarys with arm64 suffix when build for WoA. This was done in Building wxWidgets using CMAKE for ARM64 MSW, it generates the wrong lib folder name · Issue #23347 · wxWidgets/wxWidgets · GitHub

However FindwxWidgets.cmake still uses

      if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set(_WX_ARCH _x64)
      endif()

which causes it unable to find the library when using find_package(wxWidgets) on WoA.

I think this should be updated to use CMAKE_GENERATOR_PLATFORM like Fix MSW lib names for ARM64 with CMake build · vadz/wxWidgets@77db8b7 · GitHub did.

Thanks.

CMAKE_GENERATOR_PLATFORM is not the right way to detect this. It’s an input that may or may not be set by the user, and it’s generator-specific. For Visual Studio generators only, the actual target platform is in CMAKE_VS_PLATFORM_NAME.

CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID is more generally available and should be used instead. I’d welcome a merge request to start using it in FindwxWidgets.

Ah you’re right. I missed that one when reading wxWidgets’ commit.

I guess that’s why wxWidgets checks this variable first, then fallback to CMAKE_VS_PLATFORM_NAME if not present? Is that the right approach so that cross-compile could work? Or maybe for some other reason? Sorry I’m still quite new to cmake.