<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 --- - Hardcoded paths in cmake files"
href="http://llvm.org/bugs/show_bug.cgi?id=21121">21121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Hardcoded paths in cmake files
</td>
</tr>
<tr>
<th>Product</th>
<td>Build scripts
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</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>stephen.warner.thomas@gmail.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 asked this question on Stack Overflow; the consensus is that this is a bug.
I'll copy and paste the text from the SO question here:
I'm using LLVM/Clang in my C++ project. I can build and run everything fine
with a Makefile.
I'm now trying to move to Cmake and I can't get things to work. Let me explain
what I've done.
I'm following this tutorial:
<a href="http://llvm.org/docs/CMake.html#embedding">http://llvm.org/docs/CMake.html#embedding</a>
A relevant snippet from that webpage is:
<span class="quote">> From LLVM 3.5 onwards both the CMake and autoconf/Makefile build
> systems export LLVM libraries as importable CMake targets.</span >
Great! I'll go download LLVM 3.5 and I should be good to go. I went to the
download page:
<a href="http://llvm.org/releases/download.html">http://llvm.org/releases/download.html</a>
and downloaded the pre-built binaries for Clang for Ubuntu 14.04 Linux.
Then, I added the following to my `CMakeLists.txt` file:
find_path (LLVM_DIR LLVM-Config.cmake
/home/dev/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu/share/llvm/cmake
)
message(STATUS "LLVM_DIR = ${LLVM_DIR}")
find_package(LLVM REQUIRED CONFIG)
(This is the same as the tutorial, except I set `LLVM_DIR` since it is
currently in a non-standard location.)
When I run `cmake`, I get the following error:
[dev@beauty:/path/to/project/build (develop)] $ cmake ..
-- LLVM_DIR =
/home/dev/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu/share/llvm/cmake
CMake Error at
/home/dev/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu/share/llvm/cmake/LLVMConfig.cmake:50
(include):
include could not find load file:
/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/share/llvm/cmake/LLVMExports.cmake
Call Stack (most recent call first):
CMakeLists.txt:14 (find_package)
CMake Error at
/home/dev/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu/share/llvm/cmake/LLVMConfig.cmake:53
(include):
include could not find load file:
/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
CMakeLists.txt:14 (find_package)
So Cmake seems to be finding LLVM's Cmake file, but Cmake is complaining about
some path starting with `/home/ben/`.
Indeed, it appears that LLVM's `LLVMConfig.cmake` file has some absolute paths
in it that are not relevant for my machine. For example:
[dev@beauty:~/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu ] $ head
./share/llvm/cmake/LLVMConfig.cmake
# This file provides information and services to the final user.
set(LLVM_INSTALL_PREFIX
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install")
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 5)
set(LLVM_VERSION_PATCH 0)
set(LLVM_PACKAGE_VERSION 3.5.0)
set(LLVM_COMMON_DEPENDS )
Who's `ben` and what's he doing in this file? He shows up in a few more places:
[dev@beauty:~/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu ] $ grep ben
./share/llvm/cmake/LLVMConfig.cmake
set(LLVM_INSTALL_PREFIX
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install")
set(LLVM_INCLUDE_DIRS
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/include")
set(LLVM_LIBRARY_DIRS
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/lib")
set(LLVM_CMAKE_DIR
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/share/llvm/cmake")
set(LLVM_TOOLS_BINARY_DIR
"/home/ben/development/llvm/3.5/final/Phase3/Release/llvmCore-3.5.0-final.install/bin")
Needless to say, those paths do not exist on my machine. I'm confused as to why
these files have these paths in them? Am I supposed to run a tool or something
to change these paths for my machine? Or do I need to change them all manually?
**EDIT**: Out of curiosity, I manually changed all those paths to point to
paths on my machine:
[dev@beauty:~/Downloads/clang+llvm-3.5.0-x86_64-linux-gnu/share/llvm/cmake
] $ sed -i
-e's/.home.ben.development.llvm.3.5.final.Phase3.Release.llvmCore-3.5.0-final.install/\/home\/dev\/Downloads\/clang+llvm-3.5.0-x86_64-linux-gnu/g'
*
After that, Cmake no longer complained and my build proceeded.
I'd still like to know why I needed to do that.</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>