gcc-9: fix CMake parsing of CPU architecture

GCC-9 adds known options section for march that causes regex
replace failure in CMake file

Fixes github issue #136
This commit is contained in:
Wang, Xiang W 2019-03-25 06:02:39 -04:00 committed by Wang Xiang W
parent f9c78376d9
commit 5c8f06e4c8

View File

@ -191,6 +191,8 @@ 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"
GNUCC_ARCH "${_GCC_OUTPUT}")