Changeset View
Changeset View
Standalone View
Standalone View
cmake/KF5I18nMacros.cmake.in
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #create the implementation files from the ui files and add them to the list of sources | 44 | #create the implementation files from the ui files and add them to the list of sources | ||
45 | #usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) or KI18N_WRAP_UI(TARGET ${ui_files}) | 45 | #usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) or KI18N_WRAP_UI(TARGET ${ui_files}) | ||
46 | macro (KI18N_WRAP_UI _sources ) | 46 | macro (KI18N_WRAP_UI _sources ) | ||
47 | if(NOT TARGET Qt5::uic) | 47 | if(NOT TARGET Qt5::uic) | ||
48 | message(FATAL_ERROR "Qt5Widgets should be found before calling ki18n_wrap_ui(). Please add find_package(Qt5Widgets ...)") | 48 | message(FATAL_ERROR "Qt5Widgets should be found before calling ki18n_wrap_ui(). Please add find_package(Qt5Widgets ...)") | ||
49 | endif() | 49 | endif() | ||
50 | 50 | | |||
51 | foreach (_current_FILE ${ARGN}) | 51 | foreach (_current_FILE ${ARGN}) | ||
52 | 52 | | |||
kossebau: This assumes a relative path given. It might make sense to also deal with absolute path, and… | |||||
Some lines below we anyways do get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) Could we not just use the result of this for both the check + output? cullmann: Some lines below we anyways do
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)… | |||||
53 | get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) | 53 | get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) | ||
54 | if(NOT EXISTS ${_tmp_FILE}) | ||||
55 | message(SEND_ERROR | ||||
56 | " Cannot find ui file:\n \n" | ||||
57 | " ${_current_FILE}\n") | ||||
58 | endif() | ||||
54 | get_filename_component(_basename ${_tmp_FILE} NAME_WE) | 59 | get_filename_component(_basename ${_tmp_FILE} NAME_WE) | ||
55 | set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h) | 60 | set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h) | ||
56 | 61 | | |||
57 | get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION) | 62 | get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION) | ||
58 | # we need to run uic and replace some things in the generated file | 63 | # we need to run uic and replace some things in the generated file | ||
59 | # this is done by executing the cmake script kf5i18nuic.cmake | 64 | # this is done by executing the cmake script kf5i18nuic.cmake | ||
60 | add_custom_command(OUTPUT ${_header} | 65 | add_custom_command(OUTPUT ${_header} | ||
61 | COMMAND ${CMAKE_COMMAND} | 66 | COMMAND ${CMAKE_COMMAND} | ||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |
This assumes a relative path given. It might make sense to also deal with absolute path, and only append CMAKE_CURRENT_LIST_DIR if not absolute, then check for existance?