From 09c2e58373d7edcb068053fc949493dd3f591b41 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Tue, 23 Apr 2013 19:26:15 +0200 Subject: [PATCH] Extend and use qt4_wrap_ui --- development/cmake/modules/FindQt4.cmake | 25 +++++++++++++++++++++-- development/cmake/modules/LyXMacros.cmake | 4 +--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/development/cmake/modules/FindQt4.cmake b/development/cmake/modules/FindQt4.cmake index 1997106cf6..15620def5b 100644 --- a/development/cmake/modules/FindQt4.cmake +++ b/development/cmake/modules/FindQt4.cmake @@ -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) diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index 266a76f03c..dae7c5837f 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -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) -- 2.39.5