Compare commits
No commits in common. "2f8024b6704615cf8e2cc19b081bdaf02f8c1b5e" and "f0d887e4888fffc2277e0d3d8ed33c06f8217b99" have entirely different histories.
2f8024b670
...
f0d887e488
@ -30,13 +30,13 @@ function(common_target_properties Name)
|
||||
endif()
|
||||
if(TARGET Qt5::Widgets)
|
||||
set_target_properties(${Name} PROPERTIES AUTOUIC TRUE)
|
||||
# if(CMAKE_VERSION VERSION_LESS 3.7.99)
|
||||
# target_include_directories(
|
||||
# ${Name}
|
||||
# PUBLIC
|
||||
# $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${Name}_autogen/include>
|
||||
# )
|
||||
# endif()
|
||||
if(CMAKE_VERSION VERSION_LESS 3.7.99)
|
||||
target_include_directories(
|
||||
${Name}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_autogen/include>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND NOT APPLE)
|
||||
set_target_properties(${Name} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
|
||||
|
@ -24,32 +24,37 @@ function(qt_translation)
|
||||
set(_ts "${_target}_${_lang}.ts")
|
||||
set(_qm "${_target}_${_lang}.qm")
|
||||
list(APPEND _ts_list ${_ts_dir}/${_ts})
|
||||
list(APPEND _l10n_targets "${_target}_l10n_${_lang}")
|
||||
string(APPEND L10N_QRC_BODY "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||
|
||||
add_custom_target(${_target}_l10n_${_lang}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources_list} -ts ${_ts_dir}/${_ts} -target-language ${_lang}
|
||||
DEPENDS ${_sources_list})
|
||||
|
||||
if(NOT EXISTS "${_ts_dir}/${_ts}")
|
||||
add_custom_target(${_ts} DEPENDS ${_target}_l10n_${_lang})
|
||||
else()
|
||||
add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
|
||||
if(NOT EXISTS ${_ts_dir}/${_ts})
|
||||
file(WRITE ${_ts_dir}/${_ts} "<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version=\"2.1\" language=\"${_lang}\"></TS>")
|
||||
endif()
|
||||
string(APPEND L10N_QRC_BODY
|
||||
"<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
|
||||
COMMAND ${Qt5_LRELEASE_EXECUTABLE}
|
||||
ARGS ${_ts_dir}/${_ts} -qm ${CMAKE_BINARY_DIR}/${_qm}
|
||||
DEPENDS ${_ts})
|
||||
ARGS ${_ts_dir}/${_ts} -qm
|
||||
${CMAKE_BINARY_DIR}/${_qm}
|
||||
DEPENDS ${_ts_dir}/${_ts})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${_ts_list}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
|
||||
ARGS ${_sources_list} -ts ${_ts_list}
|
||||
DEPENDS ${_sources_list})
|
||||
|
||||
configure_file(${CMLIB_MODULE_DIR}/qrc/l10n.qrc.in
|
||||
${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
||||
qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
|
||||
add_custom_target(${_target}_qrc DEPENDS ${_qrc})
|
||||
add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets})
|
||||
add_custom_target(_qrc_target DEPENDS ${_qrc})
|
||||
|
||||
add_dependencies(${_target} ${_target}_qrc)
|
||||
foreach(_lang ${_languages})
|
||||
set(_ts "${_target}_${_lang}.ts")
|
||||
set(_qm "${_target}_${_lang}.qm")
|
||||
endforeach()
|
||||
|
||||
add_dependencies(${_target} _qrc_target)
|
||||
target_sources(${_target} PUBLIC ${_qrc})
|
||||
endfunction()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user