{"id":2795,"date":"2021-04-02T10:13:02","date_gmt":"2021-04-02T08:13:02","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=2795"},"modified":"2021-04-02T16:24:36","modified_gmt":"2021-04-02T14:24:36","slug":"installing-pico-arduino-with-cmake-fetchcontent","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/","title":{"rendered":"Installing &#8220;pico-arduino&#8221; with CMake"},"content":{"rendered":"<p>I finally could tick off the final to-do for my <a href=\"https:\/\/github.com\/pschatzmann\/pico-arduino\">Pico-Arduino project<\/a>: It is not necessary any more to install the project in advance. The project can now be treated <strong>as library<\/strong> and you can just pull it automatically from github with the help e.g. of a <a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/module\/FetchContent.html\">cmake fetchcontent<\/a>. Here is a simple example:<\/p>\n<pre><code>cmake_minimum_required(VERSION 3.19.2)\nset(CMAKE_C_STANDARD 11)\nset(CMAKE_CXX_STANDARD 17)\n\ninclude(FetchContent)\nFetchContent_Declare( arduino GIT_REPOSITORY https:\/\/github.com\/pschatzmann\/pico-arduino.git  GIT_TAG  main)\nFetchContent_MakeAvailable(arduino)\n\nproject(use_as_library)\n\nadd_executable(use_as_library use_as_library.cpp)\n\n# Pull in our arduino library\ntarget_link_libraries(use_as_library arduino)\n# create map\/bin\/hex\/uf2 file etc.\npico_add_extra_outputs(use_as_library)\n<\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/pschatzmann\/pico-arduino\/tree\/main\/examples\/use_as_library\">The full example can be found on Github<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finally could tick off the final to-do for my Pico-Arduino project: It is not necessary any more to install the project in advance. The project can now be treated as library and you can just pull it automatically from github with the help e.g. of a cmake fetchcontent. Here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2799,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,24],"tags":[],"class_list":["post-2795","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-pico"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Installing &quot;pico-arduino&quot; with CMake - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing &quot;pico-arduino&quot; with CMake - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I finally could tick off the final to-do for my Pico-Arduino project: It is not necessary any more to install the project in advance. The project can now be treated as library and you can just pull it automatically from github with the help e.g. of a cmake fetchcontent. Here [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-02T08:13:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-02T14:24:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png\" \/>\n\t<meta property=\"og:image:width\" content=\"299\" \/>\n\t<meta property=\"og:image:height\" content=\"169\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Installing &#8220;pico-arduino&#8221; with CMake\",\"datePublished\":\"2021-04-02T08:13:02+00:00\",\"dateModified\":\"2021-04-02T14:24:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/\"},\"wordCount\":67,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/cmake.png\",\"articleSection\":[\"Arduino\",\"Pico\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/\",\"name\":\"Installing \\\"pico-arduino\\\" with CMake - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/cmake.png\",\"datePublished\":\"2021-04-02T08:13:02+00:00\",\"dateModified\":\"2021-04-02T14:24:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/cmake.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/cmake.png\",\"width\":299,\"height\":169},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/02\\\/installing-pico-arduino-with-cmake-fetchcontent\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing &#8220;pico-arduino&#8221; with CMake\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Installing \"pico-arduino\" with CMake - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/","og_locale":"en_US","og_type":"article","og_title":"Installing \"pico-arduino\" with CMake - Phil Schatzmann","og_description":"I finally could tick off the final to-do for my Pico-Arduino project: It is not necessary any more to install the project in advance. The project can now be treated as library and you can just pull it automatically from github with the help e.g. of a cmake fetchcontent. Here [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/","og_site_name":"Phil Schatzmann","article_published_time":"2021-04-02T08:13:02+00:00","article_modified_time":"2021-04-02T14:24:36+00:00","og_image":[{"width":299,"height":169,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png","type":"image\/png"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Installing &#8220;pico-arduino&#8221; with CMake","datePublished":"2021-04-02T08:13:02+00:00","dateModified":"2021-04-02T14:24:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/"},"wordCount":67,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png","articleSection":["Arduino","Pico"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/","url":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/","name":"Installing \"pico-arduino\" with CMake - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png","datePublished":"2021-04-02T08:13:02+00:00","dateModified":"2021-04-02T14:24:36+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/04\/cmake.png","width":299,"height":169},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/02\/installing-pico-arduino-with-cmake-fetchcontent\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Installing &#8220;pico-arduino&#8221; with CMake"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=2795"}],"version-history":[{"count":5,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2795\/revisions"}],"predecessor-version":[{"id":2801,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2795\/revisions\/2801"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/2799"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=2795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=2795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=2795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}