Skip to content

Commit

Permalink
Update CMake modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed Feb 27, 2009
1 parent 281ee2c commit df762f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
19 changes: 14 additions & 5 deletions CMake/FindPETSc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI
# PETSC_DEFINITIONS - Compiler switches for using PETSc
# PETSC_MPIEXEC - Executable for running MPI programs
# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR)
#
# Hack: PETSC_VERSION currently decides on the version based on the
# layout. Otherwise we need to run C code to determine the version.
#
# Setting these changes the behavior of the search
# PETSC_DIR - directory in which PETSc resides
Expand All @@ -18,7 +22,9 @@

find_path (PETSC_DIR include/petsc.h
HINTS ENV PETSC_DIR
PATHS /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 $ENV{HOME}/petsc
PATHS
/usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 # Debian
$ENV{HOME}/petsc
DOC "PETSc Directory")

if (PETSC_DIR AND NOT PETSC_ARCH)
Expand All @@ -41,18 +47,21 @@ if (PETSC_DIR AND NOT PETSC_ARCH)
set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
endif (PETSC_DIR AND NOT PETSC_ARCH)

set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS)
set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS
INCLUDE_DIR INCLUDE_CONF)
include (FindPackageMultipass)
find_package_multipass (PETSc petsc_config_current
STATES DIR ARCH
DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves})

# Determine whether the PETSc layout is old-style (through 2.3.3) or
# new-style (not yet released, petsc-dev)
# new-style (3.0.0)
if (EXISTS ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h) # > 2.3.3
set (petsc_conf_base ${PETSC_DIR}/conf/base)
set (PETSC_VERSION "3.0.0")
elseif (EXISTS ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h) # <= 2.3.3
set (petsc_conf_base ${PETSC_DIR}/bmake/common/base)
set (PETSC_VERSION "2.3.3")
else (EXISTS ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h)
set (petsc_conf_base "NOTFOUND")
endif (EXISTS ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h)
Expand Down Expand Up @@ -117,13 +126,13 @@ static const char help[] = \"PETSc test program.\";
int main(int argc,char *argv[]) {
PetscErrorCode ierr;
TS ts;
PetscFunctionBegin;
ierr = PetscInitialize(&argc,&argv,0,help);CHKERRQ(ierr);
ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
ierr = TSSetFromOptions(ts);CHKERRQ(ierr);
ierr = TSDestroy(ts);CHKERRQ(ierr);
ierr = PetscFinalize();CHKERRQ(ierr);
PetscFunctionReturn(0);
return 0;
}
" ${runs})
if (${${runs}})
Expand Down
2 changes: 1 addition & 1 deletion CMake/FindPackageMultipass.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# if (NOT foo_current)
# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES
# endif (NOT foo_current)
#
#
# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS)
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale.
Expand Down
2 changes: 1 addition & 1 deletion CMake/FindiMesh.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ show :
mark_as_advanced (IMESH_LIBRARY)

include (ResolveCompilerPaths)

include (CheckCSourceRuns)
macro (IMESH_TEST_RUNS libraries runs)
multipass_c_source_runs (iMesh "${imesh_includes}" "${libraries}" "
Expand Down

0 comments on commit df762f8

Please sign in to comment.