cmake: clear package version after pkg-config
detection
#15409
Closed
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.
pkg_check_modules()
seems to leave<PACKAGE>_VERSION
defined with anempty value, if the package is not found.
When the package is also not found in the fallback branch,
find_package_handle_standard_args()
logs and error message. In thismessage it includes the bogus empty value as:
(found version "")
:https://github.com/curl/curl/actions/runs/11509727553/job/32040378958?pr=15408#step:31:99
Clear the version number to avoid the confusion:
https://github.com/curl/curl/actions/runs/11510022503/job/32041149129?pr=15408#step:31:99
Seen with CMake v3.30.5.
Follow-up to 7bab201 #15193