[cmake-developers] [CMake 0012652]: CMAKE_<LANG>_FLAGS are passed for linking too, but this causes warnings for compilation-only flags

Mantis Bug Tracker mantis at public.kitware.com
Tue Jan 3 15:49:57 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12652 
====================================================================== 
Reported By:                Sean McBride
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12652
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-01-03 15:49 EST
Last Modified:              2012-01-03 15:49 EST
====================================================================== 
Summary:                    CMAKE_<LANG>_FLAGS are passed for linking too, but
this causes warnings for compilation-only flags
Description: 
Searching the archives, I see that CMake deliberately passes the
CMAKE_<LANG>_FLAGS for linking too:

<http://www.cmake.org/pipermail/cmake/2010-July/038090.html>

If I add -std=c++0x to CMAKE_CXX_FLAGS, then compilation is fine, but clang will
warn when linking:

clang-3: warning: argument unused during compilation: '-std=c++0x'

For one's own projects, one could do something like:

SET_SOURCE_FILES_PROPERTIES(${MYCPPS} PROPERTIES COMPILE_FLAGS --std=c++0x)

But my hope was to use --std=c++0x on my CMake/VTK/ITK dashboards to make sure
their codebases are foreword-compatible with the new language standard.

Above all, it seems weird that something named CMAKE_C_FLAGS is passed to the
linker when we already have CMAKE_EXE_LINKER_FLAGS and the like.

I realize changing this has compatibility implications.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-03 15:49 Sean McBride   New Issue                                    
======================================================================




More information about the cmake-developers mailing list