Home > The Unit Test Framework > Compilation >
PrevNext

The UTF compilation variants and procedures

Table of Contents

Standalone library compilation
Auto-linking support
Direct include

The UTF is comparatively complicated component and is implemented in close to hundred header and source files, so for long term usage the preferable solution is to build the UTF as a reusable standalone library. Depending on your platform this may save you a significant time during test module compilation and doesn't really require that much effort. Boost Getting started tells you how to get pre-built libraries for some platforms. If available, this is the easiest option and you can ignore standalone library compilation instructions below.

Following files constitute the UTF implementation:

Compilation procedures

In comparison with many other boost libraries, which are completely implemented in header files, compilation and linking with the UTF may require additional steps. The UTF presents you with options to either built and link with a standalone library or include the implementation directly into a test module. If you opt to use the library the UTF headers implement the auto-linking support. The compilation of the UTF library and a test module can be configured using the following compilation flags.

Table3.The UTF compilation flags

Flag Usage
BOOST_TEST_DYN_LINK Define this flag to build/use dynamic library.
BOOST_TEST_NO_LIB Define this flag to prevent auto-linking.
BOOST_TEST_NO_MAIN Define this flag to prevent function main() implementation generation.
BOOST_TEST_MAIN Define this flag to generate an empty test module initialization function and in case of dynamic library variant default function main() implementation as well.
BOOST_TEST_MODULE Define this flag to generate the test module initialization function, which uses the defined value to name the master test suite. In case of dynamic library variant default function main() implementation is generated as well
BOOST_TEST_ALTERNATIVE_INIT_API Define this flag to generate the switch to the alternative test module initialization API.

Further in documentation you are going to see in details when and how these flags should be used.


PrevUpHomeNext