Browse Source

Gettext rules updated.

Kolan Sh 3 years ago
parent
commit
dd44f3f616

+ 11
- 17
GettextCommonRules.cmake View File

@@ -1,30 +1,24 @@
1 1
 SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
2 2
 ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
3
+FIND_PACKAGE (Gettext REQUIRED)
3 4
 
4
-# FIXME: Custom locale directory
5
-IF (WIN32)
6
-  SET (LOCALEDIR "")
7
-ELSE ()
8
-  SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
9
-ENDIF ()
10
-SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")		
11
-IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
12
-  SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
13
-  MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
14
-ENDIF ()
5
+# Custom locale directory
6
+SET (LOCALEDIR "share/locale" CACHE STRING "Directory to install l10n files into")
7
+MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
15 8
 ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
16
-SET (LOCALE_INSTALL_DIR "share/locale")
17 9
 
18
-# by all langs
19
-INCLUDE (MacroOptionalAddSubdirectory)
20
-FIND_PACKAGE (Gettext REQUIRED)
21
-MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs)
10
+# for each language
11
+INCLUDE (MacroSubdirList)
12
+SUBDIRLIST (SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
13
+FOREACH (subdir ${SUBDIRS})
14
+  ADD_SUBDIRECTORY (${subdir})
15
+ENDFOREACH()
22 16
 
23 17
 # configure a header file for Gettext
24 18
 STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader)
25 19
 CONFIGURE_FILE (
26 20
   "gettext-config.h.in"
27
-  "${PROJECT_BINARY_DIR}/po/gettext-config.h"
21
+  "${CMAKE_CURRENT_BINARY_DIR}/gettext-config.h"
28 22
 )
29 23
 
30 24
 # check for msgmerge utility

+ 3
- 0
GettextLangRules.cmake View File

@@ -0,0 +1,3 @@
1
+FILE (GLOB _po_files *.po)
2
+GET_FILENAME_COMPONENT (LANG "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
3
+GETTEXT_PROCESS_PO_FILES ("${LANG}" ALL INSTALL_DESTINATION ${LOCALEDIR} PO_FILES ${_po_files} )

+ 10
- 0
MacroSubdirList.cmake View File

@@ -0,0 +1,10 @@
1
+MACRO(SUBDIRLIST result curdir)
2
+  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
3
+  SET(dirlist "")
4
+  FOREACH(child ${children})
5
+    IF(IS_DIRECTORY ${curdir}/${child})
6
+        LIST(APPEND dirlist ${child})
7
+    ENDIF()
8
+  ENDFOREACH()
9
+  SET(${result} ${dirlist})
10
+ENDMACRO()

+ 1
- 1
ValaBinCommonRules.cmake View File

@@ -13,7 +13,7 @@ VALA_PRECOMPILE (VALA_C ${BinSources}
13 13
                  GENERATE_HEADER
14 14
                 )
15 15
 PKG_CHECK_MODULES (PKGS REQUIRED ${BinPkgModules})
16
-INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
16
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
17 17
 ADD_EXECUTABLE (${BinName} ${VALA_C} ${BinExtraSources})
18 18
 ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
19 19
 TARGET_LINK_LIBRARIES (${BinName} ${PKGS_LIBRARIES} ${BinLinkLibs})

+ 1
- 1
ValaLibCommonRules.cmake View File

@@ -15,7 +15,7 @@ VALA_PRECOMPILE (VALA_C ${LibSources}
15 15
                  GENERATE_HEADER ${LibName}-${MAJOR}
16 16
                 )
17 17
 PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
18
-INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
18
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
19 19
 ADD_LIBRARY (${LibName} SHARED ${VALA_C} ${LibExtraSources})
20 20
 ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
21 21
 TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})

+ 1
- 1
ValaPluginCommonRules.cmake View File

@@ -11,7 +11,7 @@ VALA_PRECOMPILE (VALA_C ${PluginSources}
11 11
                  GENERATE_HEADER
12 12
                 )
13 13
 PKG_CHECK_MODULES (PKGS REQUIRED ${PluginPkgModules})
14
-INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
14
+INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
15 15
 ADD_LIBRARY (${PluginName} SHARED ${VALA_C} ${PluginExtraSources})
16 16
 ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
17 17
 TARGET_LINK_LIBRARIES (${PluginName} ${PKGS_LIBRARIES} ${PluginLinkLibs})

Loading…
Cancel
Save