Changing Compilation Flag for Individual Source Files in VisualGDB VS2015 Commun

Sysprogs forums Forums VisualGDB Changing Compilation Flag for Individual Source Files in VisualGDB VS2015 Commun

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8168
    sunsina
    Participant

    I am wondering how can I change for a couple of files in VisualGDB project imported from STM32CubeMX
    the compilation flags settings such as -O0 ,….
    I R-Click over individual files in solution explorer to change their flags but there is not such options available.
    I would like to know if there is a way to accomplish that without modifying make file!?

     

    Thanks

    #8173
    support
    Keymaster

    Hi,

    You can do that by hacking the Makefile:

    1. Modify the file rule templates to include file-specific variables:

    $(CXX) $(CXXFLAGS) $($(basename $(notdir $<))_FLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

    1. Add file-specific flags defines above the FileSpecificTemplates line:

    LEDBlink_FLAGS := -O0

    You can modify the $(basename $(notdir …)) expression to use the directory name instead of the file name and apply some flags to entire directories. See the GNU Make function reference for more details.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.