<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLVM_EXTERNAL_*_SOURCE_DIR not relative to topmost source directory"
   href="https://bugs.llvm.org/show_bug.cgi?id=38440">38440</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM_EXTERNAL_*_SOURCE_DIR not relative to topmost source directory
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tom@tromey.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The cmake docs (<a href="https://llvm.org/docs/CMake.html">https://llvm.org/docs/CMake.html</a>) say:

LLVM_EXTERNAL_{CLANG,LLD,POLLY}_SOURCE_DIR:PATH
    These variables specify the path to the source directory for the external
LLVM projects Clang, lld, and Polly, respectively, relative to the top-level
source directory. If the in-tree subdirectory for an external project exists
(e.g., llvm/tools/clang for Clang), then the corresponding variable will not be
used. If the variable for an external project does not point to a valid path,
then that project will not be built.


However, using a path relative to the top-level source directory does not work.

I have a directory structure like so:

.
├── build
└── src
    ├── llvm
    └── tools
        ├── clang
        └── lldb

To test it, "cd build" and then run:

cmake  -DLLVM_EXTERNAL_CLANG_SOURCE_DIR="../src/tools/clang"
-DLLVM_EXTERNAL_LLDB_SOURCE_DIR="../src/tools/lldb" ../src/llvm/

For me, this fails to include lldb in the build.
You can see this either by examining the output -- build with lldb
say something like:

-- Symbols (liblldb): exporting all symbols from the lldb namespace

... or by trying "make lldb" and having it fail.

Using a path relative to the build directory works.  An absolute path also
works.

I tend to think that the documented behavior is preferable; certainly it
would have been nicer in my situation.  However, another option would be to
fix this by changing the documentation.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>