]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
gcc-9: fix CMake parsing of CPU architecture for non-English locale
authorWang Xiang W <xiang.w.wang@intel.com>
Mon, 17 Feb 2020 09:41:36 +0000 (04:41 -0500)
committerHong, Yang A <yang.a.hong@intel.com>
Mon, 25 May 2020 13:46:42 +0000 (13:46 +0000)
Fixes github issue #217

CMakeLists.txt

index 83197af1e213516c1905bc8e2b90ad8854ee3598..297a3b33acd8c5c7808397007e314ca50d8e82d4 100644 (file)
@@ -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