Skip to content

Configure a Project

Qt projects using the SDK need some additional configuration to incorporate the SDK’s build system, which takes care of defining a consistent build-kit identity and linking the correct compiled library for the project’s specified device/OS target.

The first step in setting up a project to use the Qt SDK is to tell the SDK’s build system the name of the target that will consume the SDK.

For most projects, this will be the same as the name of the target declared in the project command:

project(spoke-zone-demo LANGUAGES CXX)
... # Other code
set(MRS_SDK_QT_CONSUMER_TARGET "spoke-zone-demo")

This step is only necessary for QMake-based projects. You can skip to the next section.

CMake has a feature that allows for setting a kit-level toolchain file that is applied before the project’s CMakeLists.txt file is executed. The SDK uses this feature for bootstrapping from the Qt Creator kit settings.

The next step is to import the SDK’s global configuration helper, which has a constant location. This lets the build system know where to find the the SDK installation and which version is linked as the current version.

include("$ENV{HOME}/.config/mrs-sdk-qt/global-config.cmake")

The final step is to run the SDK’s custom build system, which comes in both CMake and QMake variants.

The MRS_SDK_QT_ROOT variable is defined by the global config helpers.

include("${MRS_SDK_QT_ROOT}/current/lib/cmake/mrs-sdk-qt/config.cmake")

For more information about the build system, see the SDK component reference.

Here are some examples of what the final project configuration might look like:

set(MRS_SDK_QT_CONSUMER_TARGET "spoke-zone-demo")
include("$ENV{HOME}/.config/mrs-sdk-qt/global-config.cmake")
include("${MRS_SDK_QT_ROOT}/current/lib/cmake/mrs-sdk-qt/config.cmake")