On 2018-09-21 15:55+0200 Florian Lindner wrote:

Hello,

on a really weird configured system (but I can't change it), there is a 
pkg-config file which I want to find with cmake:

 set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:$ENV{PETSC_DIR}/lib/pkgconfig")
 set(CMAKE_PREFIX_PATH "$ENV{PETSC_DIR}/lib/pkgconfig")
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(PETSC REQUIRED craypetsc_real)

but

-- Checking for module 'craypetsc_real'
--   No package 'craypetsc_real' found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:363 (message):
 A required package was not found



cat $PETSC_DIR/lib/pkgconfig/craypetsc_real.pc

VERSION=3.8.4.0
PE=GNU
pe=gnu
GENCOMP=7.1
CPU_TARGET=haswell

install_prefix=/opt/cray/pe
root=${install_prefix}/petsc/3.8.4.0/real
prefix=${root}/${PE}/${GENCOMP}/${CPU_TARGET}
libdir=${prefix}/lib
includedir=${prefix}/include

cray_as_needed=
cray_no_as_needed=

Name: craypetsc_real
Description: Scientific libraries
Version: ${VERSION}
Libs: -L${libdir} ${cray_as_needed}-lcraypetsc_gnu_71_real${cray_no_as_needed}  
-fopenmp
Libs.private:
Requires:
Requires.private: mpich >= 7.0 sci_mp >= 13.0 cray-tpsl >= 16.03.1 hdf5_parallel
Conflicts: hdf5
Cflags:  -I${includedir}

pkg-config also finds it:

PKG_CONFIG_PATH=$PETSC_DIR/lib/pkgconfig pkg-config --print-variables 
craypetsc_real
cray_as_needed
prefix
libdir
[...]


CMakeError.log does not exist, CMakeOutput.log I have attached.

Hi Florian:

What happens if you set PKG_CONFIG_PATH outside cmake rather than inside?

e.g.,

env PKG_CONFIG_PATH=$PETSC_DIR/lib/pkgconfig cmake ....

with both

set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:$ENV{PETSC_DIR}/lib/pkgconfig")
set(CMAKE_PREFIX_PATH "$ENV{PETSC_DIR}/lib/pkgconfig")

commented out inside your CMakeList.txt file?

That method has always worked for me.  And if it works for you, then I would
think attempting to set the enviroment variable PKG_CONFIG_PATH inside
your CMakeLists.txt file with just

set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:$ENV{PETSC_DIR}/lib/pkgconfig")

(setting CMAKE_PREFIX_PATH should not be required) should just work, but it is
always possible (although I haven't checked documentation to see) there is
some incorrect syntax in that line so I would also use message to print
out the PKG_CONFIG_PATH environment variable to see what you have actually
set it to within CMake.

Alan
__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to