qt5/6: 增加兼容性构建检查方案,如果文件中存在 true 将认为可兼容构建

This commit is contained in:
zinface 2023-03-01 02:53:30 +08:00
parent bb5af11a50
commit 5414380422
3 changed files with 25 additions and 0 deletions

View File

@ -110,3 +110,13 @@ endif()
# ----------------- Notepad-- 线 ----------------- #
if(USE_QT6)
# Qt5/Qt6
include(cmake/platforms/utils.cmake)
qt5_qt6_compatible_check(cmake/qt5_qt6_compatible_check QT56_PASS)
if(NOT QT56_PASS)
message(SEND_ERROR "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前未能检查通过,不建议构建 Qt6。")
else()
message(NOTICE "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前检查通过。")
endif(NOT QT56_PASS)
endif(USE_QT6)

View File

@ -38,3 +38,17 @@ endfunction(get_current_platform_lib_name _VAR _IS_SHREAD _LIB)
# MacOS
# .a .dylib
# lib
# qt5_qt6_compatible_check <file> <var>
# Qt5/6 true
# _CHECK_FILE Qt5/Qt6
# _VAR
function(qt5_qt6_compatible_check _CHECK_FILE _VAR)
set(${_VAR} true PARENT_SCOPE)
file(READ ${_CHECK_FILE} file_content)
string(FIND ${file_content} "true" _index)
if(_index LESS 0)
# -1: It is not checked and passed
set(${_VAR} false PARENT_SCOPE)
endif(_index LESS 0)
endfunction(qt5_qt6_compatible_check _CHECK_FILE _VAR)

View File

@ -0,0 +1 @@
true