Hi, I am trying to move to cmake to build my code. How would you suggest to handle the dependency on PETSc? Currently my makefile relies on the PETSc variables for building the all code, namely FLINKER, CLINKER and so on. I found the FindPETSc.cmake module and I successfully used it but it does not import the aforementioned variables. Any suggestion on the matter is greatly appreciated. Thanks, Michele
Michele Rosso <[email protected]> writes:
Hi,
I am trying to move to cmake to build my code. How would you suggest to handle the dependency on PETSc? Currently my makefile relies on the PETSc variables for building the all code, namely FLINKER, CLINKER and so on. I found the FindPETSc.cmake module and I successfully used it but it does not import the aforementioned variables.
CMake insists on setting the compiler before discovering dependent packages. FindPETSc.cmake sets PETSC_COMPILER, but you can't set the compiler based on this information; you can only check and decide whether to error. That's life with CMake.
Hi Jed, thank you for your reply. So basically I should use PETSC_COMPILER to check against the system compiler and proceed only if they match, correct? Also, I attached the output of cmake and FindPETSc.cmake: it complains that PETSc requires extra include paths and explicit linking to all dependencies. Despite that, I can compile and run my correctly. Should I worry about it? Finally, is there a way to retrieve the compiler flags I use to build PETSc? Thanks, Michele On Sat, 2015-06-20 at 14:11 -0600, Jed Brown wrote:
Michele Rosso <[email protected]> writes:
Hi,
I am trying to move to cmake to build my code. How would you suggest to handle the dependency on PETSc? Currently my makefile relies on the PETSc variables for building the all code, namely FLINKER, CLINKER and so on. I found the FindPETSc.cmake module and I successfully used it but it does not import the aforementioned variables.
CMake insists on setting the compiler before discovering dependent packages. FindPETSc.cmake sets PETSC_COMPILER, but you can't set the compiler based on this information; you can only check and decide whether to error. That's life with CMake.
Michele Rosso <[email protected]> writes:
Hi Jed,
thank you for your reply. So basically I should use PETSC_COMPILER to check against the system compiler and proceed only if they match, correct?
Also, I attached the output of cmake and FindPETSc.cmake: it complains that PETSc requires extra include paths and explicit linking to all dependencies. Despite that, I can compile and run my correctly. Should I worry about it?
No, it probably means you have some or all static libraries. It's only a showstopper if you are building for an environment that prohibits overlinking (like some Linux distros). For private users, it's rarely an issue.
Finally, is there a way to retrieve the compiler flags I use to build PETSc?
Not at this time and there is no single set of flags. If you just want all the PETSc makefile variables, include the makefile. CMake users normally want firm insulation from the flags used to build the package (it gets hokey at times, but it's what they ask for and what they expect). I would not be opposed if you want to create CMake variables for those flags (but be sure to namespace completely and accurately).
participants (2)
-
Jed Brown -
Michele Rosso