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

    <tr>
        <th>Summary</th>
        <td>
            Missing header `omp.h` in install directory when building `llvm@18.1.2` with `openmp` as runtime with `cmake@3.29.0` 
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          s-sajid-ali
      </td>
    </tr>
</table>

<pre>
    ### Summary
When installing `llvm@18.1.2` with `spack` using `cmake@3.29.0` and configuring `openmp` to be enabled as a runtime, the final install directory is missing `omp.h` even though the header is present in the build directory. However, this problem does not occur when building `llvm@18.1.2` with the same configuration using `cmake@3.27.9`. 

### Details
Here are the two builds of `llvm@18.1.2` differing only in the version of `cmake` used for the build. 
```
sasyed@MAC-140753 ~> spack find -lv llvm
-- darwin-sonoma-m1 / apple-clang@15.0.0 ------------------------
cgcsya3 llvm@18.1.2+clang~code_signing~cuda~flang~gold~ipo~libomptarget~libomptarget_debug~link_llvm_dylib+lld+lldb+llvm_dylib+lua~mlir+polly~python~split_dwarf~z3~zstd build_system=cmake build_type=Release compiler-rt=runtime generator=ninja libcxx=runtime libunwind=runtime openmp=runtime shlib_symbol_version=none targets=none version_suffix=none
bydpwmd llvm@18.1.2+clang~code_signing~cuda~flang~gold~ipo~libomptarget~libomptarget_debug~link_llvm_dylib+lld+lldb+llvm_dylib+lua~mlir+polly~python~split_dwarf~z3~zstd build_system=cmake build_type=Release compiler-rt=runtime generator=ninja libcxx=runtime libunwind=runtime openmp=runtime shlib_symbol_version=none targets=none version_suffix=none
==> 2 installed packages
sasyed@MAC-140753 ~> spack diff /cgc /byd
==> Warning: This interface is subject to change.

--- llvm@18.1.2/cgcsya36nknpeizproew2cdxtf4r6xcb
+++ llvm@18.1.2/bydpwmdkng7shunf3ltzj56a3bkjepy5
@@ hash @@
-  cmake slpmwq3esyyjikfqskqbea3nvobw7oei
+  cmake yyb45mfiot4obxxx7kashbrpvudmx3d4
-  llvm cgcsya36nknpeizproew2cdxtf4r6xcb
+  llvm bydpwmdkng7shunf3ltzj56a3bkjepy5
@@ package_hash @@
-  cmake gsj2wl26n5psfanwtf3a3owh6fcj5mnx6eyuygm6g7eo5wye6y4a====
+  cmake 4nfzzuirvovagbkvkxjvtkvwyokgaekv3iyo3emo7h2ai42uofmq====
@@ version @@
-  cmake 3.29.0
+  cmake 3.27.9
sasyed@MAC-140753 ~>
```

Here are the results of an attempt to locate `omp.h` within the two install destinations: 
```
sasyed@MAC-140753 ~> fd "omp.h" (spack location -i /cgc)
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-cgcsya36nknpeizproew2cdxtf4r6xcb/include/llvm/Frontend/OpenMP/OMP.h.inc
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-cgcsya36nknpeizproew2cdxtf4r6xcb/include/polly/CodeGen/LoopGeneratorsGOMP.h
sasyed@MAC-140753 ~> fd "omp.h" (spack location -i /byd)
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-bydpwmdkng7shunf3ltzj56a3bkjepy5/include/c++/v1/__algorithm/comp.h
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-bydpwmdkng7shunf3ltzj56a3bkjepy5/include/llvm/Frontend/OpenMP/OMP.h.inc
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-bydpwmdkng7shunf3ltzj56a3bkjepy5/include/polly/CodeGen/LoopGeneratorsGOMP.h
/Users/sasyed/Documents/packages/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/llvm-18.1.2-bydpwmdkng7shunf3ltzj56a3bkjepy5/lib/clang/18/include/omp.h
sasyed@MAC-140753 ~> 
```
where it is clear that when using `cmake@3.29.0` the header `omp.h` is missing. 

It is however, present in the build directory as shown below:
```
sasyed@MAC-140753 /v/f/m/z/T/s/s/s/spack-build-cgcsya3> pwd
/var/folders/mb/zd6pgmt100q77s5fhn5xf4jw0000gq/T/sasyed/spack-stage/spack-stage-llvm-18.1.2-cgcsya36nknpeizproew2cdxtf4r6xcb/spack-build-cgcsya3
sasyed@MAC-140753 /v/f/m/z/T/s/s/s/spack-build-cgcsya3> fd "omp.h"
include/c++/v1/__algorithm/comp.h
include/llvm/Frontend/OpenMP/OMP.h.inc
runtimes/runtimes-bins/openmp/runtime/src/omp.h
sasyed@MAC-140753 /v/f/m/z/T/s/s/s/spack-build-cgcsya3> 
```

### Platform information & Supporting logs
Output of `spack debug report`:
```
sasyed@MAC-140753 ~> spack debug report
* **Spack:** 0.22.0.dev0 (69509a6d9a9c515dc4e00fbfe94c7e27a440b0ad)
* **Python:** 3.9.6
* **Platform:** darwin-sonoma-m1
* **Concretizer:** clingo
sasyed@MAC-140753 ~> 
```

Build log for `llvm@18.1.2 targets=none ^cmake@3.29.0`: [spack-build-out.txt](https://github.com/llvm/llvm-project/files/14765311/spack-build-out.txt)
Build log for `llvm@18.1.2 targets=none` (implicitly picking `cmake@3.27.9`): [spack-build-out.txt](https://github.com/llvm/llvm-project/files/14765315/spack-build-out.txt)



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWEtv4zgS_jXMhZAgUw_HBx-SdqtngW1MY3sWczQosSQxpkiFpCwrB__2BSk5dtLuRxo7mBlgAkUWX8V6fsUiNYbXEmCN0nuUbm5obxul1yYw9IGzgAp-Uyg2rhGJpwd_7tuW6hFFGxTd_d6AxFwaS4XgssYoi4TYtyiJFrfhIiQoi_DAbeMGTEfLnevozTy1bOkOUBLFIVmFkRuikuFSyYrXvZ4nqQ5k27lBq3ABGCQtBDBMDaZY99LyFhB5h20DuOKSihM_mHEN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