[cmake-developers] [CMake 0014635]: CMake with Xcode generator breaks with Xcode 5.1 DP due to brittle regex in CMakeDetermineCompilerId.cmake

Mantis Bug Tracker mantis at public.kitware.com
Fri Dec 6 19:18:46 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14635 
====================================================================== 
Reported By:                Ted Kremenek
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14635
Category:                   (No Category)
Reproducibility:            always
Severity:                   major
Priority:                   urgent
Status:                     new
====================================================================== 
Date Submitted:             2013-12-06 19:18 EST
Last Modified:              2013-12-06 19:18 EST
====================================================================== 
Summary:                    CMake with Xcode generator breaks with Xcode 5.1 DP
due to brittle regex in CMakeDetermineCompilerId.cmake
Description: 
Logic in CMakeDetermineCompilerId.cmake tries to determine the compiler version
number by scraping the output of xcodebuild.  Cleanups in the output of Xcode
5.1 (Developer Preview) causes this regex to break.  The fix is very simple:

diff --git a/CMakeDetermineCompilerId.cmake b/CMakeDetermineCompilerId.cmake
index 8ca5334..dd0c2bd 100644
--- a/CMakeDetermineCompilerId.cmake
+++ b/CMakeDetermineCompilerId.cmake
@@ -209,7 +209,7 @@ Id flags: ${testflags}
     #      ...
     #      /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}[ \t\n\\\"]")
+    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}[
\t\n\\\"]")
       set(_comp "${CMAKE_MATCH_2}")
       if(EXISTS "${_comp}")
         set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)

Essentially this makes matching the "./" before the project name optional. 
Making this match optional fixes the problem.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-12-06 19:18 Ted Kremenek   New Issue                                    
======================================================================



More information about the cmake-developers mailing list