waLBerla 7.2
Loading...
Searching...
No Matches
Using waLBerla as a library in your CMake Project

The recommended way to embed waLBerla into your own CMake project is to integrate its build system with your own CMake tree, such that waLBerla is built from source alongside your project. There are two ways to achieve this in a stable and reproducible manner: Git submodules and FetchContent

Include waLBerla as a Git Submodule

To include waLBerla as a submodule, run the following commands inside your project folder:

git submodule add https://i10git.cs.fau.de/walberla/walberla.git
git submodule update --init

After waLBerla has been downloaded, git commit the submodule. You may then add waLBerla to your CMake project by adding the following to your root CMakeLists.txt:

add_subdirectory( walberla )

Pull waLBerla using FetchContent

CMake allows us to download and include external projects into a build tree at configuration time using FetchContent. This can be more convenient and easier to reproduce than Git submodules, or other ways of semi-manual installation.

To include waLBerla into your CMake project using FetchContent, add the following lines to your CMakeLists.txt:

include(FetchContent)
FetchContent_Declare(
walberla
GIT_REPOSITORY https://i10git.cs.fau.de/walberla/walberla.git
GIT_TAG <commit-hash / branch name / git tag>
)
FetchContent_MakeAvailable(walberla)

Using the GIT_TAG option you can specify the exact Git revision to include: We recommend fixing this to a specific commit hash or tag to avoid surprising changes. In this case, you will have to remember to regularily update this dependency.