Skip to content

ctest (58+60,/67 cmake_import_configure) fails when build with -D JSON_Install:BOOL=OFF because of missing nlohmann_jsonTargets.cmake #2946

Closed
@Andreas-Schniertshauer

Description

@Andreas-Schniertshauer

What is the issue you have?

Start 58: cmake_import_configure
58/67 Test #58: cmake_import_configure .......................***Failed    2.07 sec
...
-- Found nlohmann_json: build/json/nlohmann_jsonConfig.cmake (found version "3.10.0")
CMake Error at build/json/nlohmann_jsonConfig.cmake:6 (include):
  include could not find requested file:

    build/json/nlohmann_jsonTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:5 (find_package)

This is because in CMakeLists.txt export ... NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE is called only in case of JSON_Install is true.

Please describe the steps to reproduce the issue.

  1. cmake .. -D JSON_Install:BOOL=OFF -D JSON_ImplicitConversions:BOOL=OFF -D JSON_BuildTests:BOOL=ON
  2. cmake --build . --config Release
  3. ctest -C Release --output-on-failure

What is the expected behavior?

Tests should not fail when using flags -D JSON_Install:BOOL=OFF -D JSON_ImplicitConversions:BOOL=OFF -D JSON_BuildTests:BOOL=ON

And what is the actual behavior instead?

Some tests fail.

Which compiler and operating system are you using?

  • Compiler: Visual Studio 2019 16.11.1 Professional
  • Operating system: Windows 10 21H1

Which version of the library did you use?

  • latest release version 3.10.0 (zip file)
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions