diff options
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 8ca5334..de4a882 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -80,6 +80,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- @@ -161,7 +163,8 @@ Id flags: ${testflags} ) # Match the compiler location line printed out. if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") - set(_comp "${CMAKE_MATCH_1}") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}") if(EXISTS "${_comp}") file(TO_CMAKE_PATH "${_comp}" _comp) set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) @@ -308,9 +311,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(COMPILER_ID) set(COMPILER_VERSION) set(PLATFORM_ID) + set(ARCHITECTURE_ID) + set(SIMULATE_ID) + set(SIMULATE_VERSION) file(STRINGS ${file} - CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:") - set(HAVE_COMPILER_TWICE 0) + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:") + set(COMPILER_ID_TWICE) foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") if(COMPILER_ID) @@ -332,6 +338,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() + if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*") + set(SIMULATE_ID "${CMAKE_MATCH_1}") + endif() + if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*") + set(SIMULATE_VERSION "${CMAKE_MATCH_1}") + string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") + string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") + endif() endforeach() # Detect the exact architecture from the PE header. @@ -369,6 +383,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}") + set(CMAKE_${lang}_SIMULATE_ID "${SIMULATE_ID}") + set(CMAKE_${lang}_SIMULATE_VERSION "${SIMULATE_VERSION}") endif() # Check the compiler identification string. @@ -417,6 +433,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) endfunction() |