From: Wang, Xiang W Date: Mon, 25 Mar 2019 10:02:39 +0000 (-0400) Subject: gcc-9: fix CMake parsing of CPU architecture X-Git-Tag: v5.1.1^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8f06e4c89ff6ee58ef11035de7feb7b628153b;p=thirdparty%2Fvectorscan.git 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cac4fab7..5601c287 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}")