Skip to content

Fix kit cmakeSettings boolean + semicolon regressions (#4927, #4934)#4936

Merged
snehara99 merged 6 commits into
mainfrom
fix/kit-cmakesettings-bool-and-semicolon
May 15, 2026
Merged

Fix kit cmakeSettings boolean + semicolon regressions (#4927, #4934)#4936
snehara99 merged 6 commits into
mainfrom
fix/kit-cmakesettings-bool-and-semicolon

Conversation

@hanniavalera
Copy link
Copy Markdown
Contributor

@hanniavalera hanniavalera commented May 13, 2026

Fixes #4927 and #4934

Changes

Schema / type widening (#4927):

  • schemas/kits-schema.json - cmakeSettings value oneOf now accepts boolean and number in addition to
    string / string[].
  • src/kits/kit.ts - Kit.cmakeSettings widened to { [key: string]: string | string[] | boolean | number }.
  • "BUILD_TESTING": true now produces -DBUILD_TESTING:BOOL=TRUE and shows as a checkbox in the Cache Editor.

Semicolon passthrough (#4934):

  • src/cmakeValue.ts - cmakeify() no longer rewrites ;\; in string values. ; keeps its natural CMake
    list-separator meaning, matching how CMake Presets cacheVariables have always behaved. Users who need a literal
    ; inside a single list element can pre-escape as \; in JSON.
  • The change applies to all three call sites in CMakeDriver.generateCMakeSettingsFlags() (kit cmakeSettings,
    workspace cmake.configureSettings, variant settings) so behavior is consistent across the three legacy sources
    and aligned with presets.

Cleanup:

  • src/drivers/cmakeDriver.ts - removed an obsolete as string cast on the variant branch.

Tests

  • test/unit-tests/backend/cmakeify.test.ts - updated ;-handling assertions; added BOOL / array regression
    tests.
  • test/unit-tests/backend/kits-schema.test.ts (new) - loads a kit JSON with BUILD_TESTING: true through the
    same Ajv validator the kit loader uses, locking [Bug] cmake-kits.json boolean cmakeSettings are broken #4927 at the schema layer.

Docs

  • docs/kits.md - rewrote the "Semicolon Handling" section to describe the new behavior, the Windows \; trap,
    and the pre-escape escape hatch.
  • docs/cmake-settings.md - updated the cmake.configureSettings row to match.
  • docs/variants.md - clarified that variant settings follow the same rule as cmake.configureSettings.
  • CHANGELOG.md - entries under 1.24 Bug Fixes.

Verified

PR #4823 ("Support string arrays in kit cmakeSettings ...") tightened
the cmake-kits.json schema for cmakeSettings to oneOf [string, string[]],
which silently rejected boolean values that previously worked (#4927). It
also kept the long-standing string semicolon-escape behavior in
cmakeify(), which mangles values such as

    "CMAKE_PREFIX_PATH": "C:/a;C:/b"

into

    "C:/a\;C:/b"

on the command line (#4934). PR #4823 only patched the array path for

Changes

- schemas/kits-schema.json:
  Add boolean and number to the cmakeSettings patternProperty oneOf so
  the editor and JSON validator accept the full set of types the runtime
  already supports.

- src/kits/kit.ts:
  Widen Kit.cmakeSettings value type to:

      string | string[] | boolean | number

- src/cmakeValue.ts:
  Stop transforming string values; pass them through unchanged.
@hanniavalera hanniavalera force-pushed the fix/kit-cmakesettings-bool-and-semicolon branch from b1a4b6b to 49ac2f3 Compare May 14, 2026 15:37
@hanniavalera hanniavalera linked an issue May 14, 2026 that may be closed by this pull request
The new schema test used a fixed-depth path (../../../) that worked under
`yarn backendTests` (ts-node from `test/unit-tests/backend/`) but failed
under `yarn unitTests` because the compiled file at
`out/test/unit-tests/backend/kits-schema.test.js` is one directory deeper
relative to the repo root. CI failed on Linux/Windows/macOS with ENOENT on
`out/schemas/kits-schema.json`.

Replace with a walk-up resolver that locates `schemas/kits-schema.json` from
either `__dirname`, making the test invariant under both invocation modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hanniavalera hanniavalera force-pushed the fix/kit-cmakesettings-bool-and-semicolon branch from 5368925 to 74515ee Compare May 14, 2026 16:52
hanniavalera and others added 3 commits May 14, 2026 13:28
 The variant `settings` block is documented as "Similar to
 cmake.configureSettings in settings.json" but didn't spell out
 the semicolon rule. Now that this PR unifies `cmakeify()` to
 pass `;` through verbatim across all three settings sources
 (workspace, variants, kits), make the rule explicit here:
 strings pass through verbatim, use array notation for a
 declarative list, or pre-escape `\;` for a literal semicolon.
@snehara99 snehara99 merged commit 72bfc76 into main May 15, 2026
4 checks passed
@snehara99 snehara99 deleted the fix/kit-cmakesettings-bool-and-semicolon branch May 15, 2026 16:27
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.

[Bug] cmakeSettings support in cmake-tools-kit.json is invalid [Bug] cmake-kits.json boolean cmakeSettings are broken

2 participants