-
Notifications
You must be signed in to change notification settings - Fork 918
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
fails to generate project(name C) #387
Comments
Which part of your project was being built when you saw those errors? Note that building the toolchain also builds elf2uf2 (which converts the |
It breaks before the build process during generation as mentioned in the report. Does this regardlessly of me having add_extra_outputs. The toolchain config should be responsible for providing C++ compiler to build elf2uf2, not the project itself. But even considering that I'm not sure whether elf2uf2 is the root of the problem. |
Yeah; fixing this is a bit nasty, because the SDK itself is a CXX project, and reports as such vi ENABLED_LANGUAGES property in cmake. Your project fails, because at the toplevel scope CXX is not a valid language. I had a little play and see that if the SDK doesn't include new_delete.cpp then you are fine, but as I say we can't simply check ENABLED_LANGUAGES as that does contain CXX at this point. I don't feel strongly enough to expend much effort on it right now, so feel free to post a PR... I guess we could add a CMake build flag at least to say you want nothing to do with C++ assuming it is an actual requirement See #339 for C99 |
I guess I'll try to toy with the toolchain later and maybe port tools like elf2uf2 to C then |
elf2uf2 is not the problem; that is a separate build and works fine |
So it's solely the toolchain that breaks because of undefined languages? It seems like it's quite trivial to use gcc-arm toolchain in place of CMAKE_TOOLCHAIN_FILE, but I'm not sure on how to link the libraries in this case. iirc vcpkg adds directories to CMAKE_FIND_ROOT_PATH in order to be able to use find_package or find_path. Can I do the same separately for pico toolchain and if yes, which dirs should I add? |
I manage to solve this by using a variable In target_sources(pico_standard_link INTERFACE
${CMAKE_CURRENT_LIST_DIR}/crt0.S
${CMAKE_CURRENT_LIST_DIR}/new_delete.cpp
${CMAKE_CURRENT_LIST_DIR}/binary_info.c
) by set(pico_standard_link_SOURCES ${CMAKE_CURRENT_LIST_DIR}/crt0.S ${CMAKE_CURRENT_LIST_DIR}/binary_info.c)
if(NOT DEFINED PICO_SDK_PURE_C)
message("C++ enabled, add ${CMAKE_CURRENT_LIST_DIR}/new_delete.cpp")
set(pico_standard_link_SOURCES ${pico_standard_link_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/new_delete.cpp)
endif() And then, in your |
Worked for me! Thank's a lot @Bolayniuss |
In default examples
project
has no explicitly used languages, which impliesC
andCXX
LANGUAGES
, but if I set my project to be C only (which is correct), cmake fails to generate it. I think toolchain's internals should be separated from the project completely like VCPKG does.Error log:
CMakeLists.txt:
The text was updated successfully, but these errors were encountered: