How to use multiple outputs in build dependencies

I try to make a drv for omnetpp, which needs qtbase’s QtGlobal.QtGlobal is stayed in qtbase.dev. Then I add qtbase.dev into nativeBuildInputs or buildInputs, but CFLAGS in the configure script is empty.

Should I set CFLAGS with NIX_CFLAGS_COMPILE by myself? Why cannot nix do it automatically?

Currently, I make a patch for configure file, and set CFLAGS manually by using a enviroment variable which is exported from preConfigure by ${qtbase.dev}/include/QtCore. But I want to know is there a way to make this automatically.

When you add a package to buildInputs its dev output should be available as well, see Section 8.3, “Using a split package” of the Nixpkgs manual:

When a multiple-output derivation gets into a build input of another derivation, the dev output is added if it exists, otherwise the first output is added. In addition to that, propagatedBuildOutputs of that package which by default contain $outputBin and $outputLib are also added. (See Section 8.4.2, “File type groups”.)

Could you share the whole expression?

nix file is here: github.

I know when adding it into buildInputs, it is available. Of course, it is in NIX_CFLAGS_COMPILE, but this is not passed to configure scripts.