[CMake] 32-bit mode on 64-bit machine

Glenn Coombs glenn.coombs at gmail.com
Thu May 26 13:39:40 EDT 2011


I do exactly that for my project using these lines:

if(UNIX)
    # only build 32-bit binaries
    add_definitions(                        -m32)
    set(CMAKE_EXE_LINKER_FLAGS                "${CMAKE_EXE_LINKER_FLAGS}
-m32")
    set(CMAKE_SHARED_LIBRARY_C_FLAGS        "${CMAKE_SHARED_LIBRARY_C_FLAGS}
-m32")
    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS
"${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -m32")
endif()


I do it unconditionally but you could easily add an option variable to turn
this behaviour on or off accordingly.
--
Glenn


On 26 May 2011 17:54, Sara Rolfe <smrolfe at u.washington.edu> wrote:

> Hello,
>
> I'd like to force a 64-bit machine to build a 32-bit program.  Can I
> control this using CMake?
>
> Thanks,
> Sara
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110526/78c2171c/attachment.htm>


More information about the CMake mailing list