-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
40 lines (34 loc) · 1.41 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
cmake_minimum_required(VERSION 3.16)
project("plasmoid-spacer-extended")
option(BUILD_PLUGIN "Build the plugin" OFF)
option(INSTALL_PLASMOID "Install plasmoid" ON)
option(PACKAGE_PLASMOID "Package plasmoid" OFF)
# Use Extra CMake Modules (ECM) for common functionality.
# See http://api.kde.org/ecm/manual/ecm.7.html
# and http://api.kde.org/ecm/manual/ecm-kde-modules.7.html
find_package(ECM REQUIRED NO_MODULE)
# Needed by find_package(KF5Plasma) below.
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH})
# Get id and version from metadata
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.json METADATA)
string(JSON PLUGIN_ID GET ${METADATA} KPlugin Id)
string(JSON CUR_VERSION GET ${METADATA} KPlugin Version)
message("Plugin Id: ${PLUGIN_ID}")
message("Version: ${CUR_VERSION}")
if(INSTALL_PLASMOID)
# Locate plasma_install_package macro.
find_package(Plasma REQUIRED)
plasma_install_package(package luisbocanegra.panelspacer.extended)
endif()
if(PACKAGE_PLASMOID)
# GenEreate plasmoid file
set(PLASMOID_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-v${CUR_VERSION}.plasmoid")
add_custom_target(plasmoid ALL
COMMAND rm -rf "${PLASMOID_FILE}"
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/package zip -r ${PLASMOID_FILE} ./
COMMENT "Generating ${PLASMOID_FILE}"
)
endif()
if(BUILD_PLUGIN)
add_subdirectory(plugin)
endif()