Tuesday, October 12, 2010

CMake

I have recently worked with CMake in order to improve our build system a little.
The old system, based on GNU Make on Linux ans SCCS Make on Solaris had some flaws and it became extremely hard to maintain.CMake seemed a good solution at a first sight as the syntax was clear and most of the things worked out of the box (hierarchical builds, custom build commands).
However CMake misses a very important feature - the variant builds. I am not speaking of the Debug/Release builds but feature bounded builds as in my care custom builds for C7/A7/CH7/J7 ISUP variants. For this kind of builds I need:
1. Different defines
2. Different include paths
3. Different link libraries.

Point 3 can be easily solved with CMake (via TARGET_LINK_LIBRARIES), but point 1&2 cannot. I have tried several variants and workarounds and finally I have found one that
worked 
SET_PROPERTY(TARGET MainNed_itu APPEND PROPERTY COMPILE_DEFINITIONS  "C7_Q")

Another way was to use SCons for build. It provides some nice features (hierarchical/variant builds) and is easily extensible in Python. It also has a better Java support than CMake.
It was quite easy to migrate the CMakeLists to SConstruct files using a simple script.

No comments:

Post a Comment