From 20d3484075610928467fda9c71b2f3bf8c334bbf Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Wed, 8 Jun 2011 20:22:27 +0000 Subject: [PATCH] Compile fix for Qt 4.5 and earlier. Update for cmake build. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38996 a592a061-630c-0410-9148-cb99ea01b6c8 --- CMakeLists.txt | 5 +++++ development/cmake/modules/LyXMacros.cmake | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72e9375b40..1061c1bedc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -616,6 +616,11 @@ endif() configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h) +# Compute qt4-version from ${QTVERSION} +if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") + MATH(EXPR QT4_VERSIONNUM "${CMAKE_MATCH_1}*10000+${CMAKE_MATCH_2}*100+${CMAKE_MATCH_3}") + set(QT4_VERSION "0x${QT4_VERSIONNUM}") +endif() add_subdirectory(src "${TOP_BINARY_DIR}/src") add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx") diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index 4d247d9598..6df513654b 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -108,7 +108,7 @@ macro(LYX_AUTOMOC) #set(_moc ${_abs_PATH}/${_current_MOC}) add_custom_command(OUTPUT ${_moc} COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_def} ${_moc_INCS} ${_header} -o ${_moc} + ARGS "-DQT_VERSION=${QT4_VERSION}" ${_def} ${_moc_INCS} ${_header} -o ${_moc} MAIN_DEPENDENCY ${_header}) macro_add_file_dependencies(${_abs_FILE} ${_moc}) SET_SOURCE_FILES_PROPERTIES(${_moc} GENERATED)