[CMake] Testing for a Target

Michael Jackson mike.jackson at bluequartz.net
Wed Nov 26 15:26:45 EST 2008


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?

  So the alternate version of the above would be to run through the  
requirements and essentially do an add_library() call for each of the  
variations even though that code may have already been called.


Thanks for any advice.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio





More information about the CMake mailing list