From fbcae3bda8d3ad8be7b23eb8c4465fa8020e4d76 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Nov 2025 18:22:30 -0700 Subject: [PATCH 1/3] Add an rc file for cmake-lint --- .cmakelintrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .cmakelintrc diff --git a/.cmakelintrc b/.cmakelintrc new file mode 100644 index 00000000..2e4a4578 --- /dev/null +++ b/.cmakelintrc @@ -0,0 +1,3 @@ +# CMake lint file for hipFile +# https://cmake-format.readthedocs.io/en/latest/cmake-lint.html +filter=-linelength From 3fd1a1944cc7e54a979c13c084daf718d19956ba Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Nov 2025 18:22:53 -0700 Subject: [PATCH 2/3] Fix cmake-lint issues Does not fix the FetchContent naming complaints as those are not something we control --- cmake/AISCompilerOptions.cmake | 2 +- cmake/AISGNUCompilerOptions.cmake | 2 +- cmake/AISInstall.cmake | 2 +- cmake/AISSanitizers.cmake | 2 +- cmake/AISSetCoverageFile.cmake | 4 ++-- cmake/AISUseGTest.cmake | 2 +- rocfile/src/CMakeLists.txt | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/AISCompilerOptions.cmake b/cmake/AISCompilerOptions.cmake index 2f013be9..58aea238 100644 --- a/cmake/AISCompilerOptions.cmake +++ b/cmake/AISCompilerOptions.cmake @@ -7,7 +7,7 @@ include(AISClangCompilerOptions) include(AISGNUCompilerOptions) -function (ais_set_compiler_flags target) +function(ais_set_compiler_flags target) get_target_property(sources ${target} SOURCES) foreach(source IN LISTS sources) get_source_file_property(language ${source} LANGUAGE) diff --git a/cmake/AISGNUCompilerOptions.cmake b/cmake/AISGNUCompilerOptions.cmake index 52324f50..070cd7db 100644 --- a/cmake/AISGNUCompilerOptions.cmake +++ b/cmake/AISGNUCompilerOptions.cmake @@ -9,7 +9,7 @@ function(get_ais_gnu_warning_flags outvar compiler_version) # Warning flags for g++ 9 and earlier - set(flags + set(flags # Basic "high" warning levels -Wall -Wextra diff --git a/cmake/AISInstall.cmake b/cmake/AISInstall.cmake index 9bcc9692..14b38019 100644 --- a/cmake/AISInstall.cmake +++ b/cmake/AISInstall.cmake @@ -28,7 +28,7 @@ if(BUILD_ROCFILE OR BUILD_HIPFILE) ) endif() if(BUILD_HIPFILE) - rocm_install( + rocm_install( DIRECTORY ${CMAKE_SOURCE_DIR}/hipfile/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/cmake/AISSanitizers.cmake b/cmake/AISSanitizers.cmake index 29a4bf09..561e13d1 100644 --- a/cmake/AISSanitizers.cmake +++ b/cmake/AISSanitizers.cmake @@ -9,7 +9,7 @@ if(AIS_BUILD_THREAD_SANITIZERS) message(WARNING "TSAN has known problems with higher levels of entropy, try using `sudo sysctl vm.mmap_rnd_bits=28` if you encounter errors concerning unexpected memory mappings.") endif() -function (ais_add_sanitizers target) +function(ais_add_sanitizers target) if(AIS_BUILD_SANITIZERS AND AIS_BUILD_THREAD_SANITIZERS) message(FATAL_ERROR "AIS_BUILD_SANITIZERS is not compatible with AIS_BUILD_THREAD_SANITIZERS") endif() diff --git a/cmake/AISSetCoverageFile.cmake b/cmake/AISSetCoverageFile.cmake index 71207a61..deb963fa 100644 --- a/cmake/AISSetCoverageFile.cmake +++ b/cmake/AISSetCoverageFile.cmake @@ -2,13 +2,13 @@ # # SPDX-License-Identifier: MIT -function (ais_set_coverage_file test_list_name directory) +function(ais_set_coverage_file test_list_name directory) set(test_counter 0) set(test_list "${${test_list_name}}") foreach(test IN LISTS test_list) set_tests_properties( ${test} PROPERTIES ENVIRONMENT_MODIFICATION "LLVM_PROFILE_FILE=set:${directory}/${test_list_name}.${test_counter}.profraw") - MATH(EXPR test_counter "${test_counter}+1") + math(EXPR test_counter "${test_counter}+1") endforeach() endfunction() diff --git a/cmake/AISUseGTest.cmake b/cmake/AISUseGTest.cmake index 4c43d837..f96fe0d2 100644 --- a/cmake/AISUseGTest.cmake +++ b/cmake/AISUseGTest.cmake @@ -23,7 +23,7 @@ endif() include(GoogleTest) -function (ais_gtest_discover_tests target) +function(ais_gtest_discover_tests target) cmake_language(CALL gtest_discover_tests ${ARGV}) if(BUILD_CODE_COVERAGE) diff --git a/rocfile/src/CMakeLists.txt b/rocfile/src/CMakeLists.txt index 782f2dd7..42ff398b 100644 --- a/rocfile/src/CMakeLists.txt +++ b/rocfile/src/CMakeLists.txt @@ -26,6 +26,6 @@ ais_add_libraries( DETAIL amd SRCS ${ROCFILE_SOURCES} LIBINCL ${ROCFILE_INCLUDE_PATH} - SYSINCLS ${ROCFILE_SOURCE_PATH} + SYSINCLS ${ROCFILE_SOURCE_PATH} LIBS mount ) From a06a6390bc78b6f63035a93a03663b7c8225dc3e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Nov 2025 18:35:23 -0700 Subject: [PATCH 3/3] Add CMake linter comments The CMake linter does not like FooBar_BazWhat. --- cmake/AISUseGTest.cmake | 4 ++++ cmake/AISUseROCmCMake.cmake | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cmake/AISUseGTest.cmake b/cmake/AISUseGTest.cmake index f96fe0d2..7c6c7159 100644 --- a/cmake/AISUseGTest.cmake +++ b/cmake/AISUseGTest.cmake @@ -3,6 +3,8 @@ # SPDX-License-Identifier: MIT include(FetchContent) + +# lint_cmake: -readability/wonkycase FetchContent_Declare( googletest URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz @@ -13,7 +15,9 @@ FetchContent_Declare( set(INSTALL_GTEST OFF CACHE BOOL "Don't install gtest.") set(GTEST_HAS_ABSL OFF CACHE BOOL "Don't use abseil for GTest.") + FetchContent_MakeAvailable(googletest) +# lint_cmake: +readability/wonkycase if(rocm-cmake_SOURCE_DIR) message(STATUS "Using fetched googletest.") diff --git a/cmake/AISUseROCmCMake.cmake b/cmake/AISUseROCmCMake.cmake index 8c8555ca..8e7f6668 100644 --- a/cmake/AISUseROCmCMake.cmake +++ b/cmake/AISUseROCmCMake.cmake @@ -4,6 +4,7 @@ include(FetchContent) +# lint_cmake: -readability/wonkycase FetchContent_Declare( rocm-cmake URL https://github.com/ROCm/rocm-cmake/archive/refs/tags/rocm-6.4.3.tar.gz @@ -13,6 +14,7 @@ FetchContent_Declare( FIND_PACKAGE_ARGS NAMES ROCmCMakeBuildTools ) FetchContent_MakeAvailable(rocm-cmake) +# lint_cmake: +readability/wonkycase if(rocm-cmake_SOURCE_DIR) message(STATUS "Using fetched rocm-cmake.")