'cmake install with pkg_check_modules
After installing a package (let’s call it XXX) with cmake, xxx.pc in install/lib64/pkgconfig looks like:
prefix=/path/to/xxx/install
includedir=/path/to/xxx/install/include
libdir=/path/to/xxx/install/lib64
Name: xxx
Description: The xxx library
Version: 2.2.0
Cflags: -I/path/to/xxx/install/include
Libs: -L/path/to/xxx/install/lib64 -lxxx /path/to/scalapack/lib/libscalapack.a /usr/lib64/liblapack.so /path/to/openblas/lib/libopenblas.a -lgfortran -lm /path/to/openblas/lib/libopenblas.a -lgfortran -lm -lm
Now when I try to build another package using that installation of XXX using pkg_check_modules(XXX REQUIRED xxx), cmake sets XXX_LDFLAGS to:
/path/to/scalapack/lib/libscalapack.a;/usr/lib64/liblapack.so;/path/to/openblas/lib/libopenblas.a;-L/path/to/xxx/install/lib64;-lxxx;-lgfortran;-lm
That is it re-ordered the list of libraries with the .a first and the '-l' last. The problem is that now I am getting some undefined scalapack functions at link time in xxx since xxx comes after scalapack, but depends on scalapack. Any idea how to fix that, either on the second package side or when generating the .pc on the XXX side?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
