Dependency on a framework?

I have a library which depends on another one. So far so good … great, in fact, with PIO.
Just add the dependency and everything gets taken care of. Wonderful. Amazing. Practical!

But now I’m running into some code which depends on CMSIS and the vendor-specific device tree (i.e. STM32 include files). I have found these in the cmsis framework, i.e. ~/.platformio/packages/framework-cmsis (and especially the variants/ in there).

These files are auto-installed by PIO when you use CMSIS as framework in your project, but I’m using other frameworks.

The workaround I can think of is to tell people to first build a dummy project based on CMSIS, just to get framework-cmsis installed, and then rely on this fact with hacked include paths in my library, so that the headers will be found in any project.

But it feels like a hack. Is there some more elegant way to do this?

-jcw

To follow up, this appears to work:

[common]
cmsis = /Users/jcw/.platformio/packages/framework-cmsis

[env:genericSTM32F103RB]
build_flags =
    -Iinclude
    -Wa,-Iinclude
    -I.piolibdeps/libusb_stm32/inc
    -Wa,-I.piolibdeps/libusb_stm32/inc
    -I${common.cmsis}/cores/stm32
    -Wa,-I${common.cmsis}/cores/stm32
platform = ststm32
board = genericSTM32F103RB
framework = libopencm3
[...etc...]

There’s an absolute path reference (is there a generic way to refer to the PIO home dir?),
and the include paths have to be duplicated for the .S assembly files in the library.