-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCMakeLists.txt
76 lines (63 loc) · 2.01 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
cmake_minimum_required(VERSION 3.5)
project(QEFIEntryManager LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
qefientryview.cpp
qefientryview.h
qefientry.cpp
qefientry.h
qefientrystaticlist.cpp
qefientrystaticlist.h
qefivar/qefi.cpp
)
if(WIN32)
list(PREPEND PROJECT_SOURCES WIN32)
set(CMAKE_EXE_LINKER_FLAGS "/MANIFESTUAC:\"level='requireAdministrator'\"")
endif()
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(QEFIEntryManager
${PROJECT_SOURCES}
)
else()
add_executable(QEFIEntryManager
${PROJECT_SOURCES}
)
endif()
# Find and link efivar/win32 API
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(EFIVAR efivar)
endif()
if(EFIVAR_FOUND)
message("Use libefivar for EFI operations")
include_directories(QEFIEntryManager ${EFIVAR_INCLUDE_DIRS})
target_link_libraries(QEFIEntryManager PRIVATE ${EFIVAR_LIBRARIES})
elseif(WIN32)
message("Use Windows API for EFI operations")
else()
message(FATAL_ERROR "No EFI utility found, please make sure you have libefivar installed")
endif()
target_include_directories(QEFIEntryManager PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/qefivar)
# Make a CMAKE project config file in QEFI, the libefivar should be linked automatically
target_link_libraries(QEFIEntryManager PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
install(TARGETS QEFIEntryManager
RUNTIME DESTINATION bin
)
# For AppImage
include(GNUInstallDirs)
install(PROGRAMS qefientrymanager.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications
)
install(FILES cc.inoki.qefientrymanager.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/96x96/apps
)