The TFEL project generates several C++ libraries that can be used directly: TFELMFront, TFELMTest, TFELSystem, TFELMaterial, TFELMathCubicSpline, TFELMathKriging, TFELMathParser, TFELMath, TFELTests, TFELCheck, TFELException, TFELGlossary, TFELUtilities, TFELNUMODIS, TFELConfig, and TFELUnicodeSupport.

Using those libraries requires in practice to add several pre-processor, compiler or linker flags, including paths to headers and libraries, and handling dependencies between those libraries.

The TFEL project provides two tools to ease developers’ life:

Using tfel-config

The tfel-config utility provides much information useful for compiling projects based on the TFEL libraries. This utility is used internally by MFront (see this page for details).

Paths

Most paths are influenced by the TFELHOME environment variable. If this variable is not defined, then the installation path, defined by the CMAKE_INSTALL_PREFIX variable, is used.

Headers

The following flags allow to get the paths toward the TFEL headers.

Libraries

The following flags allow to request information for the linker:

Compilation flags

The following flags allow to request various pre-processor, compiler or linker flags:

Note that those flags are consistent with the compiler used to compile the TFEL project.

Selection of the libraries

The following flags allow to select specific libraries:

Examples of usage

The following examples showcase typical usages of tfel-config:

$ tfel-config --includes
-I<TFEL_INSTALL_PATH>/include 
$ tfel-config --include-path
<TFEL_INSTALL_PATH>/include 
$ tfel-config --libs --math-parser
-L<TFEL_INSTALL_PATH>/lib -lTFELMathParser -lTFELMathKriging -lTFELMath -lTFELUnicodeSupport -lTFELException

In those example, <TFEL_INSTALL_PATH> is to be replaced by the actual installation path of the TFEL project.

Using cmake

The following cmake packages are available: TFELMFront, TFELMTest, TFELMaterial, TFELMath, TFELMathCubicSpline, TFELMathKriging, TFELMathParser, TFELSystem, TFELNUMODIS, TFELCheck, TFELUtilities, TFELGlossary, TFELTests, TFELUnicodeSupport, TFELException, TFELConfig

Those packages can be loaded using the find_package command. It is highly recommended to pass the TFEL_DIR to cmake to indicate where the TFEL library has been installed.

Note that those packages import targets in the tfel:: namespace.

Example of usage

The following CMakeLists.txt file declares a simple executable relying on the TFELMathCubicSpline library:

project(Test)
cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
find_package(TFELMathCubicSpline REQUIRED HINTS "${TFEL_DIR}/share/tfel/cmake")
add_executable(test main.cxx)
target_link_libraries(test tfel::TFELMathCubicSpline)

Exported variables

The tfel-modules-common.cmake file defines the following variables:

The tfel-modules-common.cmake can be included as follows:

include("${TFEL_DIR}/share/tfel/cmake/tfel-modules-common.cmake")