-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
How to include in an external project #2083
Comments
Did you install the library? This is required if you want to find it via |
Yes installed but I have one doubt. Once it is installed with Homebrew, then in my CMake I need to add:
what is what goes in the |
I could do the following: brew tap nlohmann/json
brew install nlohmann-json and the following project: cmake_minimum_required(VERSION 3.1)
project(DummyProject CXX)
find_package(nlohmann_json 3.2.0 REQUIRED)
add_executable(dummy dummy.cpp)
target_link_libraries(dummy PRIVATE nlohmann_json::nlohmann_json) #include <nlohmann/json.hpp>
#include <iostream>
int main()
{
std::cout << nlohmann::json::meta() << std::endl;
} can be configured via: $ cmake ..
-- The CXX compiler identification is AppleClang 11.0.3.11030032
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found nlohmann_json: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.7.3", minimum required is "3.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/niels/Desktop/foo/build and build with
|
You are right, thank @nlohmann . I know it does not concern you as it is a problem from my side but I have In my project one general CMake and one other inside the subproject. With this I get the error:
An this is the CMake in
Do you know what is the reason why with this structure happens this error? Thank a lot |
How does |
|
Are there errors or warning running CMake? |
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:
But get this output:
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
The text was updated successfully, but these errors were encountered: