From: Wang Xiang W Date: Mon, 17 Feb 2020 09:41:36 +0000 (-0500) Subject: gcc-9: fix CMake parsing of CPU architecture for non-English locale X-Git-Tag: v5.3.0^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbf04d615d8b1dad5bbaa8deba28ebc5750dc063;p=thirdparty%2Fvectorscan.git gcc-9: fix CMake parsing of CPU architecture for non-English locale Fixes github issue #217 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 83197af1..297a3b33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,9 +187,9 @@ else() set (EXEC_ARGS ${CC_ARG1} -c -Q --help=target -march=native -mtune=native) execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS} OUTPUT_VARIABLE _GCC_OUTPUT) - string(FIND "${_GCC_OUTPUT}" "Known" POS) - string(SUBSTRING "${_GCC_OUTPUT}" 0 ${POS} _GCC_OUTPUT) - string(REGEX REPLACE ".*march=[ \t]*([^ \n]*)[ \n].*" "\\1" + string(FIND "${_GCC_OUTPUT}" "march" POS) + string(SUBSTRING "${_GCC_OUTPUT}" ${POS} -1 _GCC_OUTPUT) + string(REGEX REPLACE "march=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_ARCH "${_GCC_OUTPUT}") # test the parsed flag