compiler_args

This is the reference page for compiler_args generator. Go to Integrations/Compilers on command line if you want to learn how to integrate your project calling your compiler in the command line.

Generates a file named conanbuildinfo.args containing a command line parameters to invoke gcc, clang or cl compiler.

You can use the compiler_args generator directly to build simple programs:

gcc/clang:

> g++ timer.cpp @conanbuildinfo.args -o bin/timer

cl:

$ cl /EHsc timer.cpp @conanbuildinfo.args

With gcc or clang

FLAG

MEANING

-DXXX

Corresponding to requirements defines

-IXXX

Corresponding to requirements include dirs

-Wl,-rpathXXX

Corresponding to requirements lib dirs

-LXXX

Corresponding to requirements lib dirs

-lXXX

Corresponding to requirements libs and system_libs

-m64

For x86_64 architecture

-m32

For x86 architecture

-DNDEBUG

For Release builds

-s

For Release builds (only gcc)

-g

For Debug builds

-D_GLIBCXX_USE_CXX11_ABI=0

When setting libcxx == “libstdc++”

-D_GLIBCXX_USE_CXX11_ABI=1

When setting libcxx == “libstdc++11”

-framework XXX

Corresponding to requirements frameworks (OSX)

-F XXX

Corresponding to requirements framework dirs (OSX)

Other flags

cxxflags, cflags, sharedlinkflags, exelinkflags (applied directly)

With cl (Visual Studio)

FLAG

MEANING

/DXXX

Corresponding to requirements defines

/IXXX

Corresponding to requirements include dirs

/LIBPATH:XX

Corresponding to requirements lib dirs

/MT, /MTd, /MD, /MDd

Corresponding to Runtime

-DNDEBUG

For Release builds

/Zi

For Debug builds

Directly inside a recipe

 from conans import ConanFile

 class PocoTimerConan(ConanFile):
     settings = "os", "compiler", "build_type", "arch"
     requires = "poco/1.9.4"
     generators = "compiler_args"
     default_options = {"poco:shared": True, "openssl:shared": True}

     def build(self):
         self.run("mkdir -p bin")
         command = 'g++ timer.cpp @conanbuildinfo.args -o bin/timer'
         self.run(command)