cmake_minimum_required(VERSION 3.11) # add to module path list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # include module include(Download) # Or include directly ## include("${PROJECT_SOURCE_DIR}/cmake/Download.cmake") # use like this download_file_with_hash_check( "http://127.0.0.1:8080/random_file.bin" "${CMAKE_BINARY_DIR}/random_file.bin") # or this download_file_with_hash_check( "http://127.0.0.1:8080/random_file.bin" "${CMAKE_BINARY_DIR}/random_file.bin" REQUIRED) # or this # download_file_with_hash_check(URL "http://127.0.0.1:8080/random_file.bin" DEST "${CMAKE_BINARY_DIR}/random_file.bin" REQUIRED) # Or include directly ## include("${PROJECT_SOURCE_DIR}/cmake/Download.cmake")