-
Notifications
You must be signed in to change notification settings - Fork 2.7k
CMake: Dynamic libraries can only be searched if they have been gener… #1113
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
base: develop
Are you sure you want to change the base?
Conversation
…ated. Dynamic libraries can only be searched if they have been generated.
|
@madler: Have you seen this PR? |
|
Nope, they can be searched always. minizip is now part of zlib, but if this is changed for any reason in the future there shouldn't be any traces of zlib in there. This breaks more than it fixes as ZLIB::ZLIB does not exist if ZLIB_BUILD_SHARED is not set so in as with the self-contained variant it is possible that other projects include just minizip and use some other zlib (maybe system searched earlier, maybe some patched version from another subdir). If they decide to use systems zlib and it's the first usage, the search never happens and the configure will fail. |
|
For example, my current project directly includes the zlib code directory and only uses the static library and minizip static library, causing compilation to fail directly. My configuration is as follows: |
|
Or should I modify it to check the MINIZIP_BUILD_SHARED condition? |
|
k, that's a valid reason and fix. Searching the shared if needed. Have you checked what happens if only static is requested? I think the build breaks as no (interpreted as all) components are specified. I wanted to change that to only search for what's really needed (actually wanted this already 2 weeks ago). Would you mind to wait another 1 or 2 days to refine that? |
|
My project uses a root CMake instance to compile all third-party libraries in a single call. If dynamic libraries are used, the libraries need to be installed in the environment first. I need my project to include the zlib library code itself, without relying on external libraries. |
|
For example, in the Android NDK environment, I only need to statically compile all the code into a single .so file once. |
|
Simply put, my entire project is contained in the form of source files, and the corresponding binary files haven't been generated and installed yet when searching for libraries. |
With the current modifications, everything works correctly, and minizipstatic compiles successfully. |
~/zlib/build# cmake -DZLIB_BUILD_MINIZIP=1 -DMINIZIP_ENABLE_BZIP2=0 ../ ~/zlib/build# make all |
That should have worked before as this is what is run in the tests here. You fixed:
I was asking for:
|
Yes, it's fixed. I was just testing whether my patch would affect shared library mode.This proves that everything is working correctly, whether in shared library mode or static library mode. |
|
Nice, we have a working solution. I still would like to refine that patch by using components for search and let each part just search for the parts it needs. First because I think it's cleaner and second just to have code that others can use to see how this all is supposed to work out in the project. Unfortunately I found that the actions are broken atm and need to wait for #1116 to itegrate that cleanly. |
|
Can this PR be used? |
It has been applied and the actions seem to be working now. |
#1086
Dynamic libraries can only be searched if they have been generated.