-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[vtk] FindPEGTL fix #37561
[vtk] FindPEGTL fix #37561
Conversation
@microsoft-github-policy-service agree |
Please adjust the |
ports/vtk/findpegtl.patch
Outdated
+ get_target_property(TARGET_IMPORTED_GLOBAL taocpp::pegtl IMPORTED_GLOBAL) | ||
+ if(NOT TARGET_IMPORTED_GLOBAL) | ||
+ set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE) | ||
+ endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to be the only change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the other changes were caused by the automatic conversion of line endings.
Should be fixed now. |
+ get_target_property(TARGET_IMPORTED_GLOBAL taocpp::pegtl IMPORTED_GLOBAL) | ||
+ if(NOT TARGET_IMPORTED_GLOBAL) | ||
+ set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE) | ||
+ endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused: Isn't this identical to just deleting the line set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE)
?
If taocpp::pegtl
is IMPORTED_GLOBAL
, then TARGET_IMPORTED_GLOBAL
will be true, and we run set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE)
... but it already was true.
If taocpp::pegtl
is not IMPORTED_GLOBAL
, then TARGET_IMPORTED_GLOBAL
will be false, and we don't do anything.
I think we need to understand why this IMPORTED_GLOBAL
was added in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @ras0219-msft pointed out that I missed a NOT.
Can you explain why this fix works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the code is run the first time the imported global is not true and as such gets set. Each subsequent run will thus not set the property which generates the error. Due to the property being set the second run will also not create the target and thus it cannot be modified, so the test is need to see if the target was created in this run. It is a bit annoying setting targets to global but some people just mess up their target scoping.
@martinfalk seems like this PR is ready to merge, hopefully it can go in soon as there is another large PR waiting on this one: #37119 🤞 |
Thanks for the fix and sorry I read it backwards before |
No worries, and happy to contribute :) |
Fixes #35223
./vcpkg x-add-version --all
and committing the result.