Find_package - MSVC - Standard Architecture not defined.

I am working with a few packages and noticed that the CMAKE find_package is fundamentally broken with MSVC. From what I can tell the following variables are not defined:

  • CMAKE_LIBRARY_ARCHITECTURE
  • CMAKE_C_LIBRARY_ARCHITECTURE
  • CMAKE_CXX_LIBRARY_ARCHITECTURE

What is defined however is the following:

  • MSVC_C_ARCHITECTURE_ID (Internal variable)
  • MSVC_CXX_ARCHITECTURE_ID (Internal variable)
  • CMAKE_C_ARCHITECTURE_ID
  • CMAKE_CXX_ARCHITECTURE_ID

I expect the values for the missing variable to match the variables that are already defined.

CMake 3.7 - The documentation for find_pacakge shows 3 entries for windows that involve “arch”.

CMake 4.3 - The documentation for find_package still includes 3 entries for windows involving “arch”

Note 1: I noticed this issue with CMAKE v3.31.6 that is included with msvc, and the relevant configuration files (cmake-msvc.cmake, cmake-msvc-c.cmake and cmake-msvc-cxx.cmake) do not appear to be updated with anything that sets the missing variable.

Note 2: fixing this could be useful for searching for packages implementing the common package specification on windows.