{"id":1289,"date":"2022-11-28T11:34:16","date_gmt":"2022-11-28T11:34:16","guid":{"rendered":"https:\/\/ibex.tech\/c\/?p=1289"},"modified":"2022-11-28T11:34:17","modified_gmt":"2022-11-28T11:34:17","slug":"creating-cmakelists-txt-file","status":"publish","type":"post","link":"https:\/\/ibex.tech\/c\/compilers\/gcc-compiler\/cmake\/cmakelists-txt\/creating-cmakelists-txt-file","title":{"rendered":"Creating CMakeLists.txt file"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Create CMakeLists.txt<\/h5>\n\n\n\n<p>A typical C\/C++ SDK uses the CMake build automation tool which needs us to create \u201cCMakeLists.txt\u201d, containing the instructions describing the project sources files and targets.<\/p>\n\n\n\n<p>In Visual Studio Code:<\/p>\n\n\n\n<p>Menu &gt; File &gt; New File<\/p>\n\n\n\n<p>Menu &gt; File &gt; Save As &gt; \u201cCMakeLists.txt\u201d<\/p>\n\n\n\n<p>An example to paste this code into the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Set minimum required version of CMake\ncmake_minimum_required(VERSION 3.12)\n\n# Include build functions from your SDK\n#include($ENV{PICO_SDK_PATH}\/external\/pico_sdk_import.cmake)\n\n# Set name of project (as PROJECT_NAME) and C\/C++ Standards\nproject(blink-led C CXX ASM)\nset(CMAKE_C_STANDARD 11)\nset(CMAKE_CXX_STANDARD 17)\n\n# Point out where to find the executable source file\nadd_executable(${PROJECT_NAME}\n        main.c\n)\n\n# Pull in our pico_stdlib which pulls in commonly used features (gpio, timer-delay etc)\n#target_link_libraries(${PROJECT_NAME}\n#            mysdk_stdlib\n#)<\/code><\/pre>\n\n\n\n<p>Close and re-open Visual Studio, Explorer &gt; Open Folder &gt; Open your project folder<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create CMakeLists.txt A typical C\/C++ SDK uses the CMake build automation tool which needs us to create \u201cCMakeLists.txt\u201d, containing the instructions describing the project sources files and targets. In Visual Studio Code: Menu &gt; File &gt; New File Menu &gt; File &gt; Save As &gt; \u201cCMakeLists.txt\u201d An example to paste this code into the file: [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-1289","post","type-post","status-publish","format-standard","hentry","category-cmakelists-txt"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/comments?post=1289"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1289\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/1289\/revisions\/1290"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/media?parent=1289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/categories?post=1289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/tags?post=1289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}