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

Pau Garcia i Quiles pgquiles at elpauer.org
Tue Mar 31 11:20:51 EDT 2009


Hello,

Try

SET_SOURCE_FILES_PROPERTIES( file1.c file2.c file3.c PROPERTIES LANGUAGE CXX )

On Tue, Mar 31, 2009 at 5:16 PM, Alexandre Feblot
<Alexandre.Feblot at thomsonreuters.com> wrote:
> 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.
> _______________________________________________
> 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
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list