From 5f0dad75a9dd9bb9e7b2f917806588563c3ed39e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 11:24:54 -0400 Subject: 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. --- Modules/CMakeDetermineCompilerId.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Modules/CMakeDetermineCompilerId.cmake') diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7ddf33fcf6..3c715e91e2 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -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() -- cgit v1.2.1