[CMake] cross-compiling / host compiling
Aeschbacher, Fabrice
Fabrice.Aeschbacher at siemens.com
Mon Jun 7 03:18:51 EDT 2010
Thank you for responding
Actually, I noticed that putting following line in the CMakeLists.txt of the tool that should not be cross-compiled also works:
SET(CMAKE_C_COMPILER "gcc")
The only drawback I found until now is that the native compiler (gcc) is not checked by cmake at startup (which is for us a minor issue)
Best regards,
Fabrice Aeschbacher
> -----Ursprüngliche Nachricht-----
> Von: Michael Wild [mailto:themiwi at gmail.com]
> Gesendet: Donnerstag, 3. Juni 2010 14:15
> An: Alexander Neundorf
> Cc: cmake at cmake.org; Aeschbacher, Fabrice
> Betreff: Re: [CMake] cross-compiling / host compiling
>
>
> On 3. Jun, 2010, at 14:09 , Alexander Neundorf wrote:
>
> >> I have a project where almost every sub-dirs should be
> cross-compiled
> >> (arm-linux-gnuueabi-gcc), but one directory containing a
> tool which must be
> >> compiled on the host (gcc) first.
> >>
> >> Can you give me a hint about the best way to achieve this
> with cmake?
> >
> > They need to be compiled separately.
> > With cmake, one buildtree is always one toolchain, using
> more than one
> > toolchain in one buildtree is not supported.
> >
> > So you first need to build the tool in a native build tree,
> and then build the
> > rest in a cross compiling tree.
> > You may want to "export" the tool from the native buildtree
> and "import" it
> > again in the cross compiling tree.
> >
> > Alex
>
> Or use an ExternalProject_Add for the native tool and then do
> an ADD_EXECUTABLE(tool IMPORTED) in the cross compiling
> top-level project.
>
> Michael
More information about the CMake
mailing list