CMakeLists.txt
#查找當前檔案夾中的所有源代碼檔案,也可以通過Set命令將所有檔案設定為一個變數
FILE(GLOB CPP_FILES "*.cpp")
#同理,查找當前檔案夾中所有的頭檔案
FILE(GLOB HEAD_FILES "*.h")
#同理,查找當前檔案夾中所有的ui檔案
FILE(GLOB UI_FILES "*.ui")
FILE(GLOB TS_FILES "*.ts")
#通過Ui檔案生成對應的頭檔案,一定要添加
qt5_wrap_ui(WRAP_FILES ${UI_FILES})
qt5_create_translation(Translate ${CMAKE_SOURCE_DIR} ${TS_FILES}) #${UI_FILES} ${CPP_FILES}
message(WARNING ${TS_FILES})
編譯結果 lupdate更新失敗,路徑下存在.ts檔案。
我想知道為什么會失敗?是哪里的路徑設定錯誤嗎?我用qmake建立的工程可以正常更新。
用命令呼叫的可以成功,通過QT選單呼叫怎么可以獲取到傳給lupdate.exe的引數?
以下輸出資訊:
Starting external tool "E:\QT5\5.14.2\mingw73_32\bin\lupdate.exe E:/QT5project/Manager/CMakeLists.txt"
Running E:\tools\CMake\cmake-3.18.2-win64-x64\bin\cmake.exe E:/QT5project/Manager "-GCodeBlocks - MinGW Makefiles" in E:\QT5project\build-Manager-Desktop_Qt_5_14_2_MinGW_32_bit-Debug.
lupdate warning: no TS files specified. Only diagnostics will be produced.
"E:\QT5\5.14.2\mingw73_32\bin\lupdate.exe" finished
CMake Warning at CMakeLists.txt:36 (message):
E:/QT5project/Manager/manager_chs.tsE:/QT5project/Manager/manager_cht.tsE:/QT5project/Manager/manager_eng.ts
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/175277.html
標籤:Qt
