Skip to content

Fix CI build: accommodate CMake 4.x and skip upstream chai REPL#35

Open
leftibot wants to merge 1 commit intoChaiScript:masterfrom
leftibot:fix-outdated-cmake
Open

Fix CI build: accommodate CMake 4.x and skip upstream chai REPL#35
leftibot wants to merge 1 commit intoChaiScript:masterfrom
leftibot:fix-outdated-cmake

Conversation

@leftibot
Copy link
Copy Markdown
Contributor

Summary

Fixes the CI failures from #34 (tracked in #33). The build breakage is rooted in the outdated CMakeLists.txt that ships with ChaiScript 6.1.0 and gets pulled in via FetchContent.

Two independent CMake issues:

  • macOS Configure error — runners now ship CMake 4.x, which removes support for cmake_minimum_required(VERSION < 3.5). ChaiScript 6.1.0's root CMakeLists.txt still declares VERSION 2.8 and configure aborts. Fixed by setting CMAKE_POLICY_VERSION_MINIMUM 3.5 just before add_subdirectory, forcing an acceptable floor for the transitive project.

  • Windows MSVC Build error — ChaiScript 6.1.0's src/main.cpp (the chai REPL) has a missing <chrono> include and fails to compile under current MSVC ('high_resolution_clock': is not a class or namespace name). The REPL target is declared unconditionally in the subproject, so EXCLUDE_FROM_ALL on add_subdirectory keeps it out of the default build. chaiscript_extras only consumes ChaiScript's headers, so no functionality is lost.

Drive-by modernization: bump cmake_minimum_required to 3.16, explicitly opt into CMP0169 OLD so the intentional FetchContent_Populate call stays quiet on CMake 3.30+, and drop the now-unused BUILD_MODULES ON override (modules aren't needed by the tests, and EXCLUDE_FROM_ALL would skip them regardless).

Out of scope

The Linux ASAN/UBSAN job still fails on string_methods_test with a heap-use-after-free originating in chaiscript::extras::string_methods::split when accessed via a chained index expression (e.g. split(",")[1]). That is a runtime bug in the extras+ChaiScript 6.1.0 interaction — not a CMake issue — and should be tracked separately.

Test plan

  • Local clean configure on CMake 3.31 — no errors, deprecation warnings silenced
  • cmake --build (Debug) — succeeds, chai REPL not built
  • cmake --build (Release) — succeeds, chai REPL not built
  • ctest (Debug) — both tests pass
  • ctest (Release) — both tests pass
  • GitHub Actions CI — macOS/Windows/Linux non-sanitizer jobs should go green; Linux sanitizers will still fail on the pre-existing runtime bug noted above

🤖 Generated with Claude Code

The CI introduced in ChaiScript#34 surfaced two failures rooted in the outdated
CMakeLists.txt fetched as part of ChaiScript 6.1.0:

1. macOS runners ship CMake 4.x, which removes compatibility with
   cmake_minimum_required(VERSION < 3.5). The fetched subproject still
   declares VERSION 2.8 and configure aborts. Setting
   CMAKE_POLICY_VERSION_MINIMUM to 3.5 before add_subdirectory forces an
   acceptable floor for the transitive project.

2. Windows MSVC builds fail compiling ChaiScript's own src/main.cpp (the
   `chai` REPL) - a missing <chrono> include in upstream 6.1.0. The REPL
   target is unconditionally declared by the subproject, so adding
   EXCLUDE_FROM_ALL on add_subdirectory keeps it out of the default build.
   chaiscript_extras only needs ChaiScript's headers, so nothing else
   changes.

Also modernized: bump cmake_minimum_required to 3.16, drop the now-unused
BUILD_MODULES toggle, and explicitly opt into CMP0169 OLD so the
deprecated FetchContent_Populate call is kept quiet on CMake 3.30+.

Note: this PR does not address the unrelated ASAN/UBSAN heap-use-after-free
surfaced by string_methods_test - that is a runtime bug in the
extras+ChaiScript 6.1.0 interaction and will be tracked separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leftibot leftibot mentioned this pull request Apr 17, 2026
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.

1 participant