<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57292>57292</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Buildsystem] FindZ3.cmake is not handling extreme cases.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Naville
      </td>
    </tr>
</table>

<pre>
    ``llvm/cmake/modules/FindZ3.cmake`` 's try_run is broken

``if(Z3_COMPILED)`` is not checking for run success, which in my case on Windows, might fail due to program not able to find Z3's linked MSVC runtime or whatsoever, which results in the system error message gets used to parse Z3 version string

My patch is to change that line to ``if(Z3_COMPILED AND NOT (Z3_RETURNCODE STREQUAL FAILED_TO_RUN))``
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUk1v2zAM_TX2hVhgy4k_Dj6kSQoMaJMtTTcgl0C2aVuLbBWSnCz_fpSaoj0MECxZJN97emSlmlsZpBEtKS9DwB7rgZ-R9kE1k0RDp0cxNsdk9h7wqRCwzIDVt5OeRhAGKq3OOAbROoiW969PFG3A8mNyWu2ef3x_2qwDVtwRqGhUFuoe67MYO2iVBgdmprpGQ7QruPai7kGMMNyg5gZBjfCbtKirDw-i6y20XEhoJgSr4E2rTvPBA_NK-ruWCuCYeMFSjGds4Pnl18pxWTEQpiYebo3CC-pPVo1mktY4dtsjmJuxOABqTfkD6eMdQoeUMBlCdNxck8JjAgRjBCk1VtO7vlryfKMs655kXEXd85FQLLE7ZV7t_12D5XYN290B3q_3m8PrfrvarTfwcthvfr4un-Bx6RJPh91p_7p1Ln8YHWIZp2nMkpwVcdiUSVMkBQ-tsBLLYPHwMAnZvD8vWKzha68_ekQ6G-l6hH-tRvLMNcPMwknLsrf2zQTJksaEVidsP1WzWrlBus-T275RZ_5gbelXGDP5qVpkrGBhX_I4Zmye1TzPmmKe8pTNY2SLDFmetNhmoeQVSuO0BoyNeAUPQWfSG4qSRYxFOUuiLJov4lmxaPKKp1WbJm1RzeNgHuFAMzJzOmZKd6EuvaRq6gwFpTDWfAa5MaIb0Vvj8Plke6XLLb8IKTH01KWX_g94iQfc">