Building Code Examples

This document shows how to build Sample Code provided within HOOPS Exchange installation package.

Since HOOPS Exchange 2025.4.0, we provide CMake support for our sample code.

You need CMake version 3.20.2 or higher.

The example code projects follow a typical CMake workflow. If you are familiar with CMake, no special steps are required. If you are new to CMake, we recommend the official tutorial from Kitware.

To learn more or to download CMake, visit the official website.

Check if you have CMake

You can check if CMake is installed by running the following command in your terminal or command prompt:

cmake --version

This will show the version of CMake on your system. If you do not have it, or if the version is lower than 3.20.2, you should install a newer version.

You can download the installer from the CMake downloads page. There are versions for Windows, macOS, and Linux.

Building sample code with the CMake UI

CMake has a graphical interface that can help you set up your project step by step. This is available on Windows, macOS, and Linux.

First, open the CMake application.

  • In the field Where is the source code, choose the folder that contains the sample code.
  • In the field Where to build the binaries, choose a different empty folder. This is where the build files will be created.

Click the Configure button. CMake will ask you which compiler or tool you want to use (see Supported Platforms). After configuration, you will see some options you can change if needed.

Click Generate to create the project files.

Now you can open the generated project in your IDE and build it there.

Building sample code from the command line (POSIX)

If you prefer to use the terminal, you can also run CMake from the command line.

First, create a new folder for the build:

$ mkdir build
$ cd build

Then run CMake with the path to the sample code:

$ cmake ../path/to/samples -DCMAKE_BUILD_TYPE=Release

If you want to choose a specific compiler or generator, you can add the -G option:

$ cmake ../path/to/samples -G "Visual Studio 17 2022"

Once CMake finishes, you can build the code with this command:

$ cmake --build . --config Release

CMake will automatically run the correct build tool, such as make, ninja, or msbuild, depending on what you selected.

After building, you will find the compiled sample programs in the folder named sample_bin/ at the root of your build directory.