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

    <tr>
        <th>Summary</th>
        <td>
            cmake failure for compiler-rt when building Flang
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

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

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

<pre>
    The error occurs at the `compiler-rt` stage building as recommended by [Flang getting started](https://flang.llvm.org/docs/GettingStarted.html).

This is a regression due to 487d5af6482ea5f074c12d29d7e376d3fc697706 , prior to that cmake runs through without problem.

Explicitly I used:
```
cd /tmp && rm -rf /tmp/build && mkdir /tmp/build && cd /tmp/build && \
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=11 -DCMAKE_C_CFLAGS=-mlong-double-128 -DCMAKE_CXX_CFLAGS=-mlong-double-128 -DCOMPILER_RT_BUILD_ORC=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_SANITIZERS=OFF ../llvm-project/compiler-rt
```
which results in:
```
...
-- Performing Test COMPILER_RT_TARGET_HAS_UNAME - Success
-- Configuring done (9.9s)
CMake Error at cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

 $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
 exists.
Call Stack (most recent call first):
 lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

 $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
 exists.
Call Stack (most recent call first):
 lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

 $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
 exists.
Call Stack (most recent call first):
 lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  No SOURCES given to target: clang_rt.ctx_profile-x86_64
Call Stack (most recent call first):
  lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)
```
One can temporarily work around the problem be deleting the last 8 lines of `compiler-rt/lib/ctx_profile/CMakeLists.txt`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVkuPozgQ_jXOpRRETALhkAMhYbZ3O50WSUs9c0EGF-BpgyPb9GN__QpCv2ZnWqvVXlZqKUKJ65Gq-r7CHzNGVC3iiizWZLGZsM7WSq_Y94Y9LWeTXPGn1bFGQK2VBlUUnTbALNgagfhuoZqTkKin2hLfBWNZhZB3QnLRVsAMaCxU02DLkUP-BGSxTiRrK6jQ2t7FWKYtcrLYELqsrT0Z4kWEJoQmZe_oSHnfOEpXhCZcFYbQ5Ms59HCOdGrbSEJDh7gb4kbn57EWBoQBBhorjcYI1QLvEKyC-TLgC1b68yVFtijdYF7MKKchD9ALfO6VhR8GgesDoTGctFC6j7I1s1A07A5Bd60BW2vVVTU8CFurzsJJq1xi866K7eNJikJY-QQX0BnkfWtnu--On-FnwYHQxDYnINQn1AfdwFSX4yGhyTDRZ2Nzx4X-he0l048GsojP_xXHxNsUAwbx7e3zd0LXhK7HBqebeBf9sc3WNxeXm-z49XpLvE2KEpl5Nca3t9nhGF1tonRDvM1s9mrJ4uQy-nIg3mbaSNVWU666XOJ0Rpfvwj922--uLy63aZYex0L2aV_6Pkl-ar1No68fmHfb3XW6Tz7wuLxYJzffvm3TD3wO0dXF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