-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
48 lines (40 loc) · 1.71 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.22)
project(RunScript)
if(UNIX AND NOT APPLE)
file(READ "/etc/os-release" OS_RELEASE)
string(REGEX MATCH "ID=([A-Za-z]*)" LINUX_ID_MATCH "${OS_RELEASE}")
set(LINUX_ID "${CMAKE_MATCH_1}")
if(NOT LINUX_ID)
string(REGEX MATCH "ID_LIKE=([A-Za-z]*)" LINUX_ID_LIKE_MATCH "${OS_RELEASE}")
set(LINUX_ID "${CMAKE_MATCH_1}")
endif()
if(LINUX_ID STREQUAL "")
message(WARNING "Could not identify Linux distribution. Adapting as much as possible.")
set(DISTRO "Unknown Linux Distribution")
else()
if(LINUX_ID STREQUAL "arch")
message(STATUS "Detected Arch Linux")
set(DISTRO "Arch Linux")
add_custom_target(run_script
COMMAND sudo pacman -S --needed base-devel curl wget file openssl gtk3 patchelf libappindicator-gtk3 librsvg -y webkit2gtk
COMMENT "Running script on Arch Linux"
)
elseif(LINUX_ID STREQUAL "debian")
message(STATUS "Detected Debian Linux")
set(DISTRO "Debian Linux")
add_custom_target(run_script
COMMAND sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev -y
COMMENT "Running script on Debian Linux"
)
else()
message(STATUS "Detected ${LINUX_ID}-like Linux distribution")
set(DISTRO "${LINUX_ID}-like Linux")
add_custom_target(run_script
COMMAND sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev -y
COMMENT "Running script on Debian Linux"
)
endif()
endif()
else()
message(FATAL_ERROR "This CMake script is designed for Linux systems only.")
endif()