Reputation: 33505
I'm trying to build LLVM/Clang on Windows 7 with Microsoft C++ 2013. Building LLVM spat out a few error messages along the way but mostly seemed to be succeeding and did end up creating a folder full of exe's so that part seems to have worked. When I try to build Clang:
C:\clang>\CMake\bin\cmake.exe ..\clang-3.4 -DCLANG_PATH_TO_LLVM_BUILD=/llvm
CMake Error at CMakeLists.txt:29 (message):
Please set CLANG_PATH_TO_LLVM_BUILD to a directory containing a LLVM build.
And I get the same error message whether I omit CLANG_PATH_TO_LLVM_BUILD, define it in CMakeLists.txt or an environment variable instead of the command line, set it to possibly relevant subdirectories of /llvm etc.
What am I missing?
Upvotes: 0
Views: 1795
Reputation: 76785
You're not following the instructions on this page correctly, under "Using Visual Studio". You will end up with
/ /llvm /llvm/CMakeLists.txt /llvm/tools/clang /llvm/tools/clang/CMakeLists.txt
Step 4, repeated here for clarity:
- Run CMake to generate the Visual Studio solution and project files:
cd ..\..
(back to where you started)mkdir build
(for building without polluting the source dir)cd build
- If you are using Visual Studio 2012:
cmake -G "Visual Studio 11" ..\llvm
That last bit needs to be run from inside the VS Command Prompt, but you seem to have that sorted out. You can also generate "NMake makefiles" if you don't use the IDE to build. Anyways, the point is that you should call cmake
on the toplevel CMakeLists.txt
file, not on the clang one directly. Clang will be built as part of the build process. You can even add libc++ and compiler-rt to the llvm/projects
directory to have these built automatically on platforms that support them.
What you are doing is building clang "out of tree". Which is possible and even supported, but only really useful in certain circumstances. You'll need a previously built build of LLVM in some directory. You then set CLANG_PATH_TO_LLVM_BUILD
to the directory containing the built LLVM files (this is not the source directory). But as I said, that's making things needlessly difficult.
Upvotes: 1