[petsc-users] Trouble finding PETSc with cmake
Håkon Strandenes
haakon at hakostra.net
Fri Feb 27 12:13:13 CST 2015
I use the PkgConfig CMake module with PETSc in my projects like this:
find_package(PkgConfig)
pkg_search_module(PETSC REQUIRED PETSc)
The only requirement is that the environment variable $PKG_CONFIG_PATH
is set correctly (f.ex. 'arch-linux2-c-debug/lib/pkgconfig/').
I have found this this to be rather successful on my machines. Perhaps
it works for you as well?
Regards,
Håkon
Den 2015-02-27 17:57, skrev Alice Raeli:
> Hi all,
>
> i’m trying to build my project using cmake.
> PETSc is already installed and its tests runned but when I try cmake
> .. for my project it appears that it doesn’t find PETSc. The error
> message is:
>
> cmake module path
> /Users/Alice/Documents/Work/Programmazione/TEST_AUTOMATIZZAZIONE/ParallelOrder/Penalizzazione/cmake-modules
> dir /usr/local/petsc arch arch-darwin-c-debug
> CMake Warning (dev) at cmake-modules/FindPackageMultipass.cmake:48
> (if):
> Policy CMP0054 is not set: Only interpret if() arguments as variables
> or
> keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
> details. Use the cmake_policy command to set the policy and suppress
> this
> warning.
>
> Quoted variables like "/usr/local/petsc" will no longer be
> dereferenced
> when the policy is set to NEW. Since the policy is not set the OLD
> behavior will be used.
> Call Stack (most recent call first):
> cmake-modules/FindPETSc.cmake:108 (find_package_multipass)
> test/CMakeLists.txt:8 (FIND_PACKAGE)
> This warning is for project developers. Use -Wno-dev to suppress it.
>
> CMake Error at
> /usr/local/homebrew/Cellar/cmake/3.1.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:138
> (message):
> PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH.
> (missing: PETSC_EXECUTABLE_RUNS)
> Call Stack (most recent call first):
>
> /usr/local/homebrew/Cellar/cmake/3.1.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:374
> (_FPHSA_FAILURE_MESSAGE)
> cmake-modules/FindPETSc.cmake:323 (find_package_handle_standard_args)
> test/CMakeLists.txt:8 (FIND_PACKAGE)
>
> ______________
>
> PETSC_DIR and PETSC_ARCH are:
>
> /usr/local/petsc/
>
> arch-darwin-c-debug
>
> but also following the given instruction it seems not reading the
> correct path.
>
> I work on OS X Yosemite 10.10.2
>
> cmake version 3.1.3
>
> CmakeLists.txt […]
>
> SET(CMAKE_C_COMPILER mpicc)
>
> SET(CMAKE_CXX_COMPILER mpicxx)
>
> SET (CMAKE_C_FLAGS_INIT "-Wall -std=c99")
> SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
> SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
> SET (CMAKE_C_FLAGS_RELEASE_INIT "-O4 -DNDEBUG")
> SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
>
> SET (CMAKE_CXX_FLAGS_INIT "-Wall")
> SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
> SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
> SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O4 -DNDEBUG")
> SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
>
> […]
>
> Have you got a solution?
>
> Thanks,
> Alice
>
> Alice Raeli
> alice.raeli at math.u-bordeaux1.fr
More information about the petsc-users
mailing list