From b2084050900f403d57dd625976a97459a3366d06 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 12 Oct 2017 09:57:57 +0300 Subject: [PATCH] 0023473: [CEA 2163] SMESH compilation failure with a PyCompileError - Improve SALOME_INSTALL_SCRIPTS and PYQT_WRAP_SIP macros to return name of created target --- cmake/SalomeMacros.cmake | 16 ++++++++++++---- cmake/UsePyQt.cmake | 12 ++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cmake/SalomeMacros.cmake b/cmake/SalomeMacros.cmake index 1db407c..cea90a7 100644 --- a/cmake/SalomeMacros.cmake +++ b/cmake/SalomeMacros.cmake @@ -93,7 +93,7 @@ ENDMACRO(PARSE_ARGUMENTS) #---------------------------------------------------------------------------- # SALOME_INSTALL_SCRIPTS is a macro useful for installing scripts. # -# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [WORKING_DIRECTORY dir] [DEF_PERMS]) +# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [WORKING_DIRECTORY dir] [DEF_PERMS] [TARGET_NAME name]) # # ARGUMENTS: # file_list: IN : list of files to be installed. This list should be quoted. @@ -101,10 +101,14 @@ ENDMACRO(PARSE_ARGUMENTS) # # By default files to be installed as executable scripts. # If DEF_PERMS option is provided, than permissions for installed files are -# only OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ. +# only OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ. +# WORKING_DIRECTORY option may be used to specify the relative or absolute +# path to the directory containing source files listed in file_list argument. +# If TARGET_NAME option is specified, the name of the target being created +# with this macro is returned via the given variable. #---------------------------------------------------------------------------- MACRO(SALOME_INSTALL_SCRIPTS file_list path) - PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "WORKING_DIRECTORY" "DEF_PERMS" ${ARGN}) + PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "WORKING_DIRECTORY;TARGET_NAME" "DEF_PERMS" ${ARGN}) SET(PERMS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) IF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS) SET(PERMS ${PERMS} OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) @@ -168,7 +172,11 @@ MACRO(SALOME_INSTALL_SCRIPTS file_list path) WHILE(TARGET "PYCOMPILE${unique_name}_${_cnt}") MATH(EXPR _cnt ${_cnt}+1) ENDWHILE() - ADD_CUSTOM_TARGET("PYCOMPILE${unique_name}_${_cnt}" ALL DEPENDS ${_all_pyc} ${_all_pyo}) + SET(_target_name "PYCOMPILE${unique_name}_${_cnt}") + ADD_CUSTOM_TARGET(${_target_name} ALL DEPENDS ${_all_pyc} ${_all_pyo}) + IF(SALOME_INSTALL_SCRIPTS_TARGET_NAME) + SET(${SALOME_INSTALL_SCRIPTS_TARGET_NAME} ${_target_name}) + ENDIF(SALOME_INSTALL_SCRIPTS_TARGET_NAME) ENDIF() ENDMACRO(SALOME_INSTALL_SCRIPTS) diff --git a/cmake/UsePyQt.cmake b/cmake/UsePyQt.cmake index 587aef2..42a5287 100644 --- a/cmake/UsePyQt.cmake +++ b/cmake/UsePyQt.cmake @@ -66,9 +66,11 @@ ENDFUNCTION() #################################################################### MACRO(PYQT_WRAP_UIC outfiles) + PARSE_ARGUMENTS(PYQT_WRAP_UIC "TARGET_NAME" "" ${ARGN}) + IF(NOT WIN32) - FOREACH(_input ${ARGN}) + FOREACH(_input ${PYQT_WRAP_UIC_DEFAULT_ARGS}) GET_FILENAME_COMPONENT(_input_name ${_input} NAME) STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name}) SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) @@ -81,6 +83,9 @@ MACRO(PYQT_WRAP_UIC outfiles) ENDFOREACH() _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}}) + IF(PYQT_WRAP_UIC_TARGET_NAME) + SET(${PYQT_WRAP_UIC_TARGET_NAME} ${_uniqueTargetName}) + ENDIF(PYQT_WRAP_UIC_TARGET_NAME) ELSE(NOT WIN32) @@ -95,8 +100,11 @@ MACRO(PYQT_WRAP_UIC outfiles) SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL) + IF(PYQT_WRAP_UIC_TARGET_NAME) + SET(${PYQT_WRAP_UIC_TARGET_NAME} ${_uniqueTargetName}) + ENDIF(PYQT_WRAP_UIC_TARGET_NAME) SET_TARGET_PROPERTIES(${_uniqueTargetName} PROPERTIES FOLDER PYQT_WRAP_UIC_TARGETS) - FOREACH(_input ${ARGN}) + FOREACH(_input ${PYQT_WRAP_UIC_DEFAULT_ARGS}) GET_FILENAME_COMPONENT(_input_name ${_input} NAME) STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name}) SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) -- 2.39.2