Preserving forwarding of empty string arguments using placeholder strings#699
Open
TheLartians wants to merge 27 commits into
Open
Preserving forwarding of empty string arguments using placeholder strings#699TheLartians wants to merge 27 commits into
TheLartians wants to merge 27 commits into
Conversation
Also: - Support cmake-format on Windows by using auto lione-ending
…lars/preserve_empty_strings
…lars/preserve_empty_strings
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
…lars/preserve_empty_strings
…lars/preserve_empty_strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About
This PR builds on #461 to ensure that empty arguments do not get lost, but instead
of usingreplacing the main CPM function with macros it encodes empty arguments with a special string, which gets decoded back to an empty string after parsing. In #461 @ClausKlein raised an unaddressed point about usingevalandARGNin macros leading to unexpected results, not the macro is entirely contained by CPM methods, so it should be safe.This PR addresses #460 and supersedes #461 and #687.
Copilot summary
This pull request introduces robust handling of empty string arguments in CPM's CMake functions, ensuring that empty arguments are preserved and correctly forwarded through all relevant APIs. This addresses long-standing issues with CMake's argument parsing, especially for packages and commands that require empty arguments. The update also includes new tests to verify this behavior and minor improvements to formatting and test setup.
Argument encoding/decoding and forwarding:
cpm_encode_empty_arguments,cpm_decode_empty_argument, andcpm_decode_empty_argumentsfunctions to reliably encode and decode empty string arguments, preventing their loss during CMake argument parsing.CPMAddPackageto use the new encoding/decoding functions, ensuring empty arguments are preserved when parsing and forwarding arguments.cpm_declare_fetchto forward arguments, including empty ones, unmodified toFetchContent_Declare.CPMDeclarePackageto store all arguments, including empty strings.broken_dependency/CMakeLists.txt.into quote empty arguments, ensuring they are handled as intended.Testing improvements:
forward_arguments.cmaketo verify that empty arguments are correctly encoded, decoded, and forwarded through all relevant CPM and CMake APIs.options.cmakeby ensuring the test build directory is cleaned before use.Configuration and formatting:
line_ending: autoin.cmake-formatfor consistent line endings across platforms.