          }
          try fileContents.write(toFile: fileName, atomically: true, encoding: encoding)
       }
+   }
+   
+   //MQTT headers are required by the libmqttplugin's files
+   var targetWorkingDir = srcDirPath + FILE_SEPARATOR + MQTT_PLUGIN_DIR
+   _ = fm.changeCurrentDirectoryPath(targetWorkingDir)
+   print("Attempting to enumerate " + targetWorkingDir)
+   fileEnum = fm.enumerator(atPath: targetWorkingDir)
+   while let fn = fileEnum?.nextObject() {
+      let fileName = String(fn)
+      var fileContents = try String(contentsOfFile: fileName, encoding: encoding)
+      fileContents = fileContents.replacingOccurrences(of: "#include \"MQTT", 
+                                                       with:"#include \"../"+PAHO+"/"+SOURCE_DIR+"/MQTT")
+      try fileContents.write(toFile: fileName, atomically: true, encoding: encoding)
    }
    
    ///PAHO is now complete. All uncomplete modules (apart from agentcore) now have a single source file and a single header

let package = Package(
   name: "omr-agentcore",
   targets: [
      Target(name: "libmqttplugin", dependencies: [.Target(name: "org.eclipse.paho.mqtt.c")]),
      Target(name: "libcpuplugin", dependencies: [.Target(name: "libagentcore")]),
      Target(name: "libenvplugin", dependencies: [.Target(name: "libagentcore")]),
      Target(name: "libmemplugin", dependencies: [.Target(name: "libagentcore")]),

   }
   _ = fm.changeCurrentDirectoryPath(prevWorkingDir)
   
   //finally, we alter libagentcore's headers to become relative.
   targetWorkingDir = srcDirPath + FILE_SEPARATOR + AGENT_CORE_DIR
   _ = fm.changeCurrentDirectoryPath(targetWorkingDir)
