Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opus.pc variable substitution bug #268

Open
marklomas opened this issue Nov 29, 2022 · 0 comments
Open

opus.pc variable substitution bug #268

marklomas opened this issue Nov 29, 2022 · 0 comments

Comments

@marklomas
Copy link

There is a problem with variable substitution when generating the opus.pc pkg-config file using CMake.

CMakeLists.txt executes configure_file(opus.pc.in opus.pc), which according to the CMake docs will substitute occurrences of @VAR@ AND ${VAR} in opus.pc.in. See: https://cmake.org/cmake/help/v3.10/command/configure_file.html

However, since this is a .pc file which uses the ${VAR} syntax for its own substitution purposes, we really only want @VAR@ to be substituted. The problem is that ${libdir} and ${includedir} in the opus.pc.in file (shown below) are substituted when they shouldn't be. This results in absolute paths being embedded in -L and -l flags, breaking pkg-config's own substitution/relocation/prefix mechanism.

Libs: -L${libdir} -lopus
Cflags: -I${includedir}/opus

I fixed this locally by adding the @ONLY attribute: configure_file(opus.pc.in opus.pc @ONLY). The resulting opus.pc file is relocatable and works smoothly with the usual pkg-config --define-prefix mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant