<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Building clang with CMake outside LLVM tree without specifying CLANG_PATH_TO_LLVM_SOURCE"
href="http://llvm.org/bugs/show_bug.cgi?id=17837">17837</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Building clang with CMake outside LLVM tree without specifying CLANG_PATH_TO_LLVM_SOURCE
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jesper.eskilson@iar.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I'm trying to build Clang using CMake, and I want to keep the Clang and LLVM
source trees separate. Looking at the Clang top-level CMakeLists.txt it should
be possible, but when I try to build with
cmake ... -DCLANG_PATH_TO_LLVM_BUILD=/my/llvm ...
the build fails with
FAILED: cd
/home/jesperes/dev/wtd-analyzer/build/clang-prefix/src/clang-build/include/clang/Driver
&& /home/jesperes/dev/wtd-analyzer/build/llvm-prefix/bin/llvm-tblgen
-gen-opt-parser-defs -I
/home/jesperes/dev/wtd-analyzer/build/clang-prefix/src/clang/include/clang/Driver
-I /lib/Target -I /include
/home/jesperes/dev/wtd-analyzer/build/clang-prefix/src/clang/include/clang/Driver/Options.td
-o
/home/jesperes/dev/wtd-analyzer/build/clang-prefix/src/clang-build/include/clang/Driver/Options.inc.tmp
/home/jesperes/dev/wtd-analyzer/build/clang-prefix/src/clang/include/clang/Driver/Options.td:15:9:
error: Could not find include file 'llvm/Option/OptParser.td'
include "llvm/Option/OptParser.td"
^
I noted the "-I /lib/Target", which got me suspicious and started poking around
in the CMakeLists.txt file, and discovered this line:
set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
but LLVM_MAIN_SRC_DIR is only set if CLANG_PATH_TO_LLVM_SOURCE is set. However,
the documentation of CLANG_PATH_TO_LLVM_SOURCE claims that it is not necessary
to set if building against an installed LLVM.
It looks like the proper solution is to set LLVM_MAIN_INCLUDE_DIR properly
using output from "llvm-config --includedir` if CLANG_PATH_TO_LLVM_SOURCE is
not set.</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>