Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Other arguments will be added as the need for them arises. The ordering of these arguments are not important.

Compiler options

SCons provides some compiler independent options. They should be used as much as possible. Less common options have to be specified in a compiler dependent way and, therefore, prior to setting a compiler option for a less common option one should perform a check for which OS is being executed. This sort of check was described in a previous section.

In almost all cases these compiler options are lists that need to be appended to. If they are simply assigned new values they will overwrite older options already defined. Additionally, in order to prevent repetition of the same compile options several times, one should only append if the option does not exist. Luckily these options are available through a single function call: AppendUnique().

For example, to add a unique pre processor definition to the compiler when compiling an application you would do

No Format

progeEnv.AppendUnique(CPPFLAGS = ['TRAP_FPE')

This would add a -DTRAPF_FPE to the compiler options if one didn't already exist.

A complete version of these compiler options is available in the SCons man pages online at http://scons.org.

Common platform independent compiler options

These compiler options appear common enough that SCons will take care of converting to the required format for the compiler being used. If possible one should use these as much as possible.

  • CPPFLAGS - A platform independent specification of C preprocessor definitions.
  • CPPPATH - The list of directories that the C preprocessor will search for include directories. You should never need to set this.
  • LIBPATH - The list of directories that will be searched for libraries. You should never need to set this.
  • LIBS - A list of one or more libraries that will be linked with any executable programs created by this environment. You should never need to set this.

Less common platform dependent compiler options

These compiler options need to be specified different depending on the compiler being used. As a result they should be wrapped around if statements.

  • ARFLAGS - General options passed to the static library archiver. You should never need to set this.
  • CCFLAGS - General options that are passed to the C and C++ compilers.
  • CFLAGS - General options that are passed to the C compiler (C only; not C++).
  • CXXFLAGS - General options that are passed to the C++ compiler. By default, this includes the value of CCFLAGS, so that setting CCFLAGS affects both C and C++ compilation.