Merge lp:~davidagraf/zorba/detect-clang-properly into lp:zorba

Proposed by David Graf
Status: Merged
Approved by: David Graf
Approved revision: 10942
Merged at revision: 10979
Proposed branch: lp:~davidagraf/zorba/detect-clang-properly
Merge into: lp:zorba
Diff against target: 27 lines (+12/-5)
1 file modified
CMakeCompiler.txt (+12/-5)
To merge this branch: bzr merge lp:~davidagraf/zorba/detect-clang-properly
Reviewer Review Type Date Requested Status
David Graf (community) Approve
Paul J. Lucas Approve
Review via email: mp+117994@code.launchpad.net

Commit message

Since OSX Mountain Lion, clang is the default c++ compiler on mac. Therefore, it is not enough to check if the c++ compiler executable is called clang.

Description of the change

Since OSX Mountain Lion, clang is the default c++ compiler on mac. Therefore, it is not enough to check if the c++ compiler executable is called clang.

To post a comment you must log in.
10942. By David Graf

detect clang properly

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

gcc --version only output the string "llvm" or "LLVM" and not "clang. You should check for "LLVM" and not "clang".

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Needs Fixing
Revision history for this message
David Graf (davidagraf) wrote :

Hey Paul

According to http://llvm.org/releases/2.6/docs/CommandGuide/html/llvmgxx.html, llvm-g++ behaves like g++. It's a different C and C++ front-end for the LLVM compiler then clang. So, I still think we need to check the compiler frontend (clang or gcc) and not the backend (llvm).

David

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Isn't the name of the clang C++ = "clang++"? Does MATCHES do partial or exact matches?

Revision history for this message
David Graf (davidagraf) wrote :

Match does partial matches. c++ --version does return much more then 'clang' :-).

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
David Graf (davidagraf) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job detect-clang-properly-2012-08-09T09-52-00.038Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeCompiler.txt'
2--- CMakeCompiler.txt 2012-07-24 08:48:48 +0000
3+++ CMakeCompiler.txt 2012-08-02 21:16:20 +0000
4@@ -13,11 +13,18 @@
5 # limitations under the License.
6
7
8-IF (${CMAKE_CXX_COMPILER} MATCHES "clang")
9- SET (CLANG 1)
10-ELSE (${CMAKE_CXX_COMPILER} MATCHES "clang")
11- SET (CLANG 0)
12-ENDIF(${CMAKE_CXX_COMPILER} MATCHES "clang")
13+# check if clang is used to compile c++
14+EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
15+ ARGS --version
16+ OUTPUT_VARIABLE CXX_COMPILER_VERSION_OUTPUT
17+)
18+STRING(REGEX MATCH "clang"
19+ CXX_IS_CLANG "${CXX_COMPILER_VERSION_OUTPUT}")
20+IF (CXX_IS_CLANG)
21+ SET (CLANG 1)
22+ELSE ()
23+ SET (CLANG 0)
24+ENDIF ()
25
26 #-----------------------------------------------------------------------------
27 # Let's use the highest warning level.

Subscribers

People subscribed via source and target branches