[CMake] Configure 32 bit build in 64 bit environment from cli
Bill Hoffman
bill.hoffman at kitware.com
Thu Mar 28 15:03:41 EDT 2013
On 3/28/2013 2:19 PM, Martin Koller wrote:
> I'm doing this with a toolchain file, so that cmake sees this as cross-compiling.
>
> E.g. I have the following toolchain file "linux_i686.toolchain.cmake":
>
> # toolchain file for building a 32bit version on a 64bit host
>
> # use it like this:
> # cmake -DCMAKE_TOOLCHAIN_FILE=linux_i686.toolchain.cmake <sourcedir>
>
> set(CMAKE_SYSTEM_NAME Linux)
> set(CMAKE_SYSTEM_VERSION 1)
> set(CMAKE_SYSTEM_PROCESSOR "i686")
>
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags")
> set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags")
You want this:
set(CMAKE_CXX_COMPILER_ARG1 "-m32")
set(CMAKE_C_COMPILER_ARG1 "-m32")
-Bill
More information about the CMake
mailing list