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

    <tr>
        <th>Summary</th>
        <td>
            [15.x] Please backport d230055234863aafe63489f9ab95e52d2c1883f2 ([llvm] [cmake] Move LLVM_INSTALL_PACKAGE_DIR top-level to fix llvm-config) to 15.x
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            cmake,
            release:backport
      </td>
    </tr>

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

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

<pre>
    > commit d230055234863aafe63489f9ab95e52d2c1883f2 (origin/main)
Author: Michał Górny <mgorny@gentoo.org>
Date:   2022-08-15 09:50:14 +0200
>
>    [llvm] [cmake] Move LLVM_INSTALL_PACKAGE_DIR top-level to fix llvm-config
>    
>    Move the `LLVM_INSTALL_PACKAGE_DIR` declaration from llvm/cmake/modules
    directory to the top-level llvm/CMakeLists.txt, in order to fix
    the regression in `llvm-config --cmakedir` output for installed LLVM.
    Since the tools directory is processed by CMake prior to
    llvm/cmake/modules, the llvm-config executable ended up using
    the variable prior to it being defined and incorrectly used an empty
    path, resulting in e.g.:
>    
>        $ llvm-config --cmakedir
>        /usr/lib/llvm/16/
>    
>    With this patch, the path is defined (and therefore the default value
    is being set) prior to adding the tools subdirectory and llvm-config
    starts working correctly:
>    
>        $ llvm-config --cmakedir
>        /usr/lib/llvm/16/lib64/cmake/llvm
>    
>    This fixes a regression introduced by D130539.  Thanks to Petr Polezhaev
    for reporting the problem @ https://bugs.gentoo.org/865165
>    
>    Differential Revision: https://reviews.llvm.org/D131878

CC @Ericson2314 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VU2P4jgQ_TXhYhE5zgfJIQcamtFo6VVrZrR7bDlJJXjbxMh2mGZ__VYF6IBGHFZaLQfj2K7nV68-XJnmVAbxM6vNfq88a0TMeZ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