You can fetch compiler toolchains or binaries early in the configuration process so they are available for the rest of the build. Key Variables to Access Content
Once populated, CMake provides several variables (based on the name used in FetchContent_Declare ) to help you interact with the downloaded files:
FetchContent_GetProperties(my_data_files) if(NOT my_data_files_POPULATED) FetchContent_Populate(my_data_files) # The content is now at ${my_data_files_SOURCE_DIR} endif() Use code with caution. Why Use "Download-Only"?
Use this method to download machine learning models, test datasets, or documentation files that just need to exist in a known location.
Instead of MakeAvailable , check the population status manually and call FetchContent_Populate() . This command downloads and extracts the content but does call add_subdirectory() .
include(FetchContent) FetchContent_Declare( my_data_files URL https://example.com URL_HASH SHA256=... ) Use code with caution. 2. Populate Manually
You can fetch compiler toolchains or binaries early in the configuration process so they are available for the rest of the build. Key Variables to Access Content
Once populated, CMake provides several variables (based on the name used in FetchContent_Declare ) to help you interact with the downloaded files: cmake fetch content only download
FetchContent_GetProperties(my_data_files) if(NOT my_data_files_POPULATED) FetchContent_Populate(my_data_files) # The content is now at ${my_data_files_SOURCE_DIR} endif() Use code with caution. Why Use "Download-Only"? You can fetch compiler toolchains or binaries early
Use this method to download machine learning models, test datasets, or documentation files that just need to exist in a known location. Use this method to download machine learning models,
Instead of MakeAvailable , check the population status manually and call FetchContent_Populate() . This command downloads and extracts the content but does call add_subdirectory() .
include(FetchContent) FetchContent_Declare( my_data_files URL https://example.com URL_HASH SHA256=... ) Use code with caution. 2. Populate Manually