mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
600 stars 206 forks source link

Remove boost dependency from pkg-config template file #210

Closed ych closed 5 years ago

ych commented 5 years ago

Boost does not provide pkg-config file, so if execute 'pkg-config --exists cppkafka' command with boost dependency, user always gets non-zero return. And PKG_SEARCH_MODULE in cmake use the command to check the status of cppkafka.

The boost dependency should be removed for general usage can be works.

accelerated commented 5 years ago

@ych, do you have to add boost manually on the link line? Maybe there's a flag in pkg-config to skip unknown .pc files instead of throwing an error? Our boost installs have .pc files for instance, but I think it's more of a company artifact than something standard.

ych commented 5 years ago

@accelerated If cppkafka really need Boost but Boost is not supported in pkg-config, it should put to Cflags field. (please refer https://people.freedesktop.org/~dbn/pkg-config-guide.html, "Cflags: The compiler flags specific to this package and any required libraries that don't support pkg-config.")

But I try to find out where cppkafka using Boost, and I find out that Boost only is used in the example program for program options. pkg-config is a way to describe how to use the library, it does not need to include the library which only the example program used.

accelerated commented 5 years ago

@ych, in that case we have to bring back -I@Boost_INCLUDE_DIRS@ in CFlags because CppKafka uses boost::optional which is header-only file. boost::program_options are used in tests only. This is what I originally had but i was unaware that open source boost distros don't provide a .pc file. So my testing was not failing because our company generates these .pc files.

ych commented 5 years ago

@accelerated ok, I only use ldd command to check executable files and library files, so I ignore the boost::optional part.

I add @Boost_INCLUDE_DIRS@ to pkg-config template file, it will be converted correctly by configure_file command in CMakeLists.txt.

accelerated commented 5 years ago

@ych, can you please fix the conflict so this can be merged?

ych commented 5 years ago

Sorry, I did not notice the comment.

The conflict should be fixed now.

mfontanini commented 5 years ago

@accelerated are you good with this one? I don't use pkg-config so I'm not sure what are the implications of this.

accelerated commented 5 years ago

Yes I recently heard from another source that pkg_config if broken if used with cmake because of boost, so I say it should be removed.

mfontanini commented 5 years ago

Perfect. Thanks @ych and @accelerated!