<div dir="ltr"><div><div>This seems to be the recommended way to link against the zlib library:<br><pre style class=""><code><span class="">find_package</span><span class="">(</span><span class="">ZLIB</span><span class="">)</span><span class="">
</span><span class="">if</span><span class=""> </span><span class="">(</span><span class="">ZLIB_FOUND</span><span class="">)</span><span class="">
    include_directories</span><span class="">(</span><span class="">$</span><span class="">{</span><span class="">ZLIB_INCLUDE_DIRS</span><span class="">}</span><span class=""></span><span class="">)</span><span class="">
    target_link_libraries</span><span class="">(</span><span class=""></span><span class="">MyProg</span><span class=""> $</span><span class="">{</span><span class="">ZLIB_LIBRARIES</span><span class="">}</span><span class=""></span><span class="">)</span><span class="">
endif</span><span class="">(</span><span class=""></span><span class="">)<br></span></code></pre>When I run this on linux I see that ZLIB_LIBRARIES has the value /usr/lib64/libz.so.  On this machine gcc creates 64-bit binaries by default.  In my CMakeLists.txt I have an option for building 32-bit which adds "-m32" to the compiler and linker command lines.  However the ZLIB_LIBRARIES variable is still returning the 64-bit version (/usr/lib64/libz.so) instead of the 32-bit version (/usr/lib/libz.so).<br>
<br></div>Is there some way for me to let cmake know that I'm building 32-bit so that the find_package(ZLIB) command sets ZLIB_LIBRARIES to the correct 32-bit version of the library ?<br><br>--<br></div>Glenn<br><br><div>
<div><pre style class=""><code><span class=""><br></span></code></pre><br></div></div></div>