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.
This commit is contained in:
Brad King 2015-06-18 11:24:54 -04:00
parent c65a060e1b
commit 5f0dad75a9
1 changed files with 6 additions and 5 deletions

View File

@ -37,11 +37,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
"" ""
${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
if(NOT CMAKE_${lang}_COMPILER_ID)
CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
endforeach() endforeach()
if(CMAKE_${lang}_COMPILER_ID)
break()
endif() endif()
endforeach() endforeach()