machinezone / IXWebSocket

websocket and http client and server library, with TLS support and very few dependencies
BSD 3-Clause "New" or "Revised" License
539 stars 173 forks source link

CMake packaging doesn't support example usage #504

Open HunterZ opened 7 months ago

HunterZ commented 7 months ago

The project readme says to use #include <ixwebsocket/xyz.h> but the CMake install logic uses .../include/ixwebsocket in the exported target properties: https://github.com/machinezone/IXWebSocket/blob/c5a02f1066fb0fde48f80f51178429a27f689a39/CMakeLists.txt#L275

This means that unless you get the parent include directory via some other means, the #include directive breaks, which is exactly what just happened to me when I tried to reuse some of my ixwebsocket-dependent code in another CMake project.

Note that ixwebsocket's pkgconfig setup exports the parent include directory, so fixing this would bring those into alignment: https://github.com/machinezone/IXWebSocket/blob/c5a02f1066fb0fde48f80f51178429a27f689a39/ixwebsocket.pc.in#L4

bsergean commented 7 months ago

Do you have any clue on how to fix that, without breaking vcpkg and all ?

HunterZ commented 6 months ago

Well my point is that vcpkg is already broken...It seems the answer is to change: $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket> ...to: $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ...which would align it with both the pkgconfig setup and other vcpkg packages' CMake configs.