FindNeon.cmake seems to always detect neon feature

Issue #583 new
Mattias Wadman created an issue

Hi, I noticed that neon got enabled even when there was no neon feature in proc/cpuinfo and I think it happen because of how execute_process is used.

From cmake documentation https://cmake.org/cmake/help/latest/command/execute_process.html

COMMAND

A child process command line.

CMake executes the child process using operating system APIs directly. All arguments are passed VERBATIM to the child process. No intermediate shell is used, so shell operators such as > are treated as normal arguments. (Use the INPUT_*OUTPUT_*, and ERROR_* options to redirect stdin, stdout, and stderr.)

If a sequential execution of multiple commands is required, use multiple execute_process() calls with a single COMMAND argument.

So I think:

execute_process(COMMAND cat /proc/cpuinfo | grep Features | grep neon
                OUTPUT_VARIABLE neon_version
                ERROR_QUIET
                OUTPUT_STRIP_TRAILING_WHITESPACE)

Should be replaced with:

execute_process(COMMAND sh -c "cat /proc/cpuinfo | grep Features | grep neon"
                OUTPUT_VARIABLE neon_version
                ERROR_QUIET
                OUTPUT_STRIP_TRAILING_WHITESPACE)

Then it seems to work as it was intended (otherwise cat will get pipes and everything as filename arguments)

Comments (0)

  1. Log in to comment