-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
62 lines (49 loc) · 2.34 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
cmake_minimum_required(VERSION 2.6)
project(NemoAdmin NONE)
find_package(Gettext REQUIRED)
# Configurable paths
set(NEMO_PATH "/usr/bin/nemo" CACHE FILEPATH "nemo program path.")
set(XED_PATH "/usr/bin/xed" CACHE FILEPATH "xed program path.")
# Configure files
configure_file(extension/nemo-admin.py
extension/nemo-admin.py)
# Update and compile the translations
file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "po/*.po")
foreach(trans_file ${TRANSLATION_FILES})
configure_file(${trans_file} ${trans_file} COPYONLY)
endforeach()
file(GLOB PO_FILES "${CMAKE_CURRENT_BINARY_DIR}/po/*.po")
# Add custom command to generate nemo-admin.pot
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/po/nemo-admin.pot
COMMAND xgettext --output=${CMAKE_CURRENT_BINARY_DIR}/po/nemo-admin.pot ${CMAKE_CURRENT_SOURCE_DIR}/extension/nemo-admin.py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/extension/nemo-admin.py
)
# Create translations
gettext_create_translations("${CMAKE_CURRENT_BINARY_DIR}/po/nemo-admin.pot"
ALL ${PO_FILES})
# Ensure the locale directory exists
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ko/LC_MESSAGES)
# Generate .mo files for nemo-admin domain
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/locale/ko/LC_MESSAGES/nemo-admin.mo
COMMAND msgfmt ${CMAKE_CURRENT_BINARY_DIR}/po/ko.po -o ${CMAKE_CURRENT_BINARY_DIR}/locale/ko/LC_MESSAGES/nemo-admin.mo
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/po/ko.po
)
add_custom_target(translations_nemo_extension_admin ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/locale/ko/LC_MESSAGES/nemo-admin.mo
)
# Install target
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/extension/nemo-admin.py"
DESTINATION /usr/share/nemo-python/extensions)
# Install nemo-admin .mo file
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/locale/ko/LC_MESSAGES/nemo-admin.mo"
DESTINATION /usr/share/locale/ko/LC_MESSAGES)
# Uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND}
-P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
# Install the appdata file
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nemo-admin.appdata.xml
DESTINATION share/metainfo)