<div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hi Jed,</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Thanks for the comment. I added the module but still saw errors (before I arrived here, I had to do cp - r /home/evan/petsc//lib/petsc/<wbr>conf/rules /home/evan/petsc//<wbr>lib/petsc/conf/petscrules). They are supposed to be defined by FindPETSc.cmake. How could I solve these errors? </div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Could you also explain a little bit about how to use pkg-config to find PETSc? Thanks!</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Evan</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div>cmake_minimum_required(VERSION 3.10)</div><div><br></div><div>project(hellopetsc)</div><div>list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/<wbr>hellopetsc)</div><span class="gmail-im" style="color:rgb(80,0,80)"><div><br></div><div>SET(CMAKE_CXX_STANDARD 11)</div><div>SET(CMAKE_C_COMPILER mpicc)</div><div>SET(CMAKE_CXX_COMPILER mpicxx)</div><div><br></div></span><div>find_package(PETSc COMPONENTS CXX)</div><div><br></div><div>add_executable(hellopetsc main.cpp)</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span class="gmail-im" style="color:rgb(80,0,80)"><div>/home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc</div></span><div>-- PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (found version "3.9.1")</div><div>-- Configuring done</div><div>-- Generating done</div><div>-- Build files have been written to: /home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug</div><div><br></div><div>[Finished]</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 12:08 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, it depends on this module from the same repository.<br>
<br>
Note that you can use pkg-config to find PETSc these days.<br>
<div class="HOEnZb"><div class="h5"><br>
Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> writes:<br>
<br>
> Hi Stefano,<br>
><br>
> Thanks for your comment. Now, cmake was able to locate FindPETSc.cmake file<br>
> in my project directory, but I see a new error.<br>
><br>
> Evan<br>
><br>
><br>
> Messages<br>
> ------------------------------<wbr>----------------<br>
> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug<br>
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc<br>
> CMake Error at FindPETSc.cmake:123 (include):<br>
>   include could not find load file:<br>
><br>
>     FindPackageMultipass<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>   Unknown CMake command "find_package_multipass".<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> -- Configuring incomplete, errors occurred!<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeOutput.log".<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeError.log".<br>
> ------------------------------<wbr>----------------<br>
><br>
> CMakeLists.txt<br>
> ------------------------------<wbr>----------------<br>
> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug<br>
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/<wbr>hellopetsc<br>
> CMake Error at FindPETSc.cmake:123 (include):<br>
>   include could not find load file:<br>
><br>
>     FindPackageMultipass<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>   Unknown CMake command "find_package_multipass".<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> -- Configuring incomplete, errors occurred!<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeOutput.log".<br>
> See also<br>
> "/home/evan/CLionProjects/<wbr>hellopetsc/cmake-build-debug/<wbr>CMakeFiles/CMakeError.log".<br>
><br>
> [Finished]<br>
><br>
><br>
><br>
> On Fri, May 11, 2018 at 11:34 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a><br>
>> wrote:<br>
><br>
>> CMAKE is case sensitive on this. You should use find_package(PETSc ….)<br>
>><br>
>><br>
>> > On May 11, 2018, at 9:28 PM, Evan Um <<a href="mailto:evanum@gmail.com">evanum@gmail.com</a>> wrote:<br>
>> ><br>
>> > Hi,<br>
>> ><br>
>> > I would like to ask a question about FindPETSc.cmake. I place the cmake<br>
>> file in the same directory where main.cpp is placed. I also placed the file<br>
>> in /usr/share/cmake_xx/Modules.<br>
>><br>
>> Actually, it can be put in any directory pointed by the variable<br>
>> CMAKE_MODULE_PATH. If I were you, I would not modify /usr/share/<br>
>><br>
>> > Where should i put the file? What else should I do to use the file in<br>
>> cmake? Do I need any other lines in my cmakelists.txt except<br>
>> find_package(petsc)? Thanks for your comments.<br>
>> ><br>
>> > Evan<br>
>> ><br>
>> > ------------------------------<wbr>------------------------------<wbr>-<br>
>> ><br>
>> > cmake_minimum_required(VERSION 3.10)<br>
>> ><br>
>> > project(hellopetsc)<br>
>> ><br>
>> > SET(CMAKE_CXX_STANDARD 11)<br>
>> > SET(CMAKE_C_COMPILER mpicc)<br>
>> > SET(CMAKE_CXX_COMPILER mpicxx)<br>
>> ><br>
>> > find_package(PETSC COMPONENTS CXX)<br>
>> ><br>
>> > add_executable(hellopetsc main.cpp)<br>
>> ><br>
>> > ------------------------------<wbr>------------------------------<br>
>> > CMake Warning at CMakeLists.txt:9 (find_package):<br>
>> >   By not providing "FindPETSC.cmake" in CMAKE_MODULE_PATH this project<br>
>> has<br>
>> >   asked CMake to find a package configuration file provided by "PETSC",<br>
>> but<br>
>> >   CMake did not find one.<br>
>> ><br>
>> >   Could not find a package configuration file provided by "PETSC" with<br>
>> any of<br>
>> >   the following names:<br>
>> ><br>
>> >     PETSCConfig.cmake<br>
>> >     petsc-config.cmake<br>
>> ><br>
>> >   Add the installation prefix of "PETSC" to CMAKE_PREFIX_PATH or set<br>
>> >   "PETSC_DIR" to a directory containing one of the above files.  If<br>
>> "PETSC"<br>
>> >   provides a separate development package or SDK, be sure it has been<br>
>> >   installed.<br>
>><br>
>><br>
</div></div></blockquote></div><br></div>