diff --git a/.gitignore b/.gitignore index 85697e8..87df178 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea .vscode cmake-* +build diff --git a/CMakeLists.txt b/CMakeLists.txt index 194de51..98e3724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ include(pico_sdk_import.cmake) # We also need PICO EXTRAS include(pico_extras_import.cmake) +set(PICO_PLAYGROUND_PATH ${PROJECT_SOURCE_DIR}) +# Include playground_auto_set_url +include(playground_auto_set_url.cmake) + project(pico_playground C CXX) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) diff --git a/playground_auto_set_url.cmake b/playground_auto_set_url.cmake new file mode 100644 index 0000000..b2d0595 --- /dev/null +++ b/playground_auto_set_url.cmake @@ -0,0 +1,5 @@ +set(PICO_PLAYGROUND_URL_BASE "https://github.com/raspberrypi/pico-playground/tree/HEAD") +macro(playground_auto_set_url TARGET) + file(RELATIVE_PATH URL_REL_PATH "${PICO_PLAYGROUND_PATH}" "${CMAKE_CURRENT_LIST_DIR}") + pico_set_program_url(${TARGET} "${PICO_PLAYGROUND_URL_BASE}/${URL_REL_PATH}") +endmacro() diff --git a/reset/hello_reset/CMakeLists.txt b/reset/hello_reset/CMakeLists.txt index 29519cd..14a9df4 100644 --- a/reset/hello_reset/CMakeLists.txt +++ b/reset/hello_reset/CMakeLists.txt @@ -10,5 +10,5 @@ if (TARGET hardware_reset) pico_add_extra_outputs(hello_reset) # add url via pico_set_program_url - example_auto_set_url(hello_reset) -endif () \ No newline at end of file + playground_auto_set_url(hello_reset) +endif ()