Skip to content

cmake: use built-in variable and target property dump functions with CMake 4.5+ - #22566

Closed
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:cm-dump-45
Closed

vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:cm-dump-45

Conversation

@vszakats

@vszakats vszakats commented Aug 12, 2026

Copy link
Copy Markdown
Member

Their output is nearly identical to curl's implementations. Minor
differences: it goes to stdout (curl: stderr), marks cache variables,
but doesn't mark 'advanced' ones.

Also:

  • indent curl's output to match CMake's.
  • replace single quotes with double to match CMake output.
  • alpha-sort target properties to match CMake.
  • alpha-sort config types to match CMake.
  • tested OK with cmake-4.4.20260811-g567ed0e and 4.4.20260812-g760e4fb.

Refs:
https://gitlab.kitware.com/cmake/cmake/-/commit/f723293c7f625b14bd48627042fc04e67b76c513
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/11834
https://gitlab.kitware.com/cmake/cmake/-/work_items/27513
https://cmake.org/cmake/help/git-master/command/cmake_language.html#command:cmake_language

Follow-up to 855acb3 #17701
Follow-up to f58342a #15562
Follow-up to cd51bb5 #14439


I wish there was also a function to retrieve command-line arguments.
The current hack e.g. doesn't work as expected when vcpkg is used.

https://github.com/curl/curl/pull/22566/files?w=1

Tested OK with cmake-4.4.20260811-g567ed0e.

@github-actions github-actions Bot added the build label Aug 12, 2026
@vszakats
vszakats requested a balanced review from Copilot August 13, 2026 07:03
@vszakats vszakats changed the title cmake: use built-in variable and prop dump functions with CMake 4.5+ cmake: use built-in variable and target property dump functions with CMake 4.5+ Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Uses CMake 4.5’s built-in diagnostic functions while retaining compatibility fallbacks.

Changes:

  • Adopt built-in variable and target-property dumping.
  • Align fallback formatting and property ordering with CMake output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CMake/Utilities.cmake Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

CMake/Utilities.cmake:73

  • Sorting before expanding <CONFIG> still does not match CMake's alphabetical output. For example, <CONFIG>_POSTFIX sorts at the start, then expands to DEBUG_POSTFIX; curl initializes that property, and the explicit DEBUG_POSTFIX entry causes it to be printed again later. Expand and de-duplicate the concrete property names before sorting them.
    list(SORT _cmake_property_list)

@vszakats

Copy link
Copy Markdown
Member Author
  • Sorting before expanding <CONFIG> still does not match CMake's alphabetical output. For example, <CONFIG>_POSTFIX sorts at the start, then expands to DEBUG_POSTFIX; curl initializes that property, and the explicit DEBUG_POSTFIX entry causes it to be printed again later. Expand and de-duplicate the concrete property names before sorting them.

Sorting (and being like CMake) is not important to justify any complexity here. This is OK.

@vszakats vszakats closed this in dea00a6 Aug 13, 2026
@vszakats
vszakats deleted the cm-dump-45 branch August 13, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants