Skip to content

Wrong libdir in pkg-config .pc files if CMAKE_INSTALL_LIBDIR is absolute #3905

@akien-mga

Description

@akien-mga

#1284 dehardcoded the libdir and includedir in the pkg-config .pc files, but if you pass an absolute path to CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR (which is supported by CMake and used among other things by RPM distro packager's cmake macros), you can end up with:

$ cat /usr/lib64/pkgconfig/SPIRV-Tools.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}//usr/lib64
includedir=${prefix}//usr/include

Name: SPIRV-Tools
Description: Tools for SPIR-V
Version: 2020.5.1
URL: https://github.com/KhronosGroup/SPIRV-Tools

Libs: -L${libdir} -lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link
Cflags: -I${includedir}

Similar to KhronosGroup/Vulkan-Loader#214

I couldn't get this PR merged (though the bug is still valid in Vulkan-Loader), so I'm now trying with an issue instead of directly providing a potential fix.

That's a pretty common issue so I'm sure there's a proper way to do this with CMake... but there's so many ways to do things with CMake that I'm not so inclined to give it a go myself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions