2 # Once done this will define
4 # PETSC_DIR - directory in which PETSc resides
5 # PETSC_ARCH - build architecture
8 # If unset, try environment
10 set(PETSC_DIR $ENV{PETSC_DIR})
13 set(PETSC_ARCH $ENV{PETSC_ARCH})
16 find_file(PETSC_VARIABLES_FILE petscvariables
18 ${PETSC_DIR}/${PETSC_ARCH}/conf
19 ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf
20 ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc-conf
22 if(NOT PETSC_VARIABLES_FILE)
23 message(FATAL_ERROR ${PETSC_VARIABLES_FILE})
24 endif(NOT PETSC_VARIABLES_FILE)
26 file(STRINGS ${PETSC_VARIABLES_FILE} PETSC_VARIABLES)
27 foreach(LINE ${PETSC_VARIABLES})
28 string(REGEX REPLACE " = " ";" FIELDS ${LINE})
29 list(LENGTH FIELDS LISTLEN)
31 list(GET FIELDS 0 VAR)
32 list(GET FIELDS 1 VAL)
33 set("PETSCVAR_${VAR}" ${VAL} CACHE INTERNAL "petsc varible")
34 #message(STATUS PETSCVAR_${VAR})
35 endif(LISTLEN EQUAL 2)
36 endforeach(LINE ${PETSC_VARIABLES})