Skip to content

Commit c01b4f1

Browse files
authored
Allow suppression of warnings in ROCMChecks (#281)
* fix: allow suppression of warning for third-party deps * fix: analyzer issues
1 parent 5f1f73d commit c01b4f1

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

share/rocmcmakebuildtools/cmake/ROCMChecks.cmake

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,30 @@ function(rocm_check_toolchain_var var access value list_file)
2525
set(message_type WARNING)
2626
set(message_title "ROCMChecks WARNING")
2727
endif()
28-
if(access STREQUAL "MODIFIED_ACCESS")
29-
set(cmake_module Off)
30-
get_filename_component(base "${list_file}" DIRECTORY)
31-
# Skip warning in cmake's built-in modules
32-
if("${base}" STREQUAL "${CMAKE_ROOT}/Modules")
33-
set(cmake_module On)
34-
elseif("${base}" MATCHES ".*/CMakeFiles/${CMAKE_VERSION}$")
35-
set(cmake_module On)
36-
endif()
37-
if(NOT cmake_module)
38-
message( "
28+
if(ROCM_WARN_TOOLCHAIN_VAR OR ROCM_ERROR_TOOLCHAIN_VAR)
29+
if(access STREQUAL "MODIFIED_ACCESS")
30+
set(cmake_module Off)
31+
get_filename_component(base "${list_file}" DIRECTORY)
32+
# Skip warning in cmake's built-in modules
33+
if("${base}" STREQUAL "${CMAKE_ROOT}/Modules")
34+
set(cmake_module On)
35+
elseif("${base}" MATCHES ".*/CMakeFiles/${CMAKE_VERSION}$")
36+
set(cmake_module On)
37+
endif()
38+
if(NOT cmake_module)
39+
message( "
3940
*******************************************************************************
4041
*------------------------------- ${message_title} --------------------------*
4142
Options and properties should be set on a cmake target where possible. The
4243
variable '${var}' may be set by the cmake toolchain, either by
4344
calling 'cmake -D${var}=\"${value}\"'
4445
or set in a toolchain file and added with
4546
'cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file>'. ROCMChecks now calling:")
46-
message(${message_type} "'${var}' is set at ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt:<line#> shown below:")
47-
message( "*-----------------------------------------------------------------------------*
47+
message(${message_type} "'${var}' is set at ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt:<line#> below:")
48+
message( "*-----------------------------------------------------------------------------*
4849
*******************************************************************************
4950
")
51+
endif()
5052
endif()
5153
endif()
5254
endfunction()

0 commit comments

Comments
 (0)