[CMake] Configure 32 bit build in 64 bit environment from cli

Martin Koller kollix at aon.at
Fri Mar 29 04:39:45 EDT 2013


On Thursday 28 March 2013 15:03:41 Bill Hoffman wrote:
> 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")

Do I want this inside the toolchain file or can I set this on cmake invocation
time via -DCMAKE_CXX_COMPILER_ARG1=-m32 ... ?

I did not find this variable in the documentation.
Is this something internal, not for the ordinary user ?

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at


More information about the CMake mailing list