summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx39
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h8
-rw-r--r--Tests/SubProject/CMakeLists.txt11
-rw-r--r--Tests/SubProject/bar.cxx5
-rw-r--r--Tests/SubProject/gen.cxx.in4
5 files changed, 32 insertions, 35 deletions
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/gen.cxx.in b/Tests/SubProject/gen.cxx.in
new file mode 100644
index 0000000..c3f6a18
--- /dev/null
+++ b/Tests/SubProject/gen.cxx.in
@@ -0,0 +1,4 @@
+int bar()
+{
+ return 10;
+}