Skip to content
  • Alexander Richardson's avatar
    cmake: correctly forward user-provided flags to try_compile() · f8bcfde2
    Alexander Richardson authored
    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.
    
    This is an upstream CMake issue:
    See https://gitlab.kitware.com/cmake/cmake/-/issues/22414 and
    https://gitlab.kitware.com/cmake/cmake/-/issues/19512.
    f8bcfde2