[CMake] Compile all .c source files with the CXX compiler

Alexandre Feblot Alexandre.Feblot at thomsonreuters.com
Tue Mar 31 11:16:13 EDT 2009


Hi,

 

In my project, all sources named .c are C++ files, and should be
considered as CXX language files.

 

I tried to set this with CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS, at the
very beginning of my project, without success. How should I do it?

 

cmake_minimum_required (VERSION 2.6) 

project(MY_PROJECT)

# Can't changes the following values before calling project(), which
reset them to default values.

list(REMOVE_ITEM CMAKE_C_SOURCE_FILE_EXTENSIONS c)

list(APPEND    CMAKE_CXX_SOURCE_FILE_EXTENSIONS c)

#  value: CMAKE_C_SOURCE_FILE_EXTENSIONS: 

#  value: CMAKE_CXX_SOURCE_FILE_EXTENSIONS: C;M;c++;cc;cpp;cxx;m;mm;c

 

But later on, my .c files are still considered as C files, as shown
with:

 

get_source_file_property(lang source_file.c LANGUAGE)

#value: lang: C

 

 

 

Thanks

 

Alexandre



This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/f76fddfb/attachment-0001.htm>


More information about the CMake mailing list