]> granicus.if.org Git - esp-idf/commitdiff
cmake: fix crosstool-NG version check regex
authorSergei Silnov <sergei.silnov@espressif.com>
Fri, 7 Jun 2019 12:06:15 +0000 (14:06 +0200)
committerbot <bot@espressif.com>
Mon, 10 Jun 2019 09:51:40 +0000 (09:51 +0000)
tools/cmake/crosstool_version_check.cmake

index 2ea681da1be0f0c4b82da2e84fe233398500f4e4..93b77d55eb4d576ff09bb6b4770a44260b735e38 100644 (file)
@@ -12,11 +12,11 @@ endfunction()
 
 function(crosstool_version_check expected_ctng_version)
     execute_process(
-        COMMAND ${CMAKE_C_COMPILER} -v
-        ERROR_VARIABLE toolchain_stderr
-        OUTPUT_QUIET)
+        COMMAND ${CMAKE_C_COMPILER} --version
+        OUTPUT_VARIABLE toolchain_version
+        ERROR_QUIET)
 
-    string(REGEX MATCH "crosstool-ng-[0-9a-g\\.-]+" ctng_version "${toolchain_stderr}")
+    string(REGEX REPLACE ".*(crosstool-NG ([^\)]+)).*\n" "\\2" ctng_version "${toolchain_version}")
     # We use FIND to match version instead of STREQUAL because some toolchains are built
     # with longer git hash strings than others. This will match any version which starts with
     # the expected version string.