You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The readme advises to include the header with #include "json.hpp". If we add this repo as a git submodule, we would add the src/ directory of this repo to the include path, and also do #include "json.hpp". However, if one runs the CMake INSTALL target of this repo, or uses it via e.g. vcpkg, the header gets copied to the location nlohmann/json.hpp and should now be included as #include "nlohmann/json.hpp".
I think it would be better (and best practice) to put the header in the repo into a directory include/nlohmann/. Most header-only libraries that I know of do this. This would unify the #include: We could just use #include "nlohmann/json.hpp, no matter whether we're including via git submodule, CMake INSTALL target, vcpkg, etc. Another plus is that it sort-of "namespaces" the header, i.e. a clash with a potential other json.hpp file in any of the compiler's include directories is avoided (not unlikely, as json.hpp is quite a generic name).
The text was updated successfully, but these errors were encountered:
Hi!
The readme advises to include the header with
#include "json.hpp"
. If we add this repo as a git submodule, we would add thesrc/
directory of this repo to the include path, and also do#include "json.hpp"
. However, if one runs the CMake INSTALL target of this repo, or uses it via e.g. vcpkg, the header gets copied to the locationnlohmann/json.hpp
and should now be included as#include "nlohmann/json.hpp"
.I think it would be better (and best practice) to put the header in the repo into a directory
include/nlohmann/
. Most header-only libraries that I know of do this. This would unify the#include
: We could just use#include "nlohmann/json.hpp
, no matter whether we're including via git submodule, CMake INSTALL target, vcpkg, etc. Another plus is that it sort-of "namespaces" the header, i.e. a clash with a potential otherjson.hpp
file in any of the compiler's include directories is avoided (not unlikely, asjson.hpp
is quite a generic name).The text was updated successfully, but these errors were encountered: