0

I have imported a CMake project into Eclipse CDT following the instructions in this question, specifically this answer.

This works well unless I make changes to the makefiles – they will not be picked up automatically. The file in question was Makefile.am, which is used for custom build commands to convert SVG files into PNG files of predefined size. I had added a few svgs += blah.svg lines.

Re-running the cmake command in the original answer fixed things.

I tried to automate this step by creating a custom builder that would run cmake at the start of each build. This worked well on a test run, but after cleaning the project once, my custom builder is gone. Moerover, when I try to recreate it (with the same name), I get the error message

A 'Program' configuration with this name already exists

Why does the custom builder get deleted? Why is it still lurking around somewhere (resulting in the name still appearing to be in use)? What can I do about it?

UPDATE:

Closer investigation (using git to track changes to the workspace) revealed the following:

  • The custom builder definition is stored in a file in project_dir/.externalToolsBuilders/builder_name.launch, where project_dir is the project directory and builder_name is the name of the custom builder.
  • A reference to the custom builder is added to project_dir/.project.
  • Cleaning leaves the .launch file but removes the entry in .project.

This explains the behavior: without the entry in .project, the custom builder will not show in the Builders dialog and not run as is it no longer associated with the project. But since the file for the builder definition still exists, Eclipse cannot add another builder of the same name.

The culprit is thus clearly Eclipse, not cmake, as the changes occur outside of the directory structure which cmake would touch.

The question then is: how can I prevent Eclipse from messing with my custom builders on clean?

4
  • Question post you refer doesn't contains any instructions. This answer does, but it doesn't contain CMake code anywhere. Please, post CMake code you use. And describe changes to configured makefiles you have done.
    – Tsyvarev
    Commented Nov 9, 2015 at 20:21
  • @Tsyvarev I've added the details you requested (the answer is actually my own recap of the steps I performed). However, my question isn't "why isn't Eclipse picking up these changes" – I'm taking it for granted that anything generated by cmake is static to Eclipse, as cmake only runs once when I generate the project files (and whenever I re-run it manually). Rather, my question is "why does the custom builder disappear, and why does its name still appear to be in use?"
    – user149408
    Commented Nov 10, 2015 at 13:31
  • I think I know what it might be: The custom builder is project specific, hence Eclipse likely stores it in the project dir – which is the cmake build dir. Cleaning will reset the build dir and thus eliminate any information on the custom builder stored there. Thus the solution would be to identify the files affected, and find a way to ensure a clean operation will leave them alone. Could it be a bug in cmake that Eclipse project files do not get exempted from clean operations? IMHO that shouldn't be happening in the first place.
    – user149408
    Commented Nov 13, 2015 at 18:32
  • cmake is not to blame – I updated the question.
    – user149408
    Commented Nov 15, 2015 at 12:02

0

Browse other questions tagged or ask your own question.