diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2022-08-20 22:00:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-09-22 13:24:46 (GMT) |
commit | a509602699eb83fbbea67244051c8a18f708a6ae (patch) | |
tree | 94dc40d7c2f27d428e3e421a079fdb9c74ca29e3 /Source | |
parent | 914d21de58094d461c9f86738136fb034a691113 (diff) | |
download | CMake-a509602699eb83fbbea67244051c8a18f708a6ae.zip CMake-a509602699eb83fbbea67244051c8a18f708a6ae.tar.gz CMake-a509602699eb83fbbea67244051c8a18f708a6ae.tar.bz2 |
Build: Modernize some `foreach` calls to use `IN LISTS`/`IN ITEMS`
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 8 |
2 files changed, 8 insertions, 11 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 86f8116..8f4750e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -881,16 +881,13 @@ if(WIN32 AND NOT CYGWIN) target_link_libraries(cmcldeps CMakeLib) endif() -foreach(v CURL_CA_BUNDLE CURL_CA_PATH) +foreach(v IN ITEMS CURL_CA_BUNDLE CURL_CA_PATH) if(${v}) set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}") endif() endforeach() -foreach(check - STAT_HAS_ST_MTIM - STAT_HAS_ST_MTIMESPEC - ) +foreach(check IN ITEMS STAT_HAS_ST_MTIM STAT_HAS_ST_MTIMESPEC) if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry set(CMake_${check} 1) else() @@ -1217,7 +1214,7 @@ if(WIN32) # MinGW's windres tool with spaces in the path to the include directories. add_library(CMakeVersion OBJECT "${CMAKE_CURRENT_BINARY_DIR}/CMakeVersion.rc") set_property(TARGET CMakeVersion PROPERTY INCLUDE_DIRECTORIES "") - foreach(_tool ${_tools}) + foreach(_tool IN LISTS _tools) target_sources(${_tool} PRIVATE $<TARGET_OBJECTS:CMakeVersion>) endforeach() endif() @@ -1229,7 +1226,7 @@ endif() # Install tools -foreach(_tool ${_tools}) +foreach(_tool IN LISTS _tools) CMake_OPTIONAL_COMPONENT(${_tool}) install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT}) endforeach() diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 0c263bb..9b6007c 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -100,13 +100,13 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) endif() endmacro() macro(install_qt_plugins _comps _plugins_var) - foreach(_qt_comp ${${_comps}}) + foreach(_qt_comp IN LISTS ${_comps}) if (INSTALLED_QT_VERSION VERSION_LESS 6) set(_qt_module_plugins ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_PLUGINS}) else() get_target_property(_qt_module_plugins Qt${INSTALLED_QT_VERSION}::${_qt_comp} QT_PLUGINS) endif() - foreach(_qt_plugin ${_qt_module_plugins}) + foreach(_qt_plugin IN LISTS _qt_module_plugins) if (INSTALLED_QT_VERSION VERSION_GREATER_EQUAL 6) # Qt6 provides the plugins as individual packages that need to be found. find_package(Qt${INSTALLED_QT_VERSION}${_qt_plugin} QUIET @@ -308,13 +308,13 @@ install(TARGETS cmake-gui ${CMAKE_INSTALL_DESTINATION_ARGS}) if(UNIX AND NOT APPLE) - foreach (size IN ITEMS 32 128) + foreach(size IN ITEMS 32 128) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" DESTINATION "${CMAKE_XDGDATA_DIR}/icons/hicolor/${size}x${size}/apps" ${COMPONENT} RENAME "CMakeSetup.png") - endforeach () + endforeach() # install a desktop file so CMake appears in the application start menu # with an icon |