Merge branch 'bugfix/cmake_check_crosstool_ng_version' into 'master'

cmake: fix crosstool-NG version check regex

See merge request idf/esp-idf!5163
This commit is contained in:
Ivan Grokhotkov 2019-06-10 20:23:57 +08:00
commit bde1c30c5b

View 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.