This library contains CMake code (files with .cmake extentions),
Python scripts and it is intended for simplification different actions
on the organization of the build environment.
Revision | 0e0a93a5b008c758c699c64fe52b9a86f0b73bd4 (tree) |
---|---|
Zeit | 2022-09-12 18:38:56 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
Added cmtStringMidToEnd()
@@ -0,0 +1,17 @@ | ||
1 | +# This Source Code Form is subject to the terms of the Mozilla Public | |
2 | +# License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 | +# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
4 | + | |
5 | +# Compatibility with old cmake | |
6 | + | |
7 | +function(cmtStringMidToEnd variable startIndex) | |
8 | + if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_LESS 12.8.5) | |
9 | + string(LENGTH "${variable}" CMT_VARIABLE_LENGTH__) | |
10 | + math(EXPR CMT_VARIABLE_LENGTH__ "${CMT_VARIABLE_LENGTH__} - 1") | |
11 | + string(SUBSTRING "${variable}" ${startIndex} ${CMT_VARIABLE_LENGTH__} CMT_NEW_VARIABLE__) | |
12 | + else() | |
13 | + string(SUBSTRING "${variable}" ${startIndex} -1 CMT_NEW_VARIABLE__) | |
14 | + endif() | |
15 | + | |
16 | + set(CMT_STRING_MID_TO_END "${CMT_NEW_VARIABLE__}" PARENT_SCOPE) | |
17 | +endFunction(cmtStringMidToEnd) |