From cbf04d615d8b1dad5bbaa8deba28ebc5750dc063 Mon Sep 17 00:00:00 2001 From: Wang Xiang W Date: Mon, 17 Feb 2020 04:41:36 -0500 Subject: [PATCH] gcc-9: fix CMake parsing of CPU architecture for non-English locale Fixes github issue #217 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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