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
CMakeLists.txt - fix zconf.h not being found in case of out-of-source… #532
Conversation
Could we merge this. Until now we were keeping this one-liner around as a local patch, because we don't run CMake in mini zip's source directory. If I am not mistaken, this fix for the "zconf.h not found" error with out-of-source-tree builds stems from the following discussion: madler/zlib#132 |
According to this line in the CMakeLists.txt for madler/zlib, it is configured to the binary directory. https://github.com/madler/zlib/blob/master/CMakeLists.txt#L84-L85 What are the cmake commands you are using that reproduce the error? |
I created a separate build directory and executed the follwing command in git bash: Afterwards I open the generated Visual Studio solution, and when building minzip I get the follwowing compile error: From what I found, the following line in zlib cmake is related to the issue: The following discussion is also related to the issue: |
It looks like FetchContent is using BINARY_DIR of the SOURCE_DIR. |
This PR broke the Windows builds. |
Could you provide the cmake line to reproduce? |
Actually it looks like for whatever reason cmake is finding an installed version of LZMA on Windows machines (probably GitHub changes the images) and it is failing. So not this PR. |
Yep, looks like it is not checking out liblzma: |
I have made some additional changes that should fix things. Also I have added a CI build that checks that out-of-source-tree builds work. |
Thank you, much appreciated |
…-tree build
zlib CMakeLists.txt does some strange things with zconf.h.in and zconf.h
To make sure zconf.h is found with an out-of-source-tree build, we have to adjust the add_subdirectory call, and give the source directory as binary directory.
ZLIB_BINARY_DIR is empty anyways, but that is caused by another issue in the clone_repo cmake helper, and even if it would have a valid value, for zlib we need to point to the source dir.