Projects needing that same content will use the same name, leading to Choosing an unusual name makes it unlikely that other To its top level project() command (if it is a CMake project).įor well-known public projects, the name should generally be the official Represents, often being the name of the child project or the value given Treated case-insensitively and it should be obvious for the content it Would be to use only letters, numbers and underscores. The content can be any string without spaces, but good practice Projects to have parent projects override content details of child projects. This "first to record, wins" approach is what allows hierarchical Hierarchy), this and all later calls for the same content are If such details have alreadyīeen recorded earlier in this project (regardless of where in the project The FetchContent_Declare() function records the options that describe The typical pattern of suchįetchContent_Declare(. These lack the richerįeatures provided by FetchContent_MakeAvailable() though, so theirĭirect use should be considered a last resort. Steps in a way that cannot be captured by the declared details alone.įor such situations, the lower level FetchContent_GetProperties() andįetchContent_Populate() commands can be used. The population, or it may be required to explicitly define the population In some cases, the main project may need to have more precise control over Similarly, the first call that tries to populate aĭependency "wins", with subsequent populations reusing the result of theįirst instead of repeating the population again. The first details to be declaredįor a given dependency take precedence, regardless of where in the project The hierarchy are able to override the declared details of content specifiedĪnywhere lower in the project hierarchy. When using a hierarchical project arrangement, projects at higher levels in See the command's documentation for how these steps Main build, if possible, so that the main build can use the populated When performing the population, it will also add them to the The FetchContent_MakeAvailable() command ensures the namedĭependencies have been populated, either by an earlier call or by populating The following shows a typical example of declaring content details for someĭependencies and then ensuring they are populated with a separate call:įetchContent_Declare( googletest GIT_REPOSITORY GIT_TAG 703 bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0 ) FetchContent_Declare( m圜ompanyIcons URL URL_HASH MD5 = 5588 a7b18261c20068beabfb4f530b87 ) FetchContent_MakeAvailable( googletest m圜ompanyIcons ) Hierarchies where dependencies may be shared between multiple projects. This is particularly important in more complex project This separation ensures that all theĭependency details are defined before anything might try to use them to WhereasĮxternalProject_Add() downloads at build time, theįetchContent module makes content available immediately, allowing theĬonfigure step to use the content in commands like add_subdirectory(),Ĭontent population details should be defined separately from the command that This module enables populating content at configure time via any method The guide is recommended pre-reading before moving on to the details below. Including its relationship to the find_package() command. Where the FetchContent module fits into the bigger picture, The Using Dependencies Guide provides a high-level
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |