Skip to content

Conversation

nigels-com
Copy link
Contributor

I've been on a little bit of an adventure to see what version of cmake is required for building boost.
See boostorg/boost#1081

Json needs cmake-3.15.0, otherwise it errors with:

-- Configuring done
CMake Error at libs/json/test/CMakeLists.txt:63 (target_compile_options):
  Error evaluating generator expression:

    $<CXX_COMPILER_ID:GNU,Clang,AppleClang>

  $<CXX_COMPILER_ID> expression requires one or zero parameters.

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1106.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@Flamefire
Copy link

I can confirm this change is sound: https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:CXX_COMPILER_ID

Changed in version 3.15: Multiple compiler_ids can be specified. CMake 3.14 and earlier only accepted a single compiler ID.

@grisumbras
Copy link
Member

To be honest, If that's all, I'm more willing to replace that one line with 3. I can do it myself, but if you want you can change the PR.

@nigels-com nigels-com changed the title CMake 3.15 is required, 3.14 does not work CMake 3.14 is required, 3.13 does not work Sep 10, 2025
@nigels-com
Copy link
Contributor Author

I've updated the change here to support cmake-3.14 (instead of cmake-3.15).

However cmake-3.13 cmake fails with -DBUILD_TESTING=Y due to parser requiring cmake-3.14:

$ PATH=/opt/cmake-3.13.0-Linux-x86_64/bin:$PATH cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=Y -DCMAKE_CXX_COMPILER=clang++-18 -DBUILD_TESTING=Y -DBOOST_INCLUDE_LIBRARIES=json && ninja -v
-- Boost: using system layout: include, bin, lib, lib/cmake
-- Boost: Release build, static libraries, MPI OFF, Python OFF, testing Y
-- Boost: libraries included: json
-- Boost.Charconv: quadmath support OFF
-- Boost.Context: architecture x86_64, binary format elf, ABI sysv, assembler gas, suffix .S, implementation fcontext
-- Boost.Fiber: NUMA target OS is linux
-- Boost.Iostreams: ZLIB ON, BZip2 ON, LZMA ON (multithreaded), Zstd ON
-- Found the following ICU libraries:
--   data (required)
--   i18n (required)
--   uc (required)
-- Found ICU: /usr/include (found suitable version "74.2", minimum required is "4.8.1") 
-- Boost.Locale: iconv ON, ICU ON, POSIX ON, std ON, winapi OFF
-- Boost.Math: standalone mode OFF
-- Boost.Multiprecision: standalone mode OFF
CMake Error at libs/parser/CMakeLists.txt:9 (cmake_minimum_required):
  CMake 3.14 or higher is required.  You are running version 3.13.0


-- Configuring incomplete, errors occurred!

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1106.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@Flamefire
Copy link

I've updated the change here to support cmake-3.14 (instead of cmake-3.15).

Why? It doesn't really matter what dependencies require. They state their requirements on their own, it is not the responsibly of this library.

How does it get pulled in though? I don't see it as a dependency. Try -DBoost_DEBUG=ON for more info

@grisumbras
Copy link
Member

JSON definitely does not depend on Parser.

Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.71%. Comparing base (e280e70) to head (fa1223a).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1106   +/-   ##
========================================
  Coverage    93.71%   93.71%           
========================================
  Files           91       91           
  Lines         9156     9156           
========================================
  Hits          8581     8581           
  Misses         575      575           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e280e70...fa1223a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nigels-com
Copy link
Contributor Author

The superproject cmake does seem to pulling in Parser via a GLOB in BoostRoot.cmake.

cmake-3.13 does succeed with -DBOOST_EXCLUDE_LIBRARIES=parser specified to skip parser specifically.

@nigels-com nigels-com changed the title CMake 3.14 is required, 3.13 does not work CMake boost super-build requires 3.14, 3.13 does not work Sep 10, 2025
@Flamefire
Copy link

The superproject cmake does seem to pulling in Parser via a GLOB in BoostRoot.cmake.

cmake-3.13 does succeed with -DBOOST_EXCLUDE_LIBRARIES=parser specified to skip parser specifically.

That glob is only for detecting available libraries. Libraries are only configured as requested. One exception is if BUILD_TESTING is set which adds all libraries but doesn't build them by default:
https://github.com/boostorg/cmake/blob/81b08178c629b94b67e3baff5b1b9bee25db7f3a/include/BoostRoot.cmake#L355-L378

