• R/O
  • SSH

cmake_tools: Commit

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.


Commit MetaInfo

Revision0e0a93a5b008c758c699c64fe52b9a86f0b73bd4 (tree)
Zeit2022-09-12 18:38:56
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

Added cmtStringMidToEnd()

Ändern Zusammenfassung

Diff

diff -r 519159705076 -r 0e0a93a5b008 tools/string.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/string.cmake Mon Sep 12 12:38:56 2022 +0300
@@ -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)
Show on old repository browser