[petsc-dev] PETSc 3.5.3 and CMake

gouarin loic.gouarin at math.u-psud.fr
Thu Feb 5 06:18:03 CST 2015


Hello,

I had the same problem. The rules and variables files are not in the 
same directory with the petsc-3.5.3. You just have to replace the lines 
in FindPETSc.cmake

# Determine whether the PETSc layout is old-style (through 2.3.3) or
# new-style (>= 3.0.0)
if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h")   # > 2.3.3
   set (petsc_conf_rules "${PETSC_DIR}/conf/rules")
   set (petsc_conf_variables "${PETSC_DIR}/conf/variables")
elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3
   set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules")
   set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables")
elseif (PETSC_DIR)
   message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} 
PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation")
endif ()

by

# Determine whether the PETSc layout is old-style (through 2.3.3) or
# new-style (>= 3.0.0)
if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h")   # > 2.3.3
   if (EXISTS "${PETSC_DIR}/conf/rules")
     set (petsc_conf_rules "${PETSC_DIR}/conf/rules")
     set (petsc_conf_variables "${PETSC_DIR}/conf/variables")
   else()
      set (petsc_conf_rules "${PETSC_DIR}/lib/petsc-conf/rules")
      set (petsc_conf_variables "${PETSC_DIR}/lib/petsc-conf/variables")
   endif()
elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3
   set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules")
   set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables")
elseif (PETSC_DIR)
   message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} 
PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation")
endif ()

It works for me.

Jed will probably have a better solution.

Loic

Le 05/02/2015 12:59, Pierre Jolivet a écrit :
> Hello,
> I don’t know if Jed is the sole maintainer of the FindPETSc.cmake file available here [1], so sorry in advance for disturbing the rest of you if this is the case.
>
> It appears that with version 3.5.3, FindPETSc.cmake can’t detect PETSc correctly anymore and just returns:
> "PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH."
> even though these variables are set. That would be great if you could fix this.
>
> Thank you in advance,
> Pierre
>
> [1] https://github.com/jedbrown/cmake-modules/

-- 
Loic Gouarin
Laboratoire de Mathématiques
Université Paris-Sud
Bâtiment 425
91405 Orsay Cedex
France
Tel: (+33) 1 69 15 60 14
Fax: (+33) 1 69 15 67 18




More information about the petsc-dev mailing list