-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
CMake: Use configuration package for zlib install target #295
Conversation
@madler Is your repository dead? Should I contribute elsewhere? Does anyone know? |
No, not dead. Just a large backlog. |
By the way, I won't be removing zconf.h. This is explained elsewhere. |
@madler Where is it explained so I can read it and understand? Thanks!
|
Side note, I need to make the following changes:
|
Sorry, yes, it does take a little digging to find things here. #163 has the answer. |
@madler Thanks for finding that for me. So basically you're still trying to support the older build methods, right? I was assuming you should only support building with CMake. Is there a reason you can't drop support for the other build methods? CMake works on all platforms, after all... Thanks for your feedback! |
@timofonic What about it? |
.gitattributes
Outdated
# Linux-centric files maintain LF line endings on Windows platforms | ||
*.sh eol=lf | ||
Makefile* eol=lf | ||
configure eol=lf |
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 think it would be helpful to make this a separate patch.
The smaller a patch, the easier it is to accept.
And this in particular is a separate concept from this pull request's title.
That said, I think this is a good idea to enforce text files use lf line endings. It would be unfortunate for someone to submit a pull request where their editor auto-converted opened files. But * text=auto is a tad dangerous. Maybe instead list out the file types we expect? I would include all code files.
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.
@ProgramMax How is it dangerous? I recommend reading the gitattributes documentation page for more information on what this does.
Other great reading material:
Separate patch is a good idea, I will do that later. However it is likely that I close this PR and move it to the zlib-ng repository per a previous comment. This one is far too inactive and turnaround times for PRs are very long.
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 read those before commenting. :) It is dangerous because it relies on Git to determine what is and isn't a text file. Git has gotten this wrong in the past. For example, in .png files: https://stackoverflow.com/questions/29435156/what-will-text-auto-eol-lf-in-gitattributes-do
Plus, some files which are text simply shouldn't be LF-formatted. For example, a Visual Studio solution or project file.
So I think it would make more sense to opt-in on the files which should be protected.
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.
To your point, even if git assumes wrong for a file type, I think we should explicitly specify only the types it is getting wrong. This is a little more maintainable, as I feel confident the majority of file types will be handled correctly. So in your case we'd do something like:
* text=auto
*.png binary
The idea here is that the exclusive list will be much larger than the inclusive one. For the most part I trust Git, and as I've seen this work in many projects over many years with very few edge cases coming up, I plan to continue following this pattern in the .gitattributes
I am contributing. I do appreciate your feedback though, however I think those cases should be handled explicitly.
On that note, does this repo even have PNG files?
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.
Also in your linked SO question, they state that the issue you're talking about (using PNG as an example) was fixed in 2.10.0 of Git, per this answer. However this bug may not be relevant since my .gitattributes
is doing * text=auto
not * text=auto eol=lf
. The latter is what the OP is doing in the SO question you linked.
The configuration package is the ideal way to provide downstream targets information about zlib. It puts the burden of intrinsic knowledge of zlib's installation properties on the zlib project itself, rather than CMake which maintains the `FindZLIB.cmake` package module.
1f41c26
to
6df13ec
Compare
Detailed changelog:
The configuration package is the ideal way to provide downstream targets information about zlib. It puts the burden of intrinsic knowledge of zlib's installation properties on the zlib project
itself, rather than CMake which maintains the
FindZLIB.cmake
package module.Example usage: