How to use FindPETSc.cmake?
Hello, I have copied the FindPETSc.cmake to /usr/share/cmake-3.7/Modules (where all the other .cmake files are). However, when I run cmake the following message is shown:
" 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. "
This is how FindPETSc.cmake is called in my top level CMakeLists: find_package(PETSC) if(PETSC_FOUND) include_directories(${PETSC_INCLUDE_DIR}) add_definitions( "-DHAS_PETSC" ) endif()
Could you please provide more information?
Thank you.
CMake is case-sensitive so there is a difference between PETSc and PETSC.
Also note that it's unreasonable to ask your users to copy FindPETSc.cmake to the system module path. One would normally include the file (and its dependencies) in your source repository (you can use a git submodule, git subtree, or just copy the files in), then have
project (MyProject)
list (APPEND CMAKE_MODULE_PATH "${MyProject_SOURCE_DIR}/cmake-modules")
Issue solved, thank you.