Am Dienstag, 24. Juni 2014, 22:32:22 schrieb Glenn Coombs:
> This seems to be the recommended way to link against the zlib library:
> 
> find_package(ZLIB)if (ZLIB_FOUND)
>     include_directories(${ZLIB_INCLUDE_DIRS})
>     target_link_libraries(MyProg ${ZLIB_LIBRARIES})
> endif()
> 
> 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).

That means that CMake doesn't know that it is building a 32 bit executable, 
which is a bad idea for reasons you already discovered. Try CC="gcc -m32" 
cmake ... in a clean build tree.

Eke

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to