Solution configuration(target) and source files

Sysprogs forums Forums VisualGDB Solution configuration(target) and source files

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23971
    Ocef
    Participant

    Hello.

    I would like to make different build targets with different source files. Debug has x.c and Release has y.c, etc..

    If I right-click on a file and select properties, then there is on option for “Exclude from build”. I selected that option and I can actually see a little mark on the files. If I change the build target, then the little mark goes away, just like a would expect. (see my included picture)

    The problem is: If I try to build, then I get an error, that there are multiply definitions for my functions. For some reason the makefile can still see every file despite the “Exclude from build” option.

    Can you help with this problem?

    Attachments:
    You must be logged in to view attached files.
    #23974
    support
    Keymaster

    Hi,

    Please ensure you are using MSBuild-based projects, not GNU Make-based ones. The “Excluded from build” flag is only supported when using MSBuild.

    If you specifically need to use Make, please consider patching the Makefile instead (conditionally removing specific files from all_source_files using the $(filter-out …) syntax) or adding an #ifdef directive inside the file itself.

    #24932
    Ocef
    Participant

    hi,

     

    I am using Make for my project and can’t really edit the source files, so no macros.

    Can I ask for further help with $(filter-out …) ? Where should I put without overwriting it with automatic make generation?

    #24933
    support
    Keymaster

    Sorry, the fully supported and easy-to-use way to support excluding files for specific configurations would be to switch to MSBuild. We have specifically designed our MSBuild backend to be fast and support multiple advanced scenarios and this one is definitely one of them.

    The alternative procedure with $(filter-out) would involve conditionally removing specific files from the SOURCEFILES variable based on checking the current CONFIG variable, but as it is error-prone and much more fragile, we only recommend doing it if you are familiar with GNU Make internals and would otherwise advise using MSBuild.

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