![]() For example:Īzsphere_configure_api(TARGET_API_SET "6") You must specify the target API set for the build by using the azsphere_configure_api function to store the value in CMakeLists.txt. The azsphere_configure_tools function specifies the minimum SDK version that is required to build your application. For example, the 20.04 release introduced four new CMake functions that were not present in the 20.01 release. For example:Īzsphere_configure_tools(TOOLS_REVISION "20.04")ĭifferent versions of the Azure Sphere tools may offer different CMake features. This call must precede all other function calls. You must specify the Azure Sphere SDK version for your build by calling the azsphere_configure_tools function to store the value in CMakeLists.txt. The CMakeLists.txt file must call the project command before any of the azsphere_ functions. If you have an existing application that was created with an SDK earlier than 20.04, see Convert an existing app to use the CMake functions. Azure Sphere supports the use of the following functions in CMakeLists.txt: Name The CMakeLists.txt file provides the general configuration settings that CMake uses to build an application. ![]() The specific character is determined by the Windows or Linux terminal configuration. The line continuation character "^" for the Windows command line, " \ " for the Linux command line, or "`" for Powershell can be used for readability but is not required. Required for building with Visual Studio Code.ĬMake parameters are separated by spaces. Visual Studio configuration file for projects with multiple roots, as in the IntercoreComms sample. Either this file or CMakePresets.json is required for building with Visual Studio. Either this file or CMakeSettings.json is required for building with Visual Studio. Required for all builds.Ĭonfiguration presets file for Visual Studio and Visual Studio Code. CMake Tools extension for Visual Studio CodeĬMake builds use the following files: File.The following sources provide information about using CMake with Visual Studio or Visual Studio Code: CMake is an open-source, cross-platform make system. Let’s create a file in the project folder, sample.Azure Sphere uses CMake to configure builds for applications with Visual Studio, Visual Studio Code, and the Windows and Linux command lines. No new scope is created as if the content of the file is pasted at the include() line. We can include CMake scripts from another file by include. While CMAKE_CURRENT_SOURCE_DIR is dependent on the location of focused CMakeLists.txt, PROJECT_SOURCE_DIR is always set to the top-level folder containing CMakeLists.txt which has project() command in it.Ī subdirectory usually contains some source files that need to be compiled. The variables in subdirectory scope are private and not visible to the project scope. Afterward, CMake comes back to the project scope and sets CMAKE_CURRENT_SOURCE_DIR to myProject path. When it reaches the add_subdirectory line, it will jump into library1/CMakeLists.txt, set CMAKE_CURRENT_SOURCE_DIR to library1 path, and runs the command there. Running cmake, it will set CMAKE_CURRENT_SOURCE_DIR variable to the myProject path. ![]() ![]() Project ( myProject ) message ( "Hello from myProject" ) message ( $ ) add_subdirectory ( "library1" ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |