1

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?

Community
  • 1
  • 1
Scorpio
  • 1,124
  • 1
  • 11
  • 28

1 Answers1

1

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.

Scorpio
  • 1,124
  • 1
  • 11
  • 28