Answer the question
In order to leave comments, you need to log in
How to properly add and distribute zlib to a Qt 5 CMake project?
The project is cross-platform (Windows, Linux, Mac OS). There is a problem with find at least on Windows - I never managed to get CMake to find zlib and build everything. The option with qmake and using the zlib built into Qt is understandable, but it is not clear how to transfer it to CMake.
Answer the question
In order to leave comments, you need to log in
So far I have settled on the option - add sources to the project and connect via
But so far I have not found a better way to include headers in the main project than adding target_include_directories to the CMakeLists.txt of the child project:
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question