Skip to content
  • Raul Tambre's avatar
    CUDA: Fail if compiler detection using the host compiler fails · 9f81aa0f
    Raul Tambre authored
    If an user specified a host compiler we should fail if we are unable to perform
    compiler detection with it.
    Previously we would try without and likely succeed and continue. Then we'd fail
    during ABI detection and compiler testing since we'd still try to use it.
    
    This is particularly problematic when crosscompiling since we extract the host
    linker from the compiler detection link line. This would result in the wrong
    host linker being used and a linking error due to architecture mismatch during
    ABI detection where other necessary flags may already be present to make the
    host compiler work. See #21076 for an example.
    
    Fix this by adding CMAKE_<LANG>_COMPILER_ID_REQUIRE_SUCCESS to
    CMakeDetermineCompilerId, which throws a fatal error if executing the compiler
    results in a non-zero exit code.
    
    Fixes #21120.
    9f81aa0f