diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 3f2f9ad7e7..3ec0febf53 100755 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -43,10 +43,13 @@ macro(add_gettext_python _par _dir) ADD_CUSTOM_COMMAND( OUTPUT "${_dst}" PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}" - COMMAND ${LYX_PYTHON_EXECUTABLE} - ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par1} "--src_file=${_src_files}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations" + COMMAND ${CMAKE_COMMAND} + "-DTOP_SRC_DIR=${TOP_SRC_DIR}" + "-DDestFile=${_dst}" + "-DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}" + "-DParType=${_par1}" + "-DSources=${_src_files}" + -P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake" DEPENDS ${_sources} ${_src_files} "${TOP_SRC_DIR}/lib/layouttranslations" COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o ${_dst} -t ${_par1} --src_file=${_src_files}" ) diff --git a/po/CreateLayoutTranslations.cmake b/po/CreateLayoutTranslations.cmake new file mode 100644 index 0000000000..22e3a529b3 --- /dev/null +++ b/po/CreateLayoutTranslations.cmake @@ -0,0 +1,34 @@ +# -DTOP_SRC_DIR=xxx \ +# -DDestFile=xxx \ +# -DLYX_PYTHON_EXECUTABLE=xxx \ +# -DParType=xxx \ +# -DSources=xxx \ + +set(_dst ${DestFile}) +set(type ${ParType}) +set(_src_files ${Sources}) + +message(STATUS "Starting CreateLayoutTranslations") +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}" + RESULT_VARIABLE _err) +string(COMPARE EQUAL ${_err} 0 _erg) +if(NOT _erg) + message(FATAL_ERROR "CreateLayoutTranslations: Copy of layouttranslations failed") +endif() + +execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} + "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${type} + "--src_file=${_src_files}" + RESULT_VARIABLE _err) + +string(COMPARE EQUAL ${_err} 0 _erg) +if(NOT _erg) + message(FATAL_ERROR "CreateLayoutTranslations: Calling python wit errors") +endif() + +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations" + RESULT_VARIABLE _err) +if(NOT _erg) + message(FATAL_ERROR "CreateLayoutTranslations: Copy of layouttranslations to source failed") +endif() +