It happens quite often that an upstream package built with CMake generates a pkg-config file, which contains paths incompatible with NixOS. For example, upstream may assume CMAKE_INSTALL_LIBDIR
is a relative path lib/
and concatenates ${prefix}/lib
out of it, while in case of NixOS/nixpkgs it is absolute.
The CMake documentation states unambigously, that CMAKE_INSTALL_*
can be relative or absolute and that one should use the CMAKE_INSTALL_FULL_*
variables to get an absolute path.
What is the right recommendation to give to upstream if they generate a pkg-config file with paths that break on NixOS?
I was shouted at for suggesting CMAKE_INSTALL_FULL_*
instead of an approach defining CMake variables specifically for pkg-config (e.g. libdir_for_pc_file
), hence I’m seeking clarification.
If there is consensus, I suggest adding the recommendation to the nixpkgs documentation section on CMake.
cc @jtojnar