Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using set(${PROJECT_NAME}_SRCS ) has no effect on compile #17

Open
rklosinski opened this issue Aug 22, 2019 · 5 comments
Open

using set(${PROJECT_NAME}_SRCS ) has no effect on compile #17

rklosinski opened this issue Aug 22, 2019 · 5 comments

Comments

@rklosinski
Copy link

Just installed the latest version of this plugin. Skeleton code compiled and uploaded fine. So I tried adding a new class (test cpp/h) then added them to the CMakeList.txt file using set(${PROJECT_NAME}_SRCS test.cpp) and set(${PROJECT_NAME}_HDRS User_Setup.h test.h). This had no effect on the outcome of the compile.

What did worked was to change set(${PROJECT_NAME}_SRCS) and set(${PROJECT_NAME}_HDRS User_Setup.h), then rename test.cpp to test.ino. It seems only ino files are searched for automatically, and set(${PROJECT_NAME}_SRCS) is broken.

@vsch
Copy link
Owner

vsch commented Aug 22, 2019

@rklosinski, did you reload the CMakeLists.txt after modifying it? The IDE needs to reload the file to change its project build files.

@rklosinski
Copy link
Author

yes I did

@vsch
Copy link
Owner

vsch commented Aug 22, 2019

@rklosinski, just figured out that if you want to include extra cpp files in the project then instead of set(${PROJECT_NAME}_SKETCH untitled8.ino) main file you should rename the .ino to .cpp and add all cpp file as set(${PROJECT_NAME}_SRCS test.cpp untitled8.cpp)

Loading CMakeLists.txt now recognizes all .cpp and .h files as part of the project. This must be somewhere in the docs of Arduino CMake but I don't remember coming across it.

With a sketch file all the .cpp files need to be included into the .ino file as part of its source.

@rklosinski
Copy link
Author

@vsch Thanks! I'll try that when Im able to get back to my Arduino project. another project's priority just bumped it down a notch.

@jord1e
Copy link

jord1e commented Mar 9, 2021

For future reference (edit these two lines in your own project): francoiscampbell/arduino-cmake#10

After this de _SKETCH, _SRCS and _HDRS all work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants