]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to CMake: improve PYQT4_WRAP_UIC macro for multiple usage in the same project...
authorvsr <vsr@opencascade.com>
Thu, 3 Oct 2013 06:51:31 +0000 (06:51 +0000)
committervsr <vsr@opencascade.com>
Thu, 3 Oct 2013 06:51:31 +0000 (06:51 +0000)
adm_local/cmake_files/UsePyQt4.cmake

index a5c33abfc912d37a6234d8e5a0b2a78f8da5822b..aa41a6be2e692141518bdfa1534a81eefa104369 100644 (file)
 #
 # Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
+####################################################################
+#
+# _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
+# 
+# Used to generate unique custom target name for usage in
+# PYQT4_WRAP_UIC macro.
+#
+# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
+#
+# ARGUMENTS:
+#   prefix [in] prefix for the name
+#   unique_name [out] unique name generated by function
+#
+####################################################################
+FUNCTION(_PYQT4_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
+   SET(_propertyName "_PYQT4_WRAP_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()
+
 ####################################################################
 #
 # PYQT4_WRAP_UIC macro
@@ -49,7 +74,8 @@ MACRO(PYQT4_WRAP_UIC outfiles)
       )
     SET(${outfiles} ${${outfiles}} ${_output})
   ENDFOREACH()
-  ADD_CUSTOM_TARGET(BUILD_UI_PY_FILES ALL DEPENDS ${${outfiles}})
+  _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
 ENDMACRO(PYQT4_WRAP_UIC)
 
 ####################################################################