Merge pull request #15 from xhochy/qt45-build-compability
Qt4<->5 build compability
This commit is contained in:
commit
3e420a5e81
|
@ -11,8 +11,13 @@ set(QTKEYCHAIN_SOVERSION 0)
|
|||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# try Qt5 first, and prefer that if found
|
||||
find_package(Qt5Core QUIET)
|
||||
option(BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF)
|
||||
|
||||
if( NOT BUILD_WITH_QT4 )
|
||||
# try Qt5 first, and prefer that if found
|
||||
find_package(Qt5Core QUIET)
|
||||
endif()
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
|
@ -22,6 +27,13 @@ if (Qt5Core_FOUND)
|
|||
qt5_add_dbus_interface(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
macro(qt_add_translation)
|
||||
qt5_add_translation(${ARGN})
|
||||
endmacro(qt_add_translation)
|
||||
macro(qt_create_translation)
|
||||
qt5_create_translation(${ARGN})
|
||||
endmacro(qt_create_translation)
|
||||
macro(qt_wrap_cpp)
|
||||
qt5_wrap_cpp(${ARGN})
|
||||
endmacro()
|
||||
|
@ -48,6 +60,12 @@ else()
|
|||
endif()
|
||||
include_directories(${QT_INCLUDES})
|
||||
set(QTCORE_LIBRARIES ${QT_QTCORE_LIBRARY})
|
||||
macro(qt_add_translation)
|
||||
qt4_add_translation(${ARGN})
|
||||
endmacro(qt_add_translation)
|
||||
macro(qt_create_translation)
|
||||
qt4_create_translation(${ARGN})
|
||||
endmacro(qt_create_translation)
|
||||
macro(qt_wrap_cpp)
|
||||
qt4_wrap_cpp(${ARGN})
|
||||
endmacro()
|
||||
|
@ -93,8 +111,8 @@ set(qtkeychain_TR_FILES
|
|||
)
|
||||
|
||||
file(GLOB qtkeychain_TR_SOURCES *.cpp *.h *.ui)
|
||||
qt4_create_translation(qtkeychain_MESSAGES ${qtkeychain_TR_SOURCES} ${qtkeychain_TR_FILES})
|
||||
qt4_add_translation(qtkeychain_QM_FILES ${qtkeychain_TR_FILES})
|
||||
qt_create_translation(qtkeychain_MESSAGES ${qtkeychain_TR_SOURCES} ${qtkeychain_TR_FILES})
|
||||
qt_add_translation(qtkeychain_QM_FILES ${qtkeychain_TR_FILES})
|
||||
add_custom_target(messages DEPENDS ${qtkeychain_MESSAGES})
|
||||
add_custom_target(translations DEPENDS ${qtkeychain_QM_FILES})
|
||||
|
||||
|
|
Loading…
Reference in New Issue