@grisumbras
Copy link
Member

https://drone.cpp.al/boostorg/json/1913/22/2

This job invokes cmake -DBoost_VERBOSE=1 -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=iprefix -DBOOST_INCLUDE_LIBRARIES=json .., which results in the following (abriged) output:

...
-- Boost: using system layout: include, bin, lib, lib/cmake
-- Boost: using CMake 3.18.4
-- Boost: Release build, static libraries, MPI OFF, Python OFF, testing ON
-- Boost: libraries included: json
-- Adding Boost dependency align
-- Adding Boost dependency assert
-- Adding Boost dependency config
-- Adding Boost dependency container
...
-- Adding Boost dependency container_hash
-- Adding Boost dependency core
-- Adding Boost dependency describe
-- Adding Boost dependency endian
-- Adding Boost dependency headers
-- Adding Boost dependency intrusive
-- Adding Boost library json
-- Adding Boost dependency move
-- Adding Boost dependency mp11
-- Adding Boost dependency predef
-- Adding Boost dependency static_assert
-- Adding Boost dependency system
-- Adding Boost dependency throw_exception
-- Adding Boost dependency variant2
-- Adding Boost dependency winapi
-- Configuring done

No Parser. Your result could be a consequence of -DBUILD_TESTING=Y not being parsed correctly.

@Flamefire
Copy link

No Parser. Your result could be a consequence of -DBUILD_TESTING=Y not being parsed correctly.

Actually that is expected right now: The dependency scanner doesn't parse the test CML but just adds all other libraries with EXCLUDE_FROM_ALL and w/o installation set. But it still does add them.
See boostorg/cmake#86

@grisumbras
Copy link
Member

https://drone.cpp.al/boostorg/json/1916/22/2 <- this passes, which means JSON should work with CMake 3.8. However, according to boostorg/boost#1083, the minimum should be 3.9. Can you change the PR to use that?

@nigels-com
Copy link
Contributor Author

@grisumbras Yes, happy to make that change to cmake-3.9.

@grisumbras
Copy link
Member

Scratch that, according to boostorg/boost#1083 3.8 should work. So, please keep 3.8.

@Flamefire
Copy link

However, according to boostorg/boost#1083, the minimum should be 3.9.

Turns out that was a documentation bug and 3.8.0 does work for JSON.

@nigels-com nigels-com changed the title CMake boost super-build requires 3.14, 3.13 does not work CMake boost super-build fixups for cmake-3.8 Sep 11, 2025
@nigels-com
Copy link
Contributor Author

There was one more fixup needed for cmake-3.8.
The find_package(BoostPrettyPrinters) portion requires cmake-3.12, but it seems optional.

@nigels-com
Copy link
Contributor Author

Tested in combination with boostorg/cmake#86

$ PATH=/opt/cmake-3.8.0-Linux-x86_64/bin:$PATH cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=N -DCMAKE_CXX_COMPILER=clang++-18 -DBUILD_TESTING=Y -DBOOST_INCLUDE_LIBRARIES=json && ninja check
-- The CXX compiler identification is Clang 18.1.3
-- Check for working CXX compiler: /usr/bin/clang++-18
-- Check for working CXX compiler: /usr/bin/clang++-18 -- works
...
-- Generating done
-- Build files have been written to: /home/nigels/dev/boost/build
[69/69] cd /home/nigels/dev/boost/build && /opt/cmake-3.8.0-Linux-x86_64/bin/ctest --output-on-failure --no-tests=error -C Release
Test project /home/nigels/dev/boost/build
    Start 1: boost_json-tests
1/4 Test #1: boost_json-tests ...................   Passed    0.87 sec
    Start 2: boost_json-limits
2/4 Test #2: boost_json-limits ..................   Passed    0.00 sec
    Start 3: boost_json-no_exceptions
3/4 Test #3: boost_json-no_exceptions ...........   Passed    0.00 sec
    Start 4: boost_json-intrusive-macro-tests
4/4 Test #4: boost_json-intrusive-macro-tests ...   Passed    0.00 sec

100% tests passed, 0 tests failed out of 4

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1106.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

@grisumbras grisumbras merged commit 9dd59bc into boostorg:develop Sep 11, 2025
5 checks passed
@grisumbras
Copy link
Member

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants