Skip to content

std.Build.Step.ConfigHeader: handle empty keys more permissively #24051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jan200101
Copy link
Contributor

@Jan200101 Jan200101 commented Jun 1, 2025

${} is valid in cmake config headers and needs to be substituted instead of throwing an error

cmake_minimum_required(VERSION 3.15)

project(test)

set("" "Empty Key")

message("Output: ${}")
$ cmake .
Ouput: Empty Key
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/tmp.xjaLJ6qVKc

there are practically no real world projects that depend on this but it still needs to be supported.
There are still projects (e.g. darktable) with cmake config headers that include ${} in a comment that is not intended to be subsituted with anything else, I think that requiring the user to explicitly provide an empty key introduces unnecessary friction for a problem that isn't real, so this PR uses .undef as a fallback instead of erroring.

TL;DR

  • make empty key not an error
  • if empty key has no value default to undefined

${} is never used in a cmake config header but still needs to be
substituted
instead of erroring because of an empty key simply omit the value
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