summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-29 15:19:15 (GMT)
committerBrad King <brad.king@kitware.com>2015-06-30 14:14:08 (GMT)
commit99d160385e22ab7bd8e712d5a58460940573cfcd (patch)
tree1c46739797b220168ca6b3f900ddd40fa879dbf1 /Modules/CMakeDetermineCompilerId.cmake
parentbbfebcbc13df87173dd8cb59cd34e1e0b3e1c0cc (diff)
downloadCMake-99d160385e22ab7bd8e712d5a58460940573cfcd.zip
CMake-99d160385e22ab7bd8e712d5a58460940573cfcd.tar.gz
CMake-99d160385e22ab7bd8e712d5a58460940573cfcd.tar.bz2
CMakeDetermineCompilerId: Use per-language regex to match Xcode compiler tool
Move the Ld invocation match expression from CMakeDetermineCompilerId into CMakeDetermine{C,CXX,Fortran}Compiler so that it can be specified on a per-language basis.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake15
1 files changed, 6 insertions, 9 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 487429b..c699315 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -304,15 +304,12 @@ Id flags: ${testflags}
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}")
endif()
- # Match the link line from xcodebuild output of the form
- # Ld ...
- # ...
- # /path/to/cc ...CompilerId${lang}/...
- # to extract the compiler front-end for the language.
- if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?(CompilerId${lang}.xctest/)?CompilerId${lang}[ \t\n\\\"]")
- set(_comp "${CMAKE_MATCH_2}")
- if(EXISTS "${_comp}")
- set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX)
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}")
+ set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}")
+ if(EXISTS "${_comp}")
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ endif()
endif()
endif()
else()