[cmake-developers] [CMake 0013194]: Clang compiler flag detection incorrectly reports "Success"
Mantis Bug Tracker
mantis at public.kitware.com
Sat May 5 14:38:46 EDT 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13194
======================================================================
Reported By: Jared Boone
Assigned To:
======================================================================
Project: CMake
Issue ID: 13194
Category: Modules
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-05-05 14:38 EDT
Last Modified: 2012-05-05 14:38 EDT
======================================================================
Summary: Clang compiler flag detection incorrectly reports
"Success"
Description:
I recently tried compiling GNU Radio (3.6.1-ish development branch) and ran into
trouble when CMake was detecting compiler flags relating to instruction sets. It
turns out that Clang reports "unused arguments" as warnings, and the message is
not presently matched in Modules/CheckCXXCompilerFlag.cmake.
Steps to Reproduce:
The command line executed by CheckCXXCompilerFlag:
/usr/bin/c++ -Dhave_maltivec -maltivec -o
CMakeFiles/cmTryCompileExec.dir/src.cxx.o -c
/Users/jboone/tmp/gnuradio/build/volk/CMakeFiles/CMakeTmp/src.cxx
When I run the test on my Intel Mac using my own src.cxx ("int main() { return
0; }"), I get:
clang: warning: argument unused during compilation: '-maltivec'
This warning will not be detected by the current CheckCXXCompilerFlags.cmake:
From
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CheckCXXCompilerFlag.cmake;hb=HEAD
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+"
# GNU
FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "ignoring unknown option" # MSVC
FAIL_REGEX "warning D9002" # MSVC, any lang
FAIL_REGEX "option.*not supported" # Intel
FAIL_REGEX "invalid argument .*option" # Intel
FAIL_REGEX "ignoring option .*argument required" # Intel
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
FAIL_REGEX "not supported in this configuration; ignored" # AIX
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
FAIL_REGEX "WARNING: unknown flag:" # Open64
I was able to solve the problem by adding one line to the list of FAIL_REGEXs:
FAIL_REGEX "argument unused during compilation" # Clang
Additional Information:
I'm using MacOS X 10.7.3 with Xcode 4.3.2. I have MacPorts installed, but have
removed all MacPorts gcc, llvm, and cctools packages, to ensure I'm working with
the Xcode Clang.
$ /usr/bin/cc -v
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
$ /usr/bin/c++ -v
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
$ ls -l /usr/bin/cc
lrwxr-xr-x 1 root wheel 5 Apr 18 22:05 /usr/bin/cc -> clang
$ ls -l /usr/bin/c++
lrwxr-xr-x 1 root wheel 7 Apr 18 22:05 /usr/bin/c++ -> clang++
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-05-05 14:38 Jared Boone New Issue
======================================================================
More information about the cmake-developers
mailing list