[CMake] [Dev] CMake 2.5 tool chain support example

Trevor Kellaway tkellaway at asl-electronics.co.uk
Sun Jun 10 17:38:54 EDT 2007


Alex,

> I checked in a change in cvs yesterday.
> 
> Now cmake tries to load:
> 
> Platform/CMAKE_SYSTEM.cmake
> Platform/CMAKE_SYSTEM-<COMPILER_BASENAME>.cmake
> Platform/CMAKE_SYSTEM-<COMPILER_BASENAME>-CMAKE_SYSTEM_PROCESSOR.cmake
> 
> Let me know how this works for you.

I've tried it with cmake version 2.5-20070609. When running this:

 "CMake -G"NMake Makefiles"
-DCMAKE_MODULE_PATH:string=m:\freescale-hc12-demo\toolchain
-DCMAKE_TOOLCHAIN_FILE:string=Toolchain-Freescale-HC12 ..\source"

It fails with:

 -- Check size of void*
 CMake Error: Invalid escape sequence \f
 Syntax error in cmake code at
 M:/freescale-hc12-demo/build1/CMakeFiles/CMakeTmp/CMakeLists.txt:1:
 syntax error, unexpected cal_ERROR, expecting $end (4), when parsing
string "m:\freescale-hc12-demo\toolchain"

It appears that the module path has to now use forward slashes, this is
a bit unfriendly for native Windows users. Changing the slashes to
forward seems to work with my example, unchanged, however this isn't
representative of the intended use of the new includes.

I'm assuming you intend that I don't set CMAKE_SYSTEM_INFO_FILE anymore,
using the new file inclusions instead?

I was hoping that the tool chain file would now only need to include
these lines:

 SET (CMAKE_SYSTEM_NAME	"Freescale")
 SET (CMAKE_SYSTEM_PROCESSOR 	"hc12")
 SET (CMAKE_C_COMPILER "chc12" CACHE STRING "Tool chain C compiler")

However, this doesn't work, I still have to include other items (see
attachment).


It now isn't possible to suppress the check for the size of "void *" in
CMakeTestCCompiler.cmake, I suggest wrapping this in a test if it is
already defined, I've had to do this.

When I first run CMake to generate the config it seems to include the
files multiple times, have you any idea what is causing this? Here is a
log of an initial CMake config from an empty directory (every tool chain
file contains a single 'MESSAGE ("Loaded: ...")' at the top:

===snip===

 Loaded: Toolchain-Freescale-HC12.cmake
 Loaded: Toolchain-Freescale-HC12.cmake
 Loaded: Freescale.cmake
 Loaded: Freescale-chc12.cmake
 Loaded: Freescale-HC12-opt.cmake  

 HC12 core .................: HCS12X
 HC12 memory model .........: Banked
 HC12 start12*.o ...........: start12xb.o
 HC12 RTL ..................: ansixb.lib
 HC12 linker prm file ......: M:/freescale-hc12-demo/source/link.prm
 HC12 library search dir ...: M:/freescale-hc12-demo/build1/lib
 HC12 linker o/p directory .: M:/freescale-hc12-demo/build1/image
 HC12 list file directory ..: M:/freescale-hc12-demo/build1/lst
 HC12 error file directory .: M:/freescale-hc12-demo/build1/err

 Loaded: Freescale-chc12-hc12.cmake
 Skipping test of size of void *
 Loaded: Freescale-chc12.cmake
 Loaded: Freescale-HC12-opt.cmake

 HC12 core .................: HCS12X
 HC12 memory model .........: Banked
 HC12 start12*.o ...........: start12xb.o
 HC12 RTL ..................: ansixb.lib
 HC12 linker prm file ......: M:/freescale-hc12-demo/source/link.prm
 HC12 library search dir ...: M:/freescale-hc12-demo/build1/lib
 HC12 linker o/p directory .: M:/freescale-hc12-demo/build1/image
 HC12 list file directory ..: M:/freescale-hc12-demo/build1/lst
 HC12 error file directory .: M:/freescale-hc12-demo/build1/err

 Loaded: Freescale-chc12-hc12.cmake
 -- Configuring done
 -- Generating done
 -- Build files have been written to: M:/freescale-hc12-demo/build1 

===/snip==

An auto-config does the same. I'd really prefer my summary printout to
only appear once.

Note that in my example Freescale.cmake and Freescale-chc12-hc12.cmake
are effectively empty, as all content seems to logically belong in
Freescale-chc12.cmake in this case.

I think the new style naming makes sense, although it's a shame we can't
push more content down out of the top level tool chain file. Anyway,
we're nearly there.

 - TrevK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freescale-hc12-demo.zip
Type: application/x-zip-compressed
Size: 20993 bytes
Desc: freescale-hc12-demo.zip
Url : http://public.kitware.com/pipermail/cmake/attachments/20070610/65447256/freescale-hc12-demo-0001.bin


More information about the CMake mailing list