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

    <tr>
        <th>Summary</th>
        <td>
            Compilation fails because `CMAKE_CXX_COMPILER_ID` not defined in `CheckProblematicConfigurations.cmake`
        </td>
    </tr>

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

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

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

<pre>
    Trying to compile `clang` and `lld` as static executables targeting WebAssembly only (you can copy paste this in `/tmp` for ex):

```bash
LLVM_BRANCH="release/15.x"
FOLDER=`echo llvm-project-${LLVM_BRANCH} | tr '/' '_'`
git clone https://github.com/llvm/llvm-project.git --branch ${LLVM_BRANCH} --single-branch --depth 1 ${FOLDER}
mkdir -p ${FOLDER}/build
cd ${FOLDER}/build

cmake ../llvm -DLLVM_ENABLE_PROJECTS='clang;lld' \
  -DCMAKE_BUILD_TYPE=MinSizeRel \
  -DCMAKE_EXE_LINKER_FLAGS=-static \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DLLVM_TARGETS_TO_BUILD=WebAssembly \
  -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi'
make -j $(nproc) -i
```
In the phase:
```
[100%] Performing configure step for 'runtimes'
```
compilation fails because `CMAKE_CXX_COMPILER_ID` is not defined in `CheckProblematicConfigurations.cmake`:
```bash
-- Linker detection: GNU ld
CMake Error at /tmp/llvm-project-release_15.x/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):
  if given arguments:

    "STREQUAL" "MSVC"

  Unknown arguments specified
Call Stack (most recent call first):
  /tmp/llvm-project-release_15.x/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:149 (include)
```

My setup:
```bash
:~$ cc --version
cc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

:~$ c++ --version
c++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

:~$ cmake --version
cmake version 3.22.1
~$ python3 --version
Python 3.10.4
```

Compilation goes on for a while before failing so I doubt it is a problem with my system. I'm able to compile `clang` and `lld` without the "runtimes" option. Only when I set the runtimes does a configure stage happens in the middle of the compilation and fails this way.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVkuT2jgQ_jXm0mWXHzAMBw7GmMQbXgsmOzlRsi2wgl9lyWHYX78t2UwYZmoqm70uRdmW1N1qfeqvu6MyuYzD-sKKI4gS4jKvWEZBezDjjBRHfAMpEjnOskSNOHBBBIuBPtO4ESTKKAdB6iMV0shfNHI5p3mUXaAs8KHZj5eygZgUaL26QEW4oCBSxoEV0rBmz0ReSduHskarmj3SHFczp5p5faKQ-keEp-3UfP51sZ9s3KX3WXOmmm3XNKOEUzRmDQy0Ybdys9V86m-kyINJ47SELPuR61Vdfqex0DW7rw0nt7aGU9CGHoga_R6iMXzKr70coQvK5pEJiLOyoJAKUXHprBSc4XzaRAZiiAO5T_e6bmdIRV2PalLEKby7t65zBDGjVyFdT2glUrA68e44w2nrSX5KWA169WbVnkUNwwtTUnHy8XonlZMTBcPonAZ9qnzzl-5k7u_Xm9UfvhduFdjDNjaciYwJCdDAa20AankL94u_n-yC-XQfflv7qLFgxZb9TTc0e0_Uf_L382D5xd_sZ3P3k9xC70LsHen1ahuEwWq5D5ZTf-3jYxnuvdVU7rNavtZQBwjdzSc_3O7DVesUyt3G6FuF7sSb3TIMFn534oxF8fOzPLL6IBGTEdFegsRN_64wth8LvOwYQxh0dhe87TAoMPYpVKkMVuc-wLvhYGKZy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