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

    <tr>
        <th>Summary</th>
        <td>
            [offload] [cmake] Standalone build test logic is broken
        </td>
    </tr>

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

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

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

<pre>
    I'm trying to figure out how to build it post-openmp/offload split, and the test logic just doesn't seem to make any sense to me.

So far I've noticed that:
- offload reuses the `OpenMPTesting` logic that tries to use `OPENMP_TEST_{C,CXX}_COMPILER`
- however, the `cmake/DetectTestCompiler` directories has not been copied from `openmp`, so the whole logic fails
- `test` directory instead uses `CMAKE_{C,CXX}_COMPILER`

Even if I copy the directory, ensure that C/C++ compiler is clang and make the whole CMake pass, the test target seems to be broken:

```
$ ninja check-libomptarget
ninja: error: 'test/omp', needed by 'test/CMakeFiles/check-libomptarget', missing and no known rule to make it
```

And if I remove the wrong dependency from `test/CMakeLists.txt`, the tests fail because of:

```
# .---command stderr------------
# | x86_64-pc-linux-gnu-clang: error: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5'
# `-----------------------------
# error: command failed with exit status: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVVFvozgQ_jXOy4gIDIHLQx4a0kjVbW-rax_2rTL2AG6NjWzTNP_-ZEPSaG-1iyo34JlvvvnmMzDnZKcRd2SzJ5vDik2-N3Y3dMbq86ox4rx7ILQawNuz1B14A63sJotgJg-9OYUnzSSVAOlhNM4nZkQ9jIQeTdsqwwS4UUlPaA1MC_A9gkfnQZlOcnibnAdh0GlCKw8OcQiIA3tHYPoMDrXD-ATXJD2Q9G5enw20zELg9oGgjZccAzjzJF9CErgQsDg5dLE0KdPvI-rH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