-
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
zlibstatic - purpose, make optional? #575
Comments
We have a similar issue. Is there any chance to get this fixed in the main zlib repo? |
You can use |
Hi @nmoinvaz not sure if this helps here. The context of our issue is that we build the zlib dependency as part of a contrib repository and then use FindZLIB in our main project to include it into the build. If zlib builds both static and dynamic always the dynamic version gets picked up by FindZLIB. As @aleksandaratanasov explained, it would be good to choose what static vs. dynamic gets build as this would also resolve the problem with FindZLIB. |
Depending this on BUILD_SHARED_LIBS is the worst you can do. The complete concept of this var is just to set a default if the dev didn't. This would mean for every packager to always run two complete configure/build/install cylces. The right approach here would be to make both of them optional to let you turn one off. And yes, you can use EXCLUDE_FROM_ALL and then let your FindZLIB point to the target here, so this one would be built. I'm thinking about doing this and merging almost all other PRs into one bigger one, so everyone could just point to this PR until it get's merged, But as always, too many other projects. |
See #1027 . |
I am assuming that
zlibstatic
is the static version of zlib. I am confused as to how buildingzlibstatic
is controlled. From what I am seeingis outside any control block (compiler- or platform-specific, e.g. CYGWIN, MSVC, MINGW etc., installation routine etc.) so it means that it is always built regardless of whether
BUILD_SHARED_LIBS
is set or not.If this is indeed the case I suggest making the process optional depending on the
BUILD_SHARED_LIBS
(if set, static will not be built, otherwise it will) or some other variable in case the case when both versions of the library are required. Example:Further tweaks are necessary since the code above produces binary such as
zlibd1
, which should not be possible (adding release AND debug suffix to the binary's name). It is just a demonstration of what I am describing.The reason why I am suggesting this is simple: a project should not build specific binaries unless told so. In my case I don't want to build the static version. While zlib is small, building unwanted binaries adds to the complexity of a build process that depends on zlib including build time, sources of error and last but not least automated deployment (e.g. copying all
*.lib
files from the binary directory by a simplefile(GLOB ...)
call and automatically including them into another project; currently not possible without extra work since bothzlib1.lib
/zlibd.lib
andzlibstatic
/zlibstaticd.lib
(Windows platforms) are being captured).The text was updated successfully, but these errors were encountered: