commit cbd4e332f7aa16590a6ecffa9908d0afde2c90b3
Author: Kornel Benko <[email protected]>
Date:   Wed Jul 27 07:34:50 2016 +0200

    Cmake build: Make missing polib less destructive.
    
    Configure still whines, but proceeds succesfull.
    Only the target 'layouttranslations1' will fail.
---
 po/CMakeLists.txt                 |    8 +++++---
 po/CreateLayoutTranslations.cmake |    4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index e690e40..bb9c839 100755
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -12,8 +12,6 @@ include_directories(${TOP_SRC_DIR}/po)
 SET(_lyxname ${PACKAGE})
 SET(_py_sources)
 
-# Idea stolen from 
http://public.kitware.com/pipermail/cmake/2011-January/041666.html
-
 macro(add_gettext_python  _par _dir)
   set(_sources)
   foreach(_arg ${ARGN})
@@ -45,7 +43,10 @@ macro(add_gettext_python  _par _dir)
   if (${_par} MATCHES "layouttranslations")
     # lyx_pot.py requires the module "polib" if using target 
layouttranslations1,
     # so we have to check for it
-    find_python_module("polib" REQUIRED)
+    find_python_module("polib")
+    if ("${LYX_PY_POLIB}" STREQUAL "")
+      message(STATUS "You will be unable to update layouttranslations file")
+    endif()
     ADD_CUSTOM_COMMAND(
       OUTPUT "${_dst}"
       PRE_BUILD
@@ -55,6 +56,7 @@ macro(add_gettext_python  _par _dir)
        "-DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}"
        "-DParType=${_par1}"
        "-DSources=${_src_files}"
+        "-DLYX_PY_POLIB=${LYX_PY_POLIB1}"
        -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
index 9f3d533..1987f41 100644
--- a/po/CreateLayoutTranslations.cmake
+++ b/po/CreateLayoutTranslations.cmake
@@ -9,6 +9,7 @@
 #       -DLYX_PYTHON_EXECUTABLE=xxx \
 #       -DParType=xxx \
 #       -DSources=xxx \
+#       -DLYX_PY_POLIB=${LYX_PY_POLIB} \
 #       -P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake"
 
 set(_dst ${DestFile})
@@ -23,6 +24,9 @@ macro(die_if _err text)
 endmacro()
 
 message(STATUS "Starting CreateLayoutTranslations")
+if ("${LYX_PY_POLIB}" STREQUAL "")
+  message(STATUS "Missing needed pythons polib, be prepared for error")
+endif()
 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different 
"${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}"
   RESULT_VARIABLE _err)
 die_if(_err "Copy of layouttranslations failed")

Reply via email to