Merge topic 'vs-subdir-sln-depends'
cb67509b
VS: Remove unused parameter of WriteTargetConfigurations790e1677
VS: Fix subproject .sln dependencies on custom targets5fba44cf
VS: Move VS-only API out of cmGlobalGenerator
This commit is contained in:
commit
3eb50bbe8c
|
@ -1045,36 +1045,6 @@ void cmGlobalGenerator::ClearEnabledLanguages()
|
||||||
this->LanguageEnabled.clear();
|
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()
|
void cmGlobalGenerator::Configure()
|
||||||
{
|
{
|
||||||
this->FirstTimeProgress = 0.0f;
|
this->FirstTimeProgress = 0.0f;
|
||||||
|
|
|
@ -225,9 +225,6 @@ public:
|
||||||
that is a framework. */
|
that is a framework. */
|
||||||
bool NameResolvesToFramework(const std::string& libname) const;
|
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
|
///! Find a local generator by its startdirectory
|
||||||
cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const;
|
cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const;
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ void cmGlobalVisualStudio71Generator
|
||||||
fout << "\tGlobalSection(" << this->ProjectConfigurationSectionName
|
fout << "\tGlobalSection(" << this->ProjectConfigurationSectionName
|
||||||
<< ") = postSolution\n";
|
<< ") = postSolution\n";
|
||||||
// Write out the configurations for all the targets in the project
|
// Write out the configurations for all the targets in the project
|
||||||
this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
|
this->WriteTargetConfigurations(fout, orderedProjectTargets);
|
||||||
fout << "\tEndGlobalSection\n";
|
fout << "\tEndGlobalSection\n";
|
||||||
|
|
||||||
if (useFolderProperty)
|
if (useFolderProperty)
|
||||||
|
|
|
@ -366,7 +366,6 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile()
|
||||||
|
|
||||||
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||||
std::ostream& fout,
|
std::ostream& fout,
|
||||||
cmLocalGenerator* root,
|
|
||||||
OrderedTargetDependSet const& projectTargets)
|
OrderedTargetDependSet const& projectTargets)
|
||||||
{
|
{
|
||||||
// loop over again and write out configurations for each target
|
// loop over again and write out configurations for each target
|
||||||
|
@ -392,8 +391,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const std::set<std::string>& configsPartOfDefaultBuild =
|
const std::set<std::string>& configsPartOfDefaultBuild =
|
||||||
this->IsPartOfDefaultBuild(root->GetMakefile()->GetProjectName(),
|
this->IsPartOfDefaultBuild(projectTargets, target);
|
||||||
target);
|
|
||||||
const char *vcprojName =
|
const char *vcprojName =
|
||||||
target->GetProperty("GENERATOR_FILE_NAME");
|
target->GetProperty("GENERATOR_FILE_NAME");
|
||||||
if (vcprojName)
|
if (vcprojName)
|
||||||
|
@ -579,7 +577,7 @@ void cmGlobalVisualStudio7Generator
|
||||||
|
|
||||||
// Write out the configurations for all the targets in the project
|
// Write out the configurations for all the targets in the project
|
||||||
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
|
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
|
||||||
this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
|
this->WriteTargetConfigurations(fout, orderedProjectTargets);
|
||||||
fout << "\tEndGlobalSection\n";
|
fout << "\tEndGlobalSection\n";
|
||||||
|
|
||||||
// Write out global sections
|
// Write out global sections
|
||||||
|
@ -981,8 +979,7 @@ cmGlobalVisualStudio7Generator
|
||||||
|
|
||||||
std::set<std::string>
|
std::set<std::string>
|
||||||
cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||||
const std::string& project,
|
OrderedTargetDependSet const& projectTargets, cmTarget const* target)
|
||||||
cmTarget const* target)
|
|
||||||
{
|
{
|
||||||
std::set<std::string> activeConfigs;
|
std::set<std::string> activeConfigs;
|
||||||
// if it is a utilitiy target then only make it part of the
|
// if it is a utilitiy target then only make it part of the
|
||||||
|
@ -992,7 +989,7 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||||
{
|
{
|
||||||
return activeConfigs;
|
return activeConfigs;
|
||||||
}
|
}
|
||||||
if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target))
|
if(type == cmTarget::UTILITY && !this->IsDependedOn(projectTargets, target))
|
||||||
{
|
{
|
||||||
return activeConfigs;
|
return activeConfigs;
|
||||||
}
|
}
|
||||||
|
@ -1010,6 +1007,24 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||||
return activeConfigs;
|
return activeConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
cmGlobalVisualStudio7Generator
|
||||||
|
::IsDependedOn(OrderedTargetDependSet const& projectTargets,
|
||||||
|
cmTarget const* targetIn)
|
||||||
|
{
|
||||||
|
for (OrderedTargetDependSet::const_iterator l = projectTargets.begin();
|
||||||
|
l != projectTargets.end(); ++l)
|
||||||
|
{
|
||||||
|
cmTarget const& target = **l;
|
||||||
|
TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
|
||||||
|
if(tgtdeps.count(targetIn))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static cmVS7FlagTable cmVS7ExtraFlagTable[] =
|
static cmVS7FlagTable cmVS7ExtraFlagTable[] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,7 +150,6 @@ protected:
|
||||||
OrderedTargetDependSet const& projectTargets);
|
OrderedTargetDependSet const& projectTargets);
|
||||||
virtual void WriteTargetConfigurations(
|
virtual void WriteTargetConfigurations(
|
||||||
std::ostream& fout,
|
std::ostream& fout,
|
||||||
cmLocalGenerator* root,
|
|
||||||
OrderedTargetDependSet const& projectTargets);
|
OrderedTargetDependSet const& projectTargets);
|
||||||
|
|
||||||
void GenerateConfigurations(cmMakefile* mf);
|
void GenerateConfigurations(cmMakefile* mf);
|
||||||
|
@ -164,8 +163,11 @@ protected:
|
||||||
|
|
||||||
std::string ConvertToSolutionPath(const char* path);
|
std::string ConvertToSolutionPath(const char* path);
|
||||||
|
|
||||||
std::set<std::string> IsPartOfDefaultBuild(const std::string& project,
|
std::set<std::string>
|
||||||
cmTarget const* target);
|
IsPartOfDefaultBuild(OrderedTargetDependSet const& projectTargets,
|
||||||
|
cmTarget const* target);
|
||||||
|
bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
|
||||||
|
cmTarget const* target);
|
||||||
std::vector<std::string> Configurations;
|
std::vector<std::string> Configurations;
|
||||||
std::map<std::string, std::string> GUIDMap;
|
std::map<std::string, std::string> GUIDMap;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
project(SubProject)
|
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)
|
add_library(bar bar.cxx)
|
||||||
|
target_include_directories(bar PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
add_dependencies(bar gen)
|
||||||
add_executable(car car.cxx)
|
add_executable(car car.cxx)
|
||||||
add_subdirectory(foo)
|
add_subdirectory(foo)
|
||||||
|
|
|
@ -1,4 +1 @@
|
||||||
int bar()
|
#include "gen.cxx"
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
int bar()
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
Loading…
Reference in New Issue