[evolution-ews] Make sure intltool-merge cache is created only once



commit 384f5ff9f5dd0152f0c71f0575319a3501abd14e
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 30 15:56:47 2018 +0100

    Make sure intltool-merge cache is created only once
    
    Similar to https://gitlab.gnome.org/GNOME/evolution/issues/196
    when intltool-merge is called in parallel, it could either rewrite
    the ongoing attempt to build it or use an incomplete data, which
    results in broken output files (.desktop, .metainfo and so on).
    This change ensures the intltool-merge cache is created only once
    and any other requests which would use it will wait until it's created.

 cmake/modules/FindIntltool.cmake | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/cmake/modules/FindIntltool.cmake b/cmake/modules/FindIntltool.cmake
index 2cda2549..8e223e9d 100644
--- a/cmake/modules/FindIntltool.cmake
+++ b/cmake/modules/FindIntltool.cmake
@@ -176,9 +176,18 @@ macro(intltool_merge _in_filename _out_filename)
                        DEPENDS ${_in}
                )
        else(_has_no_translations)
+               if(NOT TARGET intltool-merge-cache)
+                       add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/po/.intltool-merge-cache
+                               COMMAND ${INTLTOOL_MERGE} ${_args} --quiet 
--cache="${CMAKE_BINARY_DIR}/po/.intltool-merge-cache" "${GETTEXT_PO_DIR}" "${_in}" "${_out}"
+                               DEPENDS ${_in}
+                       )
+                       add_custom_target(intltool-merge-cache ALL
+                               DEPENDS ${CMAKE_BINARY_DIR}/po/.intltool-merge-cache)
+               endif(NOT TARGET intltool-merge-cache)
+
                add_custom_command(OUTPUT ${_out}
                        COMMAND ${INTLTOOL_MERGE} ${_args} --quiet 
--cache="${CMAKE_BINARY_DIR}/po/.intltool-merge-cache" "${GETTEXT_PO_DIR}" "${_in}" "${_out}"
-                       DEPENDS ${_in}
+                       DEPENDS ${_in} intltool-merge-cache
                )
        endif(_has_no_translations)
 endmacro(intltool_merge)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]