I have worked on a project where I was using g++ to compile C code in files that end in .c. The reason is that I\'m told that g++ has better warning messages.
I am s
If you need to switch the whole project, set it in the project directive:
project(derproject LANGUAGES CXX)
You should not override the compiler for this purpose. If you really need to compile your C files as C++ then you should teach cmake that your files belong to C++ language:
set_source_files_properties(filename.c PROPERTIES LANGUAGE CXX )
To have cmake treat all C files as C++ files use:
file(GLOB_RECURSE CFILES "${CMAKE_SOURCE_DIR}/*.c")
SET_SOURCE_FILES_PROPERTIES(${CFILES} PROPERTIES LANGUAGE CXX )