I can not recall reason why I didn't use PETSC_LIBRARIES/INCLUDES, I
should reconsider this.
CMake's find_package needs hint path to the packages installed by PETSc
(not simple to make it robust), FindXYZ has to be available.
'pkg-config' -- I'm not familiar with, but I have no idea how it can
provides link information for packages installed by PETSc (namely if
PETSc where installed manually).

Exporting PETSc variables seems to be the simplest way how to achieve
the aim in robust way. Robust against different environments, using
robustness of PETSc configure system.

You may find the second pull request more useful.

Jan





On 09/06/2013 06:03 PM, Jed Brown wrote:
>>  #
>> -#  Usage:
>> -#  find_package(PETSc COMPONENTS CXX)  - required if build --with-clanguage=C++ --with-c-support=0
>> -#  find_package(PETSc COMPONENTS C)    - standard behavior of checking build using a C compiler
>> -#  find_package(PETSc)                 - same as above
>> +# MPIFC_SHOW, MPICXX_SHOW,MPICC_SHOW, PCC,  CC_FLAGS, PCC_FLAGS, FC_FLAGS, CPP_FLAGS
>> +# METIS_INCLUDE, BLASLAPACK_INCLUDE, PARMETIS_INCLUDE, MUMPS_INCLUDE
>> +# MPI_LIB, MUMPS_LIB,  METIS_LIB, PARMETIS_LIB, BLASLAPACK_LIB, SCALAPACK_LIB 
> 
> The normal includes and link variables should be in `PETSC_INCLUDES` and `PETSC_LIBRARIES`.  If you need to call third-party libraries directly, the CMake approach is to use `find_package(MUMPS)` and similar.  I think `pkg-config` is better than CMake for handling dependencies of this sort.
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jedbrown/cmake-modules/pull/3/files#r6211811
> 

-- 
------------------------
Mgr. Jan Brezina, Ph. D.
Technical University in Liberec, New technologies institute
http://www.nti.tul.cz/cz/WikiUser:Jan.Brezina