Closed drew-parsons closed 4 years ago
The same applies to FindSLEPc.cmake too.
Alternatively should it be documented that PETSC_DIR must set as a environment variable, not as a cmake defined variable?
(I guess cmake -DPETSC_DIR
never was working, so Debian/Ubuntu builds have only ever been made against the default PETSc version found by pkg-config from the default PKG_CONFIG_PATH)
Has it not always been that PETSC_DIR should be an environment variable, even in DOLFIN? I have got an "export PETSC_DIR=..." in my fenics install script for as long as I can remember, and that has not changed in the fenicsx one.
Apart from that, I do agree that this should be documented. For instance this line https://github.com/FEniCS/dolfinx/blob/master/cpp/cmake/modules/FindPETSc.cmake#L238 can be changed in
FAIL_MESSAGE "PETSc could not be found. Be sure to set PETSC_DIR as an environment variable.")
(just to put my two cents in)
@francesco-ballarin - feel free to make a PR
Trying to test dolfinx with complex number support. I've pointed PETSC_DIR at the location of my PETSc complex installation (on Debian) and provided it to cmake:
(not showing the other cmake flags here) But cmake finds my PETSc real instead of PETSc complex.
Digging into FindPETSc.cmake, it's using pkg-config to find PETSc, with
If I set a debug message here (
message("looking for PETSc with PKG_CONFIG_PATH = $ENV{PKG_CONFIG_PATH}")
)then cmake prints
So evidently the definition of PETSC_DIR given by
-D PETSC_DIR:PATH=
is not propagating down into FindPETSc.cmake.But of course, FindPETSc.cmake here is using
$ENV{PETSC_DIR}
, not${PETSC_DIR}
. Should this be changed (or should perhaps both$ENV{PETSC_DIR}
and${PETSC_DIR}
be used?)