CMake ts fix 5

This commit is contained in:
Krad
2021-12-23 14:08:55 +08:00
parent 3554e547a5
commit a853ed8ed6

View File

@@ -39,26 +39,18 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM TRUE)
set(TS_FILES
./src/translations/en_US.ts
./src/translations/zh_CN.ts)
find_package(Qt5 COMPONENTS ${REQUIRED_LIBS} LinguistTools REQUIRED)
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
set(TS_FILES
src/translations/en_US.ts
src/translations/zh_CN.ts)
foreach(_file ${TS_FILES})
set(backup ${CMAKE_CURRENT_SOURCE_DIR}/${_file}.bak)
if(NOT EXISTS ${backup})
file( WRITE ${backup} "<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE TS><TS version=\"2.1\" language=\"zh_CN\"><context></context></TS>")
endif()
endforeach()
find_package(Qt5 COMPONENTS ${REQUIRED_LIBS} LinguistTools REQUIRED)
set(cpp_source_all ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} )
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_SOURCE_DIR}/src/translations)
qt5_create_translation(QM_FILES ${cpp_source_all} ${ui_FILES} ${TS_FILES})
add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} ${QM_FILES} )
if(NOT UNIX)
find_program(POWERSHELL_PATH NAMES powershell)
endif()