<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121202>121202</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Different `fir-opt` tool is produced depending on `FLANG_INCLUDE_TESTS`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:build
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mgorny
</td>
</tr>
</table>
<pre>
The `fir-opt` tool that is installed unconditionally has some code conditional to `FLANG_INCLUDE_TESTS`. This implies that the tool installed as part of a CMake run with tests being built will be different than the tool installed otherwise.
At the very least, this goes against the principle of least surprise, and violates the Gentoo-specific policy that testing must not affect the installed package. Also, this is quite problematic for us since it implies static linking to MLIR (as the relevant test-specific MLIR libraries aren't available in the dylib — which could be acceptable for discardable test executables, but it's not fine for installed executables).
Could we perhaps build two versions of `fir-opt` instead? One that would not contain test-specific code and be installed, and another one with test-specific code that's only used by the test suite? I can submit a pull request if you agree with that approach.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0VE2PGzcM_TXyhVhjLH8f5uDuxkGAJAWa7TngSJwZdmVpIlF2_e8LyZt1t0gvNgbS43vkeyKmxIMnatX6N7V-mmGWMcT2NITor7Mu2Gv7PBKoTdNzfAiTqE0DEoIDGVGAE7BPgs6RhexN8JaFg0fnrjBighROBCbY8vN2BhJKxePnw9eP3z99ffz859OH788fvj1_U5tmDs9jKXuaHFO60chIN9I7GSaYMAqEHhAev-ALQcweLiwjCCVJ0BH7AbrMTuDCzkFHYLnvKZIvJdH_qm6QkeKFE81Vc1DN4XBjP1O8giNMovQjSFE4BEqAAxZsvTNF9oYnR0VUvQspxylyogJCb-HMwaHUtgg-kpcQHtJEhns2MAXH5vraMSUp8k85CfgggH1P5sZzFzuhecGB5nBwKbwJ4wQ_MksRFDpHJxQ20IcIOUFibwhY3uabpB479i-FTwJ8-fzpD1B6hzeVkRyd0d8k3cXWW467iLGUwUhe6a0AnpEddq7IrHh7ddyB-qDVrlH7FVxGNiOYkJ0tjqAxNEkFFImWk8Fo63chBPqbTK7nqTTYZQEWpbepTqVnf8PdZ_IOsH918bHSXQgmiiNOqcbCglxCcTZx8KmY9j7mpSahVcsj_O7p5sulFirUJnjB0uO7sdSoF6e7f_n00330NV0QPN2D-h9sYantBe-ukBNZ6K63oFINFAsVRZ_AoIeUuxMLIEzZOYj0I5dL3MM1ZMAh0k-ioh2nKQY043xm26XdL_c4o3axXa71frPbLGdjq3Wz3-wX2DWrnbVb2-gFbro9dWZrVnZDM251o1cLrbeLZr3Sy3m_17vemoVd4XK9W-_UqqETsps7dz7NQxxmnFKmdqEXutEzhx25VJeN1r1DP6jloXqhtC77J7YF-NDlIalV4zhJupcSFlc31Q25foKnt_f8iw3FqbwAmw1ZsDSRtyXhwf__7pnl6NpRZEpqeVD6qPRxYBlzNzfhpPSxKHn9e5hi-IuMKH2sHSalj69Nnlv9TwAAAP__NLvXaQ">