[CMake] how to write a cmakelist to call a function in another c or cxx file

Yixun Liu enjoywm at cs.wm.edu
Sun Jan 17 09:35:17 EST 2010


It works.
Thank you very much!

Hendrik Sattler wrote:
> Am Samstag 16 Januar 2010 19:21:42 schrieb Yixun Liu:
>   
>> I do add test.c (see previous email).
>> If I change test.c to test.cxx, it works. I do not know why.
>>     
>
> Hint: C++ name mangling.
>
> Add a test.h:
> extern "C" {
>   void func();
> }
>
> and include it in your main.cxx file.
> Alternatively, set the LANGUAGE property of the test.c file to CXX, so that 
> cmake knows that it must compile it with a C++ compiler.
>
> HS
>   



More information about the CMake mailing list