2011/12/23 Pau Garcia i Quiles <[email protected]>:
> Hi,
>
> Visual C++ 2010 does not support C99 yet and it seems it will be a
> long time before MSVC supports it. For now, the usual work-around is
> to build the project as C++.
>
> I'd like to build as C if using mingw, and as C++ if using MSVC. How
> can I do that? project() seems not to be valid here (I can't do
> if(MSVC) before project()) and I cannot find a target property to say
> "compile as language CXX"

There is a LANGUAGE property but it is for source files not target
(which is logical because a target may contain mixed language sources)

so

set_source_files_properties(<SRC> PROPERTIES LANGUAGE C)

see
cmake --help-property LANGUAGE
cmake --help-command set_source_files_properties

you may be interested by the SOURCE target property as well
which makes its possible to retrieve all SOURCE file belonging to a
target.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to