yhirose / cpp-httplib

A C++ header-only HTTP/HTTPS server and client library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different shared library (.so) names for CMake and Meson builds

jrosdahl opened this issue · comments

Hi,

I use cpp-httplib in ccache. Thanks for writing and maintaining cpp-httplib!

I noticed that the CMake and Meson build configurations have different opinions on what to call the shared library: CMake produces libhttplib.so but Meson produces libcpp-httplib.so. Consequently, different Linux distributions now use different library names depending on whether they chose CMake or Meson to build, which means that software that (at least optionally) can use cpp-httplib in its shared library form needs to search for both libhttplib.so and libcpp-httplib.so to stay portable (for example, see ccache/ccache#1465).

So, I just wanted to spread knowledge about this, as I assume it is not intentional to have different names. Perhaps the build configurations should be changed to use the same shared library name?

@jrosdahl thanks for the report.

@TheMaverickProgrammer @jimmy-park @Tachi107 It would be better to have the same shared library name on both CMake and Meson as @jrosdahl mentioned. What do you think?

Hi @jrosdahl, thanks for noticing! It'd be better to have the same name everywhere of course. I'd personally prefer the library to be called libcpp-httplib, as it is less ambiguous, and the pkg-config file is named like this too.

@Tachi107 @jimmy-park is it possible to change the library name from libhttplib.so to libcpp-httplib.so on the CMake side as well?

@yhirose We can use OUTPUT_NAME CMake property for that purpose.
For example,

set_target_properties(httplib PROPERTIES
    OUTPUT_NAME cpp-httplib
)

@jimmy-park could you make a pull request including your suggestion?

@jrosdahl this issue has been handled at #1854 by @jimmy-park.
Thanks all!