diff options
author | Brad King <brad.king@kitware.com> | 2015-06-18 15:24:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-18 15:27:00 (GMT) |
commit | 5f0dad75a9dd9bb9e7b2f917806588563c3ed39e (patch) | |
tree | 5eccf1bff5b688d87fc6f7e29b136a6f8bea30c9 /Modules/CMakeDetermineCompilerId.cmake | |
parent | c65a060e1b19a463312f9003bc4d7793db9630e5 (diff) | |
download | CMake-5f0dad75a9dd9bb9e7b2f917806588563c3ed39e.zip CMake-5f0dad75a9dd9bb9e7b2f917806588563c3ed39e.tar.gz CMake-5f0dad75a9dd9bb9e7b2f917806588563c3ed39e.tar.bz2 |
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.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7ddf33f..3c715e9 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() |