Issue
I have a project which I am compiling with gcc using CMake Debug mode to be able to debug one function. However, until I reach that function, it takes a lot of time. Is there any way to only compile one single file with -g -O0
while compiling the rest with -O2
?
Solution
You can modify single file compiler flags with:
set_source_files_properties(the_source.c PROPERTIES COMPILE_FLAGS "-g -O0")
Answered By - KamilCuk Answer Checked By - Mary Flores (WPSolving Volunteer)