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).

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 ?

--
Glenn
-- 

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