SDK multiple build steps, qmake and cmake

Option 1

In specific cases, it is possible to use qmake’s $$system() function and QMAKE_EXTRA_TARGETS variable to invoke cmake/make on a subproject. But this does not work well e.g. when the subproject needs to be fully built before qmake can be run for the superproject or when you want to open the project as a whole under Qt Creator (subproject’s files would not be listed in project tree).

Option 2

Most convenient is to unify on the build system. In your case you can

  1. switch to CMake for the superproject as you mentioned or
  2. add qmake support either
    2a) directly to the subproject or
    2b) maintained on the superproject side.

Option 3

In more complex cases with build systems not matching/integrating well, it may be better to keep projects built and packaged separately. They can be opened all at once under a single Qt Creator session and project dependencies can be configured so that Qt Creator builds them all in the right order.

See Installing custom libraries into SDK targets - #3 by martyone to learn how to make packages build from a subproject available as superproject build time dependencies.

With this approach, in order to meet the Jolla Harbour restrictions on shipping shared libraries, you can repackage subproject’s libraries (and other files) under the superproject by copying them from the system locations with commands added to the %install section of the superproject’s RPM .spec file:

BuildRequires: foobar
...
%install
%qmake5_install
install -D -m 755 --target-directory %{buildroot}%{_datadir}/%{name}/lib/ \
    /usr/lib/libFooBar.so.1.2.3
1 Like