[CMake] Performing cross-platform build - how ?

Stephen Collyer scollyer at netspinner.co.uk
Tue Nov 13 16:38:36 EST 2007


I am almost a total cmake newbie. I've been looking through
the wiki for information on how one actually performs a cross-platform
build with cmake, but I can't find any. Can someone tell me if my
thinking outline here makes sense:

1. Let's assume I want to do a Linux and Win32 build from the
same source tree.

2. I have a directory tree like:

./src/<whatever>
./build/linux
./build/win32
./install/linux/<whatever>
./install/win32/<whatever>

All of my cross-platform source resides uder src. This whole
tree, both src and build is mounted so as to be visible to
my Linux box and Windows machine.

3. I set up CMakeList.txt files appropriately in . and the
various subdirs of src

4. On my Linux box, I cd into build/linux and I type:

cmake ../..

which creates all of the cmake files and directories suitable
for a Linux build under build/linux. I type

make all

from the same directory, and everything is built for my Linux
environment under build/linux

5. On my Windows box, I cd into build/src, and I type the
same(ish) commands, to have a build made under build/win32.

6. (Now things get very fuzzy ..) I run some command
(make install, I guess) which moves my deliverable binaries
into the install/linux and install/win32 trees, based
upon some CMakeList.txt configuration I did earlier to
pick out the stuff I want to deliver

7. (Things get even fuzzier ..) I run some commands to
package stuff up from the install trees into .tgz, .rpm
etc using CPack. I have no idea at the moment how this works.

Am I thinking along the right lines ? Anyone care to
point me to the details in the wiki, or wherever, or
to fill them in here ?

-- 
Regards

Steve Collyer
Netspinner Ltd


More information about the CMake mailing list