Reputation: 1144
I have a project that has a bunch of .c files that need to be compiled as C files, but I need one of them to be compiled as C++ code. I tried the solution found here but it did not work as expected. Instead of making only filename.c be compiled as C++, it compiles all the files in my project as C++ code. Without that call, all files are compiled as C.
I even tried this:
set_source_files_properties(${FILES_SRC} PROPERTIES LANGUAGE C)
set_source_files_properties(filename.c PROPERTIES LANGUAGE CXX)
Where the FILES_SRC
variable holds all my source files.
I am using CMake 2.8.12 and the Visual Studio 11 ARM generator.
Any idea how I could fix this?
Upvotes: 1
Views: 2163
Reputation: 1144
I ended up compiling the library using the C compiler and added the C++ code in a separate library for which I created a C interface so it can be called from my C library.
Upvotes: 1