Hi everybody:
I wrote two CMake modules to help in the effort of building Qt4 and
Qt5 projects from the same source.
Today I had the time and polished it a little bit. IMO they are now
usable. There's an sample that shows how to use the modules.
It might be helpful in the task of porting LXQt to Qt5. Comments are welcome.
The repo are at:
https://github.com/luis-pereira/qtxmodules
The sample project CMakeLists.txt:
project(sample-project)
cmake_minimum_required(VERSION 2.6.2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../..")
include(FindQtX)
FindQtX(
QT4_MINIMUM_REQUIRED 4.8.1
QT5_MINIMUM_REQUIRED 5.0.1
QT4_MODULES Gui
QT5_MODULES Widgets
COMMON_MODULES Core DBus
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(UI_FILES
dialog.ui
)
set(MOC_FILES
dialog.h
)
set(HEADER_FILESproject(sample-project)
cmake_minimum_required(VERSION 2.6.2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../..")
include(FindQtX)
FindQtX(
QT4_MINIMUM_REQUIRED 4.8.1
QT5_MINIMUM_REQUIRED 5.0.1
QT4_MODULES Gui
QT5_MODULES Widgets
COMMON_MODULES Core DBus
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(UI_FILES
dialog.ui
)
set(MOC_FILES
dialog.h
)
set(HEADER_FILES
dialog.h
)
set(CPP_FILES
main.cpp
dialog.cpp
)
qtx_wrap_cpp(MOC_SOURCES ${MOC_FILES})
qtx_wrap_ui(UI_HEADERS ${UI_FILES})
qtx_add_dbus_interface(CPP_FILES
org.freedesktop.Notifications.xml
notifications_interface
)
add_executable(sample-project
${CPP_FILES}
${UI_HEADERS}
${MOC_SOURCES}
dialog.h
)
set(CPP_FILES
main.cpp
dialog.cpp
)
qtx_wrap_cpp(MOC_SOURCES ${MOC_FILES})
qtx_wrap_ui(UI_HEADERS ${UI_FILES})
qtx_add_dbus_interface(CPP_FILES
org.freedesktop.Notifications.xml
notifications_interface
)
add_executable(sample-project
${CPP_FILES}
${UI_HEADERS}
${MOC_SOURCES}
Regards,
--
Luís Pereira