<div dir="ltr">Thank you for your response.<div><p style="margin:0px;white-space:pre-wrap">I have two questions about using FindPkgConfig:</p><p style="margin:0px"></p><ol style="white-space:pre-wrap"><li>Is there any requirement for petsc version using FindPkgConfig? I'm using an older version 3.10.1.</li><li>Does the use of FindPkgConfig only require the following commands and does not require any scripts?</li></ol><p></p></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><p style="margin:0px"><span style="white-space:pre-wrap">find_package(PkgConfig REQUIRED)</span></p></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><p style="margin:0px"><span style="white-space:pre-wrap">pkg_search_module (PETSC REQUIRED PETSc)</span></p></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><p style="margin:0px"><span style="white-space:pre-wrap">target_link_libraries(testapp ${PETSC_LIBRARIES})</span></p></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><p style="margin:0px"><span style="white-space:pre-wrap">target_link_includes(testapp ${PETSC_INCLUDE_DIRS})</span></p></div></blockquote><p style="margin:0px;white-space:pre-wrap">Since I just came into contact with cmake, I really need some help.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Thanks,</p><p style="margin:0px;white-space:pre-wrap">Yingjie</p><div><p style="margin:0px;white-space:pre-wrap"><br></p><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> 于2019年12月4日周三 下午11:31写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yingjie Wu <<a href="mailto:yjwu16@gmail.com" target="_blank">yjwu16@gmail.com</a>> writes:<br>
<br>
> Dear Petsc developers<br>
> Hi,<br>
> Because I use some external library files, I want to compile the PETSc<br>
> program with CMake. I follow the library search program<br>
> <a href="https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt" rel="noreferrer" target="_blank">https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt</a><br>
> recommended<br>
> on GitHub. And wrote a cmakelist.txt:<br>
><br>
> cmake_minimum_required(VERSION 2.8.11)<br>
> project(example01cmke)<br>
> add_executable(example01cmke ex1.cpp)<br>
> set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)<br>
> find_package(PETSc)<br>
> include_directories(${PETSC_INCLUDE_DIR})<br>
<br>
This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.<br>
<br>
These days, I usually recommend that people use<br>
<br>
<a href="https://cmake.org/cmake/help/latest/module/FindPkgConfig.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/latest/module/FindPkgConfig.html</a><br>
<br>
instead of my FindPETSc.cmake because its simpler and doesn't require<br>
the script (which was developed before we added pkg-config support to<br>
PETSc).<br>
</blockquote></div></div></div>