Commit 5f0dad75 authored by Brad King's avatar Brad King

CMakeDetermineCompilerId: Refactor id build/check loop logic

Callers of CMAKE_DETERMINE_COMPILER_ID initialize the
CMAKE_${lang}_COMPILER_ID to unset so we can check it at the end of each
loop iteration instead of the beginning.  This approach allows us to
break out of the loop as soon as we succeed.  It will also allow checks
to be added in more places within the loop later.
parent c65a060e
......@@ -37,11 +37,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
""
${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
if(NOT CMAKE_${lang}_COMPILER_ID)
CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
endforeach()
CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
endforeach()
if(CMAKE_${lang}_COMPILER_ID)
break()
endif()
endforeach()
......
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