diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-05-29 10:09:52 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-05-29 13:28:30 +0000 |
commit | bcca64944052618b8aa8e3f9be82eb5ccad5807e (patch) | |
tree | 086def781b4f5f989615e901fac1cfb0b231136c /cmake | |
parent | d908e0a47db862a43fbb11fe3f2beae01a42244b (diff) |
Fix architecture detection when targeting plain arm
We record extra CPU features such as neon, etc. in the sub-architecture
field, which may very well be empty. Allow for that and avoid cmake
warnings about indexed string access beyond the string boundaries.
Change-Id: I63e61c6427d156180039b8ac6f5b0f5f55c36ee8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBaseConfigureTests.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake index 7a5502bc65..d8024787f8 100644 --- a/cmake/QtBaseConfigureTests.cmake +++ b/cmake/QtBaseConfigureTests.cmake @@ -13,13 +13,14 @@ function(run_config_test_architecture) file(STRINGS "${_arch_file}" _arch_lines LENGTH_MINIMUM 16 LENGTH_MAXIMUM 1024 ENCODING UTF-8) foreach (_line ${_arch_lines}) + string(LENGTH "${line}" lineLength) string(FIND "${_line}" "==Qt=magic=Qt== Architecture:" _pos) if (_pos GREATER -1) math(EXPR _pos "${_pos}+29") string(SUBSTRING "${_line}" ${_pos} -1 _architecture) endif() string(FIND "${_line}" "==Qt=magic=Qt== Sub-architecture:" _pos) - if (_pos GREATER -1) + if (_pos GREATER -1 AND ${lineLength} GREATER 33) math(EXPR _pos "${_pos}+34") string(SUBSTRING "${_line}" ${_pos} -1 _sub_architecture) string(REPLACE " " ";" _sub_architecture "${_sub_architecture}") @@ -31,7 +32,7 @@ function(run_config_test_architecture) endif() endforeach() - if (NOT _architecture OR NOT _sub_architecture OR NOT _build_abi) + if (NOT _architecture OR NOT _build_abi) message(FATAL_ERROR "Failed to extract architecture data from file.") endif() |