[CMake] Newbie questions; dual targeting, unit test support, cross-compilation

Davis Ford davisford at gmail.com
Sat Sep 15 14:48:17 EDT 2012


Hi, I'm still trying to get up to speed on CMake, but I have a couple of
questions that may fall into a sort of 'best practices' category, or just
generally wondering if someone can point me to a couple examples that may
be similar to what I want to accomplish.

I'm starting a new project that will be targeting Raspberry Pi
http://www.raspberrypi.org/ (essentially Linux/Arm).  I'd like to follow a
development process that includes unit testing + mocks.  I recently read
the book
http://pragprog.com/book/jgade/test-driven-development-for-embedded-c and
I'm interested in following this approach and using the test framework
CppUTest http://cpputest.org

I want the build to support dual-targeting -- meaning the code / build is
designed to run on at least two targets: the dev. machine and the target
hardware.  This allows me to design and test most of the code independent
of the hardware.  This is the approach outlined in the book.  I'd also like
to support cross-compilation so I can build for the target on the dev.
machine to avoid longer compilation times on slower Pi hardware.

I also want to support running the tests via the build - both on the dev.
machine - b/c it is fast, but I also want to support building/running the
same tests on the target hardware.

It seemed like CMake had some nice features that could make setting this up
easier, so I'm trying to build out a skeleton project to see how well it
works.  I hacked together a starter project for this here:
https://github.com/davisford/cmake-cpputest - currently it will build a
pseudo LedDriver and I can also build & run the tests.  I have yet to add
the Arm support for the Pi.

I'd appreciate any pointers / suggestions or constructive criticism on what
I've currently got - how I could do it better, or links to other projects
or sections of projects that would be helpful as input.

Thanks in advance!

Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120915/b2722b89/attachment.htm>


More information about the CMake mailing list