[petsc-users] Placing FindPETSc.cmake

Jed Brown jed at jedbrown.org
Fri May 11 14:08:42 CDT 2018


Yes, it depends on this module from the same repository.

Note that you can use pkg-config to find PETSc these days.

Evan Um <evanum at gmail.com> writes:

> Hi Stefano,
>
> Thanks for your comment. Now, cmake was able to locate FindPETSc.cmake file
> in my project directory, but I see a new error.
>
> Evan
>
>
> Messages
> ----------------------------------------------
> /home/evan/opt/clion-2018.1.2/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hellopetsc
> CMake Error at FindPETSc.cmake:123 (include):
>   include could not find load file:
>
>     FindPackageMultipass
> Call Stack (most recent call first):
>   CMakeLists.txt:10 (find_package)
>
>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):
>   Unknown CMake command "find_package_multipass".
> Call Stack (most recent call first):
>   CMakeLists.txt:10 (find_package)
>
>
> -- Configuring incomplete, errors occurred!
> See also
> "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeOutput.log".
> See also
> "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeError.log".
> ----------------------------------------------
>
> CMakeLists.txt
> ----------------------------------------------
> /home/evan/opt/clion-2018.1.2/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hellopetsc
> CMake Error at FindPETSc.cmake:123 (include):
>   include could not find load file:
>
>     FindPackageMultipass
> Call Stack (most recent call first):
>   CMakeLists.txt:10 (find_package)
>
>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):
>   Unknown CMake command "find_package_multipass".
> Call Stack (most recent call first):
>   CMakeLists.txt:10 (find_package)
>
>
> -- Configuring incomplete, errors occurred!
> See also
> "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeOutput.log".
> See also
> "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeError.log".
>
> [Finished]
>
>
>
> On Fri, May 11, 2018 at 11:34 AM, Stefano Zampini <stefano.zampini at gmail.com
>> wrote:
>
>> CMAKE is case sensitive on this. You should use find_package(PETSc ….)
>>
>>
>> > On May 11, 2018, at 9:28 PM, Evan Um <evanum at gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > I would like to ask a question about FindPETSc.cmake. I place the cmake
>> file in the same directory where main.cpp is placed. I also placed the file
>> in /usr/share/cmake_xx/Modules.
>>
>> Actually, it can be put in any directory pointed by the variable
>> CMAKE_MODULE_PATH. If I were you, I would not modify /usr/share/
>>
>> > Where should i put the file? What else should I do to use the file in
>> cmake? Do I need any other lines in my cmakelists.txt except
>> find_package(petsc)? Thanks for your comments.
>> >
>> > Evan
>> >
>> > -------------------------------------------------------------
>> >
>> > cmake_minimum_required(VERSION 3.10)
>> >
>> > project(hellopetsc)
>> >
>> > SET(CMAKE_CXX_STANDARD 11)
>> > SET(CMAKE_C_COMPILER mpicc)
>> > SET(CMAKE_CXX_COMPILER mpicxx)
>> >
>> > find_package(PETSC COMPONENTS CXX)
>> >
>> > add_executable(hellopetsc main.cpp)
>> >
>> > ------------------------------------------------------------
>> > CMake Warning at CMakeLists.txt:9 (find_package):
>> >   By not providing "FindPETSC.cmake" in CMAKE_MODULE_PATH this project
>> has
>> >   asked CMake to find a package configuration file provided by "PETSC",
>> but
>> >   CMake did not find one.
>> >
>> >   Could not find a package configuration file provided by "PETSC" with
>> any of
>> >   the following names:
>> >
>> >     PETSCConfig.cmake
>> >     petsc-config.cmake
>> >
>> >   Add the installation prefix of "PETSC" to CMAKE_PREFIX_PATH or set
>> >   "PETSC_DIR" to a directory containing one of the above files.  If
>> "PETSC"
>> >   provides a separate development package or SDK, be sure it has been
>> >   installed.
>>
>>


More information about the petsc-users mailing list