Search code examples
packageclang++llvm-clangpackage-managers

C++ Library Package Manager for Clang/LLVM


I'm using Visual Studio 2017 as my IDE. I've set the "Platform Toolset" option (right-click the project and select "Properties". Then go to Configuration Properties > General) to be "LLVM-vs2014_xp" which is Clang/LLVM. This is in-place of the standard Visual Studio 2017 toolset which uses the MSVC compiler.

Now, before I was using vcpkg to handle installing C++ libraries for the MSVC compiler, and it was quite simple. If I wanted to install Boost, msgpack, Modern JSON for C++, and a variety of other C++ libraries, I just had to type in the terminal:

  vcpkg install boost

Or equivalent. And my libraries would be found if I included the appropriate header in source code.

Now that I have switched to Clang/LLVM, when building in Visual Studio the Clang compiler can't find the same libraries. I am trying to avoid manually telling the Linker where certain things are/editing the Path variables like "Include Directories" and "Library Directories".

Does anyone know of an equivalent package manager to vcpkg for Clang?

Alternatively, if you know of a way to tell Clang to look for the vcpkg libraries that is simple, that is fine as well. I have already tried setting the "Include Directories" and "Library Directories" to the same values as for when Visual Studio toolset is set, with no luck.

EDIT: It now occurs to me that it might be possible to solve this by copying all tab values from "VC++ Directories" for when Visual C++ (MSVC) is the toolset to when Clang is the toolset. I may attempt...

EDIT 2: Do not attempt the edit above i.e. copying those tab values from the Visual C++ toolset properties. It just creates a bunch of linker errors...


Solution

  • Set the following under Configuration Properties>VC++ Directories:

    "Include Directories" to include "C:\Program Files\vcpkg\installed\x86-windows\include"
    

    and

     "Library Directories" to include "C:\Program Files\vcpkg\installed\x86-windows\lib"
    

    This links the vcpkg libraries and header files to the Clang/LLVM toolset!

    Your directories might be in different locations so just set the paths appropriately for your setup.