[CMake] Cross-compiling, CMAKE_C_FLAGS, and configure-time compiler tests

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jan 20 13:32:16 EST 2011


Hi Justin,

On Tuesday 14 December 2010, Justin Holewinski wrote:
> On Tue, Dec 14, 2010 at 4:45 AM, Johan Björk <phb at spotify.com> wrote:
> > Hi Justin,
> >
> > I'm very unsure if this is the correct solution, but it worked for me. I
> > haven't been able to find any good documentation stating how the
> > CMakeCache interacts with other parts of CMake.
> >
> > My assumption is that since CMAKE_C{XX}_FLAGS is supposed to allow the
> > user to set optional compilation flags, it prefers the value in the cache
> > versus the one from the toolchain file.
> >
> > From one of my toolchain files, reproduce as necessary for CMAKE_C_FLAGS:
> > SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti" CACHE STRING "" FORCE)
>
> I'll have to give that a try.  For now, I'm getting around the problem by
> setting the flags within the parent CMakeLists.txt script after loading the
> toolchain file.
>
> I'm really not sure what the "best practice" is for this situation.  The
> compiler will work and can be tested without the "-arch" flags, but the
> flags are necessary to build for the *right* architecture.  Most
> cross-compilers will only produce binaries for the target system, so the
> point is moot.  The iOS compilers, however, will generate code for Intel
> and ARM so I'm not sure if testing the i386 back-end when I'm targeting ARM
> is the right way or not.

please put your problem in the cmake bug tracker 
http://public.kitware.com/Bug/ and assign it to me.

Thanks
Alex


More information about the CMake mailing list