Forward all flags to try_compile() when cross-compiling
Poppler overrides the user-provided CMAKE_{C,CXX}_FLAGS
and appends them
to the per-configuration variables instead. This behaviour currently
causes cross-compilation checks to fail since a CMake issue means these
these per-configuration flags are no passed to try_compile() commands.
In my case the flags specified in the toolchain file (as part of
CMAKE_{C,CXX}_FLAGS_INIT
) are absolutely required to compile successfully
since a missing -mabi=/-march=
flag will result in a linker error due to
trying to link incompatible libraries. If CMAKE_TRY_COMPILE_CONFIGURATION
is empty CMake will no propagate the per-configuration flags to
try_compile() so we have to to set the value explicitly to one of the
configurations that includes the user-provided CMAKE_C_FLAGS
.
This is an upstream CMake issue that I've reported as https://gitlab.kitware.com/cmake/cmake/-/issues/22414 and https://gitlab.kitware.com/cmake/cmake/-/issues/19512.