Salome HOME
Add options to PYQT_WRAP_UIC macro
authorGilles DAVID <gilles-g.david@edf.fr>
Wed, 29 Mar 2017 12:34:03 +0000 (14:34 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Wed, 29 Mar 2017 12:34:03 +0000 (14:34 +0200)
cmake/UsePyQt.cmake

index 587aef25a6bb9d72a187ce0cbeccc431968a6c1b..7927ec13b0968d83d3d4d85c9d650677981499c9 100644 (file)
@@ -57,6 +57,7 @@ ENDFUNCTION()
 # ARGUMENTS:
 #   output_files [out] variable where output file names are listed to
 #   pyuic_files  [in]  list of *.ui files
+#   options      [in]  additional options to be specified to pyuic
 # 
 # NOTES:
 #   - Input files are considered relative to the current source directory.
@@ -65,16 +66,31 @@ ENDFUNCTION()
 # 
 ####################################################################
 MACRO(PYQT_WRAP_UIC outfiles)
+  SET(_output)
+  SET(_options)
+  SET(_pyuic_files)
+  SET(_get_options "0")
+  FOREACH(_input ${ARGN})
+    IF(${_input} STREQUAL "OPTIONS")
+      SET(_get_options "1")
+    ELSE()
+      IF(${_get_options} STREQUAL "1")
+        SET(_options ${_options} ${_input})
+      ELSE()
+        SET(_pyuic_files ${_pyuic_files} ${_input})
+      ENDIF()
+  ENDIF()
+  ENDFOREACH()
 
  IF(NOT WIN32)
 
-  FOREACH(_input ${ARGN})
+  FOREACH(_input ${_pyuic_files})
     GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
     STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
     SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
     ADD_CUSTOM_COMMAND(
       OUTPUT ${_output}
-      COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+      COMMAND ${PYQT_PYUIC_PATH} ${_options} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
       MAIN_DEPENDENCY ${_input}
       )
     SET(${outfiles} ${${outfiles}} ${_output})