[CMake] Re: CMake Digest, Vol 36, Issue 53

Trevor Kellaway tkellaway at asl-electronics.co.uk
Sat May 5 04:10:42 EDT 2007


Hi,

> # You can ignore the 
> GenericBuildPrologue.cmake/GenericBuildEpilogue.cmake
> # related stuff, as this is my ported existing build world 
> support, and is # a bit too specialized, although it may have 
> the odd useful CMake trick # in it, I don't claim to be an 
> expert, far from it, I'm still learning, # but have at least 
> got over the hump now where I can usefully add new # 
> functionality quickly.
> 
> My question at this point would be, is there a convenient way 
> to do target-platform-specific tests (per my recent e-mails)? 
>  We have some number of source files which are only included 
> on certain target platforms, etc.

Currently I'm using this style test for my different platform (embedded
target versus PC):

  IF (${CMAKE_CROSS_COMPILER} MATCHES "chc12")
    SET (THIS_SRC ${THIS_SRC} mc9s12/dsi.c)


As mentioned in another email I think my naming of
"CMAKE_CROSS_COMPILER" is wrong as it only specifies the compiler name
(which could clash with another vendor's naming), it should really be
"CMAKE_TOOL_CHAIN" and this is the vendor and platform name
"Freescale-HC12" and that name is used to pull in the extension
includes, which then override the compiler/linker.

So, this would make more sense:

  IF (${CMAKE_TOOL_CHAIN} MATCHES "Freescale-HC12")
    SET (THIS_SRC ${THIS_SRC} mc9s12/dsi.c)

 - TrevK


More information about the CMake mailing list