The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 6f8a74791b9e85a0878c6ce3dfcf01a47bf7b5f2 Author: Vincent van Ravesteijn <[email protected]> Date: Sun Apr 21 21:42:53 2013 +0200 Adjust CMake for Qt5 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8828b..4e64a01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -462,8 +462,31 @@ if(NOT MSVC) endif() endif() +find_package(Qt5Core QUIET) +if (Qt5Core_FOUND) + find_package(Qt5Widgets REQUIRED) + set(QTVERSION ${Qt5Core_VERSION}) + macro (qt_use_modules) + qt5_use_modules(${ARGN}) + endmacro() + macro (qt_add_resources) + qt5_add_resources(${ARGN}) + endmacro() + macro (qt_wrap_uifiles) + qt5_wrap_ui(${ARGN}) + endmacro() +else() + find_package(Qt4 "4.5.0" REQUIRED) + macro (qt_use_modules) + endmacro() + macro (qt_add_resources) + qt4_add_resources(${ARGN}) + endmacro() + macro (qt_wrap_uifiles) + qt4_wrap_ui(${ARGN}) + endmacro() +endif() -find_package(Qt4 "4.5.0" REQUIRED) find_package(Magic) if(Magic_FOUND) set(HAVE_MAGIC_H 1) diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index dae7c58..e865b25 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -25,6 +25,8 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +include (MacroAddFileDependencies) + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) macro(lyx_add_path _list _prefix) @@ -51,7 +53,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 - qt4_wrap_ui(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_) + qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_) set(${_ui} ${${_ui}} ${_header}) endforeach (_current_FILE) endmacro(LYX_ADD_UI_FILES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a922a7b..ac0ca1a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,6 +123,8 @@ add_dependencies(${_lyx} lyx_version) set_target_properties(${_lyx} PROPERTIES FOLDER "applications/LyX") +qt_use_modules(${_lyx} Core Gui) + lyx_add_gcc_pch(${_lyx}) target_link_libraries(${_lyx} diff --git a/src/frontends/qt4/CMakeLists.txt b/src/frontends/qt4/CMakeLists.txt index 9a1dc5c..14283ea 100644 --- a/src/frontends/qt4/CMakeLists.txt +++ b/src/frontends/qt4/CMakeLists.txt @@ -33,7 +33,7 @@ add_custom_command( -P ${TOP_SCRIPT_PATH}/LyXCreateImagesResource.cmake ) -qt4_add_resources(resource_files ${resource_name}) +qt_add_resources(resource_files ${resource_name}) add_definitions(-DQT_GENUINE_STR -DLYX_BUILD_QT4_FRONTEND) @@ -54,7 +54,7 @@ else() endif() set_target_properties(frontend_qt4 PROPERTIES FOLDER "applications/LyX") - +qt_use_modules(frontend_qt4 Core Gui Widgets Concurrent) target_link_libraries(frontend_qt4 frontends ${QT_QTCORE_LIBRARY} diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt index 3226201..93387ba 100644 --- a/src/support/CMakeLists.txt +++ b/src/support/CMakeLists.txt @@ -76,6 +76,8 @@ else() endif() set_target_properties(support PROPERTIES FOLDER "applications/LyX") +qt_use_modules(support Core) + target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY}) lyx_add_gcc_pch(support) commit 09c2e58373d7edcb068053fc949493dd3f591b41 Author: Vincent van Ravesteijn <[email protected]> Date: Tue Apr 23 19:26:15 2013 +0200 Extend and use qt4_wrap_ui diff --git a/development/cmake/modules/FindQt4.cmake b/development/cmake/modules/FindQt4.cmake index 1997106..15620de 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 266a76f..dae7c58 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) ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 25 ++++++++++++++++++++++++- development/cmake/modules/FindQt4.cmake | 25 +++++++++++++++++++++++-- development/cmake/modules/LyXMacros.cmake | 6 +++--- src/CMakeLists.txt | 2 ++ src/frontends/qt4/CMakeLists.txt | 4 ++-- src/support/CMakeLists.txt | 2 ++ 6 files changed, 56 insertions(+), 8 deletions(-) hooks/post-receive -- The LyX Source Repository
