mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-22 08:57:17 -06:00
Make potfile generation a custom target, and make the dist target depend on it
This commit is contained in:
parent
b12a6cf4d2
commit
1258a2adfd
@ -800,7 +800,7 @@ ENDIF()
|
||||
STRING(REPLACE ";" "\n" ALL_DIST_LINES "${ALL_DIST}")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/dist_manifest.txt ${ALL_DIST_LINES})
|
||||
|
||||
SET(DIST_GENERATED_FILES "")
|
||||
SET(DIST_GENERATED_FILES2 "")
|
||||
FOREACH(file ${COPY_FROM_BUILD})
|
||||
LIST(APPEND DIST_GENERATED_FILES2 ${BUILD_SOURCE_DIR}/${file})
|
||||
ENDFOREACH()
|
||||
@ -818,7 +818,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${DIST_FILE}.gz ${DIST_FILE}.bz2
|
||||
-P ${CMAKE_SOURCE_DIR}/common/cmake_modules/MakeDist.cmake
|
||||
|
||||
DEPENDS
|
||||
${ALL_DIST} ${DIST_GENERATED_FILES2} gnc-vcs-info iso-4217-c gnc-warnings-c gnucash-design-info ChangeLog
|
||||
${ALL_DIST} ${DIST_GENERATED_FILES2} gnc-vcs-info iso-4217-c gnc-warnings-c gnucash-design-info ChangeLog gnucash-pot
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(dist DEPENDS ${DIST_FILE}.gz ${DIST_FILE}.bz2)
|
||||
|
@ -23,7 +23,7 @@ FOREACH(lingua ${ALL_LINGUAS})
|
||||
ENDFOREACH()
|
||||
|
||||
SET_LOCAL_DIST(po_DIST_local ${po_SOURCES} CMakeLists.txt ChangeLog Makevars
|
||||
POTFILES.ignore POTFILES.in POTFILES.skip README check-po.cmake)
|
||||
POTFILES.ignore POTFILES.in POTFILES.skip README check-po.cmake gnucash-pot.cmake)
|
||||
SET(po_DIST ${po_DIST_local} ${po_glossary_DIST} PARENT_SCOPE)
|
||||
|
||||
FOREACH(lingua ${ALL_LINGUAS})
|
||||
@ -159,31 +159,22 @@ IF(BUILDING_FROM_VCS)
|
||||
MESSAGE(FATAL_ERROR "Can't find the 'xgettext' program.")
|
||||
ENDIF ()
|
||||
|
||||
IF (${CMAKE_VERSION} VERSION_GREATER 3.1 AND NOT WIN32)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND_TMP} INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT} XGETTEXT=${XGETTEXT} srcdir=${CMAKE_CURRENT_SOURCE_DIR} ${INTLTOOL_UPDATE} --gettext-package ${PACKAGE} --pot
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RESULT_VARIABLE GNUCASH_POT_RESULT
|
||||
)
|
||||
IF(NOT ${GNUCASH_POT_RESULT} STREQUAL "0")
|
||||
MESSAGE(FATAL_ERROR "Error when creating gnucash.pot: ${GNUCASH_POT_RESULT}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
CONFIGURE_FILE(make-gnucash-pot.sh.in make-gnucash-pot.sh)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${SHELL} ${CMAKE_CURRENT_BINARY_DIR}/make-gnucash-pot.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
RESULT_VARIABLE GNUCASH_POT_RESULT_SHELL
|
||||
)
|
||||
IF(NOT ${GNUCASH_POT_RESULT_SHELL} STREQUAL "0")
|
||||
MESSAGE(FATAL_ERROR "Error when creating gnucash.pot from shell script: ${GNUCASH_POT_RESULT_SHELL}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.pot)
|
||||
MESSAGE(FATAL_ERROR "POT file '${CMAKE_CURRENT_SOURCE_DIR}/gnucash.pot' was not successfully created.")
|
||||
ENDIF()
|
||||
add_custom_target(gnucash-pot
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT}
|
||||
-D INTLTOOL_UPDATE=${INTLTOOL_UPDATE}
|
||||
-D PO_SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-D PO_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-D PACKAGE=${PACKAGE}
|
||||
-D PERL=${PERL_EXECUTABLE}
|
||||
-D XGETTEXT=${XGETTEXT}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-pot.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
ELSE()
|
||||
add_custom_target(gnucash-pot
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.pot)
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_TARGET(check-po
|
||||
|
20
po/gnucash-pot.cmake
Normal file
20
po/gnucash-pot.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# Note: the set commands below can be integrated in the execute process
|
||||
# the day we require cmake > 3.1
|
||||
# The command would then become
|
||||
# COMMAND {CMAKE_COMMAND} -E env INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT} .... ${PERL} ${INTLTOOL_UPDATE} ....
|
||||
|
||||
set(ENV{INTLTOOL_EXTRACT} ${INTLTOOL_EXTRACT})
|
||||
set(ENV{XGETTEXT} ${XGETTEXT})
|
||||
set(ENV{srcdir} ${PO_SRC_DIR})
|
||||
execute_process(
|
||||
COMMAND ${PERL} ${INTLTOOL_UPDATE} --gettext-package ${PACKAGE} --pot
|
||||
WORKING_DIRECTORY ${PO_BIN_DIR}
|
||||
RESULT_VARIABLE GNUCASH_POT_RESULT
|
||||
)
|
||||
if (NOT ${GNUCASH_POT_RESULT} STREQUAL "0")
|
||||
message(FATAL_ERROR "Error when creating gnucash.pot: ${GNUCASH_POT_RESULT}")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${PO_BIN_DIR}/gnucash.pot)
|
||||
message(FATAL_ERROR "POT file '${PO_BIN_DIR}/gnucash.pot' was not successfully created.")
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user