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

Trevor Kellaway tkellaway at asl-electronics.co.uk
Mon Jun 11 10:16:26 EDT 2007


Alex,

> > It appears that the module path has to now use forward 
> slashes, this 
> > is a bit unfriendly for native Windows users.
> 
> Paths in cmake files should always have forward slashes, also 
> on Windows. If they come from the "outside" (files, env vars, 
> etc.), they have to be converted using FILE(TO_CMAKE_PATH ...)

Agreed, but why can't Cmake do this conversion at the point of use
rather than forcing the user to do this?


> > 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.
> 
> Because it can't link an application, right ?

Correct.

> You have to set two variables:
> CMAKE_SIZEOF_VOID_P
> and
> HAVE_CMAKE_SIZEOF_VOID_P
> 
> The second one is used to indicate whether the test has already run.
> Also both should go into the cache. Do you think it may make 
> sense to provide a macro which does that ?

Yes, a macro to turn this off would be cleaner.


> > 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? 
> 
> Without checking, I'd say it's loaded once for C and once for C++.
> Do you use C++ with this toolchain ?
> If not, you could use PROJECT(name C) and then only C support 
> will be loaded, 
> not C++.

I think I tried it as just a C project and it still did it, I'll test
again.

> Or you could put some logic in the file, like ifdefs in C headers:
> 
> IF(NOT _Freescale-chc12_LOADED)
>   SET(_Freescale-chc12_LOADED TRUE)
> ... all the other code
> 
> ENDIF(NOT _Freescale-chc12_LOADED)

OK, that's another workaround.

> Does it work if you put piper, linker and libmaker into the 
> Generic-chc12.cmake ?

I don't think so, I'll repeat the test (I ran out of time last night).

> 
> SET (CMAKE_C_OUTPUT_EXTENSION 	".o" 	CACHE STRING "C ...")
> SET (CMAKE_CXX_OUTPUT_EXTENSION	".o"    CACHE STRING "C++ ...")
> 
> 
> Let me see if I find a way to define this later.
> 
> 
> SET (CMAKE_C_COMPILER_ID_RUN	TRUE)
> SET (CMAKE_C_COMPILER_WORKS 	TRUE)
> SET (CMAKE_CXX_COMPILER_ID_RUN 	TRUE)
> SET (CMAKE_CXX_COMPILER_WORKS 	TRUE)
> ...
> SET (CMAKE_SIZEOF_VOID_P 2)
> 
> 
> This is basically "skip all tests". Maybe we can shorten this 
> to one line.

Yes, again a skip all would be cleaner.

 
 - TrevK


More information about the CMake mailing list