How to include a shared parent folder shared by child project folders

I have a home network that contains a number of projects and I want to specify a shared folder containing shared.h and shared.cpp files that contain code common to all the projects. How should the shared (parent) folder be specified in each (child) project?

My folder structure is (for simplicity only shows two projects):

HomeNetwork (parent folder that contain shared.h and shared.cpp files)
  -- Sensor_1 (project folder for sensor 1)
      -- src (project specific source code)
  -- Sensor_2 (project folder for sensor 2)
      -- src (project specific source code)

Project main.cpp (each project includes the common header file):

#include "../../shared.h" // contains common stuff

I experimented with the build switches -L…/…/HomeNetwork and -I…/…/HomeNetwork but still the linker cannot find functions that are defined in: HomeNetwork\shared.cpp.

Sorry for such a ‘nooby’ question, but I would like to know the right way to do this. I know I can include the shared.cpp within each project but that doesn’t feel like the right way to do it.

Just create a folder where both shared.h and shared.cpp are in, e.g., SharedLib. Then add the folder where SharedLib is (so one directory above SharedLib) to lib_extra_dirs in all needed subprojects.

Excellent, exactly what I was looking for. Many thanks Max…