summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeFindBinUtils.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-06 12:13:55 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-07 12:43:45 (GMT)
commit4d786dfcfa5a9391b5ec5f41dd015c9c3d52c358 (patch)
tree31df43b91d3eeec0f993d8961bfbb74516718363 /Modules/CMakeFindBinUtils.cmake
parent26af5908ec3be728b8ae487926b542be63e11af7 (diff)
downloadCMake-4d786dfcfa5a9391b5ec5f41dd015c9c3d52c358.zip
CMake-4d786dfcfa5a9391b5ec5f41dd015c9c3d52c358.tar.gz
CMake-4d786dfcfa5a9391b5ec5f41dd015c9c3d52c358.tar.bz2
BinUtils: Avoid clobbering a variable named without a private prefix
Refactoring in commit b12aec6c8d (BinUtils: prefer bin utils matching the compiler version extension, 2020-12-11, v3.20.0-rc1~171^2) accidentally leaked a `TOOL` variable. Name temporary variables with a private prefix. Fixes: #22035
Diffstat (limited to 'Modules/CMakeFindBinUtils.cmake')
-rw-r--r--Modules/CMakeFindBinUtils.cmake20
1 files changed, 10 insertions, 10 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e87a16b..f32266f 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -123,19 +123,19 @@ else()
list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
endif()
-foreach(TOOL IN LISTS _CMAKE_TOOL_VARS)
- foreach(NAME IN LISTS _CMAKE_${TOOL}_NAMES)
+foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
+ foreach(_name IN LISTS _CMAKE_${_tool}_NAMES)
if(NOT _CMAKE_TOOLCHAIN_PREFIX STREQUAL "")
if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
- list(PREPEND _CMAKE_${TOOL}_NAMES ${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+ list(PREPEND _CMAKE_${_tool}_NAMES ${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
endif()
- list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME})
+ list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name})
endif()
if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
- list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+ list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
endif()
endforeach()
- find_program(CMAKE_${TOOL} NAMES ${_CMAKE_${TOOL}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ find_program(CMAKE_${_tool} NAMES ${_CMAKE_${_tool}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
endforeach()
if(NOT CMAKE_RANLIB)
@@ -154,12 +154,12 @@ if(CMAKE_PLATFORM_HAS_INSTALLNAME)
endif()
# Mark any tool cache entries as advanced.
-foreach(var IN LISTS _CMAKE_TOOL_VARS)
- get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${var} PROPERTY TYPE)
+foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
+ get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${_tool} PROPERTY TYPE)
if(_CMAKE_TOOL_CACHED)
- mark_as_advanced(CMAKE_${var})
+ mark_as_advanced(CMAKE_${_tool})
endif()
- unset(_CMAKE_${var}_NAMES)
+ unset(_CMAKE_${_tool}_NAMES)
endforeach()
unset(_CMAKE_TOOL_VARS)
unset(_CMAKE_TOOL_CACHED)