[CMake] [Dev] CMake 2.5-20070519 and tool chain support
Trevor Kellaway
tkellaway at asl-electronics.co.uk
Sat May 26 12:27:47 EDT 2007
Alex,
> I tried with nmake and sdcc and it worked for me, both with
> forward and double back slashes.
> An environment variable isn't supported currently.
>
> cmake -DCMAKE_MODULE_PATH=c:/dir -DCMAKE_TOOLCHAIN_FILE=foo.cmake
srcdir
OK, this now working for me, I was trying to use a relative path
previously. Note that I have to use "-DCMAKE_TOOLCHAIN_FILE=foo", not
"-DCMAKE_TOOLCHAIN_FILE=foo.cmake"
It is shame I can't specify this as a relative path to CMAKE_BINARY_DIR,
a lot less typing for the users as in my case I'd like this to be
"../toolchain".
I now have my compiler running in the new environment and I'm trying to
tidyup the tool chain file so it can be published as an example of how
to integrate an embedded tool chain.
I currently have the following files:
Toolchain-Freescale-HC12.cmake
includes--> ${CMAKE_SYSTEM_NAME}-Freescale-HC12
I've introduced a number of new target specific variables (HC12_*) for
setting core type and memory model, these have sensible defaults, but
can be overridden on the CMake command line.
To allow these to be more easily overridden in
"Windows-Freescale-HC12.cmake" I search for
"Windows-Freescale-HC12-opt.cmake", in the main module path, the binary
directory, and the source directory.
INCLUDE ("Windows-Freescale-HC12-opt.cmake" OPTIONAL RESULT_VARIABLE
_INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
IF (NOT _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
INCLUDE ("${CMAKE_BINARY_DIR}/Windows-Freescale-HC12-opt.cmake"
OPTIONAL RESULT_VARIABLE _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
ENDIF (NOT _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
IF (NOT _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
INCLUDE ("${CMAKE_SOURCE_DIR}/Windows-Freescale-HC12-opt.cmake"
OPTIONAL RESULT_VARIABLE _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
ENDIF (NOT _INCLUDED_WINDOW_FREESCALE_HC12_OPT_FILE)
Do you think the "*-opt" naming scheme is sensible for optional
additions (not an entire file override)?
I'll post the files when I've managed to make them truly generic.
- TrevK
More information about the CMake
mailing list