[CMake] how to write a cmakelist to call a function in another c or cxx file
Hendrik Sattler
post at hendrik-sattler.de
Sat Jan 16 16:18:44 EST 2010
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