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.
Set the consumer target
Section titled “Set the consumer 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 codeset(MRS_SDK_QT_CONSUMER_TARGET "spoke-zone-demo")For most projects, this will be the same as the name of the .pro file:
# in can-simulator.proMRS_SDK_QT_CONSUMER_TARGET = "can-simulator"Bootstrap the build system
Section titled “Bootstrap the build system”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.
To set up the SDK’s build system, QMake-based projects must bootstrap from the .pro file using the the QMAKE_TOOLCHAIN_FILE variable defined in the Qt Creator kit settings:
include("$$(QMAKE_TOOLCHAIN_FILE)")Import SDK global config
Section titled “Import SDK global config”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")include("$$(HOME)/.config/mrs-sdk-qt/global-config.pri")Run SDK build system
Section titled “Run SDK build system”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")include("$$MRS_SDK_QT_ROOT/current/lib/qmake/mrs-sdk-qt/config.pri")For more information about the build system, see the SDK component reference.
Final configuration
Section titled “Final configuration”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")MRS_SDK_QT_CONSUMER_TARGET = "can-simulator"include("$$(QMAKE_TOOLCHAIN_FILE)")include("$$(HOME)/.config/mrs-sdk-qt/global-config.pri")include("$$MRS_SDK_QT_ROOT/current/lib/qmake/mrs-sdk-qt/config.pri")