[CMake] A CMake project called Help?

Bill Hoffman bill.hoffman at kitware.com
Fri Jun 10 15:11:11 EDT 2011


On 6/10/2011 1:53 PM, Alan Garny wrote:

>>
>> 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...
>

I would have to see the code, but it should work.  If you are using 
target_link_libraries with the target name (the correct thing to do), 
you will need to change the target name in that spot as well.

Like this:

add_library(myhelp help.c)
set_target_properties(myhelp  PROPERTIES OUTPUT_NAME Help)
add_executable(foo foo.c)
target_link_libraries(foo myhelp)

-Bill


More information about the CMake mailing list