[petsc-users] CMake error in PETSc

Jed Brown jed at jedbrown.org
Wed Dec 4 10:05:30 CST 2019


Yingjie Wu <yjwu16 at gmail.com> writes:

> 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.

3.10 should be sufficient (though we recommend upgrading).

>    2. Does the use of FindPkgConfig only require the following commands and
>    does not require any scripts?

Correct, no 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).
>>


More information about the petsc-users mailing list