]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
gcc-9: fix CMake parsing of CPU architecture
authorWang, Xiang W <xiang.w.wang@intel.com>
Mon, 25 Mar 2019 10:02:39 +0000 (06:02 -0400)
committerWang Xiang W <xiang.w.wang@intel.com>
Tue, 26 Mar 2019 14:16:01 +0000 (10:16 -0400)
GCC-9 adds known options section for march that causes regex
replace failure in CMake file

Fixes github issue #136

CMakeLists.txt

index cac4fab7ea32ee673a5514dd2972369b709b11f7..5601c28771dab181b7d35f5790d79a64e3bfce70 100644 (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}")