diff options
Diffstat (limited to 'Modules/CMakeDetermineCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompiler.cmake | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index 7a5cbcd..85c8662 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -71,7 +71,7 @@ macro(_cmake_find_compiler lang) unset(_languages) # Look for a make tool provided by Xcode - if(CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND" AND CMAKE_HOST_APPLE) + if(CMAKE_HOST_APPLE) macro(_query_xcrun compiler_name result_var_keyword result_var) if(NOT "x${result_var_keyword}" STREQUAL "xRESULT_VAR") message(FATAL_ERROR "Bad arguments to macro") @@ -81,13 +81,21 @@ macro(_cmake_find_compiler lang) ERROR_VARIABLE _xcrun_err) set("${result_var}" "${_xcrun_out}") endmacro() - foreach(comp ${CMAKE_${lang}_COMPILER_LIST}) - _query_xcrun("${comp}" RESULT_VAR _xcrun_result) - if(_xcrun_result) - set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${_xcrun_result}") - break() - endif() - endforeach() + + set(xcrun_result) + if (CMAKE_${lang}_COMPILER MATCHES "^/usr/bin/(.+)$") + _query_xcrun("${CMAKE_MATCH_1}" RESULT_VAR xcrun_result) + elseif (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND") + foreach(comp ${CMAKE_${lang}_COMPILER_LIST}) + _query_xcrun("${comp}" RESULT_VAR xcrun_result) + if(xcrun_result) + break() + endif() + endforeach() + endif() + if (xcrun_result) + set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${xcrun_result}") + endif() endif() endmacro() |