CMakeDownload/CMakeLists.txt

29 lines
734 B
CMake
Raw Normal View History

2024-10-14 21:04:37 +00:00
cmake_minimum_required(VERSION 3.11)
2024-10-14 21:28:59 +00:00
# add to module path
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# include module
include(Download)
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# Or include directly
## include("${PROJECT_SOURCE_DIR}/cmake/Download.cmake")
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# use like this
download_file_with_hash_check(
"http://127.0.0.1:8080/random_file.bin"
"${CMAKE_BINARY_DIR}/random_file.bin")
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# or this
download_file_with_hash_check(
"http://127.0.0.1:8080/random_file.bin"
"${CMAKE_BINARY_DIR}/random_file.bin"
REQUIRED)
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# 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)
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
# Or include directly
2024-10-14 21:04:37 +00:00
2024-10-14 21:28:59 +00:00
## include("${PROJECT_SOURCE_DIR}/cmake/Download.cmake")