Skip to content

How to include in an external project #2083

Description

@hect1995
  • Describe what you want to achieve.
    I want to import the json functionality to my own project

  • Describe what you tried.
    Following the README, I have cloned this repo in an external folder not in the path of mine and in my CMake I do:

find_package(nlohmann_json 3.2.0 REQUIRED)
add_library(${BINARY}_lib nlohmann_json::nlohmann_json)
target_link_libraries(${BINARY}_lib PRIVATE nlohmann_json::nlohmann_json)

But get this output:

CMake Error at HackerRank/CMakeLists.txt:7 (find_package):
  By not providing "Findnlohmann_json.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "nlohmann_json", but CMake did not find one.

  Could not find a package configuration file provided by "nlohmann_json"
  (requested version 3.2.0) with any of the following names:

    nlohmann_jsonConfig.cmake
    nlohmann_json-config.cmake

  Add the installation prefix of "nlohmann_json" to CMAKE_PREFIX_PATH or set
  "nlohmann_json_DIR" to a directory containing one of the above files.  If
  "nlohmann_json" provides a separate development package or SDK, be sure it
  has been installed.

Sorry in advance for the question but would be much appreciated if you could help me.

  • Describe which system (OS, compiler) you are using.
    Mac OS Catalina and LLDB

  • Describe which version of the library you are using (release version, develop branch).
    I cloned the latest master

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions