[Cmake-commits] CMake branch, next, updated. v3.0.0-3700-g015fe82

Brad King brad.king at kitware.com
Thu Jun 12 11:40:12 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  015fe828a71558e8369b661d4a0865884bef0de4 (commit)
       via  790e167718bff5660e9023f627df0413504fb207 (commit)
       via  5fba44cf41312a64b1cc661d4015ba16ac9f2af8 (commit)
      from  7f74f79890c3044f0332678f8c4a0deb22692906 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=015fe828a71558e8369b661d4a0865884bef0de4
commit 015fe828a71558e8369b661d4a0865884bef0de4
Merge: 7f74f79 790e167
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 12 11:40:11 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 12 11:40:11 2014 -0400

    Merge topic 'vs-subdir-sln-depends' into next
    
    790e1677 VS: Fix subproject .sln dependencies on custom targets
    5fba44cf VS: Move VS-only API out of cmGlobalGenerator


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=790e167718bff5660e9023f627df0413504fb207
commit 790e167718bff5660e9023f627df0413504fb207
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 12 10:36:10 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 12 11:14:06 2014 -0400

    VS: Fix subproject .sln dependencies on custom targets
    
    Each project listed in a .sln must be marked (or not) as part of the
    "default build" for each configuration.  For targets created by the
    add_custom_target() command we add them to the default build if they
    are not excluded in some way or if another target depends on them.
    In the top-level .sln, a custom target is excluded if it is not
    created with the ALL option to add_custom_target.  In subdirectory
    .sln files, a target may also be excluded if it is not within the
    directory and is brought into the solution only due to a dependency
    from another target in the solution.
    
    Fix the "IsPartOfDefaultBuild" and "IsDependedOn" methods to check
    every target to be included in the .sln for a dependency on the
    custom target.  Otherwise transitive dependencies through targets
    not in the current subdirectory will not be considered.
    
    Extend the SubProject test with a custom target to cover this case.
    
    Reported-by: William Deurwaarder <William.Deurwaarder at tomtom.com>
    Reported-by: Dirk Steenpass <dirk.steenpass at gmail.com>

diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 41a6371..08f685e 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -392,8 +392,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
     else
       {
       const std::set<std::string>& configsPartOfDefaultBuild =
-        this->IsPartOfDefaultBuild(root->GetMakefile()->GetProjectName(),
-                                   target);
+        this->IsPartOfDefaultBuild(projectTargets, target);
       const char *vcprojName =
         target->GetProperty("GENERATOR_FILE_NAME");
       if (vcprojName)
@@ -981,8 +980,7 @@ cmGlobalVisualStudio7Generator
 
 std::set<std::string>
 cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
-                                                    const std::string& project,
-                                                    cmTarget const* target)
+  OrderedTargetDependSet const& projectTargets, cmTarget const* target)
 {
   std::set<std::string> activeConfigs;
   // if it is a utilitiy target then only make it part of the
@@ -992,7 +990,7 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
     {
     return activeConfigs;
     }
-  if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target))
+  if(type == cmTarget::UTILITY && !this->IsDependedOn(projectTargets, target))
     {
     return activeConfigs;
     }
@@ -1011,31 +1009,18 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
 }
 
 bool
-cmGlobalVisualStudio7Generator::IsDependedOn(const std::string& project,
-                                             cmTarget const* targetIn)
+cmGlobalVisualStudio7Generator
+::IsDependedOn(OrderedTargetDependSet const& projectTargets,
+               cmTarget const* targetIn)
 {
-  // Get all local gens for this project
-  std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it =
-                                              this->ProjectMap.find(project);
-  if (it == this->ProjectMap.end())
-    {
-    return false;
-    }
-
-  // loop over local gens and get the targets for each one
-  for(std::vector<cmLocalGenerator*>::const_iterator geIt = it->second.begin();
-      geIt != it->second.end(); ++geIt)
+  for (OrderedTargetDependSet::const_iterator l = projectTargets.begin();
+       l != projectTargets.end(); ++l)
     {
-    cmTargets const& targets = (*geIt)->GetMakefile()->GetTargets();
-    for (cmTargets::const_iterator l = targets.begin();
-         l != targets.end(); l++)
+    cmTarget const& target = **l;
+    TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+    if(tgtdeps.count(targetIn))
       {
-      cmTarget const& target = l->second;
-      TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
-      if(tgtdeps.count(targetIn))
-        {
-        return true;
-        }
+      return true;
       }
     }
   return false;
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 399ec9f..7f55381 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -164,9 +164,11 @@ protected:
 
   std::string ConvertToSolutionPath(const char* path);
 
-  std::set<std::string> IsPartOfDefaultBuild(const std::string& project,
-                                             cmTarget const* target);
-  bool IsDependedOn(const std::string& project, cmTarget const* target);
+  std::set<std::string>
+    IsPartOfDefaultBuild(OrderedTargetDependSet const& projectTargets,
+                         cmTarget const* target);
+  bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
+                    cmTarget const* target);
   std::vector<std::string> Configurations;
   std::map<std::string, std::string> GUIDMap;
 
diff --git a/Tests/SubProject/CMakeLists.txt b/Tests/SubProject/CMakeLists.txt
index b669621..b2bada9 100644
--- a/Tests/SubProject/CMakeLists.txt
+++ b/Tests/SubProject/CMakeLists.txt
@@ -1,6 +1,15 @@
 cmake_minimum_required (VERSION 2.6)
 project(SubProject)
-message("${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/gen.cxx) # require generation
+add_custom_command(
+  OUTPUT gen.cxx
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen.cxx.in
+  COMMAND ${CMAKE_COMMAND} -E copy
+             ${CMAKE_CURRENT_SOURCE_DIR}/gen.cxx.in gen.cxx
+  )
+add_custom_target(gen DEPENDS gen.cxx)
 add_library(bar bar.cxx)
+target_include_directories(bar PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+add_dependencies(bar gen)
 add_executable(car car.cxx)
 add_subdirectory(foo)
diff --git a/Tests/SubProject/bar.cxx b/Tests/SubProject/bar.cxx
index c3f6a18..c8b8743 100644
--- a/Tests/SubProject/bar.cxx
+++ b/Tests/SubProject/bar.cxx
@@ -1,4 +1 @@
-int bar()
-{
-  return 10;
-}
+#include "gen.cxx"
diff --git a/Tests/SubProject/bar.cxx b/Tests/SubProject/gen.cxx.in
similarity index 100%
copy from Tests/SubProject/bar.cxx
copy to Tests/SubProject/gen.cxx.in

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fba44cf41312a64b1cc661d4015ba16ac9f2af8
commit 5fba44cf41312a64b1cc661d4015ba16ac9f2af8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 12 10:26:35 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 12 10:26:35 2014 -0400

    VS: Move VS-only API out of cmGlobalGenerator
    
    Move the IsDependedOn method to cmGlobalVisualStudio7Generator
    since that is the only caller.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6c8be72..36932aa 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1045,36 +1045,6 @@ void cmGlobalGenerator::ClearEnabledLanguages()
   this->LanguageEnabled.clear();
 }
 
-bool cmGlobalGenerator::IsDependedOn(const std::string& project,
-                                     cmTarget const* targetIn)
-{
-  // Get all local gens for this project
-  std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it =
-                                              this->ProjectMap.find(project);
-  if (it == this->ProjectMap.end())
-    {
-    return false;
-    }
-
-  // loop over local gens and get the targets for each one
-  for(std::vector<cmLocalGenerator*>::const_iterator geIt = it->second.begin();
-      geIt != it->second.end(); ++geIt)
-    {
-    cmTargets const& targets = (*geIt)->GetMakefile()->GetTargets();
-    for (cmTargets::const_iterator l = targets.begin();
-         l != targets.end(); l++)
-      {
-      cmTarget const& target = l->second;
-      TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
-      if(tgtdeps.count(targetIn))
-        {
-        return true;
-        }
-      }
-    }
-  return false;
-}
-
 void cmGlobalGenerator::Configure()
 {
   this->FirstTimeProgress = 0.0f;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 67bd378..6403429 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -225,9 +225,6 @@ public:
       that is a framework. */
   bool NameResolvesToFramework(const std::string& libname) const;
 
-  /** If check to see if the target is linked to by any other
-      target in the project */
-  bool IsDependedOn(const std::string& project, cmTarget const* target);
   ///! Find a local generator by its startdirectory
   cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const;
 
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b581147..41a6371 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -1010,6 +1010,37 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
   return activeConfigs;
 }
 
+bool
+cmGlobalVisualStudio7Generator::IsDependedOn(const std::string& project,
+                                             cmTarget const* targetIn)
+{
+  // Get all local gens for this project
+  std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it =
+                                              this->ProjectMap.find(project);
+  if (it == this->ProjectMap.end())
+    {
+    return false;
+    }
+
+  // loop over local gens and get the targets for each one
+  for(std::vector<cmLocalGenerator*>::const_iterator geIt = it->second.begin();
+      geIt != it->second.end(); ++geIt)
+    {
+    cmTargets const& targets = (*geIt)->GetMakefile()->GetTargets();
+    for (cmTargets::const_iterator l = targets.begin();
+         l != targets.end(); l++)
+      {
+      cmTarget const& target = l->second;
+      TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+      if(tgtdeps.count(targetIn))
+        {
+        return true;
+        }
+      }
+    }
+  return false;
+}
+
 //----------------------------------------------------------------------------
 static cmVS7FlagTable cmVS7ExtraFlagTable[] =
 {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 1dc709d..399ec9f 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -166,6 +166,7 @@ protected:
 
   std::set<std::string> IsPartOfDefaultBuild(const std::string& project,
                                              cmTarget const* target);
+  bool IsDependedOn(const std::string& project, cmTarget const* target);
   std::vector<std::string> Configurations;
   std::map<std::string, std::string> GUIDMap;
 

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGlobalGenerator.cxx              |   30 -----------------------------
 Source/cmGlobalGenerator.h                |    3 ---
 Source/cmGlobalVisualStudio7Generator.cxx |   26 ++++++++++++++++++++-----
 Source/cmGlobalVisualStudio7Generator.h   |    7 +++++--
 Tests/SubProject/CMakeLists.txt           |   11 ++++++++++-
 Tests/SubProject/bar.cxx                  |    5 +----
 Tests/SubProject/{bar.cxx => gen.cxx.in}  |    0
 7 files changed, 37 insertions(+), 45 deletions(-)
 copy Tests/SubProject/{bar.cxx => gen.cxx.in} (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list