[Cmake-commits] CMake branch, next, updated. v2.8.7-2634-g4e006d6

Alexander Neundorf neundorf at kde.org
Thu Feb 16 02:30:42 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  4e006d6624ce569e2760b1ddc1f44838d3e2fe6a (commit)
       via  3b488228032e32f03a639af3a084a4e5ad3201bd (commit)
      from  2128373082002cd11c2e3802d8346fc6d83df6f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4e006d6624ce569e2760b1ddc1f44838d3e2fe6a
commit 4e006d6624ce569e2760b1ddc1f44838d3e2fe6a
Merge: 2128373 3b48822
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Thu Feb 16 02:30:36 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 16 02:30:36 2012 -0500

    Merge topic 'FindGetTextFixMultipleTargets' into next
    
    3b48822 FindGetText: fix multiple targets with the same name problem (CMP0002)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b488228032e32f03a639af3a084a4e5ad3201bd
commit 3b488228032e32f03a639af3a084a4e5ad3201bd
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Sun Feb 12 18:57:28 2012 +0100
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Sun Feb 12 18:57:28 2012 +0100

    FindGetText: fix multiple targets with the same name problem (CMP0002)
    
    The functions in FindGettext create a custom target. If the functions
    are called multiple times, multiple times the same target is created.
    This works only if CMP0002 is set to OLD.
    With this patch there is only one central target created, and each
    invocation of the function creates a target with a unique name and
    make the central target depend on this one.
    
    Alex

diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 635090b..6dbc026 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -61,6 +61,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
 
 INCLUDE(CMakeParseArguments)
 
+FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
+   SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
+   GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}")
+   IF(NOT currentCounter)
+      SET(currentCounter 1)
+   ENDIF()
+   SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
+   MATH(EXPR currentCounter "${currentCounter} + 1")
+   SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
+ENDFUNCTION()
+
 MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
    # make it a real variable, so we can modify it here
    SET(_firstPoFile "${_firstPoFileArg}")
@@ -94,7 +105,15 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
 
    ENDFOREACH (_currentPoFile )
 
-   ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
+   IF(NOT TARGET translations)
+      ADD_CUSTOM_TARGET(translations)
+   ENDIF()
+
+  _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
+
+   ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
+
+   ADD_DEPENDENCIES(translations ${uniqueTargetName})
 
 ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
 
@@ -133,11 +152,20 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile)
       LIST(APPEND _gmoFiles ${_gmoFile})
    ENDFOREACH (_lang )
 
+  IF(NOT TARGET potfiles)
+     ADD_CUSTOM_TARGET(potfiles)
+  ENDIF()
+
+  _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
+
    IF(_parsedArguments_ALL)
-      ADD_CUSTOM_TARGET(potfiles ALL DEPENDS ${_gmoFiles})
+      ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
    ELSE(_parsedArguments_ALL)
-      ADD_CUSTOM_TARGET(potfiles DEPENDS ${_gmoFiles})
+      ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
    ENDIF(_parsedArguments_ALL)
+
+   ADD_DEPENDENCIES(potfiles ${uniqueTargetName})
+
 ENDFUNCTION(GETTEXT_PROCESS_POT_FILE)
 
 
@@ -165,11 +193,21 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang)
       LIST(APPEND _gmoFiles ${_gmoFile})
    ENDFOREACH(_current_PO_FILE)
 
+
+  IF(NOT TARGET pofiles)
+     ADD_CUSTOM_TARGET(pofiles)
+  ENDIF()
+
+  _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
+
    IF(_parsedArguments_ALL)
-      ADD_CUSTOM_TARGET(pofiles ALL DEPENDS ${_gmoFiles})
+      ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
    ELSE(_parsedArguments_ALL)
-      ADD_CUSTOM_TARGET(pofiles DEPENDS ${_gmoFiles})
+      ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
    ENDIF(_parsedArguments_ALL)
+
+   ADD_DEPENDENCIES(pofiles ${uniqueTargetName})
+
 ENDFUNCTION(GETTEXT_PROCESS_PO_FILES)
 
 IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindGettext.cmake |   48 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list