-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
The cmake_import example does not build #1976
Comments
Can you post a MWE? We do have tests for the cmake import at https://github.com/nlohmann/json/tree/develop/test already. |
I have added the json.hpp file in single_include at /opt/nlohmann_json/json.hpp Tried to compile it with the following command. It fails. |
@coderDec You have to pass the include path to #include <nlohmann/json.hpp>
#include<string.h>
// for convenience
using json = nlohmann::json;
int
main(int argc, char *argv[])
{
// create an empty structure (null)
json j;
return 0;
} with |
@coderDec Did #1976 (comment) solve your issue? |
Yes it did. |
I am trying to build the cmake_import example json-develop/test/cmake_import/project.
However it fails to build.
Following error:
`
cmake .
-- The CXX compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:5 (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"
with any of the following names:
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.
-- Configuring incomplete, errors occurred!
`
Please describe the steps to reproduce the issue. Can you provide a small but working code example?
I also put the nlohmann_jsonConfig.cmake file generated while building the project here.
What is the expected behavior?
It should build the project
And what is the actual behavior instead?
Unable to build using cmake.
Which compiler and operating system are you using? Is it a supported compiler?
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
Did you use a released version of the library or the version from the
develop
branch?develop branch
If you experience a compilation error: can you compile and run the unit tests?
yes.
The text was updated successfully, but these errors were encountered: