Thalhammer / jwt-cpp

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

[bug] Clean setup fails with CMAKE error before CMAKE 3.19 #209

Closed Thalhammer closed 2 years ago

Thalhammer commented 2 years ago

Describe the bug Doing a clean build attempt fails with the following error:

CMake Error at cmake/private-find-kazuho-picojson.cmake:8 (add_library):
     add_library INTERFACE library requires no source arguments.

How To Reproduce (Include if Applicable)

Expected behavior Build succeeds

Desktop (please complete the following information):

Additional context I have no clue why the CI doesn't fail....

Logs (Include/Attach if Applicable)

Click to expand log ``` -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.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.1", minimum required is "1.0.1") -- Could NOT find jsoncons (missing: jsoncons_DIR) -- Could NOT find nlohmann_json (missing: nlohmann_json_DIR) CMake Error at cmake/private-find-kazuho-picojson.cmake:8 (add_library): add_library INTERFACE library requires no source arguments. Call Stack (most recent call first): example/traits/CMakeLists.txt:26 (include) CMake Error at cmake/private-find-kazuho-picojson.cmake:9 (target_include_directories): Cannot specify include directories for target "kazuho_picojson" which is not built by this project. Call Stack (most recent call first): example/traits/CMakeLists.txt:26 (include) -- Configuring incomplete, errors occurred! ```
Thalhammer commented 2 years ago

Turns out this was changed in CMAKE 3.19 to make it allow sources, however many systems (including mine) ship with an older version. To make matters worse, we require a minimum of CMAKE 3.12 in the main CMakeLists.txt.

We should probably add some sort of CI to make sure that we actually support what we claim (i.e. adding a CI run with cmake 3.12 or forcing the existing CI to this version instead of using the latest.