-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathvmaware_download.cmake
48 lines (43 loc) · 2.19 KB
/
vmaware_download.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# ██╗ ██╗███╗ ███╗ █████╗ ██╗ ██╗ █████╗ ██████╗ ███████╗
# ██║ ██║████╗ ████║██╔══██╗██║ ██║██╔══██╗██╔══██╗██╔════╝
# ██║ ██║██╔████╔██║███████║██║ █╗ ██║███████║██████╔╝█████╗
# ╚██╗ ██╔╝██║╚██╔╝██║██╔══██║██║███╗██║██╔══██║██╔══██╗██╔══╝
# ╚████╔╝ ██║ ╚═╝ ██║██║ ██║╚███╔███╔╝██║ ██║██║ ██║███████╗
# ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
#
# C++ VM detection library
#
# ===============================================================
#
# This is the installation module for CMake.
#
# INCLUDE CODE:
# include(/path/to/vmaware_download.cmake)
#
# EXAMPLE USAGE:
# download_vmaware("/path/to/your/destination/directory/" OFF)
#
# NOTE:
# if you want the MIT version, switch the OFF to ON in the above example
#
# ===============================================================
#
# - Made by: @kernelwernel (https://github.com/kernelwernel)
# - Repository: https://github.com/kernelwernel/VMAware
function(download_vmaware directory mit_version)
set(DIRECTORY "${directory}" CACHE STRING "Directory to save VMAware header")
if (mit_version)
set(EXTENSION "_MIT")
else()
set(EXTENSION "")
endif()
set(DESTINATION "${DIRECTORY}/vmaware${EXTENSION}.hpp")
if (NOT EXISTS ${DESTINATION})
message(STATUS "Downloading VMAware")
set(URL "https://github.com/kernelwernel/VMAware/releases/latest/download/vmaware${EXTENSION}.hpp")
file(DOWNLOAD ${URL} ${DESTINATION} SHOW_PROGRESS)
else()
message(STATUS "VMAware already downloaded, skipping")
endif()
endfunction()