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 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
>
___
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