CMakeLists.txt 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

cmake_minimum_required(VERSION 2.8.0)

project(Systems Fortran)

find_package(LAPACK REQUIRED)

# looking for mumps
message(STATUS "looking for mumps in ${MP}")
find_library(MUMPS_FOUND dmumps HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MUMPS_COMMON_FOUND mumps_common HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(PORD_FOUND pord HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MPISEQ_FOUND mpiseq HINTS ${MP} PATH_SUFFIXES lib libseq REQUIRED)
find_path(MUMPS_INCLUDE_DIRS dmumps_struc.h NO_DEFAULT_PATH HINTS ${MP} ${MD} PATH_SUFFIXES include)

set(MUMPS_LIBRARIES ${MUMPS_FOUND} ${MUMPS_COMMON_FOUND} ${PORD_FOUND} ${MPISEQ_FOUND})


# looking for petsc

# mumps example
if( ${MP} )
  include_directories(${MUMPS_INCLUDE_DIRS})
  
  add_library( mumpsAlgebra dataStructure.f90 mumps_binding.f90)
  target_link_libraries( mumpsAlgebra ${MUMPS_LIBRARIES} ${LAPACK_LIBRARIES})
  
  add_executable( mumpsTest reference_test.f90 )
  target_link_libraries( mumpsTest mumpsAlgebra )
endif( ${MP} )

# petsc example
if( ${PP} )
  include_directories(${PETSC_INCLUDE_DIRS})
  
  add_library( petscAlgebra dataStructure.f90 petsc_binding.f90)
  target_link_libraries( petscAlgebra ${PETSC_LIBRARIES} ${LAPACK_LIBRARIES})
  
  add_executable( petscTest reference_test.f90 )
  target_link_libraries( petscTest petscAlgebra )
endif( ${PP} )