Modifying Cmake to have Deal.ii include paths

39 views
Skip to first unread message

Xavier Johnson

unread,
Feb 22, 2024, 8:33:30 AM2/22/24
to deal.II User Group
Hi,

This may be a newb question. I am probably struggling understanding how to set paths in cmake and spent some time reading the documentation for cmake.

My question is, how can I set the DEAL_II_DIR in the CMakeLists.txt so I don't have to provide a path every time I call the cmake command?

Thanks

Nils Schween

unread,
Feb 22, 2024, 8:44:09 AM2/22/24
to dea...@googlegroups.com
Hi Xavier,

i think the following command will do:

set(DEAL_II_MIN_VERSION "9.5.0")
set(DEAL_II_DIR "~/.local/lib/dealii")
find_package(deal.II ${DEAL_II_MIN_VERSION} REQUIRED
HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR})
IF(NOT ${deal.II_FOUND})
MESSAGE(FATAL_ERROR
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake"
" or set an environment variable \"DEAL_II_DIR\".")
ENDIF()

Regards,
Nils
--
Nils Schween
PhD Student

Phone: +49 6221 516 557
Mail: nils.s...@mpi-hd.mpg.de
PGP-Key: 4DD3DCC0532EE96DB0C1F8B5368DBFA14CB81849

Max Planck Institute for Nuclear Physics
Astrophysical Plasma Theory (APT)
Saupfercheckweg 1, D-69117 Heidelberg
https://www.mpi-hd.mpg.de/mpi/en/research/scientific-divisions-and-groups/independent-research-groups/apt

Bruno Turcksin

unread,
Feb 22, 2024, 9:05:39 AM2/22/24
to deal.II User Group
Hello,

You can just set DEAL_II_DIR in your environment. If you are using bash you can do `export DEAL_II_DIR=/path/to/deal.II` in your terminal or put that line you .bashrc if you want to do this permanently. Personally, I just write the cmake line in a file and make the file executable. When I need to call cmake, I just call the executable.

Best,

Bruno
Reply all
Reply to author
Forward
0 new messages