[CMake] Testing for a Target
Michael Jackson
mike.jackson at bluequartz.net
Wed Nov 26 16:39:10 EST 2008
On Nov 26, 2008, at 4:34 PM, Eric Noulard wrote:
> 2008/11/26 Michael Jackson <mike.jackson at bluequartz.net>:
>> Is there a way to actually test to see if a target exists or has been
>> created?
>>
>> I am working on the boost-cmake stuff and I would to implement a
>> macro that
>> takes in requirements for a target (regression test). As it checks
>> those
>> requirements the macro will need to check to see if one of its
>> dependencies
>> has already been created. For example say I have a regression test
>> Foo and
>> it depends on a static-multi_threaded-debug build of the boost_system
>> library.
>> Now say the user has selected to NOT build static libraries. I
>> need to
>> check for the boost-system-static-multi-debug target and if it does
>> not
>> exists (which it will not in our example) add that target.
>>
>> Alternatively, what happens if I just add a new target and the new
>> target
>> already actually exists? Is that safe?
>
> Did you try
> if(TARGET target-name)
>
> cf
>
> cmake --help-command if
> --
> Erk
let me pull my head out of my ... thanks.. ;-O
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
More information about the CMake
mailing list