Products Support Documentation Download
CMake Build System

Introduction

This README file contains information about how to build RDM using CMake. Make sure that you have CMake 2.8.7 or newer installed.

For further details on CMake please see:

Mastering CMake - A Cross-Platform Build System by Ken Martin and Bill Hoffman, published by Kitware, Inc.

http://cmake.org/

Running cmake

CMake can be used to build RDM on Windows, Linux, or OS X. Make sure you have CMake-2.8.7 or newer installed. Follow these steps to create a build directory and configure RDM using CMake:

$ mkdir mybuild
$ cd mybuild
$ cmake /opt/Raima/rdm-14.1

If you want to change any of the settings, run CMake in wizard mode using the -i option:

$ cmake -i

CMake supports a wide variety of different build systems (generators). Use the -G option to specify a build system other than the default:

$ cmake -G "Visual Studio 15 2017"

or

$ cmake -G "Visual Studio 15 2017 Win64"

Run CMake with the -h option for further help. At the end of this output it will show the generators supported by the platform you are on:

$ cmake -h

Using CMake on your host development system

Using CMake on Windows

On Windows, you also have the option of using the graphical version of CMake. If this is the first time you run CMake on RDM, you will need to click the "configure" button and select the build system you want CMake to generate files for. You can change some of the cache values and then you must click the configure button a second time. When all the cache value entries are gray instead of red, click OK to generate the selected build files and exit. If you want to generate files for another build system, click the "Delete Cache" button and start over.

Note
The RUN_TESTS selection under CmakePredefinedTargets in the Solution Explorer dialog box cannot be used to run the all of the example programs using the Start Debugging option. The programs can be run individually in the examples section of the same dialog box.

Using CMake on Linux or OS X

On Linux or OS X, you also have the option of using the curses based cmake:

$ ccmake /opt/Raima/rdm-14.1

Configuring CMake for shared libraries

This section is only applicable if you are using a source package.

For most systems, we can build both static and shared libraries (or dynamic-link libraries). By default, CMake will build static libraries only. Shared libraries can be built by passing in -DBUILD_SHARED_LIBS:BOOL=ON to CMake.

$ cmake -DBUILD_SHARED_LIBS:BOOL=ON ..

On Windows, you may want to add an option to place the executables and libraries in one common output directory:

% mkdir output
% cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=%cd%\output ...

Without the extra option on Windows you will need to add directories to the PATH environment variable so that whenever the build used rdm-compile, or rdm-convert the shared libraries will be found.

Configuring for a debug version

A debug version can be configured as follows:

   $ cmake -DCMAKE_BUILD_TYPE=Debug ...

Build stage

CMake can create project or make files for many different build systems. Select one you are familiar with and check out the documentation for CMake and the build system of your choice. If you selected UNIX Makefiles, you can build your project as follows:

   $ make

If you wish to skip building any examples and tools, you can cd into the source directory and do a build there:

   $ cd source
   $ make

If everything went well, you can install what you previously built:

   $ sudo make install

For further help, run make with help:

   $ make help

Running some tests

CMake is using ctest. Run ctest from any directory, and it will run all the tests in that directory as well as its sub directories:

   $ ctest

For further help, run ctest with "-H":

   $ ctest -H

You can also invoke ctest with the default set of parameters from the build system. With UNIX Make files, simply use the test target:

   $ make test