MinGW/CMake Undefined Reference to ZLib
<p>I have a project I want to build with CMake and compile with MinGW. The project uses Zlib. When I build with CMake I get no errors but then when I run MinGW Make it gives the following output:</p>

<pre><code>C:\Projects\MultiMCBuild&gt;C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe
.
.
.
[ 50%] Linking CXX shared library ..\libMultiMC_logic.dll
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x1f6c): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x29e2): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2a6d): undefined reference to 'z_get_crc_table'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2ca7): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2f52): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2f77): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3239): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3317): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3626): undefined reference to 'z_crc32'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x371f): undefined reference to 'z_inflate'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x376a): undefined reference to 'z_crc32'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3a57): undefined reference to 'z_inflateEnd'
C:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64-    mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):     bad reloc address 0x20 in section `.eh_frame'
collect2.exe: error: ld returned 1 exit status
logic\CMakeFiles\MultiMC_logic.dir\build.make:3186: recipe for target 'libMultiMC_logic.dll' failed
mingw32-make[2]: * * * [libMultiMC_logic.dll] Error 1
CMakeFiles\Makefile2:1806: recipe for target 'logic/CMakeFiles/MultiMC_logic.dir/all' failed
mingw32-make[1]: * * * [logic/CMakeFiles/MultiMC_logic.dir/all] Error 2
makefile:159: recipe for target 'all' failed
mingw32-make: * * * [all] Error 2
</code></pre>

<p>Anyone have a clue what I can do to fix this? I read that the code can't find the ZLib library, how do I link it?</p>

<p><strong>EDIT</strong> <a href="http://pastebin.com/sPqSMeEC" rel="nofollow" title="here">here</a> is my CMakeLists.txt. I got this from the Git project.</p>