I would like your help since I am a newbie when it comes to CMake. Let's say I have an executable target T that depends on source files A.c, B.cpp and c.cpp. I would like to compile A.c with specific flags and create the object file A.o. For simplicity let's assume B and C will be compiled with g++ with the same set of flags, and corresponding object files should be created as B.o C.o. Then I can link these object files and produce the T with gcc. I know I can do it in a few steps with a regular makefile. Basically, I have trouble compiling A.c with specific flags and the rest of the files with same flags. I don't know how exactly it should be done with CMake?
add_executable(T A.c B.cpp C.cpp) I know CMake offers a target_compile_options() but I do not how to use it for my case? I guess it can be set for global flags of the target, but not for what I am after!
add_executable(T B.cpp C.cpp $<TARGET_OBJECTS:A>). So, B and C will be compiled with the other option, then will be linked with A.o.