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

    <tr>
        <th>Summary</th>
        <td>
            llvm-mt breaks Windows build when not compiled with XML support
        </td>
    </tr>

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

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

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

<pre>
    Windows 10 Enterprise, Visual Studio Enterprise 2022 (17.1.6), 11th Gen Intel(R) Core(TM) i7-1185G7.

Reproduces on `main` and `release/14.x`.

CMake shipped with VS picks up `llvm-mt` as manifest tool, which throws an error if it wasn't compiled with `libxml2` support. To reproduce - build and install `clang` locally, then attempt to use it as a C or C++ compiler from a CMake project. For example, configuring LLVM build with Clang:

```
> cmake -GNinja -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DLLVM_ENABLE_PROJECTS="llvm;clang" ..\llvm-project\llvm
-- The C compiler identification is Clang 15.0.0 with MSVC-like command-line
-- The CXX compiler identification is Clang 15.0.0 with MSVC-like command-line
-- The ASM compiler identification is Clang with MSVC-like command-line
-- Found assembler: C:/Users/ppenzin/llvm/trunk/bin/clang-cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/ppenzin/llvm/trunk/bin/clang-cl.exe
-- Check for working C compiler: C:/Users/ppenzin/llvm/trunk/bin/clang-cl.exe - broken
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "C:/Users/ppenzin/llvm/trunk/bin/clang-cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/ppenzin/Dev/llvm/build-clang/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~1/MICROS~3/2022/ENTERP~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_f9408 && [1/2] Building C object CMakeFiles\cmTC_f9408.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_f9408.exe
    FAILED: cmTC_f9408.exe
    cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_f9408.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\Users\ppenzin\llvm\trunk\bin\llvm-mt.exe --manifests  -- C:\Users\ppenzin\llvm\trunk\bin\lld-link.exe /nologo CMakeFiles\cmTC_f9408.dir\testCCompiler.c.obj  /out:cmTC_f9408.exe /implib:cmTC_f9408.lib /pdb:cmTC_f9408.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    MT: command "C:\Users\ppenzin\llvm\trunk\bin\llvm-mt.exe /nologo /manifest CMakeFiles\cmTC_f9408.dir/intermediate.manifest /out:CMakeFiles\cmTC_f9408.dir/embed.manifest /notify_update" failed (exit code 0x1) with the following output:
    llvm-mt: error: no libxml2
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:55 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/ppenzin/Dev/llvm/build-clang/CMakeFiles/CMakeOutput.log".
See also "C:/Users/ppenzin/Dev/llvm/build-clang/CMakeFiles/CMakeError.log".
```

It would be reasonable not to provide `llvm-mt` executable when `libxml2` isn't present, because it won't be able to process manifests and would only cause compilation to fail.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1WFtz4jYU_jXkRYPHNjiEBx6IgZ20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