Commit e6c9bc26 authored by Alexander Neundorf's avatar Alexander Neundorf

Add timeout to execute_process() in CMAKE_DETERMINE_COMPILER_ID().

In CMAKE_DETERMINE_COMPILER_ID_VENDOR() the compiler is called with various
arguments. In some cases, this can make the compiler hang and wait
forever for input (e.g. "as -v"). That's why add an timeout
so it terminates finally. 10 seconds should be more than enough,
this is the time it takes to startup the compiler, which is
usually quite fast.

Alex
parent ab909166
......@@ -283,6 +283,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE output ERROR_VARIABLE output
RESULT_VARIABLE result
TIMEOUT 10
)
IF("${output}" MATCHES "${regex}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
......@@ -290,10 +291,16 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
"matched \"${regex}\":\n${output}")
SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
BREAK()
ELSE()
IF("${result}" MATCHES "timeout")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
"terminated after 10 s due to timeout.")
ELSE()
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
"did not match \"${regex}\":\n${output}")
ENDIF()
ENDIF()
ENDFOREACH()
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment