forked from JaGoLi/paleofetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (53 loc) · 1.21 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
cmake_minimum_required(VERSION 3.16.0)
project(paleofetch
VERSION 0.0.0
DESCRIPTION "Neofetch, but written in C"
HOMEPAGE_URL "https://github.com/JaGoLi/paleofetch"
)
# Without this, paths are not relative in the sources list
cmake_policy(SET CMP0076 NEW)
include(GNUInstallDirs)
include(FindPkgConfig)
# The program itself
add_executable(${PROJECT_NAME})
# Distro logo
set(DISTRO_LOGO "arch" CACHE STRING "The logo that will be displayed.")
add_subdirectory(src) # Sources list
# Shared libraries
pkg_check_modules(libs
REQUIRED IMPORTED_TARGET
libpci
x11
)
# Linking
target_link_libraries(${PROJECT_NAME}
PRIVATE
PkgConfig::libs
)
# Battery directory
execute_process(COMMAND
find
-L
/sys/class/power_supply/
-maxdepth 1
-iname "bat*"
-print0
OUTPUT_VARIABLE BATTERY_DIRECTORY
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"BATTERY_DIRECTORY=\"${BATTERY_DIRECTORY}\""
)
# Default flags
if(UNIX)
if(NOT (DEFINED ENV{CFLAGS} OR CMAKE_C_FLAGS))
set(CMAKE_C_FLAGS "-Wall -Wextra -g")
endif()
if(NOT (DEFINED ENV{CXXFLAGS} OR CMAKE_CXX_FLAGS))
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g")
endif()
endif()
# Install target
install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR}
)