find_package in a ARCH_INDEPENDENT project for a ARCH_DEPENDENT project fails (CMake 3.26 regression)
While updating to CMake 3.26, we experienced that a ARCH_INDEPENDENT project that was looking for a ARCH_DEPENDENT was failing, see https://github.com/robotology/robotology-superbuild/issues/1366 . The project is related to the CMake version used to configure the ARCH_DEPENDENT project, not the ARCH_INDEPENDENT one.
In the end, the problem seems to be related to the fact that in CMake 3.25 in the ***Version.cmake
files a check was present in the form:
"${CMAKE_SIZEOF_VOID_P}" STREQUAL ""
that was evaluating to true if CMAKE_SIZEOF_VOID_P
was an empty string, as in the case of ARCH_INDEPENDENT projects. However !8133 (merged) changed it to:
CMAKE_SIZEOF_VOID_P STREQUAL ""
that instead does not evaluate to true even if CMAKE_SIZEOF_VOID_P
is an empty string. To be honest, I am not sure if this is expected or not.
If it is expected for CMAKE_SIZEOF_VOID_P STREQUAL ""
to be false when CMAKE_SIZEOF_VOID_P
is empty, then I guess we need to go back "${CMAKE_SIZEOF_VOID_P}" STREQUAL ""
, otherwise I am not sure about the proper fix.