SJFOM / StepUp-Pico

Portable stepper motor magic - on a RPi Pico board 🥧
MIT License
0 stars 0 forks source link

Improve include paths using CMake properly #8

Closed SJFOM closed 1 year ago

SJFOM commented 1 year ago

We currently have some very long include paths that are just plain ugly, see tmc_control.hpp for example:

// TMC-API
extern "C"
{
#include "../../../Interfaces/ControlInterface.h"
#include "../../../Libraries/TMC_API/ic/TMC2300.h"
#include "../../../Libraries/TMC_API/helpers/CRC.h"
#include "../../../Libraries/TMC_API/helpers/Config.h"
}

Yuck! Let's fix this so we can reduce it to something like:

// TMC-API
extern "C"
{
#include "ControlInterface.h"
#include "TMC_API/ic/TMC2300.h"
#include "TMC_API/helpers/CRC.h"
#include "TMC_API/helpers/Config.h"
}
SJFOM commented 1 year ago

Attempting a fix to this, it doesn't appear there are many neat approaches here.

One article suggests using INCLUDE_DIRECTORIES but this had no effect in practice with the given repository.