Files
pytorch/cmake/Whitelist.cmake
Nikita Shulga b9adbb5002 Fix/relax CMake linter rules (#35574)
Summary:
Ignore mixed upper-case/lower-case style for now
Fix space between function and its arguments violation
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35574

Test Plan: CI

Differential Revision: D20712969

Pulled By: malfet

fbshipit-source-id: 0012d430aed916b4518599a0b535e82d15721f78
2020-03-27 16:52:33 -07:00

33 lines
786 B
CMake

if(__caffe2_whitelist_included)
return()
endif()
set(__caffe2_whitelist_included TRUE)
set(CAFFE2_WHITELISTED_FILES)
if(NOT CAFFE2_WHITELIST)
return()
endif()
# First read the whitelist file and break it by line.
file(READ "${CAFFE2_WHITELIST}" whitelist_content)
# Convert file contents into a CMake list
string(REGEX REPLACE "\n" ";" whitelist_content ${whitelist_content})
foreach(item ${whitelist_content})
file(GLOB_RECURSE tmp ${item})
set(CAFFE2_WHITELISTED_FILES ${CAFFE2_WHITELISTED_FILES} ${tmp})
endforeach()
macro(caffe2_do_whitelist output whitelist)
set(_tmp)
foreach(item ${${output}})
list(FIND ${whitelist} ${item} _index)
if(${_index} GREATER -1)
set(_tmp ${_tmp} ${item})
endif()
endforeach()
set(${output} ${_tmp})
endmacro()