mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 21:41:03 +00:00
98093c45db
Transitively consume the property from linked dependents. Implement configuration-specific support by following the pattern set out for compile definitions and includes in cmQtAutoGenerators. Implement support for origin-tracking with CMAKE_DEBUG_TARGET_PROPERTIES. This is motivated by the needs of KDE, which provides a separate translation system based on gettext instead of the Qt linguist translation system. The Qt uic tool provides command line options for configuring the method used to translate text, and to add an include directive to the generated file to provide the method. http://thread.gmane.org/gmane.comp.kde.devel.frameworks/7930/focus=7992 Implement the interface to provide the uic options as a usage-requirement on the KI18n target, as designed for KDE.
71 lines
1.9 KiB
CMake
71 lines
1.9 KiB
CMake
|
|
cmake_minimum_required(VERSION 2.8.12)
|
|
|
|
project(QtAutoUicInterface)
|
|
|
|
if (QT_TEST_VERSION STREQUAL 4)
|
|
find_package(Qt4 REQUIRED)
|
|
|
|
include(UseQt4)
|
|
|
|
set(QT_CORE_TARGET Qt4::QtCore)
|
|
set(QT_GUI_TARGET Qt4::QtGui)
|
|
else()
|
|
if (NOT QT_TEST_VERSION STREQUAL 5)
|
|
message(SEND_ERROR "Invalid Qt version specified.")
|
|
endif()
|
|
find_package(Qt5Widgets REQUIRED)
|
|
|
|
set(QT_CORE_TARGET Qt5::Core)
|
|
set(QT_GUI_TARGET Qt5::Widgets)
|
|
endif()
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
# BEGIN Upstream
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
add_library(KI18n klocalizedstring.cpp)
|
|
target_link_libraries(KI18n ${QT_CORE_TARGET})
|
|
|
|
set(autouic_options
|
|
-tr tr2$<$<NOT:$<BOOL:$<TARGET_PROPERTY:NO_KUIT_SEMANTIC>>>:x>i18n
|
|
)
|
|
if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0)
|
|
list(APPEND autouic_options -include klocalizedstring.h)
|
|
endif()
|
|
|
|
set_property(TARGET KI18n APPEND PROPERTY
|
|
INTERFACE_AUTOUIC_OPTIONS ${autouic_options}
|
|
)
|
|
|
|
set(domainProp $<TARGET_PROPERTY:TRANSLATION_DOMAIN>)
|
|
set(nameLower $<LOWER_CASE:$<MAKE_C_IDENTIFIER:$<TARGET_PROPERTY:NAME>>>)
|
|
set(domain_logic
|
|
$<$<BOOL:${domainProp}>:${domainProp}>$<$<NOT:$<BOOL:${domainProp}>>:${nameLower}>
|
|
)
|
|
set_property(TARGET KI18n APPEND PROPERTY
|
|
INTERFACE_COMPILE_DEFINITIONS "TRANSLATION_DOMAIN=${domain_logic}"
|
|
)
|
|
|
|
# END upstream
|
|
|
|
add_library(LibWidget libwidget.cpp)
|
|
target_link_libraries(LibWidget KI18n ${QT_GUI_TARGET})
|
|
set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON)
|
|
set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain)
|
|
|
|
add_library(MyWidget mywidget.cpp)
|
|
target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET})
|
|
|
|
add_executable(QtAutoUicInterface main.cpp)
|
|
target_compile_definitions(QtAutoUicInterface
|
|
PRIVATE
|
|
UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_libwidget.h"
|
|
UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_mywidget.h"
|
|
)
|