Well, I indeed found this to work, but my project has about 20000 c files.
Alin, forcing CC to a C++ compiler is not an option either, as I also have a
couple of libs which must be compiled with a C-ansi compiler.
I found that I could get the correct behaviour by modifying the value of
CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS in the generated files
<build_dir>/CMakeFiles/Cmake{CC,CXX}Compiler.cmake
BUT:
These files are read when calling 'project()'. They set the initial value for
CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS, which then seem to be used once for all by
cmake. Any later attempt to change them has no effect.
So, should these CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS variables be considerered
as read-only?
Is this a bug?
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Pau
Garcia i Quiles
Sent: Tuesday, 31 March 2009 17:21
To: Alexandre Feblot
Cc: Cmake Mailing List
Subject: Re: [CMake] Compile all .c source files with the CXX compiler
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
<[email protected]> 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
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