Adjust CMake for Qt5

This commit is contained in:
Vincent van Ravesteijn 2013-04-21 21:42:53 +02:00
parent 09c2e58373
commit 6f8a74791b
5 changed files with 33 additions and 4 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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}

View File

@ -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}

View File

@ -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)