[CMake] Compile C files with C++

Tom Browder tom.browder at gmail.com
Thu Dec 5 09:16:41 EST 2013


I found this 2009 thread:

  http://marc.info/?l=cmake&m=123851619629929&w=2

discussing this issue and I tried all suggestions but still cannot get
C files compiled with C++.

The last suggestion was to glob all C source files and set a LANGUAGE
CXX property on each.  I put this at the very top of my master
CMakeLists.txt file:

  file(GLOB_RECURSE all_c_files ${CMAKE_SOURCE_DIR}/src/*.c)
  set_source_files_properties(${all_c_files} PROPERTIES LANGUAGE CXX)

to no avail (I also tried putting double quotes around the glob expression).

Ideas?

Best regards,

-Tom


More information about the CMake mailing list