Fwd: [CMake] Adding cross-compiler support to CMake ...

sonicmctails at aol.com sonicmctails at aol.com
Fri Sep 8 16:06:52 EDT 2006


     
 -----Original Message-----
 From: sonicmctails at aol.com
 To: a.neundorf-work at gmx.net
 Sent: Fri, 8 Sep 2006 4:06 PM
 Subject: Re: [CMake] Adding cross-compiler support to CMake ...
 
  lol, I actually intended to try cross-compiling KDE as a demostration of CMake's cross-compiling abilities once it was perfected. Anyway, autotools does have a difference for the CC, try searching for HOST_CC, BUILD_CC, and TARGET_CC (you probably won't find this one). I can see both approachs being viable, and probably doable. The trick then would be creating a native Makefile for programs that need to be built first, and then create a cross Makefile. The problem here is that CMake, under normal cirmstances, allows make to handle dependancies, but if we're dealing with two seperate build trees, then I'm not sure how we can handle building programs that. CMake just passing things in order to Make, which means that with two seperate build trees - our current generator isn't advanced enough to write a makefile that depends on targets in a second makefile (and to my knowledge, only GNU Make supports this, while I believe the UNIX Makefile generator creates something all flavors of make can handle). Now adding that is def. possibility, but I'm not sure if its going to be easier or harder to implement then just create a single makefile that handles both possibilities - doing this would require massive changes to the makefile generator, but then we don't have to manage any dependancies in CMake itself.
 
 Also, CTest and TRY_RUN will need patches so they can run remotely, but lets get things cross-compiling first.
 Michael
    
 -----Original Message-----
 From: a.neundorf-work at gmx.net
 To: cmake at cmake.org
 Sent: Fri, 8 Sep 2006 3:31 PM
 Subject: Re: [CMake] Adding cross-compiler support to CMake ...
 
  Hi,

Von: "William A. Hoffman" <billlist at nycap.rr.com>

...
> The trouble is that in the case of 2, when you build
> some sort of code generation executable as part of the build and run it
> during
> the build, it has to be built for the host or local machine.   

Exactly.
Just imagine somebody might want to cross-compile KDE...
...and I'm afraid that day will come.

But apart from that, two other things.
I'm using cmake daily for cross-compiling for an embedded target (eCos). There 
no configure tests (TRY_RUN/TRY_COMPILE) are required. The compiler are named 
arm-elf-gcc or powerpc-eabi-gcc, i.e. only a two-part prefix.

Basically all I do is:

SET(CMAKE_COMPILER_IS_GNUCXX 1)
SET(CMAKE_CXX_COMPILER "arm-elf-c++")
SET(CMAKE_C_COMPILER "arm-elf-gcc")
SET(CMAKE_AR "arm-elf-ar")
SET(CMAKE_RANLIB "arm-elf-ranlib")

and adjust the link command:

SET(CMAKE_CXX_LINK_EXECUTABLE  "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> 
<OBJECTS>  -o <TARGET> -nostdlib  -nostartfiles -L${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib 
-Ttarget.ld")

This works even per-directory.
On this platform e.g. no dynamic linking exists, so many things are much more 
simple.

I almost have the impression that just setting a "toolchain-prefix" (e.g. 
"arm-elf-" goes already a long way.

Just my 2 cent.

Alex

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
    Check out AOL.com today. Breaking news, video search, pictures, email and IM. All on demand. Always Free.
    
________________________________________________________________________
Check out AOL.com today. Breaking news, video search, pictures, email and IM. All on demand. Always Free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060908/569f6700/attachment.htm


More information about the CMake mailing list