<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134258>134258</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CMake Config files don't provide deprecated Module variables
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bebuch
</td>
</tr>
</table>
<pre>
I try to build LLVM with zlib-ng (in compatability mode), zstd and libxml2. I have build these projects an installed there config files. I use a custom include install path. Therefor the outdated CMake Modules can't work for my build.
The modern project Config files do not provide `ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, `zstd_INCLUDE_DIR`, `zstd_LIBRARY`, `LIBXML2_LIBRARY` and `LIBXML2_INCLUDE_DIR`.
LLVM CMake code depends on these variables. It also uses the targets which are produced by the Modules and the Config files.
ZLIB is broken right at the start:
https://github.com/llvm/llvm-project/blob/61ef28650626dd4f651a250005c77255d8086f69/llvm/cmake/config-ix.cmake#L165-L186
Only the check depends on the old variables, so it works if you remove it.
The next problematic section seams to be:
https://github.com/llvm/llvm-project/blob/2334fd2ea3a0a391ca88da36764d895d9c34e1bc/llvm/cmake/modules/LLVMExternalProjectUtils.cmake#L172-L196
I think the variables are here passed to a subsequent call. This might be the reason for these errors in my build run:
```none
loading initial cache file C:/TechnoTeam/develop/usr/build/llvm/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Performing bootstrapping runtimes build.
-- Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
-- Could NOT find zstd (missing: zstd_INCLUDE_DIR)
-- Could NOT find LibXml2 (missing: LIBXML2_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
-- Could NOT find zstd (missing: zstd_INCLUDE_DIR)
-- Could NOT find LibXml2 (missing: LIBXML2_INCLUDE_DIR)
CMake Error at C:/temp/tt/env/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
Call Stack (most recent call first):
C:/temp/tt/env/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
C:/temp/tt/env/share/cmake-3.31/Modules/FindPython/Support.cmake:4002 (find_package_handle_standard_args)
C:/temp/tt/env/share/cmake-3.31/Modules/FindPython3.cmake:602 (include)
CMakeLists.txt:180 (find_package)
```
I'm not sure whats the best way to fix this. On simple way might be to create the variables from the targets if they don't exist after the `find_package`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVk-P4j4S_TThUgIF5w_hwIHugR0keqbVf1aze0GOXSFeHDtrO3Qzn35lJzR098xhNbuHn4SE4nLZr15VPRe1VuwV4iLKbqLsy4h2rtZmUWLZsXpUan5abMCZEzgNZSckh-3273fwIlwNP6Uox2oPESmEAqabljpaCincCRrNMSLziNzCT-s4UMVBivK1kWQCG6jpEYfzXI0WoTX6X8icBapAKOuolBhsBoFpVYk9VEKi9c6dRaDAOut0A0Ix2XE8O0FLXT2BJ-9YaeNPAN05Th1yuL2jB4Q7zTuJFhhVEZk5eNHmAH5vc-ohTaJ4GcXLpxpDGEad0cHtFRLgGpR23nYUHCHK439uNze7zbfb7fOX1e7L5iHKY0_A2bLd3DwsH_5xWfXM_Hp_sHzav93c_LjbkitD4PXK8v6wIZCQsT52pjkCxxYVt6DVQP6RGkHLnl0HVFrtObaBPEfNHp2Fl1qwGqgJqeIdQw7lKew48-mh-O9rkgYEPnwQFkqjD6jAiH3tgLqw3TpqXJQs-521c631X2QdkfVeuLorJ0w3EVlLeTz_jYeERGRdSl1GZJ1PsSJFnsU5yTlPqzybUpLFcZyx2YxkGS_iIq_y-eUc1tAD-v8AdyxeJ8NKsp3m2Xg7LfIe0ncl-0BZjezwgT3Qkl_483myGkRfVBZEBSfdgcFGHxGEu6osha-hdkqJDXWCgUXmhFZgkTY2tBv-MSskSdKKE6QJjWkynzJaFJwm-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