[CMake] [Dev] CMake 2.5-20070519 and tool chain support

Trevor Kellaway tkellaway at asl-electronics.co.uk
Sun May 20 18:13:01 EDT 2007


Hi CMake developers,

I've been trying to modify my previous cross compiler support work to
fit into the new development scheme of tool chain support with
CMAKE_TOOLCHAIN_FILE that is in the current development CVS tree.

I've defined CMAKE_TOOLCHAIN_FILE to point at my tool chain specific
cross compiler information, including compiler flags etc.

To make CMake configure successfully I had to define the following:

	-DCMAKE_TOOLCHAIN_FILE:string=Toolchain-Freescale-HC12 (1) 
	-DCMAKE_C_COMPILER_ID_RUN:bool=TRUE (2)
	-DCMAKE_C_COMPILER_WORKS:bool=TRUE (3)

(1) Does anyone have a proposed convention for naming extension tool
chains? I would suggest "Toolchain-<Vendor>-<Arch>"

Is the intention that I should have to define (2) and (3)? It would be
nicer to have a cleaner way to turn of the compiler self-testing which
is being caused by trying to determine the compiler ID, I would assume
this is the intention of CMAKE_CROSSCOMPILING which doesn't seem to be
being used anywhere yet?

I had to patch CMakeTestCCompiler.cmake to stop it from trying to
determine the type size for "void *" (without this I got an error saying
that TRY compiles weren't allowed for cross-compiling!)

  IF (NOT CMAKE_CROSSCOMPILING)
    CHECK_TYPE_SIZE("void*"  CMAKE_SIZEOF_VOID_P)
  ENDIF (NOT CMAKE_CROSSCOMPILING)

I at least managed to get my code compiling, but currently linking isn't
working, I'll look at this when I have more time.

Anyway, as a first attempt it was fairly painless to get the cross
compiling going (much easier than having to patch the system <g>).

 - TrevK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070520/0cf5f22f/attachment.htm


More information about the CMake mailing list