Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake-3.22 on Ubuntu-22.04 fails to fetch nlohmann library #8

Closed
mikucionisaau opened this issue Nov 20, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@mikucionisaau
Copy link
Member

The issues are in cmake/nlohmann.cmake:

  1. FetchContent_Declare statement fails with "At least one entry of URL is a path (invalid in a list)" which indicates that cmake is unable to parse the URL parameter correctly (probably cmake bug), I had to swap the arguments like this:
FetchContent_Declare(json
  DOWNLOAD_EXTRACT_TIMESTAMP ON
  URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
)
  1. add_subdirectory fails with "add_subdirectory called with incorrect number of arguments". The issue is the extra SYSTEM argument which was introduced much later than cmake-3.22. Meanwhile the root CMakeLists.txt declares to use cmake-3.15, so this is not correct. Suggested fix:
   add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)

(EXCLUDE_FROM_ALL excludes nlohmann targets from the main project targets minimizing development clutter)

@mikucionisaau
Copy link
Member Author

fixed in #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants