[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.42 1.43

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


Update of /cvsroot/CMake/CMake/Tests/Complex/Library
In directory public:/mounts/ram/cvs-serv27448/Tests/Complex/Library

Modified Files:
	CMakeLists.txt 
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: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Complex/Library/CMakeLists.txt,v
retrieving revision 1.42
retrieving revision 1.43
diff -C 2 -d -r1.42 -r1.43
*** CMakeLists.txt	14 Feb 2008 18:36:23 -0000	1.42
--- CMakeLists.txt	20 Aug 2008 15:45:16 -0000	1.43
***************
*** 115,118 ****
--- 115,122 ----
  ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx)
  
+ # Create an imported target for if(TARGET) test in Executable dir.
+ # That test should not see this target.
+ ADD_LIBRARY(LibImportedTarget UNKNOWN IMPORTED)
+ 
  # Test generation of preprocessed sources.
  IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)



More information about the Cmake-commits mailing list