[CMake] Getting if custom target is set

Alexander.Camek at elektrobit.com Alexander.Camek at elektrobit.com
Wed Nov 5 09:25:15 EST 2008

Hi folks,

I have got a project split up into a lot of single project.
So in my ROOR dir I have got a CMakeLists.txt which defines a "master" PROJECT().
Each subdirectory added by the master project adds in its CMakeLists.txt its own PROJECT() in order to build alone.

Now I add a new command ADD_CUSTOM_TARGET(lint ) in my master project in order to do a make lint.
This works fine if everybody uses the whole project. But if he uses only a subproject as standalone this doesn't work.
It doesn't know the custom target. But if I add this to the subprojects cmake warns me about "CMP0002". 

What I want to do is now to check if my custom target was set and if not I want to set it in the subproject.

Something like that:


How can I do that?

Thanks for your help.



Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.

More information about the CMake mailing list