diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8828b827..4e64a01357 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 dae7c5837f..e865b25d78 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 a922a7b84e..ac0ca1a70f 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 9a1dc5cc69..14283ea0b2 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 3226201b18..93387ba0e0 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)