Let’s say a group builds their in-house code with cmake and they link all their external dependencies via cmake modules, a natural question would be: is there also such a thing for preCICE?
Being a CMake project, preCICE generates a preciceCongfig.cmake
file instead of providing a Findprecice.cmake
module.
This file is available
- after configuration in the directory
CMAKE_BINARY_DIR
, - after installation in the
CMAKE_INSTALL_PREFIX/lib/cmake/precice
and - after installing the Debian package in
/usr/lib/cmake/precice
.
To use preCICE from another CMake project, you simply have to:
-
find the package
find_package(precice REQUIRED CONFIG)
-
link to the library to your target
target_link_libraries(yourTarget PRIVATE precice::precice)
-
for locations not searched by CMake: tell CMake where to find the config when configuring the dependant
cmake -DpreciceDIR=dir/of/precice/config ..
This allows you to easily handle multiple installations in parallel such as:
- Debian package (works without passing the
-Dprecice_DIR=dir
option - Custom release build
- Custom debug build
This is especially useful when benchmarking cases or debugging adapters.