How to get CMAKE_NO_SYSTEM_FROM_IMPORTED alike for a selected few of targets?

Hi!

In our project, we have true third-party dependencies (e.g. Boost, QT, googletest) and we have dependencies from other teams. We use find_package() and target_link_libraries() for both kind of dependencies.

While we want cmake to use -isystem on the true third-party dependencies, we would like to use -I for the include directories on the dependencies of our colleagues.

Is there a way to achieve this?

CMAKE_NO_SYSTEM_FROM_IMPORTED is a global boolean. So I can toggle between “use -isystem on all imported targets” and “use -I on all imported targets”. Whereas I would like something in between.

Thanks kindly in advance for any advice!

It is a boolean, but it is used whenever a target is created. You can set it on each target you want. However, it is set on the consuming side, so it affects all of the imported targets it uses; I don’t think you can pick and choose which imported targets it should apply to. It could be something you could set on imported targets though. Please file an issue about this use case so it can be tracked.