[CMake] A CMake project called Help?

Alan Garny agarny at hellix.com
Fri Jun 10 13:53:18 EDT 2011


> > I have a CMake project with several sub-projects (plugins for my
> > application), one of which is called "Help". Now, everything works
> > fine in that it compiles and builds as expected. However, I do get a
> > couple of warnings:
> >
> > makefile:1227: warning: overriding commands for target `Help'
> >
> > makefile:257: warning: ignoring old commands for target `Help'
> >
> > After checking the generated makefile, the issue is (obviously) that
> > there are two targets called "Help". One for my plugin and another so
> > that one can call "make help".
> >
> > Now, is there a way to avoid this conflict, keeping in mind that I
> > want my plugin to keep being called Help.? I was hoping for some kind
> > of a CMake setting that would pre/ap-pend some text to a target name
> > and thus avoid the conflict, but I couldn't find anything like that.?
> >
> 
> I would change the name of your target to help_something, then use
> OUTPUT_NAME to change it back to help.
> 
> set_target_properties(MyHelp  PROPERTIES OUTPUT_NAME Help)

Thanks Bill. Though I don't particularly like the idea, I thought I would
give it a try anyway. However, because I am still working on that plugin, I
currently need to refer to my 'plugin' when linking my application (i.e.
within TARGET_LINK_LIBRARIES). And, when doing that, I get a linking error
about my 'plugin' not being found. If I change the name of my plugin project
back to "Help", then the linking works fine. Interestingly, in both cases
and as expected, the 'plugin' is properly generated. It's just that if the
project name for my 'plugin' is not the same as the filename for the
corresponding binary, then it can't be found during linking...!? 

So, I can see your suggestion to work if my 'plugin' was working as a proper
plugin (i.e. no need to refer to it from within TARGET_LINK_LIBRARIES for my
application), but that's the case yet, so it doesn't work for me...

Alan



More information about the CMake mailing list