CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

PETSc from Cmake

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 11, 2011, 12:40
Default PETSc from Cmake
  #1
New Member
 
Join Date: Jan 2011
Posts: 3
Rep Power: 6
d_dante is on a distinguished road
Hi
does anyone know how to create a Cmake file to use PETSc in Fortran?

Write a make file for useing PETSc is quite simple, but how to call the PETSc's libraries in a Cmake?
d_dante is offline   Reply With Quote

Old   January 12, 2011, 08:50
Default
  #2
New Member
 
Join Date: Jan 2011
Posts: 3
Rep Power: 6
d_dante is on a distinguished road
Solved!
See here https://github.com/jedbrown/cmake-modules for useful cmake files for using petcs with cmake.

Here is my simple Cmakelist.txt for calling them and run one of petsc's examples

Code:
cmake_minimum_required(VERSION 2.8)
project (Test Fortran C)

SET(FIND_PETSC PROJETC_SOURCE_DIR)
SET(CMAKE_MODULE_PATH ${FIND_PETSC} )
FIND_PACKAGE(PETSc REQUIRED)
SET(FORTRAN_PREPROCESS_FLAG -I${PETSC_INCLUDE_DIR})
SET(FORTRAN_PREPROCESS_FLAG "${FORTRAN_PREPROCESS_FLAG} -I${PETSC_INCLUDE_CONF}")

ADD_EXECUTABLE(TEST ex1f.F)
SET_TARGET_PROPERTIES(TEST PROPERTIES COMPILE_FLAGS ${FORTRAN_PREPROCESS_FLAG} )
TARGET_LINK_LIBRARIES(TEST  ${PETSC_LIBRARIES})
d_dante is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cmake error in PV3FoamReader begou OpenFOAM Installation 5 April 20, 2010 07:11
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 14:43
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 10:46
Installation Problem velan OpenFOAM Installation 3 December 16, 2008 05:17
OF 15 Misleading information in README about Qt 43x in openSUSE alberto OpenFOAM Bugs 40 November 7, 2008 10:20


All times are GMT -4. The time now is 18:03.