MantisBT - CMake
View Issue Details
0015906CMakeCMakepublic2016-01-09 12:372016-06-10 14:31
Jan Henke 
Kitware Robot 
normalmajoralways
closedmoved 
Windows10
CMake 3.4.1 
 
0015906: With Microsoft Visual Studio CMake should use the C++ compiler for C files, if C standard >= C99 is set
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.
No tags attached.
Issue History
2016-01-09 12:37Jan HenkeNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042909
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042909)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.