Compilers on command line

The compiler_args generator creates a file named conanbuildinfo.args containing 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 the 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 show:

-m64 -O3 -s -DNDEBUG
-lPocoMongoDB -lPocoNetSSL -lPocoNet -lPocoCrypto -lPocoDataSQLite -lPocoData -lPocoZip -lPocoUtil
-lPocoXML -lPocoJSON -lPocoRedis -lPocoFoundation
-lrt -lssl -lcrypto -ldl -lpthread -lz

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.