[cmake-developers] cross compiling support

Bill Hoffman bill.hoffman at kitware.com
Thu Jun 29 08:49:23 EDT 2006


We have a customer that is interested in cross-compiling support.
I want to come up with plan for how we would approach the problem.

Here is the current plan:

For this project we need to be able to build VTK that has wrappers built
as part of the build.  The wrappers are used to generate source files, and
are run during the build, so they have to be compiled with the HOST compiler.

A simple approach for projects like this might be :

- Create a target property HOST_ONLY. 
- run cmake in a host mode

cmake --host-only ../path-to-source  

This would create a build tree that would build all HOST_ONLY marked
targets and any libraries that they depend on.  

Then you would run cmake on the tree with 
cmake --cross-compile -C hostVariables.cmake -DHOST_BUILD_PATH=../path/to/host_only-build  

This would create a build tree that would build all targets that
are not marked HOST_ONLY, but if a target was referred to as part
of the build and it was marked HOST_ONLY, cmake would use the one
from the host-only build.


Some features that we would require:

1. Put a check in all try-run commands that if cmake is running
in --cross-compile mode, and a try-run is executed, it prints
out an error that says:

  try-run will not work in cross compile mode, you need to set
  the variable XXX_VAR in an initial cache.

2. It would be nice if we separated the try-compile/try-run variables
for a project into a different section of the cache.


How does this sound?  Alex, you are doing some Ecos work, what would
features would make that easier?

-Bill




More information about the cmake-developers mailing list