-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
97 lines (73 loc) · 2.86 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.1)
project(KASLO VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
#set the default build type as release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
#link wxWidgets to the executable
find_package(wxWidgets 3.1 REQUIRED COMPONENTS net core base)
if(wxWidgets_FOUND)
message("-- You have wxWidgets installed in system.")
include(${wxWidgets_USE_FILE})
add_executable(kaslo src/application.cpp src/frame.cpp)
target_link_libraries(kaslo ${wxWidgets_LIBRARIES})
#if wxwidgets is not found
else(NOT wxWidgets_FOUND)
if(LINUX)
message("---You are running Linux---")
message("--You do not have wxWidgets installed.")
message("--installing it in progress...")
#check the linux disto
find_file(ARCH_FOUND arch-release
PATHS /etc
)
if(ARCH_FOUND)
message(STATUS "--You are running Arch Linux, installing wxWidgets using pacman...")
#install wxWidgets using pacman
execute_process (
COMMAND bash -c "pacman -S wxgtk3 && pacman -S wxgtk-common"
)
message("--building the program again:")
find_package(wxWidgets 3.0 REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})
add_executable(kaslo src/application.cpp src/frame.cpp)
target_link_libraries(kaslo ${wxWidgets_LIBRARIES})
endif(ARCH_FOUND)
#check for debian
find_file (DEBIAN_BASED_FOUND debian_version OR ubunto_version OR kubunto_version
PATHS /etc
)
if (DEBIAN_FOUND)
message(STATUS "--You are running Debian, installing wxWidgets using APT...")
#install wxWIdgets using apt
execute_process (
COMMAND bash -c "apt install libwxgtk3.0-dev"
)
message("--building the program again:")
find_package(wxWidgets 3.0 REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})
add_executable(kaslo src/application.cpp src/frame.cpp)
target_link_libraries(kaslo ${wxWidgets_LIBRARIES})
endif (DEBIAN_FOUND)
## Check for Fedora
find_file (FEDORA_FOUND fedora-release
PATHS /etc
)
if (FEDORA_FOUND)
message(STATUS "--You are running Fedora Linux, installing wxWidgets using dnf...")
#install wxWIdgets using dnf
execute_process (
COMMAND bash -c "dnf install wxGTK3-devel"
)
message("--building the program again:")
find_package(wxWidgets 3.0 REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})
add_executable(kaslo src/application.cpp src/frame.cpp)
target_link_libraries(kaslo ${wxWidgets_LIBRARIES})
endif (FEDORA_FOUND)
endif(LINUX)
endif(wxWidgets_FOUND)
include(CPack)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kaslo DESTINATION bin)