[Cmake] Cross compilation support for Unix
Nitin Gupta
ngupta at GlobespanVirata . com
Wed, 6 Aug 2003 15:00:04 +0530
Hi,
I have done the same succeffully (so far) by writting
a <cross-target>.cmake file in Modules/Platform. This
file overrides all the Cache Values e.g. compiler name,
flags etc.
Initially I tested the stuff by including
Modules/Platform/<cross-target.cmake> at the top of all of my
CMakeLists.txt file. The project build would work file,
though the CMake would Check the the native gcc as working compiler.
However the <corss-target.cmake> file would FORCE all the
cache entries hence the configurations done after its inclusion
worked well.
Later I modified the PROJECT command as
PROJECT(projectname [TARGET_ARCH <cross-target>] [LANG1 LANG2..]).
Now the PROJECT command includes
Modules/Platform/<coss-target>.cmake soon after setting the
project name(and before doing EnableLanguage). The CMake now
picks the correct cross compiler even while "Checking for
working C compiler" and the corresponding TRY_COMPILE
(in CMakeTestCCompiler.cmake) passes.
Regards,
Nitin
> -----Original Message-----
> From: cmake-admin at www . cmake . org [mailto:cmake-admin at www . cmake . org]On
> Behalf Of Andy Cedilnik
> Sent: Wednesday, August 06, 2003 12:13 AM
> To: Petr Ferschmann
> Cc: cmake at www . cmake . org
> Subject: Re: [Cmake] Cross compilation support for Unix
>
>
> Hi Petr,
>
> Unfortunately not yet.
>
> The issues are with the try_compile etc.
>
> In order to solve this, we will have to separate host environment and
> target environment. Then you will specify the host compiler and target
> compiler. This is unfortunately feature for after 1.8.
>
> That said, you can cross compile using CMake. The only thing is that you
> have to provide all the answers to all try compiles.
>
> For example, let say you want to compile Hello World on i32 Linux for
> Agenda Vr3, which runs Linux on MIPSel.
>
> You would run cmake on your project, check all the cache values and set
> them accordingly. So, compiler will be mipsel-gcc instead of gcc, ...
>
> Lots of work though. There were limited successes on the list. Check
> history.
>
> Andy
>
> On Tue, 2003-08-05 at 13:04, Petr Ferschmann wrote:
> > it is possible in CMake to cross compile for another platform?
>
> _______________________________________________
> Cmake mailing list
> Cmake at www . cmake . org
> http://www . cmake . org/mailman/listinfo/cmake
>