[petsc-users] CMake error in PETSc

Yingjie Wu yjwu16 at gmail.com
Wed Dec 4 10:02:23 CST 2019


Thank you for your response.

I have two questions about using FindPkgConfig:


   1. Is there any requirement for petsc version using FindPkgConfig? I'm
   using an older version 3.10.1.
   2. Does the use of FindPkgConfig only require the following commands and
   does not require any scripts?

find_package(PkgConfig REQUIRED)

pkg_search_module (PETSC REQUIRED PETSc)

target_link_libraries(testapp ${PETSC_LIBRARIES})

target_link_includes(testapp ${PETSC_INCLUDE_DIRS})

Since I just came into contact with cmake, I really need some help.


Thanks,

Yingjie


Jed Brown <jed at jedbrown.org> 于2019年12月4日周三 下午11:31写道:

> Yingjie Wu <yjwu16 at gmail.com> writes:
>
> > Dear Petsc developers
> > Hi,
> > Because I use some external library files, I want to compile the PETSc
> > program with CMake. I follow the library search program
> >
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
> > recommended
> > on GitHub. And wrote a cmakelist.txt:
> >
> > cmake_minimum_required(VERSION 2.8.11)
> > project(example01cmke)
> > add_executable(example01cmke ex1.cpp)
> > set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> > find_package(PETSc)
> > include_directories(${PETSC_INCLUDE_DIR})
>
> This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.
>
> These days, I usually recommend that people use
>
> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
>
> instead of my FindPETSc.cmake because its simpler and doesn't require
> the script (which was developed before we added pkg-config support to
> PETSc).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191205/89682164/attachment-0001.html>


More information about the petsc-users mailing list