Can't build clang-tools-extra using Visual Studio because of missing include directory in tools\extra project files

Building llvm+clang+clang-tools-extra at branch release_36 using CMake generated sln/project files for “Visual Studio 12 Win64” I got a bunch of compile errors in various clang-tools-extra projects due to the fact that …\tools\clang\include isn’t one of the “additional include directories” in the vcxproj files for projects in extra.

(A quick glance at the commit history since release_36 doesn’t show any commit (to my eyes) that would have fixed this (I looked only at the commit message).)


a) I’d like to report this problem.


b) Is there something simple I can fix in my local working directory so that I can regenerate the sln/project files using CMake and continue?

(I would do it myself and submit a fix but unfortunately I have no knowledge as to how CMake is configured.)

Thanks! – David Bakin

I don’t think anybody has put in the work yet to make the CMake compile-commands work seamlessly on Windows yet. I’d certainly welcome any patches thrown my way to help with that …

Well, I’d be willing to do that if I knew how to do it. I’ve patched up my vcxproj files by hand but have no idea how to get CMake to do it. Or possibly it is the module system (module.modulemap)? If you can point me at documentation for what’s needed I’ll get it done.

Here’s the original line of patches upstream in which I added the feature:


I have successfully built 3.5 release, 3.5.1 release, 3.6 release, and trunk (today) including LLVM, Clang, and clang extra tools on Windows with CMake 3.2 and Visual Studio 2013. I have never had any issue getting them to work.

I checked out llvm to d:\llvm\llvm
clang to d:\llvm\llvm\tools\clang
extra tools to d:\llvm\llvm\tools\clang\tools\extra

Well, that’s interesting. I did clone the extra tools into llvm\tools\clang\tools\extra. The problem was that all of the vcxprojs for the projects in extra were missing “additional include directories” for the source tree’s tools\clang\include and also the binary tree’s tools\clang\include. But all other necessary include directories were there.

The installed CMake is 3.2.1, the compiler is VS 2013 Win64, the config was Debug, and the llvm/clang/extras are all sync’d to release_36. LLVM and Clang build fine (and pass unit tests). And whatever was causing it, it was repeatable (blowing away the build output tree, rerunning cmake-gui with the same settings, and doing another build gave the same result.)

I guess I’ll have to try again. Are there any special cmake configuration variables you set? Here’s my full list:



(P.S. is there a way using cmake-gui to save/write the configuration variable settings so you can restore them the next time you want to generate VS sln/project files instead of typing them in again? Or, alternatively, getting cmake-gui to emit somewhere the actual cmake command line given the entire configuration you define with it?)

svn checkout d:/llvm/llvm
svn checkout d:/llvm/llvm/tools/clang
svn checkout d:/llvm/llvm/tools/clang/tools/extra
mkdir d:\llvm\build
cd d:/llvm/build
cmake -G “Visual Studio 12” d:/llvm/llvm

I then open LLVM.sln with VS2013 and build all. Building with revision 233933 I get error LNK1104: cannot open file ‘LLVMFuzzer.lib’, but that is new (I didn’t see that error yesterday).

Replacing trunk with branches/release_36 compiles with no errors or warnings.

Note that I am building Win32/Debug.

Ahem. Turns out it was pilot error: I was placing clang-tools-extra into llvm/tools/extra not llvm/tools/clang/tools/extra. Thanks, Daniel, your script pointed me to the error which I would have never otherwise figured out.

– David