[CMake] Using CMake for cross-compîling?

William A. Hoffman billlist at nycap.rr.com
Wed Aug 30 08:53:02 EDT 2006


At 07:35 PM 8/29/2006, Eric Noulard wrote:
>Could you tell me why we could not TRY_RUN even if
>CC  and CMAKE_C_FLAGS
>have been "overloaded"?
If you are cross compiling, you can not run sample code because it will
not be compiled for the host machine.

The basic idea for cross compiling with cmake, is to create a file
that has all the CMake variables pre-set for your target platform.
Then load that file first, which will short circuit all the try run stuff,
and set the variables for the target platform.   There is no automated
way to do this, or even a list of variables that you need to set.  It will
have to be done by trial and error.   One way might be to run on the target
platform, and then look at the cache variables and use some sub-set of the
cache.

-Bill
   



More information about the CMake mailing list