# Rosserial arduino CMake unable to link libraries

I've had an extremely difficult time compiling my Arduino code using CMake after changing sensor libraries. The problem seems to be the linking of libraries that reference each other. Specifically I am using the Adafruit library for the INA260 current sensor. This library has a dependency on the Adafruit BusIO library but if I simply included both in the folder, nothing would link. I modified the import statements to change from <> to "" but that didn't help either. I read the Arduino-CMake wiki and added dedicated library entries to the CMakeList file but that also didn't work. I've attached the the CMakeLists file for my project below. The firmware "robot" is my main file and the others are libraries I tried to make it work. The most frustrating part is that my previous sensor worked (INA219) and now when I fix one thing, another item breaks in the same way.

link_directories(/usr/share/arduino/libraries) <-- I added this for debugging
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libraries) include_directories(${ROS_LIB_DIR})

BOARD mega2560
LIBS Wire
)

generate_arduino_library(current_sensor
BOARD mega2560
)

generate_arduino_firmware(robot
SRCS robot.cpp \${ROS_LIB_DIR}/time.cpp
BOARD mega2560
PORT /dev/ttyACM0
LIBS current_sensor
)


Here is an example of an import statement I've tried in the library but that didn't work either.

#include "Arduino.h"