[CMake] cmake 2.6 cross compilation for WINCE

Alexander Neundorf a.neundorf-work at gmx.net
Thu Apr 17 15:59:32 EDT 2008


On Thursday 17 April 2008, Andreas Pokorny wrote:
> Hi,
> We currently use cmake-2.4-8 and embedded visual c (evc) 4.0 to build for
> armv4 WinCE5. I plan to upgrade the project to cmake-2.6 soon. Then I will
> probably make use of the cross compile feature.
>
> Right now we simply include a cmake file containing the settings required
> for WinCE. With that file we can only reflect the configuration required
> for CE-5.0 EVC
> and armv4i. But various other combinations are possible cl-2005 instead of
> EVC, mips instead of armv4i, or any other version/flavour of CE.
>
> Do you have any suggestions how to organize the toolchain files?

The toolchain files just describe your target, you need one for each 
combination of target architecture, compiler and operating system (since 
cmake cannot guess that).
They basically look like this:

set(CMAKE_SYSTEM_NAME WinCE)
#not sure you will need this one:
set(CMAKE_SYSTEM_VERSION 4)

# if you want to have specific settings for different hardware, use this one:
set(CMAKE_SYSTEM_PROCESSOR mips_dev_board_rev_17)

# specify the cross compiler
set(CMAKE_C_COMPILER   c:/some/path/to/cross/cl.exe)
set(CMAKE_CXX_COMPILER c:/some/path/to/cross/cl.exe)

# where is the target environment 
set(CMAKE_FIND_ROOT_PATH  c:/some/path/to/target/libs
                          c:/your/custom/target/libs)

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

> I attached our current configuration.
>
> Another issue when configuring a build for EVC/CE5 is finding the compiler
> and the SDK. I do not expect to find evc in the current path, neither
> do I expect
> to find the SDK in the $LIB and $INCLUDE environment variables, should I?
> To work around that we expect the developer to set several varialbes:
> EVCINSTALLDIR PATH "Embedded Visual C++ installation directory"
> WINCESDKDIR  PATH "Windows CE SDK Directory"
> prior to running cmake. Are there cleaner solutions?

I don't know how the environment is usually set up. Does it also have such a 
bat file which sets the required environment variables as there is for native 
Visual Studio ?
Then cmake could run from within such a shell.
Or it could try to set up everything based on the location of the compiler 
(i.e. then set the include dirs and link dirs accordingly). 

Please have a look at Modules/Platform/Windows-cl.cmake.
This will need some work so it can also handle cross compilers.

> When looking at the new qt gui of cmake I was very pleased!
>
> With regard to cross compilation it would be cool to have a dedicated
> field to enter the toolchain file. Since it has to be set prior to running
> cmake.

Yes. Please create a feature request for it in the bug tracker.
You can already now create a new variable in the GUI before starting the 
configure process. This helps somewhat.

Alex


More information about the CMake mailing list