From: vsr Date: Thu, 3 Oct 2013 06:51:31 +0000 (+0000) Subject: Porting to CMake: improve PYQT4_WRAP_UIC macro for multiple usage in the same project... X-Git-Tag: BR_hydro_v_0_3_1~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c34a194edd4d0370f1929a6a87c75c7a961cb36;p=modules%2Fgui.git Porting to CMake: improve PYQT4_WRAP_UIC macro for multiple usage in the same project: name of the custom target should be globally unique within the project. --- diff --git a/adm_local/cmake_files/UsePyQt4.cmake b/adm_local/cmake_files/UsePyQt4.cmake index a5c33abfc..aa41a6be2 100644 --- a/adm_local/cmake_files/UsePyQt4.cmake +++ b/adm_local/cmake_files/UsePyQt4.cmake @@ -18,6 +18,31 @@ # # 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) ####################################################################