Project

General

Profile

Cetbuildtools user guide - Cetbuildtools cmake modules - Defining products in the CET build environment - Using the example - Buildtool script

Cetbuildtools cmake modules

cetbuildtools contains a number of handy cmake modules.

This note describes the macros or functions you are most likely to use.

include(CetCMakeEnv)

Required.
Simply including CetCMakeEnv sets up most of the required environment.

cet_cmake_env( <product_name> <product_version> <product_qualifier> )

Required.

cet_add_compiler_flags()

Use this to add to or change the default compiler flags.
Accepted arguments:
  • DIAGS
  • -- This option may be CAVALIER, CAUTIOUS, VIGILANT or PARANOID.
  • -- Default is CAUTIOUS.
  • EXTRA_FLAGS (applied to both C and CXX)
  • EXTRA_C_FLAGS
  • EXTRA_CXX_FLAGS
  • EXTRA_DEFINITIONS

cet_report_compiler_flags()

This returns a list of compiler flags that will be used.

cet_check_gcc()

Verify that you have the expected version of the compiler.

find_ups_product( <dependent_product> <miniumum_required_version> )

If your package depends on another product, use this to define cmake variables.
The version here is a minimum required version.

cet_make( )

This is the basic command. It must be used in the appropriate source code directory.
You can build multiple executables, but only one library, per directory.

Options:
  • LIBRARY_NAME <library name>
  • -- build a library with all source code files in this directory
  • -- ignore files specified with EXEC, TEST, or EXCLUDE
  • LIBRARIES <library list>
  • -- link with these libraries
  • EXEC <exec source>
  • -- build an executable from the listed source code file(s)
  • -- this executable will be installed in <product-flavor-qual-dir>/bin
  • TEST <test source>
  • -- build a test executable from the listed source code file(s)
  • -- this executable will NOT be installed
  • EXCLUDE <ignore these files>

Installing code

Unit tests