]> git.lyx.org Git - lyx.git/commitdiff
Extend and use qt4_wrap_ui
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 23 Apr 2013 17:26:15 +0000 (19:26 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 23 Apr 2013 19:45:39 +0000 (21:45 +0200)
development/cmake/modules/FindQt4.cmake
development/cmake/modules/LyXMacros.cmake

index 1997106cf61cb5b9f62775d5063a7046a0a464bd..15620def5b1fca757771049dcd01b3858f54eb96 100644 (file)
@@ -758,17 +758,38 @@ if(QT4_QMAKE_FOUND)
   ENDMACRO (QT4_WRAP_CPP)
 
 
+
+
+macro (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options)
+       set(${_qt4_files})
+       set(${_qt4_options})
+       set(_QT4_DOING_OPTIONS FALSE)
+       foreach (_currentArg ${ARGN})
+               if ("${_currentArg}" STREQUAL "OPTIONS")
+                       set(_QT4_DOING_OPTIONS TRUE)
+               else ()
+                       if (_QT4_DOING_OPTIONS)
+                               list(APPEND ${_qt4_options} "${_currentArg}")
+                       else()
+                               list(APPEND ${_qt4_files} "${_currentArg}")
+                       endif()
+               endif()
+       endforeach()
+endmacro()
+
   # QT4_WRAP_UI(outfiles inputfile ... )
 
   MACRO (QT4_WRAP_UI outfiles )
+    QT4_EXTRACT_OPTIONS(ui_files_list ui_options ${ARGN})
+    FOREACH (it ${ui_files_list})
 
-    FOREACH (it ${ARGN})
       GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+
       set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
         COMMAND ${QT_UIC_EXECUTABLE}
-        ARGS -o ${outfile} ${infile}
+        ARGS ${ui_options} -o ${outfile} ${infile}
         MAIN_DEPENDENCY ${infile})
       set(${outfiles} ${${outfiles}} ${outfile})
     ENDFOREACH (it)
index 266a76f03c990036729d9a3ae038abbf33478398..dae7c5837f25c45a04a9403447f8c9d086adb935 100644 (file)
@@ -51,9 +51,7 @@ macro(LYX_ADD_UI_FILES _sources _ui)
                # ######
                # Latest test showed on linux and windows show no bad consequeces,
                # so we removed the call to LyXuic.cmake
-               add_custom_command(OUTPUT ${_header}
-        COMMAND ${QT_UIC_EXECUTABLE} -tr lyx::qt_ ${_tmp_FILE} -o ${_header}
-                       MAIN_DEPENDENCY ${_tmp_FILE})
+               qt4_wrap_ui(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
                set(${_ui} ${${_ui}} ${_header})
        endforeach (_current_FILE)
 endmacro(LYX_ADD_UI_FILES)