[CMake] force c++

Axel Roebel Axel.Roebel at ircam.fr
Thu Apr 6 07:40:07 EDT 2006


> Axel Roebel wrote:
>
>>does anybody know how I may force the use of a c++ compiler
>>for source files with .c extension?
>>
>>
> I think we worked around taht problem:
> If one file has cpp suffix all files are compiled as C++ instead of C.
> Thsu we added a dummy file per library.
>
> Please correct me if I'm wrong.

Hi Jan,

sorry to say that, but you are wrong! If one file  is c++
the linker will be used in c++ mode. But for compilation
all the c files are compiled using the c compiler.

My current workaround is  :

in the sub directory I set
SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})

which will replace the c compiler by the c++ compiler
for the sub directory only , and

SET_TARGET_PROPERTIES(f0main${DEBUGEXT} PROPERTIES LINKER_LANGUAGE CXX)

which will force to use c++ linker (what you achieved adding a fake c++
file). I am happy with that solution, however, I don't know whether it
would work for other things than the  Unix Makefile Generator.
And I don't know whether the LINKER_LANGUAGE property
is official part of the API, because I found that in
the cmake sources and not in any documentation


Thanks

> Jan.
>
> --
>
>   Dipl.-Ing. Jan Woetzel
> --------------------------------------------------
>   University of Kiel
>   Institute of Computer Science and Applied Mathematics
>   Hermann-Rodewald-Str. 3 [room 310]
>   24098 Kiel/Germany
> --------------------------------------------------
>   Phone +49-431-880-4477
>   Fax   +49-431-880-4054
>   Mob.  +49-179-2937346
> --------------------------------------------------
>   Url   www.mip.informatik.uni-kiel.de/~jw
>   Email jw at mip.informatik.uni-kiel.de
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>


--
Axel Roebel
IRCAM Analysis/Synthesis Team
Email: Axel.Roebel at ircam.fr | Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540



More information about the CMake mailing list