-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Missing zconf.h when using zlib as a git submodule (with CMake) #133
Comments
I think there was a commit in somewhere here that removed the rename from CMakeLists.txt, it did involve adding some includes in the source files... This however doesn't fix the issue that zconf.h gets modified during build process. |
I'm running into the same problem, except in my case, the missing zconf.h outright causes a fatal error whenever I try to How did you manage to solve this? |
@minexew add_subdirectory() should automatically add directory containing zlib.h to include path... If it doesn't, you need to make sure cmake is upgraded to latest available and that zlib.h actually exists in directory specified in second parameter of add_subdirectory(). |
Oh no, zlib.h is just fine. However, one of the first things it does inside is |
@minexew All cmake-generated files should be inside the binary directory, so it should find them if the second parameter is correctly defined. |
I'm starting to understand. Do you have an example of the intended usage when zlib is a submodule? I'm currently (trying to) do this:
|
@minexew Second parameter of add_subdirectory should be something like: "${CMAKE_CURRENT_BINARY_DIR}/zlib_build" |
Ok. Just wondering, why is it neccessary to add the include paths manually? The latter would automatically propagate include paths whenever somebody does |
@minexew target_include_directories() didn't exist in older cmake versions. |
Maybe zconf.h should be added to the .gitignore file so that changes are hidden ? |
Regarding target_include_directories(), since it was available from CMake 3.0 (over 2 years ago) I would think it is safe to require at least CMake 3.0 for zlib now. |
@robiwano I think it was added in 2.8.11 (see https://cmake.org/cmake/help/v2.8.11/cmake.html#section_Commands), but as zlib is all for backwards support for even oldest operating systems, I doubt @madler will want to require minimum CMake of 2.8.11 or 3.0. Removing zconf.h from git repository and adapting Makefiles for Windows and other non-bash operating systems to copy it from zconf.h.in would solve false update notifications. That's what I did for zlib-ng. |
Yeah, in Debian world for example, "2 years ago" is basically "yesterday". |
@minexew Development on zlib-ng has been quite slow for last 13 months because @Dead2 has been busy with other projects, but it does support more (read: better) "recent" architectures than stock zlib. I've been mostly working on the MinGW/MSYS2 support and optimized ARM and Visual C++ code based on what was posted here. |
If zlib is not going to use even 2.8.12, then note that you should probably be setting the set_target_properties(zlib PROPERTIES
DEFINE_SYMBOL ZLIB_DLL
SOVERSION 1
+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}"
) |
…ore committing renamed this disabled zconf.h renaming functionality which is in a problematic state madler/zlib#133
Hey guys, do you have any status update for this issue? |
@l33ds It's not a bug in zlib, it's an error in CMakeFiles.txt on the project using zlib as subproject. I already explained it in previous comments. It doesn't happen with just zlib, but any project that generates include files. |
@mtl1979 Problem is that the generated include files are within the source tree. I know many projects do this, but it's not a good way to do it nevertheless :) Wouldn't it be possible to generate it out of the source tree, i.e. in ${CMAKE_CURRENT_BINARY_DIR} somewhere ? |
@robiwano I already explained how to do it exactly that way... |
Ah, sorry :) |
Hi guys, I'm sorry to reactivate this thread but I just ran on something close to this issue I think. I use zlib as a git submodule and it always give me modifications from the source repo which is not of my doing but zlib directly since there is a renaming step in its
I believe in a lot of cases How to get rid of these forced changes to the submodule ? @mtl1979 you said you gave a solution, were you talking about the one with the |
@strattist zconf.h is only needed there because Makefile for Visual C++ (and other compilers not using configure or cmake) needs to have unmodified copy of the file for a successful build... In my solution I made it copy zconf.h.in to zconf.h only when needed, so zconf.h is no longer needed in source tree of the repository. |
@strattist I think this is the wrong place to talk about repository of zlib-ng... Some people would think we are spamming. |
* set(CMAKE_VERBOSE_MAKEFILE ON) * -D CMAKE_AR=/usr/bin/ar
Use fork of zlib to solve issue with CMake processing (madler/zlib#133).
Use fork of zlib to solve issue with CMake processing (madler/zlib#133).
I had this same problem. It was solved by adding the following line before linking: I am not sure if I solved it correctly but it would be great if this can be simplified in the future. My project tree is as follows:
I think that #781 is also related to this issue and I also commented there with the same comment. |
I used
add_subdirectory()
to integrate zlib into my CMake-controlled project. This works well, but there is the problem that git detects a "false update" and constantly asks me to commit a change that I didn't make.Apparently, something in the build process renames
zconf.h
tozconf.h.included
, so git detects the former as deleted and the latter as new.Is there a way to work around that, or better yet, fix it ?
The text was updated successfully, but these errors were encountered: