[CMake] Thoughts on Cross-compiling with CMake

Trevor Kellaway tkellaway at asl-electronics.co.uk
Mon Apr 30 13:45:40 EDT 2007


Alex,

> In CMakeGenericSystem.cmake Platform/gcc.cmake is included 
> unconditionally. 
> Does this cause problems for you ?

No I don't have any problems.

However, I didn't try to unstitch the existing gcc compiler support
(feeling this would be a mammoth task), instead I just tried to fool
CMake into thinking gcc existed and had already determined any config
info it needed.

Obviously you are better placed to do this properly.


You should also be aware of this thread on the topic
http://public.kitware.com/pipermail/cmake/2007-April/013498.html. My
current implementation uses the compiler name as the root name for the
new includes, I think this really needs a vendor name as well, as if two
compilers have the same name we're stuck.

The Linux "arch" style naming doesn't really work for embedded systesm,
I have three compilers for the same MC9S12 family and they share no
common features, all including their own includes and using their own
command line tools (even with different object file extensions).

So "-DCMAKE_CROSS_COMPILER=Metrowerks-MC9S12" would be better, and the
user would provide:

	CrossCompiler-Metrowerks-MC9S12.cmake
	CrossCompiler-Generic-Metrowerks-MC9S12.cmake

These files then provide the tool chain info, so I wonder if
CMAKE_CROSS_COMPILER shouldn't be called "CMAKE_TOOL_CHAIN" as that is
really what it is doing.

 - TrevK


More information about the CMake mailing list