[CMake] [Dev] CMake 2.5-20070519 and tool chain support
Alexander Neundorf
a.neundorf-work at gmx.net
Mon May 28 08:51:57 EDT 2007
On Saturday 26 May 2007 18:47, Trevor Kellaway wrote:
> Alex,
>
> I thought I had it all working, but have discovered that when CMake
> auto-runs under make (e.g. after a CMakeLists.txt has been modified)
> there are a couple of non-obvious gotchas.
>
> Firstly, when using "-DCMAKE_MODULE_PATH=c:\mypath" this works on the
> initial CMake command line invocation, but not on subsequent make
> auto-CMake runs, however if you use
> "-DCMAKE_MODULE_PATH:string=c:\mypath" it seems works OK. This is
> because it is only placed in the cache if it has a type specified.
I thought this was changed some time ago...
YOu are right, we'll have a look why it works this way.
> A similar problem occurs in my "Toolchain-Freescale-HC12.cmake" where I
> include the platform code based on the system name:
>
> SET (CMAKE_SYSTEM_INFO_FILE ${CMAKE_SYSTEM_NAME}-Freescale-HC12)
>
> On a subsequent make auto-CMake run this will fail as the system name
> isn't present, I've had to specify the explicit system name to
> workaround this:
>
> SET (CMAKE_SYSTEM_INFO_FILE Windows-Freescale-HC12)
I wouldn't call the file "Windows-Freescale-HC12", it sounds like it's a
compiler for Windows
> 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"
CMAKE_MODULE_PATH and CMAKE_ROOT are used if the filename is given without
the ".cmake" extension.
> 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".
Can't specify what ?
Giving the toolchain file as path relativ to you binary dir works here.
$ cmake -DCMAKE_TOOLCHAIN_FILE=../sdcc-mcs51.cmake ..
> 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)
This part is not required, if you include a file with extension then it is
interpreted by default as relative to the current source dir.
> PS: I'd suggest that CMakeDetermineSystem.cmake's loading of the tool
> chain file should also search CMAKE_SOURCE_DIR after the binary
> directory, this would allow me to easily version manage this file in my
> source tree (you tend not to version manage the build tree).
See above, works if the included file has an extension.
> A similar problem occurs in my "Toolchain-Freescale-HC12.cmake" where I
> include the platform code based on the system name:
>
> SET (CMAKE_SYSTEM_INFO_FILE ${CMAKE_SYSTEM_NAME}-Freescale-HC12)
Is this with current cvs ? I changed some things last thursday so this file
will be "configured" into the binary tree and so variables will be replaced
with their actual value during the initial cmake invokation.
Can you please check ?
Thanks for testing.
Alex
More information about the CMake
mailing list