csdms / bmi-c

Basic Model Interface for C
https://bmi.readthedocs.io
MIT License
1 stars 3 forks source link

Relative paths in pkg-config file #9

Closed mdpiper closed 1 year ago

mdpiper commented 1 year ago

The pkg-config file output from CMake, bmic.pc, has relative paths:

$ cat /Users/mpiper/anaconda3/envs/bmic/lib/pkgconfig/bmic.pc
Name: bmi-c
Description: The Basic Model Interface for C
URL: https://bmi.readthedocs.io
Version: 2.0
Libs: -Llib -lbmic
Cflags: -Iinclude

Absolute paths are needed, otherwise downstream packages can't find bmi.h.

mdpiper commented 1 year ago

Rereading the GNUInstallDirs documentation, I see what I did wrong: I need to use the CMAKE_INSTALL_FULL_<dir> variables in this context, not the CMAKE_INSTALL_<dir> variables used in the build process. Doing so gives the expected result:

$ cat /Users/mpiper/anaconda3/envs/bmic/lib/pkgconfig/bmic.pc
Name: bmi-c
Description: The Basic Model Interface for C
URL: https://bmi.readthedocs.io
Version: 2.0
Libs: -L/Users/mpiper/anaconda3/envs/bmic/lib -lbmic
Cflags: -I/Users/mpiper/anaconda3/envs/bmic/include
mdpiper commented 1 year ago

(Maybe this is good because the process of writing the issue made me think about what went wrong.)