Compilers on command line

The compiler_args generator creates a file named conanbuildinfo.args containing a command line arguments to invoke gcc, clang or cl (Visual Studio) compiler.

Now we are going to compile the getting started example using compiler_args instead of the cmake generator.

Open conanfile.txt and change (or add) compiler_args generator:



Install the requirements (from the mytimer/build folder):

$ conan install ..


Remember, if you don’t specify settings in install command with -s, conan will use the detected defaults. You can always change them by editing the ~/.conan/profiles/default or override them with “-s” parameters.

The generated conanbuildinfo.args:

-m64 -DNDEBUG -Wl,-rpath,"path/to/Poco/1.7.9/pocoproject/stable/package/dd758cf2da203f96c86eb99047ac152bcd0c0fa9/lib"
-lPocoUtil -lPocoMongoDB -lPocoNet -lPocoNetSSL -lPocoCrypto -lPocoData -lPocoDataSQLite -lPocoZip
-lPocoXML -lPocoJSON -lPocoFoundation -lssl -lcrypto -lz -stdlib=libc++

This is hard to read, but those are just the compiler_args parameters needed to compile our program:

  • -I options with headers directories

  • -L for libraries directories

  • -l for library names

  • and so on… see the complete reference here

It’s almost the same information we can see in conanbuildinfo.cmake and many other generators’ files.


$ mkdir bin
$ g++ ../timer.cpp @conanbuildinfo.args -std=c++14 -o bin/timer


“@conanbuildinfo.args” appends all the file contents to g++ command parameters

$ ./bin/timer
 Callback called after 250 milliseconds.

To invoke cl (Visual Studio compiler):

$ cl /EHsc timer.cpp @conanbuildinfo.args

You can also use the generator within your build() method of your

Check the Reference, generators, compiler_args section for more info.