Conan can be integrated with Visual Studio in two different ways:
- Using the cmake generator to create a conanbuildinfo.cmake file.
- Using the visual_studio generator to create a conanbuildinfo.props file.
With visual_studio generator¶
You can use the visual_studio generator to manage your requirements via your Visual Studio project.
This generator creates a Visual Studio project properties file, with all the include paths, lib paths, libs, flags etc, that can be imported in your project.
conanfile.txt and change (or add) the visual_studio generator:
[requires] Poco/1.7.8p3@pocoproject/stable [generators] visual_studio
Install the requirements:
$ conan install
Go to your Visual Studio project, and open the Property Manager, usually in View -> Other Windows -> Property Manager.
Click the “+” icon and select the generated
Build your project as usual.
Remember to set your project’s architecture and build type accordingly, explicitly or implicitly, when issuing the conan install command. If these values don’t match, you build will probably fail.
Check the Reference/Generators/visual_studio for the complete reference.
Calling Visual Studio compiler¶
You can call your Visual Studio compiler from your
build() method using the
Check Build Automation/Building with Visual Studio section for more info.