[CMake] Targets organisation of complex project

Samuel E. Henley sehenley at comcast.net
Mon Oct 12 05:04:40 EDT 2009


Some time ago I built a cmake script for the the library in your example
gdal/ogr – primarily to generate builds for gcc under Windows and Linux
– My first approach was to build a library for each of the map format
types and the four core libraries cpl, gcore, etc. The libraries
(hundreds) would not link and the library order would result in new set
of undefined symbols on each attempt. Gdal/Ogr is built with a makefile,
and the objects generated are saved and linked at the end of the
processes. What I did get to work was to include the sources, using
cmake include, in each of the four core libraries, setting source file
properties for each group of source file cflags.
(http://wush.net/trac/sehenley/browser/simulator/trunk/src/builds/gdalogr) Previously my system just identified groups of sources for each of four core libraries – that system used an unreasonable amounts of time to maintain. By having the format sources in individual groups ( *.cmake) cmake will tell you what source file it can't find – as large libraries the gcc linker will only tell you at the end of the process what symbol it can't find and even worst build a library with undefined symbols to be discoved at run time. You will still have to run down any new source files but the link symbol will give a hint as to where they were added. 




More information about the CMake mailing list