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

Yixun Liu enjoywm at cs.wm.edu
Sat Jan 16 13:21:42 EST 2010


I do add test.c (see previous email).
If I change test.c to test.cxx, it works. I do not know why.

Hendrik Sattler wrote:
> Am Samstag 16 Januar 2010 15:40:55 schrieb Yixun Liu:
>   
>> ADD_EXECUTABLE(main main.cxx  )
>>
>> TARGET_LINK_LIBRARIES(main ITKCommon ITKIO vtkCommon vtkIO )
>>
>> It works well.
>> Now I need to ,in main.cxx,  invoke a function, let's say func(),
>> defined in another c file, let's say test.c.
>>     
>
> You need to compile all sources, so
>   ADD_EXECUTABLE(main main.cxx test.c)
>
> HS
>   



More information about the CMake mailing list