Evan Um <[email protected]> writes: > Matt and Jed, > > Thanks for your comments. > > I still have a trouble in using FindPETSc.cmake. I removed the directory: > (i.e. canceling cp - r /home/evan/petsc//lib/petsc/ > conf/rules /home/evan/petsc//lib/petsc/conf/petscrules) and explicitly set > SET (PETSC_ARCH "arch-linux2-c-debug all").
No " all". > Now, FindPETSc.cmake does not recognize PETSC_DIR and PETSC_ARCH. When I > read the comments inside FindPETSc.cmake, the twos should be refined by > FindPETSc.cmake. BTW, I have my petsc at /home/evan/petsc. So all are > defaults. > > Thanks for your kind help. > > Evan > > -------------- > cmake_minimum_required(VERSION 3.10) > > project(hellopetsc) > list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/hellopetsc) > > SET(CMAKE_CXX_STANDARD 11) > SET(CMAKE_C_COMPILER mpicc) > SET(CMAKE_CXX_COMPILER mpicxx) > > SET (PETSC_ARCH "arch-linux2-c-debug all") > > find_package(PETSc COMPONENTS CXX) > > add_executable(hellopetsc main.cpp) > -------------- > /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:140 (message): > The pair PETSC_DIR=/home/evan/petsc PETSC_ARCH=arch-linux2-c-debug all do > not specify a valid PETSc installation > Call Stack (most recent call first): > CMakeLists.txt:12 (find_package) > > > -- 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") > -- 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 2:13 PM, Matthew Knepley <[email protected]> wrote: > >> On Fri, May 11, 2018 at 5:06 PM, Evan Um <[email protected]> wrote: >> >>> Hi Jed, >>> >>> 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/ >>> conf/rules /home/evan/petsc//lib/petsc/conf/petscrules). >>> >> >> That is wrong. It means PETSC_ARCH is (null) instead of the correct string. >> >> Matt >> >> >>> They are supposed to be defined by FindPETSc.cmake. How could I solve >>> these errors? >>> >>> Could you also explain a little bit about how to use pkg-config to find >>> PETSc? Thanks! >>> >>> Evan >>> >>> ---------------- >>> cmake_minimum_required(VERSION 3.10) >>> >>> project(hellopetsc) >>> list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/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) >>> ----------------- >>> >>> ----------------- >>> /home/evan/opt/clion-2018.1.2/bin/cmake/bin/cmake >>> -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" >>> /home/evan/CLionProjects/hellopetsc >>> -- 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") >>> -- Configuring done >>> -- Generating done >>> -- Build files have been written to: /home/evan/CLionProjects/hello >>> petsc/cmake-build-debug >>> >>> [Finished] >>> ----------------- >>> >>> >>> On Fri, May 11, 2018 at 12:08 PM, Jed Brown <[email protected]> wrote: >>> >>>> Yes, it depends on this module from the same repository. >>>> >>>> Note that you can use pkg-config to find PETSc these days. >>>> >>>> Evan Um <[email protected]> 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/CMake >>>> Files/CMakeOutput.log". >>>> > See also >>>> > "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMake >>>> Files/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/CMake >>>> Files/CMakeOutput.log". >>>> > See also >>>> > "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMake >>>> Files/CMakeError.log". >>>> > >>>> > [Finished] >>>> > >>>> > >>>> > >>>> > On Fri, May 11, 2018 at 11:34 AM, Stefano Zampini < >>>> [email protected] >>>> >> wrote: >>>> > >>>> >> CMAKE is case sensitive on this. You should use find_package(PETSc ….) >>>> >> >>>> >> >>>> >> > On May 11, 2018, at 9:28 PM, Evan Um <[email protected]> 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. >>>> >> >>>> >> >>>> >>> >>> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> -- Norbert Wiener >> >> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> >>
