[CMake] Compile project as C++ if MSVC

Mateusz Łoskot mateusz at loskot.net
Fri Dec 23 08:04:30 EST 2011


2011/12/23 Pau Garcia i Quiles <pgquiles at elpauer.org>:
> 2011/12/23 Mateusz Łoskot <mateusz at loskot.net>:
>>>>> For now, the usual work-around is to build the project as C++.
>>>>
>>>> If a certain feature from C99 is not supported by Visual C++,
>>>> how it is supposed to be workaround?
>>>
>>> Many C99 features were already supported by standard C++ and/or Visual
>>> C++-specific features: mixing declarations and code, snprintf, inline
>>> functions, more data types, etc
>>
>> No.
>>
>> All the features you listed above are C++ standard features, including
>> snprintf which is C++11 feature introduced as part of C99 compatibility.
>
> That's exactly why the workaround is to compile the C project as C++
> to get the C99 features that are both in C99 and in C++.

Gotcha.
Visual C++ compiles as C++ by default, unless you specify /TC option.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list