[CMake] Getting if custom target is set
Alexander.Camek at elektrobit.com
Alexander.Camek at elektrobit.com
Thu Nov 6 03:59:03 EST 2008
Hi Phillip,
Thanks for your help.
> -----Original Message-----
> From: philiplowman at gmail.com [mailto:philiplowman at gmail.com]
> <Alexander.Camek at elektrobit.com> wrote:
>
>
> 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:
> GET_TARGET_EXISTS(LINT_SET lint)
>
> IF(NOT LINT_SET)
> ADD_CUSTOM_TARGET(lint )
> ENDIF(NOT LINT_SET)
>
> How can I do that?
>
>
> I'm not completely sure what you're asking for, but the IF()
> command does support checking for targets if that's what
> you're looking for:
>
> if(TARGET target-name)
> http://www.cmake.org/cmake/help/cmake2.6docs.html
That was exactly what I am looking for. So simply....
Thought I had to use the correct property by get_target_property() or one other of that, so I did't look at the IF command.
Greetings
Alexander
----------------------------------------------------------------
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