json: Error in test\download_test_data.vcxproj custom build step when compiling with Visual Studio 2019 16.7.7 msbuild on Windows 10
I get the following error in the CustomBuild step of test\download_test_data.vcxproj when compiling with Visual Studio 2019 16.7.7 Professional msbuild on Windows 10 2004 Professional:
CustomBuild: Downloading test data from https://github.com/nlohmann/json_test_data (v3.0.0) Der Befehl “test” ist entweder falsch geschrieben oder konnte nicht gefunden werden. Building Custom Rule ./test/CMakeLists.txt
The Command “test” is not found, because it does not exist on Windows. “test -d json_test_data” is found in the CustomBuild step of the test\download_test_data.vcxproj project.
The problem is located in download_test_data.cmake “COMMAND test -d json_test_data || …”, here “COMMAND if not exist json_test_data …” should be used on Windows.
Please describe the steps to reproduce the issue.
- Download json-3.9.1.zip and unzip
- Open a Developer command Prompt v16.7.7
- cd json-3.9.1
- Create directory build and cd build
- cmake …\ -D JSON_Install:BOOL=OFF -D JSON_ImplicitConversions:BOOL=OFF -D JSON_BuildTests:BOOL=ON
- msbuild nlohmann_json.sln
- msbuild nlohmann_json.sln
What is the expected behavior?
No error.
And what is the actual behavior instead?
Step 6: CustomBuild: Downloading test data from https://github.com/nlohmann/json_test_data (v3.0.0) Der Befehl “test” ist entweder falsch geschrieben oder konnte nicht gefunden werden. Building Custom Rule ./test/CMakeLists.txt
Step 7: CustomBuild: Downloading test data from https://github.com/nlohmann/json_test_data (v3.0.0) Der Befehl “test” ist entweder falsch geschrieben oder konnte nicht gefunden werden. fatal: destination path ‘json_test_data’ already exists and is not an empty directory. c:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: “cmd.exe” wurde mit dem Code 128 beendet. [build\test\download_test_data.vcxproj]
Which compiler and operating system are you using?
- Compiler: Visual Studio 2019 16.7.7 Professional
- Operating system: Windows 10 2004 Pro German
Which version of the library did you use?
- [x ] latest release version 3.9.1
If you experience a compilation error: can you compile and run the unit tests?
- yes
- no - please copy/paste the error message below
ctest --output-on-failure
did not work, there is mising a -C <config> in the command
ctest -C Release --output-on-failure
would do the job, but an error is reported about json_test_data. After deleting the json_test_data folder and executing
ctest -C Release --output-on-failure
it works. Is also works without deleting the folder when “if exist” is used instead of “test” as reported on top of this post.
Total Test time (real) = 381.65 sec
The following tests FAILED: 51 - cmake_import_configure (Failed) 52 - cmake_import_build (Not Run) 53 - cmake_import_minver_configure (Failed) 54 - cmake_import_minver_build (Not Run) 57 - cmake_fetch_content_configure (Failed) 58 - cmake_fetch_content_build (Not Run) Errors while running CTest
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (10 by maintainers)
Commits related to this issue
- :checkered_flag: make code portable #2593 — committed to nlohmann/json by nlohmann 3 years ago
I think I found a better way. @Andreas-Schniertshauer can you please try the fix of b2244a7f5fcf3288ef3aacb17dd82813e5aff81f in branch https://github.com/nlohmann/json/tree/issue2593?