Skip to content
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

FindZLIB.cmake doesn't find the zlib-ng debug build on Mac #1793

Open
Willem871 opened this issue Sep 23, 2024 · 7 comments
Open

FindZLIB.cmake doesn't find the zlib-ng debug build on Mac #1793

Willem871 opened this issue Sep 23, 2024 · 7 comments

Comments

@Willem871
Copy link

In the zlib-ng root CMakeLists.txt file the CMAKE_DEBUG_POSTFIX variable is set to "d".
This results for debug builds in a library name with a "d" suffix, e.g., zlibstaticd.lib.

However, this only happens for Windows (due to the "if (MSVC)" statement in the CMakeLists.txt file).
The standard FindZLIB.cmake file expects this suffix also for Mac, which is not the case currently.
As a result, when using find_package(ZLIB) a system library is found instead of our custom build zlib-ng library.

@nmoinvaz
Copy link
Member

However, this only happens for Windows (due to the "if (MSVC)" statement in the CMakeLists.txt file).

That seems like it might also be a problem for madler/zlib correct? Btw, I'm not seeing that statement in our CMakeLists.txt.

@mtl1979
Copy link
Collaborator

mtl1979 commented Sep 23, 2024

The so-called standard FindZLIB.cmake isn't really standard and needs urgent updating or it will end up getting deprecated in later Cmake versions like they did for FindBoost.cmake.

@Willem871
Copy link
Author

However, this only happens for Windows (due to the "if (MSVC)" statement in the CMakeLists.txt file).

Btw, I'm not seeing that statement in our CMakeLists.txt.

See line 564:
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()

@nmoinvaz
Copy link
Member

I see, so then it seems we do match behavior of madler/zlib.

@mtl1979
Copy link
Collaborator

mtl1979 commented Sep 23, 2024

I can't see any special handling for Mac in stock zlib's CMakeLists.txt, so this is bug in CMake, not zlib or zlib-ng.

@Willem871
Copy link
Author

Ah indeed, you seem to be right.
We only bumped into this issue because some automated tests failed in our debug builds due to different compression: debug used system zlib, release zlib-ng.
Probably, the same issue existed previously as well but the stock zlib was then maybe equal in behavior than the system zlib.

@mtl1979
Copy link
Collaborator

mtl1979 commented Sep 23, 2024

For non-Windows systems, finding debug build is unsupported in module mode, it should still work in config mode though, but that is kinda untested and still unsupported as there is no "default" location for debug libraries and the config mode hasn't been supported long enough yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants