json icon indicating copy to clipboard operation
json copied to clipboard

building with cmake

Open ozcanay opened this issue 2 years ago • 1 comments

Description

Cmake .. && make -j does not work properly on CentOS-7

Reproduction steps

I am having trouble compiling the project. Here is what I am doing:

git clone https://github.com/nlohmann/json.git
cd json
mkdir build
cd build
cmake ..

So far, so good.

However, when I execute:

make -j

Nothing happens, no response at all.

Expected vs. actual results

I was expecting makefile to produce any message.

Minimal code example

No response

Error messages

No response

Compiler and operating system

gcc 10.1.0, CentOS7

Library version

3.11.2 (develop branch)

Validation

ozcanay avatar Dec 14 '22 10:12 ozcanay

Which CMake version are you using? Can you share the complete output of running CMake?

nlohmann avatar Dec 14 '22 10:12 nlohmann

image

ozcanay avatar Dec 15 '22 10:12 ozcanay

This is as expected. Your CMake version is so old that JSON_BuildTests_INIT is unconditionally set to OFF, see https://github.com/nlohmann/json/blob/develop/CMakeLists.txt#L35.

Without setting JSON_BuildTests to ON, the tests will not be built.

Fix: Call

cmake .. -DJSON_BuildTests=ON

or upgrade CMake.

nlohmann avatar Dec 15 '22 14:12 nlohmann

I would rather see a warning about this issue, though.

ozcanay avatar Dec 21 '22 06:12 ozcanay

When the library is included as third-party, no tests should be compiled unless explicitly specified with -DJSON_BuildTests=ON. This is also documented in the README.

In which situation would you expect a warning?

nlohmann avatar Dec 21 '22 08:12 nlohmann