Open BenKnigge opened 7 years ago
I encountered these similar issues when attempting to use the library.
I've written an example project and a small post which may be useful. Feel free to adapt any of this information as you please. Also, the main example on https://lwan.ws/ is incorrect for the current API. See that post for an updated version which should work.
This example uses lwan as a git submodule but you could just as easily copy out the header files and library to the location of your choice and build from there.
https://tiehuis.github.io/lwan-intro.html https://github.com/tiehuis/lwan-api-example
@BenKnigge I completely missed this issue here -- I'm sorry. I don't currently have any CMake configuration file that will work outside the project tree. What I know is that you can use CMake's pkg-config module to find Lwan, and it should work:
include(FindPkgConfig)
pkg_check_modules(LWAN lwan)
if (LWAN_FOUND)
# You can use LWAN_LIBRARIES and LWAN_INCLUDE_DIRS here
endif ()
If you can't link with Lwan when using this, please comment. I'm working towards the first release and this is one of the things I have to fix.
@tiehuis Thanks for the heads up regarding the out-of-date web page. I'll update it now so it works with the current API.
It's been many years since the last time that I've attempted to write any code in C and would really appreciate it if there was a bit of documentation on how to use lwan as a library outside of the lwan directory. I've been struggling with the cmake configuration inside of a Clion project and have decided to give up for the night. If anyone has a working cmake config that they would be willing to share it would be greatly appreciated.