ArthurSonzogni / nlohmann_json_cmake_fetchcontent

A lightweight Release-tracking repository for nlohmann/json. Suitable for CMake fetchcontent. Automatically upgraded every weeks.
MIT License
80 stars 26 forks source link

Build with MSVC is broken #15

Closed serge-s closed 11 months ago

serge-s commented 1 year ago

Attempt to use nlohmann_json_cmake_fetchcontent with Visual Studio result in this error:

CMake Error at CMakeLists.txt:14 (add_executable):
  Cannot find source file:

    build/_deps/json-src/nlohmann_json.natvis

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
RugnirViking commented 1 year ago

I'm encountering the same issue, hopefully we can merge the PR soon and get that new tag made

ArthurSonzogni commented 11 months ago

This repository is not more useful. Indeed, since v3.11.3, you can use:

include(FetchContent)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
FetchContent_MakeAvailable(json)

target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)