Hi, I installed p4est, which creates the following pkg-config files:
cat /home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/p4est-2.8-buexbce/lib/pkgconfig/p4est-2.8.pc
prefix=/home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/p4est-2.8-buexbce
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
p4est_CC=/home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/openmpi-5.0.5-nvxbduj/bin/mpicc
p4est_CFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL -O2
Name: p4est
Description: p4est manages a collection—a forest—of octrees in parallel.
Version: 2.8
URL: https://www.p4est.org/
Requires: libsc >= 2.8.2
Cflags: -I${prefix}/include
Libs: -L${exec_prefix}/lib -lp4est
Libs.private: -lz -lm
and
cat /home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/p4est-2.8-buexbce/lib/pkgconfig/libsc-2.8.3.pc
prefix=/home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/p4est-2.8-buexbce
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
libsc_CC=/home/dom/prod/spack-stack-20250128/envs/ne-gcc-13.3.1/install/gcc/13.3.1/openmpi-5.0.5-nvxbduj/bin/mpicc
libsc_CFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL -O2
Name: libsc
Description: The SC library supports parallel scientific applications.
Version: 2.8.3
URL: https://www.p4est.org/
Cflags: -I${prefix}/include
Libs: -L${exec_prefix}/lib -lsc
Libs.private: -lz -lm
cmake finds libsc correctly, but the following attempt to find p4est fails:
pkg_check_modules(libsc REQUIRED IMPORTED_TARGET libsc-2.8.3)
pkg_check_modules(p4est REQUIRED IMPORTED_TARGET p4est-2.8)
…
– Found libsc-2.8.3, version 2.8.3
– Checking for module ‘p4est-2.8’
– Package ‘libsc’, required by ‘p4est-2.8’, not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:610 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPkgConfig.cmake:832 (_pkg_check_modules_internal)
CMakeLists.txt:60 (pkg_check_modules)
I believe this has to do with the name of the .pc file being libsc-2.8.3.pc and therefore some internal name in the cmake cache being wrong (not libsc as it should be)?