1*da0073e9SAndroid Build Coastguard Worker 2*da0073e9SAndroid Build Coastguard Workerif(__caffe2_allowlist_included) 3*da0073e9SAndroid Build Coastguard Worker return() 4*da0073e9SAndroid Build Coastguard Workerendif() 5*da0073e9SAndroid Build Coastguard Worker 6*da0073e9SAndroid Build Coastguard Workerset(__caffe2_allowlist_included TRUE) 7*da0073e9SAndroid Build Coastguard Worker 8*da0073e9SAndroid Build Coastguard Workerset(CAFFE2_ALLOWLISTED_FILES) 9*da0073e9SAndroid Build Coastguard Workerif(NOT CAFFE2_ALLOWLIST) 10*da0073e9SAndroid Build Coastguard Worker return() 11*da0073e9SAndroid Build Coastguard Workerendif() 12*da0073e9SAndroid Build Coastguard Worker 13*da0073e9SAndroid Build Coastguard Worker# First read the allowlist file and break it by line. 14*da0073e9SAndroid Build Coastguard Workerfile(READ "${CAFFE2_ALLOWLIST}" allowlist_content) 15*da0073e9SAndroid Build Coastguard Worker# Convert file contents into a CMake list 16*da0073e9SAndroid Build Coastguard Workerstring(REGEX REPLACE "\n" ";" allowlist_content ${allowlist_content}) 17*da0073e9SAndroid Build Coastguard Worker 18*da0073e9SAndroid Build Coastguard Workerforeach(item ${allowlist_content}) 19*da0073e9SAndroid Build Coastguard Worker file(GLOB_RECURSE tmp ${item}) 20*da0073e9SAndroid Build Coastguard Worker set(CAFFE2_ALLOWLISTED_FILES ${CAFFE2_ALLOWLISTED_FILES} ${tmp}) 21*da0073e9SAndroid Build Coastguard Workerendforeach() 22*da0073e9SAndroid Build Coastguard Worker 23*da0073e9SAndroid Build Coastguard Workermacro(caffe2_do_allowlist output allowlist) 24*da0073e9SAndroid Build Coastguard Worker set(_tmp) 25*da0073e9SAndroid Build Coastguard Worker foreach(item ${${output}}) 26*da0073e9SAndroid Build Coastguard Worker list(FIND ${allowlist} ${item} _index) 27*da0073e9SAndroid Build Coastguard Worker if(${_index} GREATER -1) 28*da0073e9SAndroid Build Coastguard Worker set(_tmp ${_tmp} ${item}) 29*da0073e9SAndroid Build Coastguard Worker endif() 30*da0073e9SAndroid Build Coastguard Worker endforeach() 31*da0073e9SAndroid Build Coastguard Worker set(${output} ${_tmp}) 32*da0073e9SAndroid Build Coastguard Workerendmacro() 33