graphviz: allow to disable per target graphs (#14746)

In CMakeGraphVizOptions.cmake, allow the options GRAPHVIZ_GENERATE_PER_TARGET
and GRAPHVIZ_GENERATE_DEPENDERS to enable the generation of per target graphs
and subgraphs respectively. Both options are TRUE per default to maintain
current behavior.
This commit is contained in:
Daniel Pfeifer 2014-02-09 22:58:44 +01:00 committed by Brad King
parent 6abdc6c16a
commit 18bef4cd66
3 changed files with 30 additions and 0 deletions

View File

@ -93,6 +93,20 @@
# #
# * Mandatory : NO # * Mandatory : NO
# * Default : empty # * Default : empty
#
# .. variable:: GRAPHVIZ_GENERATE_PER_TARGET
#
# Set this to FALSE to exclude per target graphs ``foo.dot.<target>``.
#
# * Mandatory : NO
# * Default : TRUE
#
# .. variable:: GRAPHVIZ_GENERATE_DEPENDERS
#
# Set this to FALSE to exclude depender graphs ``foo.dot.<target>.dependers``.
#
# * Mandatory : NO
# * Default : TRUE
#============================================================================= #=============================================================================
# Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2009 Kitware, Inc.

View File

@ -53,6 +53,8 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
,GenerateForSharedLibs(true) ,GenerateForSharedLibs(true)
,GenerateForModuleLibs(true) ,GenerateForModuleLibs(true)
,GenerateForExternals(true) ,GenerateForExternals(true)
,GeneratePerTarget(true)
,GenerateDependers(true)
,LocalGenerators(localGenerators) ,LocalGenerators(localGenerators)
,HaveTargetsAndLibs(false) ,HaveTargetsAndLibs(false)
{ {
@ -116,6 +118,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
__set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS"); __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
__set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS"); __set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS");
__set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS"); __set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS");
__set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET");
__set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS");
cmStdString ignoreTargetsRegexes; cmStdString ignoreTargetsRegexes;
__set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
@ -149,6 +153,11 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
// which other targets depend on it. // which other targets depend on it.
void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
{ {
if(this->GenerateDependers == false)
{
return;
}
this->CollectTargetsAndLibs(); this->CollectTargetsAndLibs();
for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt = for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
@ -195,6 +204,11 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
// on which targets it depends. // on which targets it depends.
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{ {
if(this->GeneratePerTarget == false)
{
return;
}
this->CollectTargetsAndLibs(); this->CollectTargetsAndLibs();
for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt = for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =

View File

@ -74,6 +74,8 @@ protected:
bool GenerateForSharedLibs; bool GenerateForSharedLibs;
bool GenerateForModuleLibs; bool GenerateForModuleLibs;
bool GenerateForExternals; bool GenerateForExternals;
bool GeneratePerTarget;
bool GenerateDependers;
std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex; std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex;