Closed peterkolski closed 8 years ago
In your CmakeLists.txt file, add this below the project()
line:
include_directories(<sketchbook location>/libraries/Servo)
where <sketchbook location>
is the full path to your Arduino sketchbook folder.
If I copy now the Servo files from the SDK (mac) into the location of my CLion project, then the header should be found. But the .cpp files are in another folder, e.g.
${CMAKE_SOURCE_DIR}/Servo/avr
Anyway, if I copy the files into the same folder, it still doesn't work:
project(${PROJECT_NAME})
include_directories( ${CMAKE_SOURCE_DIR}/Servo )
Does this mean, each standard Arduino Lib has to be copied into another directory?
The Servo Lib is shown in CLion as "External Libraries" and can be included by code completion:
#include <Servo/src/Servo.h>
Still not compiling... Also the example not
Aah, seems the Servo library has a different folder structure than Arduino-cmake expects. add set(Servo_RECURSE True)
right before generate_arduino_firmware(${CMAKE_PROJECT_NAME})
and it should work.
As a note, the required folder stucture is
ExampleLib/
|-- ExampleLib.h
|-- ExampleLib.cpp
`-- OtherLibSource.cpp
but the Servo library has
Servo/
|-- src/
|-- avr
|-- Servo.cpp
|-- ServoTimers.h
|-- sam
|-- Servo.cpp
|-- ServoTimers.h
|-- Servo.h
That solved it! Merci!
How can I include the own libs of the Arduino SDK. Like eg. the Servo.h In the Arduino IDE the code below compiles fine, while in CLion there is the following error message:
Thank you very much