How to exclude QtZlib folder from ${Qt6Core5Compat_INCLUDE_DIRS}?
-
Hello, I am a contributor for an open source project, which uses Qt. We compile our own zlib and don't use Qtzlib, we need Qt6Core5Compat module though. So we recently made compiling with Qt6 possible, but we still need the Compatmodule, so when in CMake we do this for our project:
include_directories(${Qt6Core5Compat_INCLUDE_DIRS})
which results in some folders being included to the Visual Studio solution, these ones:
C:\Qt\6.4.1\msvc2019_64\include\QtCore5Compat
and
C:\Qt\6.4.1\msvc2019_64\include\QtZlibIncluding the QtZlib breaks things for us though, because we have our own zlib.h in our own directory.
How can I include Qt5Core5Compat dir but not the QtZlib dir?
-
Hello, I am a contributor for an open source project, which uses Qt. We compile our own zlib and don't use Qtzlib, we need Qt6Core5Compat module though. So we recently made compiling with Qt6 possible, but we still need the Compatmodule, so when in CMake we do this for our project:
include_directories(${Qt6Core5Compat_INCLUDE_DIRS})
which results in some folders being included to the Visual Studio solution, these ones:
C:\Qt\6.4.1\msvc2019_64\include\QtCore5Compat
and
C:\Qt\6.4.1\msvc2019_64\include\QtZlibIncluding the QtZlib breaks things for us though, because we have our own zlib.h in our own directory.
How can I include Qt5Core5Compat dir but not the QtZlib dir?
@Gertio said in How to exclude QtZlib folder from ${Qt6Core5Compat_INCLUDE_DIRS}?:
How can I include Qt5Core5Compat dir but not the QtZlib dir?
You can't since it's a dependency.
Either remove the dependency to Qt5Core5Compat or compile QtZlib with the same zlib version as you use or use the zlib version QtZlib is using.
-
But actually, QtZlib is a dependency of Core and not core5compat... It seems suspicious to me..
@Gertio said in How to exclude QtZlib folder from ${Qt6Core5Compat_INCLUDE_DIRS}?:
But actually, QtZlib is a dependency of Core and not core5compat
Then the include path is also added when you use QtCore.
Aynway - you can not add two libraries with the same name to your project - it will break. You must make sure that every part of your app is using the same version of an external library.