[CMake] Force C Compiler for C-Files

Bill Hoffman bill.hoffman at kitware.com
Mon Sep 15 21:36:37 EDT 2008


Stefan wrote:
> Hi @all,
> 
>  
> 
> it is possible to force VS2005 to use the C-Compiler instead of the 
> CXX-Compiler in a project? I try to convert one of my projects to CMAKE 
> but CMAKE configure all files to compile as cpp instead of C.
> 
> My project contains C-files as well as cpp-Files, so to say in general 
> project( fooProject C) won’t work.
> 
>  
> 
> Is there a possibility to setup VS’s configuration “compile as” to C via 
> CMAKE?
> 
>  

.c files should be C and .C should be cpp.  You can override this with 
set_source_file_properties(file1.c file2.c PROPERTIES LANGUAGE C)

-Bill


More information about the CMake mailing list