diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-08-03 21:31:25 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-08-03 21:31:25 +0000 |
commit | 3c66c2e6418246e8b802a6ad101ac752ac11eb25 (patch) | |
tree | f8f6720f22f1ecc9bd45c82f9b8b722fcbb6dfc9 /README.txt | |
parent | ad2cfe03751debb67a61bc4e4a2047ff9a235a8f (diff) | |
download | protobuf-3c66c2e6418246e8b802a6ad101ac752ac11eb25.tar.gz protobuf-3c66c2e6418246e8b802a6ad101ac752ac11eb25.tar.bz2 protobuf-3c66c2e6418246e8b802a6ad101ac752ac11eb25.zip |
Allow dependents to use pkg-config to figure out what flags to pass to link against protobuf.
Diffstat (limited to 'README.txt')
-rw-r--r-- | README.txt | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -33,6 +33,44 @@ For advanced usage information on configure and make, see INSTALL.txt. If you already built the package with a different prefix, make sure to run "make clean" before building again. +** Compiling dependent packages ** + + To compile a package that uses Protocol Buffers, you need to pass + various flags to your compiler and linker. As of version 2.2.0, + Protocol Buffers integrates with pkg-config to manage this. If you + have pkg-config installed, then you can invoke it to get a list of + flags like so: + + pkg-config --cflags protobuf # print compiler flags + pkg-config --libs protobuf # print linker flags + pkg-config --cflags --libs protobuf # print both + + For example: + + c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf` + + Note that packages written prior to the 2.2.0 release of Protocol + Buffers may not yet integrate with pkg-config to get flags, and may + not pass the correct set of flags to correctly link against + libprotobuf. If the package in question uses autoconf, you can + often fix the problem by invoking its configure script like: + + configure CXXFLAGS="$(pkg-config --cflags protobuf)" \ + LIBS="$(pkg-config --libs protobuf)" + + This will force it to use the correct flags. + + If you are writing an autoconf-based package that uses Protocol + Buffers, you should probably use the PKG_CHECK_MODULES macro in your + configure script like: + + PKG_CHECK_MODULES([protobuf], [protobuf]) + + See the pkg-config man page for more info. + + If you only want protobuf-lite, substitute "protobuf-lite" in place + of "protobuf" in these examples. + ** Note for cross-compiling ** The makefiles normally invoke the protoc executable that they just |