Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7512

General • Re: Compilation error due to CMakelists.txt

$
0
0
Line 9 of the header seems to refer to a missing file: #include "raik060spicom.pio.h" which I guess was supposed to be generated, but doesn't seem to generate.

However, this should get you closer

Code:

# Generated Cmake Pico project filecmake_minimum_required(VERSION 3.13)set(CMAKE_C_STANDARD 11)set(CMAKE_CXX_STANDARD 17)set(CMAKE_EXPORT_COMPILE_COMMANDS ON)# Initialise pico_sdk from installed location# (note this can come from environment, CMake cache etc)# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==if(WIN32)    set(USERHOME $ENV{USERPROFILE})else()    set(USERHOME $ENV{HOME})endif()set(sdkVersion 2.1.1)set(toolchainVersion 14_2_Rel1)set(picotoolVersion 2.1.1)set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)if (EXISTS ${picoVscode})    include(${picoVscode})endif()# ====================================================================================set(PICO_BOARD pico_w CACHE STRING "Board type")# Pull in Raspberry Pi Pico SDK (must be before project)include(pico_sdk_import.cmake)project(raik060spicom C CXX ASM)# Initialise the Raspberry Pi Pico SDKpico_sdk_init()# Add executable. Default name is the project name, version 0.1add_executable(raik060spicom    raik060spicom.c    )# Create file .h from pio filepico_generate_pio_header(raik060spicom ${CMAKE_CURRENT_LIST_DIR}/raik060spicom.pio)add_library(raik060spilib INTERFACE) #add and change here#add_library(name of the .h file1 INTERFACE) #add and change here# Add the source file raik060spilib.c to the raik060spilib interfacetarget_sources(raik060spilib INTERFACE    ${CMAKE_CURRENT_SOURCE_DIR}/src/raik060spilib.c)target_include_directories(raik060spilib INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)# pull in common dependenciestarget_link_libraries(raik060spicom pico_stdlib hardware_pio hardware_clocks raik060spilib)if (PICO_CYW43_SUPPORTED)    target_link_libraries(raik060spicom pico_cyw43_arch_none)endif()# create map/bin/hex file etc.pico_add_extra_outputs(raik060spicom)pico_enable_stdio_usb(raik060spicom 1)pico_enable_stdio_uart(raik060spicom 0)# add url via pico_set_program_url
I put ending parenthesis here instead of after the comments

Code:

target_include_directories(raik060spilib INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
Removed duplicate add of raik060spilib

Statistics: Posted by breaker — Thu Oct 30, 2025 3:30 am



Viewing all articles
Browse latest Browse all 7512

Trending Articles