Commit 5e4f4461 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

cmake: Fix build using Qt4

parent 319029d4
......@@ -113,7 +113,6 @@ FIND_PACKAGE(frei0r REQUIRED)
INCLUDE_DIRECTORIES(${FREI0R_INCLUDE_DIR})
# search for Qt4
if (NOT FORCE_QT4)
message(STATUS "using qt5")
......@@ -147,15 +146,15 @@ if (NOT FORCE_QT4)
else()
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
if( WITH_GUI )
list(APPEND NEEDED_QT4_COMPONENTS "QtGui")
endif()
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too")
find_package(Qt4 REQUIRED COMPONENTS ${NEEDED_QT4_COMPONENTS})
macro(qt_use_modules)
endmacro()
macro(qt_wrap_ui)
......@@ -169,6 +168,14 @@ else()
macro(qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
# On linux & using Qt4 we need to manually add -lX11
if (UNIX AND NOT APPLE)
list(APPEND VLMC_LIBS -lX11)
endif()
endif()
# layout of VLMC installation
......
......@@ -252,7 +252,13 @@ ELSE(NOT WITH_GUI)
ADD_EXECUTABLE( vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS} )
TARGET_LINK_LIBRARIES( vlmc ${VLMC_LIBS} )
qt_use_modules(vlmc Core Gui Widgets Xml Network)
if (NOT Qt4_FOUND)
qt_use_modules(vlmc Core Gui Widgets Xml Network)
else()
# We need to know the target for this one, which is not the case when doing most of the QT4/5 specific stuff.
# We could hide this command in qt_use_modules macro, but this would be some kind of black magic uglyness
TARGET_LINK_LIBRARIES(vlmc ${QT_LIBRARIES})
endif()
ENDIF( NOT WITH_GUI )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment