[Cmake-commits] [cmake-commits] king committed cmGlobalVisualStudioGenerator.cxx 1.19 1.20 cmGlobalVisualStudioGenerator.h 1.13 1.14

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Oct 1 10:27:05 EDT 2009


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

Modified Files:
	cmGlobalVisualStudioGenerator.cxx 
	cmGlobalVisualStudioGenerator.h 
Log Message:
Add alternative _UTILITY targets to all solutions

In VS 6, 7, and 7.1 solutions we implement

  add_dependencies(myexe mylib) # depend without linking

by creating an intermediate mylib_UTILITY target with dependencies

  myexe -> mylib_UTILITY -> mylib

to avoid linking myexe to mylib.  Previously these extra targets were
only added to the solution files in an ancestor directory of that
defining mylib.  For example, in the project:

  # CMakeLists.txt
  project(TOP)
  add_subdirectory(A)
  add_subdirectory(b)

  # A/CMakeLists.txt
  add_library(mylib ...)

  # B/CMakeLists.txt
  project(B)
  add_executable(myexe ...)
  add_dependencies(myexe mylib)

the solution for TOP would have mylib_UTILITY but the solution for B
would not even though it pulls in mylib through the dependency.  This
commit fixes solutions generated in other directories so that any
solution that has mylib will get mylib_UTILITY also.

See issue #9568.


Index: cmGlobalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmGlobalVisualStudioGenerator.h	30 Sep 2009 20:02:58 -0000	1.13
--- cmGlobalVisualStudioGenerator.h	1 Oct 2009 14:27:02 -0000	1.14
***************
*** 86,89 ****
--- 86,92 ----
    };
  
+   virtual void GetTargetSets(TargetDependSet& projectTargets,
+                              TargetDependSet& originalTargets,
+                              cmLocalGenerator* root, GeneratorVector const&);
  private:
    void FixUtilityDependsForTarget(cmTarget& target);

Index: cmGlobalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -C 2 -d -r1.19 -r1.20
*** cmGlobalVisualStudioGenerator.cxx	30 Sep 2009 20:02:58 -0000	1.19
--- cmGlobalVisualStudioGenerator.cxx	1 Oct 2009 14:27:02 -0000	1.20
***************
*** 410,413 ****
--- 410,437 ----
  
  //----------------------------------------------------------------------------
+ void cmGlobalVisualStudioGenerator::GetTargetSets(
+   TargetDependSet& projectTargets, TargetDependSet& originalTargets,
+   cmLocalGenerator* root, GeneratorVector const& generators
+   )
+ {
+   this->cmGlobalGenerator::GetTargetSets(projectTargets, originalTargets,
+                                          root, generators);
+ 
+   // Add alternative dependency targets created by FixUtilityDepends.
+   for(TargetDependSet::iterator ti = projectTargets.begin();
+       ti != projectTargets.end(); ++ti)
+     {
+     cmTarget* tgt = *ti;
+     if(const char* altName = tgt->GetProperty("ALTERNATIVE_DEPENDENCY_NAME"))
+       {
+       if(cmTarget* alt = tgt->GetMakefile()->FindTarget(altName))
+         {
+         projectTargets.insert(alt);
+         }
+       }
+     }
+ }
+ 
+ //----------------------------------------------------------------------------
  #include <windows.h>
  



More information about the Cmake-commits mailing list