[cmake-developers] [CMake 0015906]: With Microsoft Visual Studio CMake should use the C++ compiler for C files, if C standard >= C99 is set

Mantis Bug Tracker mantis at public.kitware.com
Sat Jan 9 12:37:40 EST 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15906 
====================================================================== 
Reported By:                Jan Henke
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15906
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-01-09 12:37 EST
Last Modified:              2016-01-09 12:37 EST
====================================================================== 
Summary:                    With Microsoft Visual Studio CMake should use the
C++ compiler for C files, if C standard >= C99 is set
Description: 
The Mircosoft Visual Studio C compiler only supports ISO 9899:1989 (aka C89).
Newer C features are only implemented in the C++ compiler and only for the
subset of C, which is part of the C++ standard (see for reference:
http://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/)

Since a few versions CMake provides a way to specify the features or standard
for your application. Thus if the requested standard level is C99 or above, or
any of the features introduced in C99 or above, CMake should use the C++
compiler for C files. To quote from above web site:

"We recommend that C developers use the C++ compiler to compile C code (using
/TP if the file is named something.c). This is the best choice for using Visual
C++ to compile C code."

Please change the generator for Visual Studio solutions accordingly. That way we
can use modern C feature with CMake and the Visual Studio compilers.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-01-09 12:37 Jan Henke      New Issue                                    
======================================================================



More information about the cmake-developers mailing list