Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
856 stars 233 forks source link

How to provide/install nlohmann_json for the JSON library #258

Closed NikolaiBirolini closed 1 year ago

NikolaiBirolini commented 1 year ago

What's your question?

How can I configure cmake to choose the nlohmann library ?

Additional Context

Hello everyone !

I want to use the JWT token in my project. So, I firstly used the arun11299 repository. It worked great but my project is written in C++11 and unfortunately, he didn't support this version of C++.

Finally, I found your repository, and I saw that in contrary of arun, we can define the used Json library. Thanks to arun's repository, I already installed the nlohmann Json library.

  1. I clone your repository
  2. I create a build folder in it
  3. I launch the commande : cmake ..

And I had this error :

-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "1.1.0l", minimum required is "1.0.1")  
-- Could NOT find nlohmann_json (missing: nlohmann_json_DIR)

I don't know if it's a bug or just a bad configuration...

Thank you for reading me !!

prince-chrismc commented 1 year ago

Are you running master or a release?

It prints that message but it's not an error, it should continue 🤔

NikolaiBirolini commented 1 year ago

I'm running in master's branch.

I use :

prince-chrismc commented 1 year ago

https://github.com/Thalhammer/jwt-cpp/actions/runs/3187923514/jobs/5200001760#step:6:19

If you let it run... it took like 2 minutes on a bad wifi connection at the airport for me... you will eventually download the git repo

This is super new so there might be something missing

You can always install nlohmann_json https://github.com/Thalhammer/jwt-cpp/blob/master/.github/actions/install/nlohmann-json/action.yml#L9 like we do in CI if it's too slow

prince-chrismc commented 1 year ago

Since this was improved with #259 there should not be any issues.

Feel free to re-open if you have issues 😸