Skip to content

Carry the C++17 requirement on the wrapper targets - #557

Merged
defiantnerd merged 1 commit into
nextfrom
fix-cxx-standard-for-consumers
Sep 14, 2026
Merged

defiantnerd merged 1 commit into
nextfrom
fix-cxx-standard-for-consumers

Conversation

@defiantnerd

Copy link
Copy Markdown
Collaborator

Independent of the 0.16 review PRs. Found while validating #548 on iOS.

The problem

The wrapper sources need C++17 — std::filesystem, if initializers — but the only place that says so is CMakeLists.txt:112, inside if (PROJECT_IS_TOP_LEVEL).

A project consuming the wrapper through add_subdirectory therefore gets no floor at all and compiles against whatever its generator defaults to. Xcode is one such generator, so anyone following docs/ios.md to build an iOS AUv3 hits it: the configure dies in clap_proxy.cpp and preset_discovery.cpp before anything wrapper-specific is reached. That is the first thing the doc tells you to do, and it does not work as written.

The fix

Put the requirement where the requirement is — a cxx_std_17 compile feature on clap-wrapper-compile-options-public, so it reaches every consumer of those targets without anyone needing to know about it.

It is a floor, not a pin. A consumer building at 20 stays at 20; it only raises a build that was below 17, which was never a supported configuration. Verified: with -DCLAP_WRAPPER_CXX_STANDARD=20 the generated project still selects stdcpp20 and still applies /Zc:char8_t-, so nothing about the C++20 path changes.

docs/ios.md gains the symptom in its troubleshooting table, since an older wrapper checked out in someone's tree will still show it.

Verification

  • Windows VST3 target builds clean at the default C++17.
  • C++20 configuration verified to keep stdcpp20 and /Zc:char8_t-, i.e. the floor does not clamp.

The consuming-project case this actually fixes is an iOS add_subdirectory build, which is worth a confirmation on a Mac — a fresh project following docs/ios.md that does not set CMAKE_CXX_STANDARD should now configure and build.

Note

Also worth considering separately: docs/ios.md has no test target in the repo, so nothing exercises the documented path in CI. This class of bug only shows up when someone follows the doc by hand.

The wrapper sources need C++17 - std::filesystem, if-initializers - but
only the top-level CMakeLists set CMAKE_CXX_STANDARD, and it did so
inside an if (PROJECT_IS_TOP_LEVEL) guard. A project consuming the
wrapper through add_subdirectory therefore got no floor at all and
compiled against whatever its generator defaulted to, failing in
clap_proxy.cpp and preset_discovery.cpp. Xcode is one such generator,
which is how this surfaces for anyone following docs/ios.md to build an
iOS AUv3 - the first configure dies before anything wrapper-specific is
reached.

Put the requirement where the requirement is, as a compile feature on
clap-wrapper-compile-options-public, so it reaches every consumer of
those targets without anyone having to know about it.

A floor rather than a pin: a consumer building at 20 stays at 20 -
verified that the C++20 configuration still selects stdcpp20 and keeps
/Zc:char8_t-. It only raises a build that was below 17, which was never
a supported configuration.

The ios.md troubleshooting table gains the symptom, since an older
wrapper in someone's tree will still show it.
@defiantnerd
defiantnerd merged commit 33c801e into next Sep 14, 2026
28 checks passed
@defiantnerd
defiantnerd deleted the fix-cxx-standard-for-consumers branch September 14, 2026 18:34
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.

2 participants