The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15526 
====================================================================== 
Reported By:                Dan Kegel
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15526
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-04-21 19:37 EDT
Last Modified:              2015-04-21 19:37 EDT
====================================================================== 
Summary:                    check_c_compiler_flag gives wrong answer on Mac
Description: 
Per
http://stackoverflow.com/questions/26108606/no-support-to-finline-functions-in-clang-3-5
XCode 6 has dropped support for -finline-functions:

$ clang -finline-functions -c foo.c -Werror
clang: error: optimization flag '-finline-functions' is not supported

so projects that use -Werror must not use that flag.

But check_c_compiler_flag doesn't use -Werror, and the output:
$ clang -finline-functions -c foo.c
clang: warning: optimization flag '-finline-functions' is not supported
clang: warning: argument unused during compilation: '-finline-functions'
sails right by its regex, so the flag is listed as supported.  D'oh.


Steps to Reproduce: 
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
include(CheckCCompilerFlag)
check_c_compiler_flag(-finline-functions FOOBARC)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-finline-functions FOOBARCXX)
$ cmake
-- The C compiler identification is AppleClang 6.1.0.6020049
-- The CXX compiler identification is AppleClang 6.1.0.6020049
-- Performing Test FOOBARC
-- Performing Test FOOBARC - Success
-- Performing Test FOOBARCXX
-- Performing Test FOOBARCXX - Success

But I expected 'Failed', not success, as that flag is not really supported and
will cause build error if used with -Werror.

Additional Information: 
Patch sent to cmake-developers, but I guess I'm not subscribed yet, so I'll
attach it here too.

Also affects older versions of cmake.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-04-21 19:37 Dan Kegel      New Issue                                    
2015-04-21 19:37 Dan Kegel      File Added: opt.patch                        
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to