[cmake-developers] BUILD_TESTING when cross compiling

Brad King brad.king at kitware.com
Tue Oct 13 10:03:25 EDT 2015


On 10/13/2015 01:17 AM, Geoffrey Viola wrote:
> Tests/CMakeLists.txt
[snip]
> run when it won't be able to run the code on the host machine?

Many of the tests end with a step that verifies that a built
executable can run.  Several tests build tools that generate
sources.  In both cases we expect to be testing for the host.

> What is the best way to make CTest run those tests with the
> GHS MULTI generator and not the default one?

One can configure CMake with

  -G <any-generator>
  -D CMake_TEST_EXTERNAL_CMAKE=c:/path/to/cmake-build/bin/Debug

to tell it to run the test suite using the "cmake" tool in the
given directory.  That will test with the given generator instead
of trying to build CMake with it.

Some work would be needed to make this work for cross-compiling.
Essentially the tests of interest need to be ported to avoid
running anything on the host.

-Brad



More information about the cmake-developers mailing list