[Cmake-commits] [cmake-commits] king committed cmIfCommand.cxx 1.87 1.88 cmIfCommand.h 1.48 1.49

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Aug 20 11:45:18 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv27448/Source

Modified Files:
	cmIfCommand.cxx cmIfCommand.h 
Log Message:
ENH: Add if(TARGET) command

It is useful to be able to test if a target has been created.  Often
targets are created only inside conditions.  Rather than storing the
result of the condition manually for testing by other parts of the
project, it is much easier for the other parts to just test for the
target's existence.  This will also be useful when find-modules start
reporting results with IMPORTED targets and projects want to test if a
certain target is available.


Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.87
retrieving revision 1.88
diff -C 2 -d -r1.87 -r1.88
*** cmIfCommand.cxx	28 Jun 2008 15:16:36 -0000	1.87
--- cmIfCommand.cxx	20 Aug 2008 15:45:16 -0000	1.88
***************
*** 409,412 ****
--- 409,419 ----
            reducible, arg, newArgs, argP1, argP2);
          }
+       // does a target exist
+       if (*arg == "TARGET" && argP1 != newArgs.end())
+         {
+         HandlePredicate(
+           makefile->FindTargetToUse((argP1)->c_str())? true:false,
+           reducible, arg, newArgs, argP1, argP2);
+         }
        // is a variable defined
        if (*arg == "DEFINED" && argP1  != newArgs.end())

Index: cmIfCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -C 2 -d -r1.48 -r1.49
*** cmIfCommand.h	28 Jun 2008 15:16:36 -0000	1.48
--- cmIfCommand.h	20 Aug 2008 15:45:16 -0000	1.49
***************
*** 143,146 ****
--- 143,148 ----
        "True if the given name is an existing policy "
        "(of the form CMP<NNNN>).\n"
+       "  if(TARGET target-name)\n"
+       "True if the given name is an existing target, built or imported.\n"
        "  if(EXISTS file-name)\n"
        "  if(EXISTS directory-name)\n"



More information about the Cmake-commits mailing list