Skip to content

build(json): avoid modifying parent CMake configuration globally #554

Description

@GaspardKirira

Summary

Prevent the JSON module from unexpectedly changing global CMake variables in parent projects and umbrella builds.

Current behavior

The module sets global variables such as:

  • CMAKE_CXX_STANDARD;
  • CMAKE_CXX_STANDARD_REQUIRED;
  • CMAKE_POSITION_INDEPENDENT_CODE;
  • CMAKE_RUNTIME_OUTPUT_DIRECTORY.

A submodule should generally express requirements through its targets rather than altering unrelated parent targets.

Expected behavior

The JSON module should use target-scoped configuration wherever possible.

Standalone build defaults may still be configured without polluting umbrella consumers.

Scope

  • Remove unnecessary global C++ standard changes.
  • Keep target_compile_features() as the public requirement.
  • Review global position-independent-code settings.
  • Review runtime output directory changes.
  • Scope example output paths locally.
  • Scope test output paths locally.
  • Add parent-project integration tests.
  • Preserve standalone behavior.

Suggested files

  • modules/json/CMakeLists.txt
  • modules/json/examples/CMakeLists.txt
  • modules/json/tests/CMakeLists.txt
  • modules/json/benchmarks/CMakeLists.txt

Acceptance criteria

  • Adding the module does not change unrelated target standards.
  • Adding the module does not redirect unrelated executables.
  • vix::json still requires C++20.
  • Standalone examples and tests remain easy to locate.
  • Umbrella builds remain compatible.
  • Parent-project integration tests pass.

Non-goals

This issue does not include:

  • changing the required C++ language version;
  • redesigning umbrella CMake;
  • altering other modules;
  • removing standalone support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildBuild system, CMake, compiler, linker, CI/CD issuesgood first issueGood for newcomersscope:jsonChanges related to the Vix JSON modulestatus:readyIssue is fully specified and ready for implementationtype:refactorRefactor without behavior change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions