babelouest / rhonabwy

Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
https://babelouest.github.io/rhonabwy/
GNU Lesser General Public License v2.1
45 stars 21 forks source link

Put microhttpd in CMakeLists.txt #2

Closed faustocarva closed 4 years ago

faustocarva commented 4 years ago

I was trying to compile rhonabwy in my computer (Ubuntu 20.04) and after running a make I've got the error below:

[ 17%] Built target orcania
[ 26%] Built target yder
[ 30%] Building C object ulfius-build/CMakeFiles/ulfius.dir/src/u_map.c.o
In file included from /home/faustocarva/gits/rhonabwy/ulfius-src/include/u_private.h:29,
                 from /home/faustocarva/gits/rhonabwy/ulfius-src/src/u_map.c:30:
/home/faustocarva/gits/rhonabwy/ulfius-src/include/ulfius.h:55:10: fatal error: microhttpd.h: No such file or directory
   55 | #include <microhttpd.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [ulfius-build/CMakeFiles/ulfius.dir/build.make:63: ulfius-build/CMakeFiles/ulfius.dir/src/u_map.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:365: ulfius-build/CMakeFiles/ulfius.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

So i did some search and found that libmicrohttpd-dev was not installed in my OS. But it would be cool if CMake tould me that (that libmicrohttpd was not found). So i put find_package command into CMakeLists.txt (grabing some code from another package of the author, FindMHD.cmake). After that, anyone who tries to compile rhonabwy is able to know in advance that libmicrohttpd has to be installed.

Thnaks.

babelouest commented 4 years ago

Thanks for the pull request!

I need to make something about it though. There is no reason libmicrohttpd is required for rhonabwy, the problem comes from ulfius which needs libmicrohttpd to create webservices, and rhonabwy only uses client HTTP requests from ulfius, which is based on libcurl.

I should either drop ulfius dependency and use libcurl directly, or allow to build ulfius without libmicrohttpd.

Meanwhile I'll use your PR. Thanks @faustocarva !