CMakeModules are a collection of cmake macros and modules for building software packages in the context of HEP.
A collection of Find modules are available in order to find some of the most common software packages within the hep community, e.g.
This modules can be used in order to use one of the packages in question in your cmake project. The next two examples show how to find the GSL and the ROOT packages with slight different options. Please visit the cmake documentation of find_package for more information on the syntax.
An additional set ot cmake macros are available in order to facilitate writing new CMakeLists for your project.
An example follows on how to get a list of header files in a given input directory (containing a possible LinkDef.h header file), use that list of headers with rootcint for generating dictionary sources and finally add the generated dictionary sources to a given library.
Get the list of headers in input_dir and store it in variable ROOT_DICT_INPUT_HEADERS. If the header file LinkDef.h exists in this directory it is automatically placed as the last header (required by rootcint!)
If there isn't a header file called LinkDef.h in the headers directory it can be generated using the macro GEN_ROOT_DICT_LINKDEF_HEADER. This macro generates the header file namespace_LinkDef.h by addig the following line for each of the header files passed as an argument to the macro.
After the list of header files (including the LinkDef.h header) has been gathered and stored in variable ROOT_DICT_INPUT_HEADERS it is possible to generate a dictionary source using rootcint. The file name of the dictionary source should be passed as an argument to the macro. The directory where the generated source file gets placed is given by the cmake variable ROOT_DICT_OUTPUT_DIR. For convenience the full path to the generated dictionary source file is automatically appended to the cmake variable ROOT_DICT_OUTPUT_SOURCES.
Finally add the generated sources stored in the variable ROOT_DICT_OUTPUT_SOURCES to the list of my library sources.