When I use the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
add_library (mylib STATIC)
target_sources (mylib PRIVATE
myfile.c
)
I get this output in Visual Studio:
[1/2] Building C object CMakeFiles\lidardump.dir\myfile.c.obj
[2/2] Linking C static library lidardump.lib
However myfile.c is C++ code. How do I instruct CMake to compile and link all .c files as C++?
I would prefer to not rename the files since they are from another programmer using gcc.