0

I've got a library (Google's protobuf, FWIW) which requires a certain compile-time flag if it's been built into a shared library. However, if it's been built into a static library, then it mustn't have the flag.

pkg-config files have a Cflags property, which contains the cflags an application should use when using both the static and shared version of the library, and a Cflags.private property, which is only for static libraries.

Cflags: -DUSED_FOR_BOTH
Cflags.private: -DUSED_ONLY_FOR_STATIC

But I can't find a property which is only applied to shared libraries --- i.e. somewhere where I'd put the -DUSED_ONLY_FOR_SHARED. Have I missed something, or is this simply not doable?

2
  • The command $ pkg-config -cflags -libs protobuf outputs -lprotobuf and $ pkg-config -cflags -libs -static protobuf outputs -lprotobuf -lz. So it's unclear why you say that protobuf "requires a certain compile-time flag if it's been built into a shared library. However, if it's been built into a static library, then it mustn't have the flag." Best if you describe your problem concretely. Commented Sep 29 at 9:39
  • Most likely you're using a different platform than the one I am; but that's not really important, as the question's about the .pc file syntax, not protobuf. Commented Sep 29 at 14:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.