summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-17 15:32:01 (GMT)
committerBrad King <brad.king@kitware.com>2010-12-17 15:32:01 (GMT)
commitad25a968b9e47e9e966d166dd0e494dc684ebd66 (patch)
tree5638f53977907708fd7473f5b3c9a582a36a1a92 /Source
parentc128abe383e2f08e3f3e916f9b64356ca47056d1 (diff)
parent78c86f454272a2ac417ad6a89e4c7ed7e4975adb (diff)
downloadCMake-ad25a968b9e47e9e966d166dd0e494dc684ebd66.zip
CMake-ad25a968b9e47e9e966d166dd0e494dc684ebd66.tar.gz
CMake-ad25a968b9e47e9e966d166dd0e494dc684ebd66.tar.bz2
Merge branch 'ImprovedDotSupport2' into dev/strict-mode
Conflicts: Source/cmake.cxx
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx44
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx4
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h16
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx356
-rw-r--r--Source/cmGraphVizWriter.cxx435
-rw-r--r--Source/cmGraphVizWriter.h84
-rw-r--r--Source/cmMakefile.cxx8
-rw-r--r--Source/cmTarget.cxx12
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx55
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h4
-rw-r--r--Source/cmake.cxx386
-rw-r--r--Source/cmake.h76
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
17 files changed, 962 insertions, 555 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 71284b2..718e52e 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -183,6 +183,8 @@ SET(SRCS
cmGlobalUnixMakefileGenerator3.cxx
cmGlobalUnixMakefileGenerator3.h
cmGraphAdjacencyList.h
+ cmGraphVizWriter.cxx
+ cmGraphVizWriter.h
cmInstallGenerator.h
cmInstallGenerator.cxx
cmInstallExportGenerator.cxx
@@ -332,7 +334,7 @@ ENDIF (WIN32)
# create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS})
-TARGET_LINK_LIBRARIES(CMakeLib cmsys
+TARGET_LINK_LIBRARIES(CMakeLib cmsys
${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
${CMAKE_CURL_LIBRARIES} )
@@ -432,7 +434,7 @@ IF(CYGWIN)
CPack/cmCPackCygwinSourceGenerator.cxx
)
ENDIF(CYGWIN)
-
+
IF(UNIX)
SET(CPACK_SRCS ${CPACK_SRCS}
CPack/cmCPackDebGenerator.cxx
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index ac2e151..47a1ff6 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -94,6 +94,18 @@ int cmCPackDebGenerator::PackageFiles()
this->GetOption("CPACK_DEBIAN_PACKAGE_SUGGESTS");
const char* debian_pkg_url =
this->GetOption("CPACK_DEBIAN_PACKAGE_HOMEPAGE");
+ const char* debian_pkg_predep =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_PREDEPENDS");
+ const char* debian_pkg_enhances =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_ENHANCES");
+ const char* debian_pkg_breaks =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_BREAKS");
+ const char* debian_pkg_conflicts =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_CONFLICTS");
+ const char* debian_pkg_provides =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_PROVIDES");
+ const char* debian_pkg_replaces =
+ this->GetOption("CPACK_DEBIAN_PACKAGE_REPLACES");
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(ctlfilename.c_str());
@@ -102,22 +114,46 @@ int cmCPackDebGenerator::PackageFiles()
out << "Section: " << debian_pkg_section << "\n";
out << "Priority: " << debian_pkg_priority << "\n";
out << "Architecture: " << debian_pkg_arch << "\n";
- if(debian_pkg_dep)
+ if(debian_pkg_dep && *debian_pkg_dep)
{
out << "Depends: " << debian_pkg_dep << "\n";
}
- if(debian_pkg_rec)
+ if(debian_pkg_rec && *debian_pkg_rec)
{
out << "Recommends: " << debian_pkg_rec << "\n";
}
- if(debian_pkg_sug)
+ if(debian_pkg_sug && *debian_pkg_sug)
{
out << "Suggests: " << debian_pkg_sug << "\n";
}
- if(debian_pkg_url)
+ if(debian_pkg_url && *debian_pkg_url)
{
out << "Homepage: " << debian_pkg_url << "\n";
}
+ if (debian_pkg_predep && *debian_pkg_predep)
+ {
+ out << "Pre-Depends: " << debian_pkg_predep << "\n";
+ }
+ if (debian_pkg_enhances && *debian_pkg_enhances)
+ {
+ out << "Enhances: " << debian_pkg_enhances << "\n";
+ }
+ if (debian_pkg_breaks && *debian_pkg_breaks)
+ {
+ out << "Breaks: " << debian_pkg_breaks << "\n";
+ }
+ if (debian_pkg_conflicts && *debian_pkg_conflicts)
+ {
+ out << "Conflicts: " << debian_pkg_conflicts << "\n";
+ }
+ if (debian_pkg_provides && *debian_pkg_provides)
+ {
+ out << "Provides: " << debian_pkg_provides << "\n";
+ }
+ if (debian_pkg_replaces && *debian_pkg_replaces)
+ {
+ out << "Replaces: " << debian_pkg_replaces << "\n";
+ }
unsigned long totalSize = 0;
{
std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 6570d0e..76ff23a 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -264,7 +264,17 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{
*this->TestHandler->LogFile << "Test time = " << buf << std::endl;
}
+
+ // Set the working directory to the tests directory
+ std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(this->TestProperties->Directory.c_str());
+
this->DartProcessing();
+
+ // restore working directory
+ cmSystemTools::ChangeDirectory(oldpath.c_str());
+
+
// if this is doing MemCheck then all the output needs to be put into
// Output since that is what is parsed by cmCTestMemCheckHandler
if(!this->TestHandler->MemCheck && started)
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 4cb2b48..e6d7a6d 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -289,14 +289,10 @@ void cmExtraCodeBlocksGenerator
std::string fileName = *(splitted.end()-1);
splitted.erase(splitted.end() - 1, splitted.end());
- // We don't want paths with ".." in them
- // reasons are that we don't want files outside the project
- // TODO: the path should be normalized first though
// We don't want paths with CMakeFiles in them
// or do we?
// In speedcrunch those where purely internal
if (splitted.size() >= 1
- && relative.find("..") == std::string::npos
&& relative.find("CMakeFiles") == std::string::npos)
{
tree.InsertPath(splitted, 1, fileName);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index e4c169a..789d0e7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1873,9 +1873,10 @@ bool cmGlobalGenerator::UseFolderProperty()
return cmSystemTools::IsOn(prop);
}
- // By default, this feature is ON:
+ // By default, this feature is OFF, since it is not supported in the
+ // Visual Studio Express editions:
//
- return true;
+ return false;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 751dc24..2b9e5ba 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -323,7 +323,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (cumulativePath.empty())
{
- cumulativePath = *iter;
+ cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
}
else
{
@@ -431,14 +431,22 @@ void cmGlobalVisualStudio7Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
{
+ const char *prefix = "CMAKE_FOLDER_GUID_";
+ const std::string::size_type skip_prefix = strlen(prefix);
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str());
- std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
+
cmSystemTools::ReplaceString(fullName, "/", "\\");
+ if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix))
+ {
+ fullName = fullName.substr(skip_prefix);
+ }
+
+ std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
fout << "Project(\"{" <<
guidProjectTypeFolder << "}\") = \"" <<
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index daa6b3a..c8ea339 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -69,14 +69,6 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return true; }
-protected:
- // Does this VS version link targets to each other if there are
- // dependencies in the SLN file? This was done for VS versions
- // below 8.
- virtual bool VSLinksDependencies() const { return true; }
-
- virtual const char* GetIDEVersion() = 0;
-
struct TargetCompare
{
bool operator()(cmTarget const* l, cmTarget const* r) const;
@@ -87,6 +79,14 @@ protected:
OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
};
+protected:
+ // Does this VS version link targets to each other if there are
+ // dependencies in the SLN file? This was done for VS versions
+ // below 8.
+ virtual bool VSLinksDependencies() const { return true; }
+
+ virtual const char* GetIDEVersion() = 0;
+
virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<cmStdString> {};
class VSDependMap: public std::map<cmTarget*, VSDependSet> {};
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4e9969d..2f7bc44 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -131,8 +131,8 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
//----------------------------------------------------------------------------
cmGlobalGenerator* cmGlobalXCodeGenerator::New()
-{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+{
+#if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser;
parser.ParseFile
("/Developer/Applications/Xcode.app/Contents/version.plist");
@@ -156,7 +156,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New()
void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
lang,
cmMakefile * mf, bool optional)
-{
+{
mf->AddDefinition("XCODE","1");
mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
if(this->XcodeVersion == 15)
@@ -175,12 +175,12 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
- // initialize Architectures so it can be used by
+ // initialize Architectures so it can be used by
// GetTargetObjectFileDirectories
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
- const char* osxArch =
+ const char* osxArch =
mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
- const char* sysroot =
+ const char* sysroot =
mf->GetDefinition("CMAKE_OSX_SYSROOT");
if(osxArch && sysroot)
{
@@ -193,10 +193,10 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator
::GenerateBuildCommand(const char* makeProgram,
- const char *projectName,
- const char* additionalOptions,
+ const char *projectName,
+ const char* additionalOptions,
const char *targetName,
- const char* config,
+ const char* config,
bool ignoreErrors,
bool)
{
@@ -210,7 +210,7 @@ std::string cmGlobalXCodeGenerator
"Generator cannot find the appropriate make command.");
return "";
}
- std::string makeCommand =
+ std::string makeCommand =
cmSystemTools::ConvertToOutputPath(makeProgram);
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
@@ -284,7 +284,7 @@ void cmGlobalXCodeGenerator::Generate()
// make sure extra targets are added before calling
// the parent generate which will call trace depends
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
- {
+ {
cmLocalGenerator* root = it->second[0];
this->SetGenerationRoot(root);
// add ALL_BUILD, INSTALL, etc
@@ -293,7 +293,7 @@ void cmGlobalXCodeGenerator::Generate()
this->ForceLinkerLanguages();
this->cmGlobalGenerator::Generate();
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
- {
+ {
cmLocalGenerator* root = it->second[0];
this->SetGenerationRoot(root);
// now create the project
@@ -319,8 +319,8 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
}
//----------------------------------------------------------------------------
-void
-cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
+void
+cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& gens)
{
cmMakefile* mf = root->GetMakefile();
@@ -339,7 +339,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
listfile += "CMakeLists.txt";
allbuild->AddSource(listfile.c_str());
- // Add XCODE depend helper
+ // Add XCODE depend helper
std::string dir = mf->GetCurrentOutputDirectory();
cmCustomCommandLine makecommand;
makecommand.push_back("make");
@@ -361,7 +361,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
for(std::vector<cmLocalGenerator*>::iterator i = gens.begin();
i != gens.end(); ++i)
{
- cmLocalGenerator* lg = *i;
+ cmLocalGenerator* lg = *i;
if(this->IsExcluded(root, *i))
{
continue;
@@ -370,7 +370,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
cmTarget& target = l->second;
- // make all exe, shared libs and modules
+ // make all exe, shared libs and modules
// run the depend check makefile as a post build rule
// this will make sure that when the next target is built
// things are up-to-date
@@ -385,7 +385,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget::POST_BUILD,
"Depend check for xcode",
dir.c_str());
-
+
}
if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
@@ -407,8 +407,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root)
cmMakefile* mf = root->GetMakefile();
std::vector<std::string> lfiles = mf->GetListFiles();
// sort the array
- std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
- std::vector<std::string>::iterator new_end =
+ std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
+ std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(), lfiles.end());
lfiles.erase(new_end, lfiles.end());
std::string dir = mf->GetHomeOutputDirectory();
@@ -428,7 +428,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root)
makefileStream << "\\\n" << this->ConvertToRelativeForMake(i->c_str());
}
std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND");
- makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmake.c_str())
+ makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmake.c_str())
<< " -H" << this->ConvertToRelativeForMake(
mf->GetHomeDirectory())
<< " -B" << this->ConvertToRelativeForMake(
@@ -451,7 +451,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
}
//----------------------------------------------------------------------------
-cmXCodeObject*
+cmXCodeObject*
cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype)
{
cmXCodeObject* obj;
@@ -468,7 +468,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::PBXType ptype)
}
//----------------------------------------------------------------------------
-cmXCodeObject*
+cmXCodeObject*
cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type)
{
cmXCodeObject* obj = new cmXCodeObject(cmXCodeObject::None, type);
@@ -539,7 +539,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
buildFile->SetComment(fileRef->GetComment());
buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
- cmXCodeObject* settings =
+ cmXCodeObject* settings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str()));
@@ -608,7 +608,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
}
fileRef->AddAttribute("fileEncoding", this->CreateString("4"));
- const char* lang =
+ const char* lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
std::string sourcecode = "sourcecode";
std::string ext = sf->GetExtension();
@@ -643,7 +643,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
sourcecode += ".c.h";
}
else if(ext == "hxx" || ext == "hpp" || ext == "txx"
- || ext == "pch")
+ || ext == "pch" || ext == "hh")
{
sourcecode += ".cpp.h";
}
@@ -675,7 +675,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
// // valid lastKnownFileType value.
// }
- fileRef->AddAttribute("lastKnownFileType",
+ fileRef->AddAttribute("lastKnownFileType",
this->CreateString(sourcecode.c_str()));
// Store the file path relative to the top of the source tree.
@@ -717,7 +717,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
std::string outdir =
cmSystemTools::CollapseFullPath(this->CurrentMakefile->
GetCurrentOutputDirectory());
- cmSystemTools::SplitPath(outdir.c_str(),
+ cmSystemTools::SplitPath(outdir.c_str(),
this->CurrentOutputDirectoryComponents);
// Select the current set of configuration types.
@@ -767,7 +767,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
*i, cmtarget);
cmXCodeObject* fr = xsf->GetObject("fileRef");
- cmXCodeObject* filetype =
+ cmXCodeObject* filetype =
fr->GetObject()->GetObject("lastKnownFileType");
cmTarget::SourceFileFlags tsFlags =
@@ -813,7 +813,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
sourceBuildPhase =
this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase);
sourceBuildPhase->SetComment("Sources");
- sourceBuildPhase->AddAttribute("buildActionMask",
+ sourceBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
for(std::vector<cmXCodeObject*>::iterator i = sourceFiles.begin();
@@ -822,7 +822,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
buildFiles->AddObject(*i);
}
sourceBuildPhase->AddAttribute("files", buildFiles);
- sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0"));
}
@@ -915,7 +915,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt )
{
cmXCodeObject* xsf =
- this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
+ this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
*sfIt, cmtarget);
buildFiles->AddObject(xsf);
}
@@ -939,12 +939,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
{
buildFiles->AddObject(*i);
}
- frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0"));
}
// create list of build phases and create the XCode target
- cmXCodeObject* buildPhases =
+ cmXCodeObject* buildPhases =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
this->CreateCustomCommands(buildPhases, sourceBuildPhase,
@@ -1033,15 +1033,15 @@ cmGlobalXCodeGenerator::CreateBuildPhase(const char* name,
{
return 0;
}
- cmXCodeObject* buildPhase =
+ cmXCodeObject* buildPhase =
this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase);
buildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
buildPhase->AddAttribute("files", buildFiles);
- buildPhase->AddAttribute("name",
+ buildPhase->AddAttribute("name",
this->CreateString(name));
- buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ buildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0"));
buildPhase->AddAttribute("shellPath",
this->CreateString("/bin/sh"));
@@ -1064,16 +1064,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
frameworkBuildPhase,
cmTarget& cmtarget)
{
- std::vector<cmCustomCommand> const & prebuild
+ std::vector<cmCustomCommand> const & prebuild
= cmtarget.GetPreBuildCommands();
- std::vector<cmCustomCommand> const & prelink
+ std::vector<cmCustomCommand> const & prelink
= cmtarget.GetPreLinkCommands();
- std::vector<cmCustomCommand> const & postbuild
+ std::vector<cmCustomCommand> const & postbuild
= cmtarget.GetPostBuildCommands();
std::vector<cmSourceFile*>const &classes = cmtarget.GetSourceFiles();
// add all the sources
std::vector<cmCustomCommand> commands;
- for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
+ for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); ++i)
{
if((*i)->GetCustomCommand())
@@ -1082,7 +1082,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
}
std::vector<cmCustomCommand> reruncom;
- cmXCodeObject* cmakeReRunPhase =
+ cmXCodeObject* cmakeReRunPhase =
this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase",
cmtarget, reruncom);
buildPhases->AddObject(cmakeReRunPhase);
@@ -1092,15 +1092,15 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
"cmakeRulesBuildPhase",
cmtarget, commands);
// create prebuild phase
- cmXCodeObject* preBuildPhase =
+ cmXCodeObject* preBuildPhase =
this->CreateBuildPhase("CMake PreBuild Rules", "preBuildCommands",
cmtarget, prebuild);
// create prelink phase
- cmXCodeObject* preLinkPhase =
+ cmXCodeObject* preLinkPhase =
this->CreateBuildPhase("CMake PreLink Rules", "preLinkCommands",
cmtarget, prelink);
// create postbuild phase
- cmXCodeObject* postBuildPhase =
+ cmXCodeObject* postBuildPhase =
this->CreateBuildPhase("CMake PostBuild Rules", "postBuildPhase",
cmtarget, postbuild);
@@ -1167,10 +1167,10 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
}
//----------------------------------------------------------------------------
-void
+void
cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmTarget& target,
- std::vector<cmCustomCommand>
+ std::vector<cmCustomCommand>
const & commands,
const char* name)
{
@@ -1181,7 +1181,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
std::string makecmd = "make -C ";
makecmd += cdir;
makecmd += " -f ";
- makecmd +=
+ makecmd +=
this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
buildphase->AddAttribute("shellScript",
@@ -1195,7 +1195,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand const& cc = *i;
+ cmCustomCommand const& cc = *i;
if(!cc.GetCommandLines().empty())
{
const std::vector<std::string>& outputs = cc.GetOutputs();
@@ -1213,7 +1213,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
}
}
}
-
+
std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory();
dir += "/CMakeScripts";
cmSystemTools::MakeDirectory(dir.c_str());
@@ -1223,19 +1223,19 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
makefile += "_";
makefile += name;
makefile += ".make";
-
- for (std::vector<std::string>::const_iterator currentConfig=
+
+ for (std::vector<std::string>::const_iterator currentConfig=
this->CurrentConfigurationTypes.begin();
currentConfig!=this->CurrentConfigurationTypes.end();
currentConfig++ )
{
- this->CreateCustomRulesMakefile(makefile.c_str(),
- target,
- commands,
+ this->CreateCustomRulesMakefile(makefile.c_str(),
+ target,
+ commands,
currentConfig->c_str(),
multipleOutputPairs);
}
-
+
std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory();
cdir = this->ConvertToRelativeForXCode(cdir.c_str());
std::string makecmd = "make -C ";
@@ -1249,18 +1249,18 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
}
makecmd += " all";
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
- buildphase->AddAttribute("shellScript",
+ buildphase->AddAttribute("shellScript",
this->CreateString(makecmd.c_str()));
}
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator
-::CreateCustomRulesMakefile(const char* makefileBasename,
- cmTarget& target,
- std::vector<cmCustomCommand>
+::CreateCustomRulesMakefile(const char* makefileBasename,
+ cmTarget& target,
+ std::vector<cmCustomCommand>
const & commands,
const char* configName,
- const std::map<cmStdString,
+ const std::map<cmStdString,
cmStdString>& multipleOutputPairs
)
{
@@ -1277,7 +1277,7 @@ void cmGlobalXCodeGenerator
makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n";
makefileStream << "# Custom rules for " << target.GetName() << "\n";
-
+
// have all depend on all outputs
makefileStream << "all: ";
std::map<const cmCustomCommand*, cmStdString> tname;
@@ -1285,7 +1285,7 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand const& cc = *i;
+ cmCustomCommand const& cc = *i;
if(!cc.GetCommandLines().empty())
{
const std::vector<std::string>& outputs = cc.GetOutputs();
@@ -1299,10 +1299,10 @@ void cmGlobalXCodeGenerator
}
}
else
- {
+ {
cmOStringStream str;
str << "_buildpart_" << count++ ;
- tname[&cc] = std::string(target.GetName()) + str.str();
+ tname[&cc] = std::string(target.GetName()) + str.str();
makefileStream << "\\\n\t" << tname[&cc];
}
}
@@ -1311,7 +1311,7 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand const& cc = *i;
+ cmCustomCommand const& cc = *i;
if(!cc.GetCommandLines().empty())
{
bool escapeOldStyle = cc.GetEscapeOldStyle();
@@ -1330,7 +1330,7 @@ void cmGlobalXCodeGenerator
// There are no outputs. Use the generated force rule name.
makefileStream << tname[&cc] << ": ";
}
- for(std::vector<std::string>::const_iterator d =
+ for(std::vector<std::string>::const_iterator d =
cc.GetDepends().begin();
d != cc.GetDepends().end(); ++d)
{
@@ -1351,7 +1351,7 @@ void cmGlobalXCodeGenerator
}
// Add each command line to the set of commands.
- for(cmCustomCommandLines::const_iterator cl =
+ for(cmCustomCommandLines::const_iterator cl =
cc.GetCommandLines().begin();
cl != cc.GetCommandLines().end(); ++cl)
{
@@ -1359,7 +1359,7 @@ void cmGlobalXCodeGenerator
const cmCustomCommandLine& commandLine = *cl;
std::string cmd2 = this->CurrentLocalGenerator
->GetRealLocation(commandLine[0].c_str(), configName);
-
+
cmSystemTools::ReplaceString(cmd2, "/./", "/");
cmd2 = this->ConvertToRelativeForMake(cmd2.c_str());
std::string cmd;
@@ -1393,7 +1393,7 @@ void cmGlobalXCodeGenerator
// Add rules to deal with multiple outputs of custom commands.
if(!multipleOutputPairs.empty())
{
- makefileStream <<
+ makefileStream <<
"\n# Dependencies of multiple outputs to their primary outputs \n";
for(std::map<cmStdString, cmStdString>::const_iterator o =
@@ -1424,6 +1424,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string defFlags;
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
(target.GetType() == cmTarget::MODULE_LIBRARY));
+ bool binary = ((target.GetType() == cmTarget::STATIC_LIBRARY) ||
+ (target.GetType() == cmTarget::EXECUTABLE) ||
+ shared);
const char* lang = target.GetLinkerLanguage(configName);
std::string cflags;
@@ -1438,10 +1441,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Add language-specific flags.
this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
-
+
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddSharedFlags(flags, lang, shared);
}
+ else if(binary)
+ {
+ cmSystemTools::Error
+ ("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
// Add define flags
this->CurrentLocalGenerator->
@@ -1476,11 +1486,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE)
{
- extraLinkOptions =
+ extraLinkOptions =
this->CurrentMakefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
std::string var = "CMAKE_EXE_LINKER_FLAGS_";
var += cmSystemTools::UpperCase(configName);
- std::string val =
+ std::string val =
this->CurrentMakefile->GetSafeDefinition(var.c_str());
if(val.size())
{
@@ -1579,9 +1589,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(pndir.c_str()));
pndir = target.GetDirectory(configName);
}
- buildSettings->AddAttribute("EXECUTABLE_PREFIX",
+ buildSettings->AddAttribute("EXECUTABLE_PREFIX",
this->CreateString(pnprefix.c_str()));
- buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
+ buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
this->CreateString(pnsuffix.c_str()));
}
buildSettings->AddAttribute("SYMROOT",
@@ -1592,20 +1602,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
case cmTarget::STATIC_LIBRARY:
{
- buildSettings->AddAttribute("LIBRARY_STYLE",
+ buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("STATIC"));
break;
}
-
+
case cmTarget::MODULE_LIBRARY:
{
- buildSettings->AddAttribute("LIBRARY_STYLE",
+ buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE"));
if(this->XcodeVersion >= 22)
{
- buildSettings->AddAttribute("MACH_O_TYPE",
+ buildSettings->AddAttribute("MACH_O_TYPE",
this->CreateString("mh_bundle"));
- buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
+ buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
this->CreateString("NO"));
// Add the flags to create an executable.
std::string createFlags =
@@ -1690,7 +1700,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
plist.c_str());
std::string path =
this->ConvertToRelativeForXCode(plist.c_str());
- buildSettings->AddAttribute("INFOPLIST_FILE",
+ buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(path.c_str()));
}
@@ -1701,7 +1711,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
if(this->XcodeVersion >= 22)
{
- buildSettings->AddAttribute("PREBINDING",
+ buildSettings->AddAttribute("PREBINDING",
this->CreateString("NO"));
}
@@ -1726,7 +1736,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
else
{
- std::string incpath =
+ std::string incpath =
this->XCodeEscapePath(i->c_str());
dirs.Add(incpath.c_str());
}
@@ -1745,12 +1755,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
if(!fdirs.IsEmpty())
{
- buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS",
+ buildSettings->AddAttribute("FRAMEWORK_SEARCH_PATHS",
fdirs.CreateList());
}
if(!dirs.IsEmpty())
{
- buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
+ buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
dirs.CreateList());
}
std::string oflagc = this->ExtractFlag("-O", cflags);
@@ -1792,11 +1802,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(gflagc.size() ==0 && gflag.size() == 0)
{
debugStr = "NO";
- }
+ }
buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS",
this->CreateString(debugStr));
- buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL",
+ buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL",
this->CreateString(optLevel));
buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN",
this->CreateString("NO"));
@@ -1806,11 +1816,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
flags += " ";
flags += defFlags;
- buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
+ buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
this->CreateString(flags.c_str()));
cflags += " ";
cflags += defFlags;
- buildSettings->AddAttribute("OTHER_CFLAGS",
+ buildSettings->AddAttribute("OTHER_CFLAGS",
this->CreateString(cflags.c_str()));
}
@@ -1818,7 +1828,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
flags += " ";
flags += defFlags;
- buildSettings->AddAttribute("OTHER_CFLAGS",
+ buildSettings->AddAttribute("OTHER_CFLAGS",
this->CreateString(flags.c_str()));
}
@@ -1846,9 +1856,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
buildSettings->AddAttribute("INSTALL_PATH",
this->CreateString(install_name_dir.c_str()));
- buildSettings->AddAttribute("OTHER_LDFLAGS",
+ buildSettings->AddAttribute("OTHER_LDFLAGS",
this->CreateString(extraLinkOptions.c_str()));
- buildSettings->AddAttribute("OTHER_REZFLAGS",
+ buildSettings->AddAttribute("OTHER_REZFLAGS",
this->CreateString(""));
buildSettings->AddAttribute("SECTORDER_FLAGS",
this->CreateString(""));
@@ -1918,12 +1928,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
//----------------------------------------------------------------------------
-cmXCodeObject*
+cmXCodeObject*
cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
{
cmXCodeObject* shellBuildPhase =
this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase);
- shellBuildPhase->AddAttribute("buildActionMask",
+ shellBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
shellBuildPhase->AddAttribute("files", buildFiles);
@@ -1938,10 +1948,10 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
shellBuildPhase->AddAttribute("shellScript",
this->CreateString(
"# shell script goes here\nexit 0"));
- cmXCodeObject* target =
+ cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
target->SetComment(cmtarget.GetName());
- cmXCodeObject* buildPhases =
+ cmXCodeObject* buildPhases =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> emptyContentVector;
this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0,
@@ -1960,7 +1970,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
this->CreateBuildSettings(cmtarget, buildSettings, theConfig);
target->AddAttribute("buildSettings", buildSettings);
}
- cmXCodeObject* dependencies =
+ cmXCodeObject* dependencies =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
@@ -1988,13 +1998,13 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
cmTarget& cmtarget)
{
- std::string configTypes =
+ std::string configTypes =
this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES");
std::vector<std::string> configVectorIn;
std::vector<std::string> configVector;
configVectorIn.push_back(configTypes);
cmSystemTools::ExpandList(configVectorIn, configVector);
- cmXCodeObject* configlist =
+ cmXCodeObject* configlist =
this->CreateObject(cmXCodeObject::XCConfigurationList);
cmXCodeObject* buildConfigurations =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
@@ -2005,11 +2015,11 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
comment += cmtarget.GetName();
comment += "\"";
configlist->SetComment(comment.c_str());
- target->AddAttribute("buildConfigurationList",
+ target->AddAttribute("buildConfigurationList",
this->CreateObjectReference(configlist));
for(unsigned int i = 0; i < configVector.size(); ++i)
{
- cmXCodeObject* config =
+ cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
buildConfigurations->AddObject(config);
cmXCodeObject* buildSettings =
@@ -2022,9 +2032,9 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
}
if(configVector.size())
{
- configlist->AddAttribute("defaultConfigurationName",
+ configlist->AddAttribute("defaultConfigurationName",
this->CreateString(configVector[0].c_str()));
- configlist->AddAttribute("defaultConfigurationIsVisible",
+ configlist->AddAttribute("defaultConfigurationIsVisible",
this->CreateString("0"));
return configVector[0];
}
@@ -2079,7 +2089,7 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
cmXCodeObject* buildPhases)
{
- cmXCodeObject* target =
+ cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXNativeTarget);
target->AddAttribute("buildPhases", buildPhases);
cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST);
@@ -2097,13 +2107,13 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
this->CreateBuildSettings(cmtarget, buildSettings, defConfig.c_str());
target->AddAttribute("buildSettings", buildSettings);
}
- cmXCodeObject* dependencies =
+ cmXCodeObject* dependencies =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
- cmXCodeObject* fileRef =
+ cmXCodeObject* fileRef =
this->CreateObject(cmXCodeObject::PBXFileReference);
if(const char* fileType = this->GetTargetFileType(cmtarget))
{
@@ -2115,7 +2125,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
fileRef->AddAttribute("sourceTree",
this->CreateString("BUILT_PRODUCTS_DIR"));
fileRef->SetComment(cmtarget.GetName());
- target->AddAttribute("productReference",
+ target->AddAttribute("productReference",
this->CreateObjectReference(fileRef));
if(const char* productType = this->GetTargetProductType(cmtarget))
{
@@ -2156,20 +2166,20 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
// now avoid circular references if dependTarget already
// depends on target then skip it. Circular references crashes
// xcode
- cmXCodeObject* dependTargetDepends =
+ cmXCodeObject* dependTargetDepends =
dependTarget->GetObject("dependencies");
if(dependTargetDepends)
{
if(dependTargetDepends->HasObject(target->GetPBXTargetDependency()))
- {
+ {
return;
}
}
-
+
cmXCodeObject* targetdep = dependTarget->GetPBXTargetDependency();
if(!targetdep)
{
- cmXCodeObject* container =
+ cmXCodeObject* container =
this->CreateObject(cmXCodeObject::PBXContainerItemProxy);
container->SetComment("PBXContainerItemProxy");
container->AddAttribute("containerPortal",
@@ -2177,25 +2187,25 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
container->AddAttribute("proxyType", this->CreateString("1"));
container->AddAttribute("remoteGlobalIDString",
this->CreateObjectReference(dependTarget));
- container->AddAttribute("remoteInfo",
+ container->AddAttribute("remoteInfo",
this->CreateString(
dependTarget->GetTarget()->GetName()));
- targetdep =
+ targetdep =
this->CreateObject(cmXCodeObject::PBXTargetDependency);
targetdep->SetComment("PBXTargetDependency");
targetdep->AddAttribute("target",
this->CreateObjectReference(dependTarget));
- targetdep->AddAttribute("targetProxy",
+ targetdep->AddAttribute("targetProxy",
this->CreateObjectReference(container));
dependTarget->SetPBXTargetDependency(targetdep);
}
-
+
cmXCodeObject* depends = target->GetObject("dependencies");
if(!depends)
{
cmSystemTools::
Error("target does not have dependencies attribute error..");
-
+
}
else
{
@@ -2243,14 +2253,14 @@ void cmGlobalXCodeGenerator
{
// There are multiple configurations. Add the setting to the
// buildSettings of the configuration name given.
- cmXCodeObject* configurationList =
+ cmXCodeObject* configurationList =
target->GetObject("buildConfigurationList")->GetObject();
- cmXCodeObject* buildConfigs =
+ cmXCodeObject* buildConfigs =
configurationList->GetObject("buildConfigurations");
std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
- // each configuration and the target itself has a buildSettings in it
+ // each configuration and the target itself has a buildSettings in it
//list.push_back(target);
- for(std::vector<cmXCodeObject*>::iterator i = list.begin();
+ for(std::vector<cmXCodeObject*>::iterator i = list.begin();
i != list.end(); ++i)
{
if(configName)
@@ -2412,7 +2422,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
cmTargets &tgts = mf->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
- {
+ {
cmTarget& cmtarget = l->second;
// Same skipping logic here as in CreateXCodeTargets so that we do not
@@ -2435,21 +2445,21 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles();
- for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
+ for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++)
{
cmSourceFile* sf = *s;
// Add the file to the list of sources.
std::string const& source = sf->GetFullPath();
- cmSourceGroup& sourceGroup =
+ cmSourceGroup& sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups);
- cmXCodeObject* pbxgroup =
+ cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup);
cmStdString key = GetGroupMapKey(cmtarget, sf);
this->GroupMap[key] = pbxgroup;
}
}
- }
+ }
}
//----------------------------------------------------------------------------
@@ -2475,7 +2485,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
{
tgroup = this->CreateObject(cmXCodeObject::PBXGroup);
this->TargetGroup[cmtarget.GetName()] = tgroup;
- cmXCodeObject* tgroupChildren =
+ cmXCodeObject* tgroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName()));
tgroup->AddAttribute("children", tgroupChildren);
@@ -2498,7 +2508,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
cmXCodeObject* tgroupChildren = tgroup->GetObject("children");
cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup);
- cmXCodeObject* groupChildren =
+ cmXCodeObject* groupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
group->AddAttribute("name", this->CreateString(sg->GetName()));
group->AddAttribute("children", groupChildren);
@@ -2518,19 +2528,19 @@ void cmGlobalXCodeGenerator
std::vector<cmLocalGenerator*>&
generators)
{
- this->ClearXCodeObjects();
+ this->ClearXCodeObjects();
this->RootObject = 0;
this->SourcesGroupChildren = 0;
this->ResourcesGroupChildren = 0;
this->MainGroupChildren = 0;
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
- cmXCodeObject* developBuildStyle =
+ cmXCodeObject* developBuildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
if(this->XcodeVersion == 15)
{
- developBuildStyle->AddAttribute("name",
+ developBuildStyle->AddAttribute("name",
this->CreateString("Development"));
developBuildStyle->AddAttribute("buildSettings", group);
listObjs->AddObject(developBuildStyle);
@@ -2546,7 +2556,7 @@ void cmGlobalXCodeGenerator
{
for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i)
{
- cmXCodeObject* buildStyle =
+ cmXCodeObject* buildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
const char* name = this->CurrentConfigurationTypes[i].c_str();
buildStyle->AddAttribute("name", this->CreateString(name));
@@ -2560,7 +2570,7 @@ void cmGlobalXCodeGenerator
}
cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->MainGroupChildren =
+ this->MainGroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
mainGroup->AddAttribute("children", this->MainGroupChildren);
if(this->XcodeVersion == 15)
@@ -2570,7 +2580,7 @@ void cmGlobalXCodeGenerator
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->SourcesGroupChildren =
+ this->SourcesGroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
sourcesGroup->AddAttribute("children", this->SourcesGroupChildren);
@@ -2593,7 +2603,7 @@ void cmGlobalXCodeGenerator
resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
this->MainGroupChildren->AddObject(resourcesGroup);
- // now create the cmake groups
+ // now create the cmake groups
this->CreateGroups(root, generators);
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
@@ -2603,16 +2613,16 @@ void cmGlobalXCodeGenerator
productGroup->AddAttribute("refType", this->CreateString("4"));
}
productGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- cmXCodeObject* productGroupChildren =
+ cmXCodeObject* productGroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
productGroup->AddAttribute("children", productGroupChildren);
this->MainGroupChildren->AddObject(productGroup);
-
-
+
+
this->RootObject = this->CreateObject(cmXCodeObject::PBXProject);
this->RootObject->SetComment("Project object");
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- this->RootObject->AddAttribute("mainGroup",
+ this->RootObject->AddAttribute("mainGroup",
this->CreateObjectReference(mainGroup));
this->RootObject->AddAttribute("buildSettings", group);
this->RootObject->AddAttribute("buildStyles", listObjs);
@@ -2639,18 +2649,18 @@ void cmGlobalXCodeGenerator
this->CreateString(pdir.c_str()));
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
}
- cmXCodeObject* configlist =
+ cmXCodeObject* configlist =
this->CreateObject(cmXCodeObject::XCConfigurationList);
cmXCodeObject* buildConfigurations =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> configs;
if(this->XcodeVersion == 15)
{
- cmXCodeObject* configDebug =
+ cmXCodeObject* configDebug =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
configDebug->AddAttribute("name", this->CreateString("Debug"));
configs.push_back(configDebug);
- cmXCodeObject* configRelease =
+ cmXCodeObject* configRelease =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
configRelease->AddAttribute("name", this->CreateString("Release"));
configs.push_back(configRelease);
@@ -2660,7 +2670,7 @@ void cmGlobalXCodeGenerator
for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i)
{
const char* name = this->CurrentConfigurationTypes[i].c_str();
- cmXCodeObject* config =
+ cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
config->AddAttribute("name", this->CreateString(name));
configs.push_back(config);
@@ -2678,13 +2688,13 @@ void cmGlobalXCodeGenerator
comment += this->CurrentProject;
comment += "\"";
configlist->SetComment(comment.c_str());
- configlist->AddAttribute("defaultConfigurationIsVisible",
+ configlist->AddAttribute("defaultConfigurationIsVisible",
this->CreateString("0"));
- configlist->AddAttribute("defaultConfigurationName",
+ configlist->AddAttribute("defaultConfigurationName",
this->CreateString("Debug"));
cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- const char* osxArch =
+ const char* osxArch =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
if(strlen(osxArch) == 0)
{
@@ -2709,11 +2719,11 @@ void cmGlobalXCodeGenerator
this->CreateString("YES"));
}
- const char* sysroot =
+ const char* sysroot =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
- const char* sysrootDefault =
+ const char* sysrootDefault =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
- const char* deploymentTarget =
+ const char* deploymentTarget =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
if(osxArch && sysroot)
{
@@ -2723,11 +2733,11 @@ void cmGlobalXCodeGenerator
cmSystemTools::ExpandListArgument(std::string(osxArch),
this->Architectures);
flagsUsed = true;
- buildSettings->AddAttribute("SDKROOT",
+ buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
std::string archString;
const char* sep = "";
- for( std::vector<std::string>::iterator i =
+ for( std::vector<std::string>::iterator i =
this->Architectures.begin();
i != this->Architectures.end(); ++i)
{
@@ -2735,12 +2745,12 @@ void cmGlobalXCodeGenerator
archString += *i;
sep = " ";
}
- buildSettings->AddAttribute("ARCHS",
+ buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
if(!flagsUsed && sysrootDefault &&
strcmp(sysroot, sysrootDefault) != 0)
{
- buildSettings->AddAttribute("SDKROOT",
+ buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
}
}
@@ -2776,7 +2786,7 @@ void cmGlobalXCodeGenerator
(*i)->AddAttribute("buildSettings", buildSettings);
}
- this->RootObject->AddAttribute("buildConfigurationList",
+ this->RootObject->AddAttribute("buildConfigurationList",
this->CreateObjectReference(configlist));
std::vector<cmXCodeObject*> targets;
@@ -2801,7 +2811,7 @@ void cmGlobalXCodeGenerator
cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST);
for(std::vector<cmXCodeObject*>::iterator i = targets.begin();
i != targets.end(); ++i)
- {
+ {
cmXCodeObject* t = *i;
allTargets->AddObject(t);
cmXCodeObject* productRef = t->GetObject("productReference");
@@ -2814,11 +2824,11 @@ void cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void
+void
cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::vector<cmXCodeObject*>& targets)
-{
- cmGeneratedFileStream
+{
+ cmGeneratedFileStream
makefileStream(this->CurrentXCodeHackMakefile.c_str());
if(!makefileStream)
{
@@ -2864,9 +2874,9 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
this->ConvertToRelativeForMake(tfull.c_str());
}
}
- makefileStream << "\n\n";
+ makefileStream << "\n\n";
}
- makefileStream
+ makefileStream
<< "# For each target create a dummy rule "
"so the target does not have to exist\n";
std::set<cmStdString> emitted;
@@ -2876,7 +2886,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
cmXCodeObject* target = *i;
std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs =
target->GetDependLibraries();
- for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci
+ for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci
= deplibs.begin(); ci != deplibs.end(); ++ci)
{
for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin();
@@ -2884,7 +2894,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
{
if(emitted.insert(*d).second)
{
- makefileStream <<
+ makefileStream <<
this->ConvertToRelativeForMake(d->c_str()) << ":\n";
}
}
@@ -2893,10 +2903,10 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream << "\n\n";
// Write rules to help Xcode relink things at the right time.
- makefileStream <<
+ makefileStream <<
"# Rules to remove targets that are older than anything to which they\n"
"# link. This forces Xcode to relink the targets from scratch. It\n"
- "# does not seem to check these dependencies itself.\n";
+ "# does not seem to check these dependencies itself.\n";
for(std::vector<std::string>::const_iterator
ct = this->CurrentConfigurationTypes.begin();
ct != this->CurrentConfigurationTypes.end(); ++ct)
@@ -2917,7 +2927,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
{
// Create a rule for this target.
std::string tfull = t->GetFullPath(configName);
- makefileStream << this->ConvertToRelativeForMake(tfull.c_str())
+ makefileStream << this->ConvertToRelativeForMake(tfull.c_str())
<< ":";
// List dependencies if any exist.
@@ -2929,7 +2939,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
for(std::vector<cmStdString>::const_iterator d = deplibs.begin();
d != deplibs.end(); ++d)
{
- makefileStream << "\\\n\t" <<
+ makefileStream << "\\\n\t" <<
this->ConvertToRelativeForMake(d->c_str());
}
}
@@ -2951,7 +2961,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
universal += "/";
universal += t->GetName();
universal += ".build/Objects-normal/";
- for( std::vector<std::string>::iterator arch =
+ for( std::vector<std::string>::iterator arch =
this->Architectures.begin();
arch != this->Architectures.end(); ++arch)
{
@@ -2960,7 +2970,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
universalFile += "/";
universalFile += t->GetFullName(configName);
makefileStream << "\t/bin/rm -f "
- <<
+ <<
this->ConvertToRelativeForMake(universalFile.c_str())
<< "\n";
}
@@ -2974,7 +2984,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
- std::vector<cmLocalGenerator*>&
+ std::vector<cmLocalGenerator*>&
generators)
{
if(generators.size() == 0)
@@ -3014,7 +3024,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
}
//----------------------------------------------------------------------------
-void
+void
cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmLocalGenerator* ,
std::vector<cmLocalGenerator*>& )
@@ -3072,7 +3082,7 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p)
}
else
{
- std::string ret =
+ std::string ret =
this->CurrentLocalGenerator->
ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p);
return cmSystemTools::ConvertToOutputPath(ret.c_str());
@@ -3088,7 +3098,7 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p)
}
else
{
- std::string ret =
+ std::string ret =
this->CurrentLocalGenerator->
ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p);
return cmSystemTools::ConvertToOutputPath(ret.c_str());
@@ -3128,7 +3138,7 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p)
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::
GetTargetObjectFileDirectories(cmTarget* target,
- std::vector<std::string>&
+ std::vector<std::string>&
dirs)
{
std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory();
@@ -3142,7 +3152,7 @@ GetTargetObjectFileDirectories(cmTarget* target,
std::string dirsave = dir;
if(this->Architectures.size())
{
- for(std::vector<std::string>::iterator i = this->Architectures.begin();
+ for(std::vector<std::string>::iterator i = this->Architectures.begin();
i != this->Architectures.end(); ++i)
{
dir += *i;
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
new file mode 100644
index 0000000..bdb33bc
--- /dev/null
+++ b/Source/cmGraphVizWriter.cxx
@@ -0,0 +1,435 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmGraphVizWriter.h"
+#include "cmMakefile.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGeneratedFileStream.h"
+
+#include <memory>
+
+
+
+static const char* getShapeForTarget(const cmTarget* target)
+{
+ if (!target)
+ {
+ return "ellipse";
+ }
+
+ switch ( target->GetType() )
+ {
+ case cmTarget::EXECUTABLE:
+ return "house";
+ case cmTarget::STATIC_LIBRARY:
+ return "diamond";
+ case cmTarget::SHARED_LIBRARY:
+ return "polygon";
+ case cmTarget::MODULE_LIBRARY:
+ return "octagon";
+ default:
+ break;
+ }
+
+ return "box";
+}
+
+
+cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
+ localGenerators)
+:GraphType("digraph")
+,GraphName("GG")
+,GraphHeader("node [\n fontsize = \"12\"\n];")
+,GraphNodePrefix("node")
+,GenerateForExecutables(true)
+,GenerateForStaticLibs(true)
+,GenerateForSharedLibs(true)
+,GenerateForModuleLibs(true)
+,LocalGenerators(localGenerators)
+,HaveTargetsAndLibs(false)
+{
+}
+
+
+void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
+ const char* fallbackSettingsFileName)
+{
+ cmake cm;
+ cmGlobalGenerator ggi;
+ ggi.SetCMakeInstance(&cm);
+ std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
+
+ const char* inFileName = settingsFileName;
+
+ if ( !cmSystemTools::FileExists(inFileName) )
+ {
+ inFileName = fallbackSettingsFileName;
+ if ( !cmSystemTools::FileExists(inFileName) )
+ {
+ return;
+ }
+ }
+
+ if ( !mf->ReadListFile(0, inFileName) )
+ {
+ cmSystemTools::Error("Problem opening GraphViz options file: ",
+ inFileName);
+ return;
+ }
+
+ std::cout << "Reading GraphViz options file: " << inFileName << std::endl;
+
+#define __set_if_set(var, cmakeDefinition) \
+ { \
+ const char* value = mf->GetDefinition(cmakeDefinition); \
+ if ( value ) \
+ { \
+ var = value; \
+ } \
+ }
+
+ __set_if_set(this->GraphType, "GRAPHVIZ_GRAPH_TYPE");
+ __set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME");
+ __set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
+ __set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
+
+#define __set_bool_if_set(var, cmakeDefinition) \
+ { \
+ const char* value = mf->GetDefinition(cmakeDefinition); \
+ if ( value ) \
+ { \
+ var = mf->IsOn(cmakeDefinition); \
+ } \
+ }
+
+ __set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
+ __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
+ __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
+ __set_bool_if_set(this->GenerateForModuleLibs , "GRAPHVIZ_MODULE_LIBS");
+
+ cmStdString tmpRegexString;
+ __set_if_set(tmpRegexString, "GRAPHVIZ_TARGET_IGNORE_REGEX");
+ if (tmpRegexString.size() > 0)
+ {
+ if (!this->TargetIgnoreRegex.compile(tmpRegexString.c_str()))
+ {
+ std::cerr << "Could not compile bad regex \"" << tmpRegexString << "\""
+ << std::endl;
+ }
+ }
+
+ this->TargetsToIgnore.clear();
+ const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
+ if ( ignoreTargets )
+ {
+ std::vector<std::string> ignoreTargetsVector;
+ cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
+ for(std::vector<std::string>::iterator itvIt = ignoreTargetsVector.begin();
+ itvIt != ignoreTargetsVector.end();
+ ++ itvIt )
+ {
+ this->TargetsToIgnore.insert(itvIt->c_str());
+ }
+ }
+
+}
+
+
+void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
+{
+ this->CollectTargetsAndLibs();
+
+ for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ this->TargetPtrs.begin();
+ ptrIt != this->TargetPtrs.end();
+ ++ptrIt)
+ {
+ if (ptrIt->second == NULL)
+ {
+ continue;
+ }
+
+ if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
+ {
+ continue;
+ }
+
+ std::set<std::string> insertedConnections;
+ std::set<std::string> insertedNodes;
+
+ std::string currentFilename = fileName;
+ currentFilename += ".";
+ currentFilename += ptrIt->first;
+ cmGeneratedFileStream str(currentFilename.c_str());
+ if ( !str )
+ {
+ return;
+ }
+
+ std::cout << "Writing " << currentFilename << "..." << std::endl;
+ this->WriteHeader(str);
+
+ this->WriteConnections(ptrIt->first.c_str(),
+ insertedNodes, insertedConnections, str);
+ this->WriteFooter(str);
+ }
+
+}
+
+
+void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
+{
+ this->CollectTargetsAndLibs();
+
+ cmGeneratedFileStream str(fileName);
+ if ( !str )
+ {
+ return;
+ }
+ this->WriteHeader(str);
+
+ std::cout << "Writing " << fileName << "..." << std::endl;
+
+ std::set<std::string> insertedConnections;
+ std::set<std::string> insertedNodes;
+
+ for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ this->TargetPtrs.begin();
+ ptrIt != this->TargetPtrs.end();
+ ++ptrIt)
+ {
+ if (ptrIt->second == NULL)
+ {
+ continue;
+ }
+
+ if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
+ {
+ continue;
+ }
+
+ this->WriteConnections(ptrIt->first.c_str(),
+ insertedNodes, insertedConnections, str);
+ }
+ this->WriteFooter(str);
+}
+
+
+void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const
+{
+ str << this->GraphType << " " << this->GraphName << " {" << std::endl;
+ str << this->GraphHeader << std::endl;
+}
+
+
+void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const
+{
+ str << "}" << std::endl;
+}
+
+
+void cmGraphVizWriter::WriteConnections(const char* targetName,
+ std::set<std::string>& insertedNodes,
+ std::set<std::string>& insertedConnections,
+ cmGeneratedFileStream& str) const
+{
+ std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
+ this->TargetPtrs.find(targetName);
+
+ if (targetPtrIt == this->TargetPtrs.end()) // not found at all
+ {
+ return;
+ }
+
+ this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
+
+ if (targetPtrIt->second == NULL) // it's an external library
+ {
+ return;
+ }
+
+
+ std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
+
+ const cmTarget::LinkLibraryVectorType* ll =
+ &(targetPtrIt->second->GetOriginalLinkLibraries());
+
+ for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
+ llit != ll->end();
+ ++ llit )
+ {
+ const char* libName = llit->first.c_str();
+ std::map<cmStdString, cmStdString>::const_iterator libNameIt =
+ this->TargetNamesNodes.find(libName);
+
+ std::string connectionName = myNodeName;
+ connectionName += "-";
+ connectionName += libNameIt->second;
+ if (insertedConnections.find(connectionName) == insertedConnections.end())
+ {
+ insertedConnections.insert(connectionName);
+ this->WriteNode(libName, this->TargetPtrs.find(libName)->second,
+ insertedNodes, str);
+
+ str << " \"" << myNodeName.c_str() << "\" -> \""
+ << libNameIt->second.c_str() << "\"";
+ str << " // " << targetName << " -> " << libName << std::endl;
+ this->WriteConnections(libName, insertedNodes, insertedConnections, str);
+ }
+ }
+
+}
+
+
+void cmGraphVizWriter::WriteNode(const char* targetName,
+ const cmTarget* target,
+ std::set<std::string>& insertedNodes,
+ cmGeneratedFileStream& str) const
+{
+ if (insertedNodes.find(targetName) == insertedNodes.end())
+ {
+ insertedNodes.insert(targetName);
+ std::map<cmStdString, cmStdString>::const_iterator nameIt =
+ this->TargetNamesNodes.find(targetName);
+
+ str << " \"" << nameIt->second.c_str() << "\" [ label=\""
+ << targetName << "\" shape=\"" << getShapeForTarget(target)
+ << "\"];" << std::endl;
+ }
+}
+
+
+void cmGraphVizWriter::CollectTargetsAndLibs()
+{
+ if (this->HaveTargetsAndLibs == false)
+ {
+ this->HaveTargetsAndLibs = true;
+ int cnt = this->CollectAllTargets();
+ this->CollectAllExternalLibs(cnt);
+ }
+}
+
+
+int cmGraphVizWriter::CollectAllTargets()
+{
+ int cnt = 0;
+ // First pass get the list of all cmake targets
+ for (std::vector<cmLocalGenerator*>::const_iterator lit =
+ this->LocalGenerators.begin();
+ lit != this->LocalGenerators.end();
+ ++ lit )
+ {
+ const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
+ for ( cmTargets::const_iterator tit = targets->begin();
+ tit != targets->end();
+ ++ tit )
+ {
+ const char* realTargetName = tit->first.c_str();
+ if(this->IgnoreThisTarget(realTargetName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+ //std::cout << "Found target: " << tit->first.c_str() << std::endl;
+ cmOStringStream ostr;
+ ostr << this->GraphNodePrefix << cnt++;
+ this->TargetNamesNodes[realTargetName] = ostr.str();
+ this->TargetPtrs[realTargetName] = &tit->second;
+ }
+ }
+
+ return cnt;
+}
+
+
+int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
+{
+ // Ok, now find all the stuff we link to that is not in cmake
+ for (std::vector<cmLocalGenerator*>::const_iterator lit =
+ this->LocalGenerators.begin();
+ lit != this->LocalGenerators.end();
+ ++ lit )
+ {
+ const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
+ for ( cmTargets::const_iterator tit = targets->begin();
+ tit != targets->end();
+ ++ tit )
+ {
+ const char* realTargetName = tit->first.c_str();
+ if (this->IgnoreThisTarget(realTargetName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+ const cmTarget::LinkLibraryVectorType* ll =
+ &(tit->second.GetOriginalLinkLibraries());
+ for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
+ llit != ll->end();
+ ++ llit )
+ {
+ const char* libName = llit->first.c_str();
+ if (this->IgnoreThisTarget(libName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+
+ std::map<cmStdString, const cmTarget*>::const_iterator tarIt =
+ this->TargetPtrs.find(libName);
+ if ( tarIt == this->TargetPtrs.end() )
+ {
+ cmOStringStream ostr;
+ ostr << this->GraphNodePrefix << cnt++;
+ this->TargetNamesNodes[libName] = ostr.str();
+ this->TargetPtrs[libName] = NULL;
+ //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
+ //<< "\" shape=\"ellipse\"];" << std::endl;
+ }
+ }
+ }
+ }
+ return cnt;
+}
+
+
+bool cmGraphVizWriter::IgnoreThisTarget(const char* name)
+{
+ if (this->TargetIgnoreRegex.is_valid())
+ {
+ if (this->TargetIgnoreRegex.find(name))
+ {
+ return true;
+ }
+ }
+ return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
+}
+
+
+bool cmGraphVizWriter::GenerateForTargetType(cmTarget::TargetType targetType)
+ const
+{
+ switch (targetType)
+ {
+ case cmTarget::EXECUTABLE:
+ return this->GenerateForExecutables;
+ case cmTarget::STATIC_LIBRARY:
+ return this->GenerateForStaticLibs;
+ case cmTarget::SHARED_LIBRARY:
+ return this->GenerateForSharedLibs;
+ case cmTarget::MODULE_LIBRARY:
+ return this->GenerateForModuleLibs;
+ default:
+ break;
+ }
+ return false;
+}
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
new file mode 100644
index 0000000..105eb96
--- /dev/null
+++ b/Source/cmGraphVizWriter.h
@@ -0,0 +1,84 @@
+#ifndef CMGRAPHVIZWRITER_H
+#define CMGRAPHVIZWRITER_H
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmStandardIncludes.h"
+#include "cmLocalGenerator.h"
+#include "cmGeneratedFileStream.h"
+#include "cmTarget.h"
+#include <cmsys/RegularExpression.hxx>
+
+
+/** This class implements writing files for graphviz (dot) for graphs
+ * representing the dependencies between the targets in the project. */
+class cmGraphVizWriter
+{
+public:
+
+ cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators);
+
+ void ReadSettings(const char* settingsFileName,
+ const char* fallbackSettingsFileName);
+
+ void WritePerTargetFiles(const char* fileName);
+
+ void WriteGlobalFile(const char* fileName);
+
+protected:
+
+ void CollectTargetsAndLibs();
+
+ int CollectAllTargets();
+
+ int CollectAllExternalLibs(int cnt);
+
+ void WriteHeader(cmGeneratedFileStream& str) const;
+
+ void WriteConnections(const char* targetName,
+ std::set<std::string>& insertedNodes,
+ std::set<std::string>& insertedConnections,
+ cmGeneratedFileStream& str) const;
+
+ void WriteNode(const char* targetName, const cmTarget* target,
+ std::set<std::string>& insertedNodes,
+ cmGeneratedFileStream& str) const;
+
+ void WriteFooter(cmGeneratedFileStream& str) const;
+
+ bool IgnoreThisTarget(const char* name);
+
+ bool GenerateForTargetType(cmTarget::TargetType targetType) const;
+
+ cmStdString GraphType;
+ cmStdString GraphName;
+ cmStdString GraphHeader;
+ cmStdString GraphNodePrefix;
+
+ bool GenerateForExecutables;
+ bool GenerateForStaticLibs;
+ bool GenerateForSharedLibs;
+ bool GenerateForModuleLibs;
+
+ cmsys::RegularExpression TargetIgnoreRegex;
+
+ std::set<cmStdString> TargetsToIgnore;
+
+ const std::vector<cmLocalGenerator*>& LocalGenerators;
+
+ std::map<cmStdString, const cmTarget*> TargetPtrs;
+ // maps from the actual target names to node names in dot:
+ std::map<cmStdString, cmStdString> TargetNamesNodes;
+
+ bool HaveTargetsAndLibs;
+};
+
+#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bb8316e..0913e0a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -928,6 +928,14 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Construct a rule file associated with the first output produced.
std::string outName = outputs[0];
outName += ".rule";
+ const char* dir =
+ this->LocalGenerator->GetGlobalGenerator()->
+ GetCMakeCFGInitDirectory();
+ if(dir && dir[0] == '$')
+ {
+ cmSystemTools::ReplaceString(outName, dir,
+ cmake::GetCMakeFilesDirectory());
+ }
// Check if the rule file already exists.
file = this->GetSource(outName.c_str());
if(file && file->GetCustomCommand() && !replace)
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3ee329f..5380257 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -834,12 +834,16 @@ void cmTarget::DefineProperties(cmake *cm)
"executable with the TARGET_LINK_LIBRARIES command. "
"On all platforms a target-level dependency on the executable is "
"created for targets that link to it. "
- "For non-DLL platforms the link rule is simply ignored since "
- "the dynamic loader will automatically bind symbols when the "
- "module is loaded. "
"For DLL platforms an import library will be created for the "
"exported symbols and then used for linking. "
- "All Windows-based systems including Cygwin are DLL platforms.");
+ "All Windows-based systems including Cygwin are DLL platforms. "
+ "For non-DLL platforms that require all symbols to be resolved at "
+ "link time, such as Mac OS X, the module will \"link\" to the "
+ "executable using a flag like \"-bundle_loader\". "
+ "For other non-DLL platforms the link rule is simply ignored since "
+ "the dynamic loader will automatically bind symbols when the "
+ "module is loaded. "
+ );
cm->DefineProperty
("Fortran_MODULE_DIRECTORY", cmProperty::TARGET,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8dfafff..524be8b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -32,6 +32,30 @@ static std::string cmVS10EscapeXML(std::string arg)
return arg;
}
+static std::string cmVS10EscapeComment(std::string comment)
+{
+ // MSBuild takes the CDATA of a <Message></Message> element and just
+ // does "echo $CDATA" with no escapes. We must encode the string.
+ // http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx
+ std::string echoable;
+ for(std::string::iterator c = comment.begin(); c != comment.end(); ++c)
+ {
+ switch (*c)
+ {
+ case '\r': break;
+ case '\n': echoable += '\t'; break;
+ case '"': /* no break */
+ case '|': /* no break */
+ case '&': /* no break */
+ case '<': /* no break */
+ case '>': /* no break */
+ case '^': echoable += '^'; /* no break */
+ default: echoable += *c; break;
+ }
+ }
+ return echoable;
+}
+
cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target,
cmGlobalVisualStudio10Generator* gg)
@@ -125,7 +149,10 @@ void cmVisualStudio10TargetGenerator::Generate()
".vcxproj");
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY)
{
- this->ComputeClOptions();
+ if(!this->ComputeClOptions())
+ {
+ return;
+ }
}
cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory();
@@ -325,6 +352,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
}
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string comment = lg->ConstructComment(command);
+ comment = cmVS10EscapeComment(comment);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
@@ -347,7 +375,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
command.GetEscapeAllowMakeVars())
);
this->WritePlatformConfigTag("Message",i->c_str(), 3);
- (*this->BuildFileStream ) << comment << "</Message>\n";
+ (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WritePlatformConfigTag("Command", i->c_str(), 3);
(*this->BuildFileStream ) << script << "</Command>\n";
this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
@@ -949,19 +977,23 @@ OutputLinkIncremental(std::string const& configName)
}
//----------------------------------------------------------------------------
-void cmVisualStudio10TargetGenerator::ComputeClOptions()
+bool cmVisualStudio10TargetGenerator::ComputeClOptions()
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
{
- this->ComputeClOptions(*i);
+ if(!this->ComputeClOptions(*i))
+ {
+ return false;
+ }
}
+ return true;
}
//----------------------------------------------------------------------------
-void cmVisualStudio10TargetGenerator::ComputeClOptions(
+bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string const& configName)
{
// much of this was copied from here:
@@ -984,7 +1016,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions(
cmSystemTools::Error
("CMake can not determine linker language for target:",
this->Name.c_str());
- return;
+ return false;
}
if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
|| strcmp(linkLanguage, "Fortran") == 0)
@@ -1044,6 +1076,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions(
}
this->ClOptions[configName] = pOptions.release();
+ return true;
}
//----------------------------------------------------------------------------
@@ -1433,8 +1466,9 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
command.GetEscapeAllowMakeVars())
);
}
+ comment = cmVS10EscapeComment(comment);
this->WriteString("<Message>",3);
- (*this->BuildFileStream ) << comment << "</Message>\n";
+ (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
this->WriteString("<Command>", 3);
(*this->BuildFileStream ) << script;
(*this->BuildFileStream ) << "</Command>" << "\n";
@@ -1445,10 +1479,13 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{
- cmGlobalGenerator::TargetDependSet const& depends
+ cmGlobalGenerator::TargetDependSet const& unordered
= this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
+ typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
+ OrderedTargetDependSet;
+ OrderedTargetDependSet depends(unordered);
this->WriteString("<ItemGroup>\n", 1);
- for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin();
+ for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
cmTarget* dt = *i;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 64b2361..c3c27f4 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -50,8 +50,8 @@ private:
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
- void ComputeClOptions();
- void ComputeClOptions(std::string const& configName);
+ bool ComputeClOptions();
+ bool ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config,
std::vector<std::string> const & includes);
void WriteRCOptions(std::string const& config,
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3aa4aa0..c5de2e8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -26,6 +26,7 @@
#include "cmDocumentationFormatterText.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include "cmGraphVizWriter.h"
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmVariableWatch.h"
# include <cmsys/Terminal.h>
@@ -180,7 +181,7 @@ cmake::cmake()
this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0;
this->ScriptMode = false;
-
+
#ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch = new cmVariableWatch;
this->VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN",
@@ -397,7 +398,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
this->DoSuppressDevWarnings = true;
}
else if(arg.find("-Wdev",0) == 0)
- {
+ {
this->SuppressDevWarnings = false;
this->DoSuppressDevWarnings = true;
}
@@ -421,7 +422,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str());
//go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete;
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->CacheManager->GetCacheIterator();
for ( it.Begin(); !it.IsAtEnd(); it.Next() )
{
@@ -437,8 +438,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// now remove them from the cache
- for(std::vector<std::string>::const_iterator currentEntry =
- entriesToDelete.begin();
+ for(std::vector<std::string>::const_iterator currentEntry =
+ entriesToDelete.begin();
currentEntry != entriesToDelete.end();
++currentEntry)
{
@@ -829,7 +830,7 @@ int cmake::AddCMakePaths()
cMakeSelf += "/cmake";
std::cerr << cMakeSelf.c_str() << "\n";
}
-#endif
+#endif
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
{
cmSystemTools::Error("CMake executable cannot be found at ",
@@ -840,12 +841,12 @@ int cmake::AddCMakePaths()
this->CacheManager->AddCacheEntry
("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.",
cmCacheManager::INTERNAL);
- // if the edit command is not yet in the cache,
+ // if the edit command is not yet in the cache,
// or if CMakeEditCommand has been set on this object,
// then set the CMAKE_EDIT_COMMAND in the cache
// This will mean that the last gui to edit the cache
// will be the one that make edit_cache uses.
- if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND")
+ if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND")
|| !this->CMakeEditCommand.empty())
{
// Find and save the command to edit the cache
@@ -853,8 +854,8 @@ int cmake::AddCMakePaths()
if(!this->CMakeEditCommand.empty())
{
editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf)
- + std::string("/")
- + this->CMakeEditCommand
+ + std::string("/")
+ + this->CMakeEditCommand
+ cmSystemTools::GetFilenameExtension(cMakeSelf);
}
if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
@@ -974,7 +975,7 @@ void CMakeCommandUsage(const char* program)
errorStream
<< "cmake bootstrap\n";
#endif
- // If you add new commands, change here,
+ // If you add new commands, change here,
// and in cmakemain.cxx in the options table
errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n"
@@ -1129,7 +1130,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0;
}
#endif
-
+
else if (args[1] == "make_directory" && args.size() == 3)
{
if(!cmSystemTools::MakeDirectory(args[2].c_str()))
@@ -1380,7 +1381,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
-
+
// Command to create a symbolic link. Fails on platforms not
// supporting them.
else if (args[1] == "create_symlink" && args.size() == 4)
@@ -1448,7 +1449,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
// Use the make system's VERBOSE environment variable to enable
// verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
// (which is set by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// Create a cmake object instance to process dependencies.
@@ -1673,14 +1674,14 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
-void cmake::AddExtraGenerator(const char* name,
+void cmake::AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction)
{
cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
const std::vector<std::string>& supportedGlobalGenerators =
extraGenerator->GetSupportedGlobalGenerators();
- for(std::vector<std::string>::const_iterator
+ for(std::vector<std::string>::const_iterator
it = supportedGlobalGenerators.begin();
it != supportedGlobalGenerators.end();
++it )
@@ -1708,11 +1709,11 @@ void cmake::AddDefaultExtraGenerators()
#endif
#ifdef CMAKE_USE_KDEVELOP
- this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
+ this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
&cmGlobalKdevelopGenerator::New);
- // for kdevelop also add the generator with just the name of the
+ // for kdevelop also add the generator with just the name of the
// extra generator, since it was this way since cmake 2.2
- this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()]
+ this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()]
= &cmGlobalKdevelopGenerator::New;
#endif
@@ -1728,7 +1729,7 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
{
names.push_back(i->first);
}
- for(RegisteredExtraGeneratorsMap::const_iterator
+ for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin();
i != this->ExtraGenerators.end(); ++i)
{
@@ -1866,7 +1867,7 @@ int cmake::DoPreConfigureChecks()
// do a sanity check on some values
if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
{
- std::string cacheStart =
+ std::string cacheStart =
this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
cacheStart += "/CMakeLists.txt";
std::string currentStart = this->GetHomeDirectory();
@@ -1910,13 +1911,13 @@ int cmake::HandleDeleteCacheVariables(const char* var)
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved;
cmOStringStream warning;
- warning
+ warning
<< "You have changed variables that require your cache to be deleted.\n"
<< "Configure will be re-run and you may have to reset some variables.\n"
<< "The following variables have changed:\n";
for(std::vector<std::string>::iterator i = argsSplit.begin();
i != argsSplit.end(); ++i)
- {
+ {
SaveCacheEntry save;
save.key = *i;
warning << *i << "= ";
@@ -1930,7 +1931,7 @@ int cmake::HandleDeleteCacheVariables(const char* var)
}
saved.push_back(save);
}
-
+
// remove the cache
this->CacheManager->DeleteCache(this->GetStartOutputDirectory());
// load the empty cache
@@ -2002,7 +2003,7 @@ int cmake::ActualConfigure()
if ( !res )
{
this->CacheManager->AddCacheEntry
- ("CMAKE_HOME_DIRECTORY",
+ ("CMAKE_HOME_DIRECTORY",
this->GetHomeDirectory(),
"Start directory with the top level CMakeLists.txt file for this "
"project",
@@ -2012,9 +2013,9 @@ int cmake::ActualConfigure()
// no generator specified on the command line
if(!this->GlobalGenerator)
{
- const char* genName =
+ const char* genName =
this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
- const char* extraGenName =
+ const char* extraGenName =
this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
if(genName)
{
@@ -2036,7 +2037,7 @@ int cmake::ActualConfigure()
this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
std::string installedCompiler;
- // Try to find the newest VS installed on the computer and
+ // Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
std::string vsregBase =
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
@@ -2100,11 +2101,11 @@ int cmake::ActualConfigure()
}
if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
{
- this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
+ this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName(),
"Name of generator.",
cmCacheManager::INTERNAL);
- this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
+ this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName(),
"Name of external makefile project generator.",
cmCacheManager::INTERNAL);
@@ -2243,7 +2244,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// set the cmake command
this->CMakeCommand = args[0];
-
+
if ( !this->ScriptMode )
{
// load the cache
@@ -2374,7 +2375,7 @@ void cmake::AddCacheEntry(const char* key, const char* value,
const char* helpString,
int type)
{
- this->CacheManager->AddCacheEntry(key, value,
+ this->CacheManager->AddCacheEntry(key, value,
helpString,
cmCacheManager::CacheEntryType(type));
}
@@ -2489,8 +2490,8 @@ void cmake::UpdateProgress(const char *msg, float prog)
}
}
-void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
- bool withCurrentCommands,
+void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
+ bool withCurrentCommands,
bool withCompatCommands) const
{
for(RegisteredCommandsMap::const_iterator j = this->Commands.begin();
@@ -2501,7 +2502,7 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
{
continue;
}
-
+
cmDocumentationEntry e((*j).second->GetName(),
(*j).second->GetTerseDocumentation(),
(*j).second->GetFullDocumentation());
@@ -2537,7 +2538,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
delete generator;
v.push_back(e);
}
- for(RegisteredExtraGeneratorsMap::const_iterator
+ for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
{
cmDocumentationEntry e;
@@ -2552,7 +2553,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
- const char* tablepath =
+ const char* tablepath =
this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if(tablepath)
@@ -2584,7 +2585,7 @@ int cmake::CheckBuildSystem()
// the make system's VERBOSE environment variable to enable verbose
// output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set
// by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// This method will check the integrity of the build system if the
@@ -2593,7 +2594,7 @@ int cmake::CheckBuildSystem()
// If no file is provided for the check, we have to rerun.
if(this->CheckBuildSystemArgument.size() == 0)
- {
+ {
if(verbose)
{
cmOStringStream msg;
@@ -2609,7 +2610,7 @@ int cmake::CheckBuildSystem()
if(verbose)
{
cmOStringStream msg;
- msg << "Re-run cmake missing file: "
+ msg << "Re-run cmake missing file: "
<< this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2629,7 +2630,7 @@ int cmake::CheckBuildSystem()
if(verbose)
{
cmOStringStream msg;
- msg << "Re-run cmake error reading : "
+ msg << "Re-run cmake error reading : "
<< this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2886,251 +2887,24 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const char* fileName) const
{
- cmGeneratedFileStream str(fileName);
- if ( !str )
- {
- return;
- }
- cmake cm;
- cmGlobalGenerator ggi;
- ggi.SetCMakeInstance(&cm);
- std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
-
- std::string infile = this->GetHomeOutputDirectory();
- infile += "/CMakeGraphVizOptions.cmake";
- if ( !cmSystemTools::FileExists(infile.c_str()) )
- {
- infile = this->GetHomeDirectory();
- infile += "/CMakeGraphVizOptions.cmake";
- if ( !cmSystemTools::FileExists(infile.c_str()) )
- {
- infile = "";
- }
- }
-
- if ( !infile.empty() )
- {
- if ( !mf->ReadListFile(0, infile.c_str()) )
- {
- cmSystemTools::Error("Problem opening GraphViz options file: ",
- infile.c_str());
- return;
- }
- std::cout << "Read GraphViz options file: " << infile.c_str()
- << std::endl;
- }
-
-#define __set_if_not_set(var, value, cmakeDefinition) \
- const char* var = mf->GetDefinition(cmakeDefinition); \
- if ( !var ) \
- { \
- var = value; \
- }
- __set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE");
- __set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME");
- __set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];",
- "GRAPHVIZ_GRAPH_HEADER");
- __set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX");
- const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
- std::set<cmStdString> ignoreTargetsSet;
- if ( ignoreTargets )
- {
- std::vector<std::string> ignoreTargetsVector;
- cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
- std::vector<std::string>::iterator itvIt;
- for ( itvIt = ignoreTargetsVector.begin();
- itvIt != ignoreTargetsVector.end();
- ++ itvIt )
- {
- ignoreTargetsSet.insert(itvIt->c_str());
- }
- }
-
- str << graphType << " " << graphName << " {" << std::endl;
- str << graphHeader << std::endl;
-
- const cmGlobalGenerator* gg = this->GetGlobalGenerator();
- const std::vector<cmLocalGenerator*>& localGenerators =
- gg->GetLocalGenerators();
- std::vector<cmLocalGenerator*>::const_iterator lit;
- // for target deps
- // 1 - cmake target
- // 2 - external target
- // 0 - no deps
- std::map<cmStdString, int> targetDeps;
- std::map<cmStdString, const cmTarget*> targetPtrs;
- std::map<cmStdString, cmStdString> targetNamesNodes;
- int cnt = 0;
- // First pass get the list of all cmake targets
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- const char* realTargetName = tit->first.c_str();
- if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- //std::cout << "Found target: " << tit->first.c_str() << std::endl;
- cmOStringStream ostr;
- ostr << graphNodePrefix << cnt++;
- targetNamesNodes[realTargetName] = ostr.str();
- targetPtrs[realTargetName] = &tit->second;
- }
- }
- // Ok, now find all the stuff we link to that is not in cmake
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- const cmTarget::LinkLibraryVectorType* ll
- = &(tit->second.GetOriginalLinkLibraries());
- cmTarget::LinkLibraryVectorType::const_iterator llit;
- const char* realTargetName = tit->first.c_str();
- if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- if ( ll->size() > 0 )
- {
- targetDeps[realTargetName] = 1;
- }
- for ( llit = ll->begin(); llit != ll->end(); ++ llit )
- {
- const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(libName);
- if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- if ( tarIt == targetNamesNodes.end() )
- {
- cmOStringStream ostr;
- ostr << graphNodePrefix << cnt++;
- targetDeps[libName] = 2;
- targetNamesNodes[libName] = ostr.str();
- //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
- //<< "\" shape=\"ellipse\"];" << std::endl;
- }
- else
- {
- std::map<cmStdString, int>::const_iterator depIt
- = targetDeps.find(libName);
- if ( depIt == targetDeps.end() )
- {
- targetDeps[libName] = 1;
- }
- }
- }
- }
- }
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ std::auto_ptr<cmGraphVizWriter> gvWriter(
+ new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
- // Write out nodes
- std::map<cmStdString, int>::const_iterator depIt;
- for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt )
- {
- const char* newTargetName = depIt->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(newTargetName);
- if ( tarIt == targetNamesNodes.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << newTargetName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
+ std::string settingsFile = this->GetHomeOutputDirectory();
+ settingsFile += "/CMakeGraphVizOptions.cmake";
+ std::string fallbackSettingsFile = this->GetHomeDirectory();
+ fallbackSettingsFile += "/CMakeGraphVizOptions.cmake";
- str << " \"" << tarIt->second.c_str() << "\" [ label=\""
- << newTargetName << "\" shape=\"";
- if ( depIt->second == 1 )
- {
- std::map<cmStdString, const cmTarget*>::const_iterator tarTypeIt =
- targetPtrs.find(newTargetName);
- if ( tarTypeIt == targetPtrs.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << newTargetName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
- const cmTarget* tg = tarTypeIt->second;
- switch ( tg->GetType() )
- {
- case cmTarget::EXECUTABLE:
- str << "house";
- break;
- case cmTarget::STATIC_LIBRARY:
- str << "diamond";
- break;
- case cmTarget::SHARED_LIBRARY:
- str << "polygon";
- break;
- case cmTarget::MODULE_LIBRARY:
- str << "octagon";
- break;
- default:
- str << "box";
- }
- }
- else
- {
- str << "ellipse";
- }
- str << "\"];" << std::endl;
- }
+ gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str());
- // Now generate the connectivity
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- std::map<cmStdString, int>::iterator dependIt
- = targetDeps.find(tit->first.c_str());
- if ( dependIt == targetDeps.end() )
- {
- continue;
- }
- std::map<cmStdString, cmStdString>::iterator cmakeTarIt
- = targetNamesNodes.find(tit->first.c_str());
- const cmTarget::LinkLibraryVectorType* ll
- = &(tit->second.GetOriginalLinkLibraries());
- cmTarget::LinkLibraryVectorType::const_iterator llit;
- for ( llit = ll->begin(); llit != ll->end(); ++ llit )
- {
- const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(libName);
- if ( tarIt == targetNamesNodes.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << libName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
- str << " \"" << cmakeTarIt->second.c_str() << "\" -> \""
- << tarIt->second.c_str() << "\"" << std::endl;
- }
- }
- }
+ gvWriter->WritePerTargetFiles(fileName);
+ gvWriter->WriteGlobalFile(fileName);
- // TODO: Use dotted or something for external libraries
- //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]"
- //<< std::endl;
- //
- str << "}" << std::endl;
+#endif
}
+
//----------------------------------------------------------------------------
int cmake::SymlinkLibrary(std::vector<std::string>& args)
{
@@ -3385,7 +3159,7 @@ int cmake::ExecuteLinkScript(std::vector<std::string>& args)
void cmake::DefineProperties(cmake *cm)
{
cm->DefineProperty
- ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL,
+ ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL,
"If set, report any undefined properties to this file.",
"If this property is set to a filename then when CMake runs "
"it will report any properties or variables that were accessed "
@@ -3393,7 +3167,7 @@ void cmake::DefineProperties(cmake *cm)
);
cm->DefineProperty
- ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL,
+ ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL,
"Does the target platform support shared libraries.",
"TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target "
"platform supports shared libraries. Basically all current general "
@@ -3430,7 +3204,7 @@ void cmake::DefineProperties(cmake *cm)
"this list.This property is used by the macros in FeatureSummary.cmake.");
cm->DefineProperty
("DISABLED_FEATURES", cmProperty::GLOBAL,
- "List of features which are disabled during the CMake run.",
+ "List of features which are disabled during the CMake run.",
"List of features which are disabled during the CMake run. Be default "
"it contains the names of all packages which were not found. This is "
"determined using the <NAME>_FOUND variables. Packages which are "
@@ -3553,7 +3327,7 @@ void cmake::DefineProperties(cmake *cm)
cm->DefineProperty
("USE_FOLDERS", cmProperty::GLOBAL,
"Use the FOLDER target property to organize targets into folders.",
- "If not set, CMake treats this property as ON by default. "
+ "If not set, CMake treats this property as OFF by default. "
"CMake generators that are capable of organizing into a "
"hierarchy of folders use the values of the FOLDER target "
"property to name those folders. See also the documentation "
@@ -3580,13 +3354,13 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
bool chained, const char *docSection)
{
this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
- FullDescription,
+ FullDescription,
docSection,
chained);
}
cmPropertyDefinition *cmake
-::GetPropertyDefinition(const char *name,
+::GetPropertyDefinition(const char *name,
cmProperty::ScopeType scope)
{
if (this->IsPropertyDefined(name,scope))
@@ -3596,7 +3370,7 @@ cmPropertyDefinition *cmake
return 0;
}
-void cmake::RecordPropertyAccess(const char *name,
+void cmake::RecordPropertyAccess(const char *name,
cmProperty::ScopeType scope)
{
this->AccessedProperties.insert
@@ -3668,13 +3442,13 @@ void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{
if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) &&
aliasedProperties.find(std::pair<cmStdString,cmProperty::ScopeType>
- (ap->first,ap->second)) ==
+ (ap->first,ap->second)) ==
aliasedProperties.end())
{
const char *scopeStr = "";
switch (ap->second)
{
- case cmProperty::TARGET:
+ case cmProperty::TARGET:
scopeStr = "TARGET";
break;
case cmProperty::SOURCE_FILE:
@@ -3776,7 +3550,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
}
else if ( propname == "COMMANDS" )
{
- cmake::RegisteredCommandsMap::iterator cmds
+ cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin();
for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds )
{
@@ -3884,14 +3658,14 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files
this->AddCMakePaths();
- std::string modulesPath =
+ std::string modulesPath =
this->CacheManager->GetCacheValue("CMAKE_ROOT");
modulesPath += "/Modules";
std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake";
std::string outFile = destPath;
outFile += "/CMakeLists.txt";
-
+
// Copy file
if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str()))
{
@@ -3899,7 +3673,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
<< "\" to \"" << outFile.c_str() << "\".\n";
return 1;
}
-
+
// do we write to a file or to stdout?
if (resultFile.size() == 0)
{
@@ -3925,7 +3699,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// change back to the original directory
cmSystemTools::ChangeDirectory(cwd.c_str());
-
+
// echo results to stdout if needed
if (writeToStdout)
{
@@ -3946,7 +3720,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
fclose(fin);
}
}
-
+
// clean up the directory
cmSystemTools::RemoveADirectory(destPath.c_str());
return 0;
@@ -4065,7 +3839,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
- // check for nmake temporary files
+ // check for nmake temporary files
if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
{
std::ifstream fin(i->substr(1).c_str());
@@ -4118,7 +3892,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
type, hasManifest, verbose);
}
-int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
std::vector<cmStdString>& command,
std::string& targetName)
{
@@ -4169,7 +3943,7 @@ bool cmake::RunCommand(const char* comment,
&retCode, 0, false);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
- // returned an error code then print the output anyway as
+ // returned an error code then print the output anyway as
// the banner may be mixed with some other important information.
if(output.find("Resource Compiler Version") == output.npos
|| retCode !=0)
@@ -4190,12 +3964,12 @@ bool cmake::RunCommand(const char* comment,
return retCode == 0;
}
-int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
+int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
int type, bool verbose)
{
// This follows the steps listed here:
// http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
-
+
// 1. Compiler compiles the application and generates the *.obj files.
// 2. An empty manifest file is generated if this is a clean build and if
// not the previous one is reused.
@@ -4207,10 +3981,10 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
// on.
// 5. The manifest tool (mt.exe) is then used to generate the final
// manifest.
-
+
// If the final manifest is changed, then 6 and 7 are run, if not
// they are skipped, and it is done.
-
+
// 6. The resource compiler is invoked one more time.
// 7. Finally, the Linker does another incremental link, but since the
// only thing that has changed is the *.res file that contains the
@@ -4269,7 +4043,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
outputOpt += resourceFile;
rcCommand.push_back(outputOpt);
rcCommand.push_back(resourceInputFile);
- // Run rc command to create resource
+ // Run rc command to create resource
if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose))
{
return -1;
@@ -4279,7 +4053,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
{
return -1;
}
- // create mt command
+ // create mt command
std::string outArg("/out:");
outArg+= manifestFile;
mtCommand.push_back("/nologo");
@@ -4330,7 +4104,7 @@ int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
{
return -1;
}
- // Run the link command as given
+ // Run the link command as given
linkCommand.push_back("/MANIFEST");
if(!cmake::RunCommand("LINK", linkCommand, verbose))
{
@@ -4521,7 +4295,7 @@ int cmake::Build(const std::string& dir,
makeProgram = it.GetValue();
return gen->Build(0, dir.c_str(),
projName.c_str(), target.c_str(),
- &output,
+ &output,
makeProgram.c_str(),
config.c_str(), clean, false, 0, true,
0, nativeOptions);
diff --git a/Source/cmake.h b/Source/cmake.h
index b132164..4d348bb 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -21,14 +21,14 @@
// command line arguments.
// 3) Load the cache by calling LoadCache (duh)
// 4) if you are using command line arguments with -D or -C flags then
-// call SetCacheArgs (or if for some other reason you want to modify the
+// call SetCacheArgs (or if for some other reason you want to modify the
// cache, do it now.
// 5) Finally call Configure
// 6) Let the user change values and go back to step 5
// 7) call Generate
//
// If your GUI allows the user to change the start & home directories then
-// you must at a minimum redo steps 2 through 7.
+// you must at a minimum redo steps 2 through 7.
//
@@ -50,6 +50,8 @@ class cmExternalMakefileProjectGenerator;
class cmDocumentationSection;
class cmPolicies;
class cmListFileBacktrace;
+class cmTarget;
+class cmGeneratedFileStream;
class cmake
{
@@ -73,14 +75,14 @@ class cmake
static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";};
static const char *GetCMakeFilesDirectoryPostSlash() {
return "CMakeFiles/";};
-
+
//@{
/**
* Set/Get the home directory (or output directory) in the project. The
* home directory is the top directory of the project. It is where
* cmake was run. Remember that CMake processes
* CMakeLists files by recursing up the tree starting at the StartDirectory
- * and going up until it reaches the HomeDirectory.
+ * and going up until it reaches the HomeDirectory.
*/
void SetHomeDirectory(const char* dir);
const char* GetHomeDirectory() const
@@ -100,9 +102,9 @@ class cmake
* is the directory of the CMakeLists.txt file that started the current
* round of processing. Remember that CMake processes CMakeLists files by
* recursing up the tree starting at the StartDirectory and going up until
- * it reaches the HomeDirectory.
+ * it reaches the HomeDirectory.
*/
- void SetStartDirectory(const char* dir)
+ void SetStartDirectory(const char* dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
@@ -158,7 +160,7 @@ class cmake
///! Return the global generator assigned to this instance of cmake
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake, const
- const cmGlobalGenerator* GetGlobalGenerator() const
+ const cmGlobalGenerator* GetGlobalGenerator() const
{ return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake
@@ -169,25 +171,25 @@ class cmake
///! get the cmCachemManager used by this invocation of cmake
cmCacheManager *GetCacheManager() { return this->CacheManager; }
-
+
///! set the cmake command this instance of cmake should use
void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; }
-
+
/**
* Given a variable name, return its value (as a string).
*/
const char* GetCacheDefinition(const char*) const;
///! Add an entry into the cache
- void AddCacheEntry(const char* key, const char* value,
- const char* helpString,
+ void AddCacheEntry(const char* key, const char* value,
+ const char* helpString,
int type);
- /**
+ /**
* Execute commands during the build process. Supports options such
* as echo, remove file etc.
*/
static int ExecuteCMakeCommand(std::vector<std::string>&);
- /**
+ /**
* Get the system information and write it to the file specified
*/
int GetSystemInformation(std::vector<std::string>&);
@@ -210,17 +212,17 @@ class cmake
/** Check if a command exists. */
bool CommandExists(const char* name) const;
-
+
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&,
bool directoriesSetBefore = false);
///! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() { return this->InTryCompile; }
-
+
///! Is this cmake running as a result of a TRY_COMPILE command
void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
-
+
///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
@@ -228,9 +230,9 @@ class cmake
(const char*msg, float progress, void *);
/**
* Set the function used by GUI's to receive progress updates
- * Function gets passed: message as a const char*, a progress
+ * Function gets passed: message as a const char*, a progress
* amount ranging from 0 to 1.0 and client data. The progress
- * number provided may be negative in cases where a message is
+ * number provided may be negative in cases where a message is
* to be displayed without any progress percentage.
*/
void SetProgressCallback(ProgressCallbackType f, void* clientData=0);
@@ -245,14 +247,14 @@ class cmake
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
/** Get the documentation entries for the supported commands.
- * If withCurrentCommands is true, the documentation for the
+ * If withCurrentCommands is true, the documentation for the
* recommended set of commands is included.
* If withCompatCommands is true, the documentation for discouraged
* (compatibility) commands is included.
* You probably don't want to set both to false.
*/
- void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
- bool withCurrentCommands = true,
+ void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
+ bool withCurrentCommands = true,
bool withCompatCommands = true) const;
void GetPropertiesDocumentation(std::map<std::string,
cmDocumentationSection *>&);
@@ -279,7 +281,7 @@ class cmake
*/
void SetScriptMode(bool mode) { this->ScriptMode = mode; }
bool GetScriptMode() { return this->ScriptMode; }
-
+
///! Debug the try compile stuff by not delelting the files
bool GetDebugTryCompile(){return this->DebugTryCompile;}
void DebugTryCompileOn(){this->DebugTryCompile = true;}
@@ -322,7 +324,7 @@ class cmake
void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
- bool chain = false,
+ bool chain = false,
const char *variableGroup = 0);
// get property definition
@@ -350,7 +352,7 @@ class cmake
}
void SetSuppressDevWarnings(bool v)
{
- this->SuppressDevWarnings = v;
+ this->SuppressDevWarnings = v;
this->DoSuppressDevWarnings = true;
}
@@ -372,10 +374,10 @@ protected:
cmPropertyMap Properties;
std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties;
- std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
PropertyDefinitions;
- typedef
+ typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
typedef std::map<cmStdString,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
@@ -389,15 +391,15 @@ protected:
void AddDefaultCommands();
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- void AddExtraGenerator(const char* name,
+ void AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction);
- cmPolicies *Policies;
+ cmPolicies *Policies;
cmGlobalGenerator *GlobalGenerator;
cmCacheManager *CacheManager;
- std::string cmHomeDirectory;
+ std::string cmHomeDirectory;
std::string HomeOutputDirectory;
- std::string cmStartDirectory;
+ std::string cmStartDirectory;
std::string StartOutputDirectory;
bool SuppressDevWarnings;
bool DoSuppressDevWarnings;
@@ -408,7 +410,7 @@ protected:
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
/// If it is set, truncate it to 50kb
void TruncateOutputLog(const char* fname);
-
+
/**
* Method called to check build system integrity at build time.
* Returns 1 if CMake should rerun and 0 otherwise.
@@ -431,24 +433,24 @@ protected:
static int ExecuteLinkScript(std::vector<std::string>& args);
static int VisualStudioLink(std::vector<std::string>& args, int type);
static int VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type,
+ int type,
bool verbose);
static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
int type,
bool hasManifest,
bool verbose);
- static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
+ static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
std::string& targetName);
static bool RunCommand(const char* comment,
std::vector<cmStdString>& command,
bool verbose,
int* retCodeOut = 0);
cmVariableWatch* VariableWatch;
-
+
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
std::string FindCMakeProgram(const char* name) const;
-private:
+private:
cmake(const cmake&); // Not implemented.
void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
@@ -478,7 +480,7 @@ private:
cmFileTimeComparison* FileComparison;
std::string GraphVizFile;
std::vector<std::string> DebugConfigs;
-
+
void UpdateConversionPathTable();
};
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 98fc895..a4306a5 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2010)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 09)
+SET(KWSYS_DATE_STAMP_MONTH 10)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 28)
+SET(KWSYS_DATE_STAMP_DAY 31)