From 20f49730ae53576812c9661aa6355d83f02cffde Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Sep 2010 09:49:20 -0400 Subject: [PATCH 01/77] Reset platform/compiler info status for each language In each CMakeInformation.cmake file we use an _INCLUDED_FILE variable to track whether a compiler information file has been loaded. Reset this variable for each language. This fixes Fortran under VS generators with the Intel plugin. Previously the variable would be left set true from C and C++ and then Fortran would not load old-style files like Platform/Windows-ifort. --- Modules/CMakeCInformation.cmake | 2 ++ Modules/CMakeCXXInformation.cmake | 2 ++ Modules/CMakeFortranInformation.cmake | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 578aff9a1..86a824a76 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -26,6 +26,8 @@ ELSE(UNIX) SET(CMAKE_C_OUTPUT_EXTENSION .obj) ENDIF(UNIX) +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_C_COMPILER_ID) INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 869894c13..680f8fdbd 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -26,6 +26,8 @@ ELSE(UNIX) SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) ENDIF(UNIX) +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index cdb8038aa..f6a52c6eb 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -16,6 +16,8 @@ # It also loads the available platform file for the system-compiler # if it exists. +SET(_INCLUDED_FILE 0) + # Load compiler-specific information. IF(CMAKE_Fortran_COMPILER_ID) INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL) From 0f6b3a0059c2b9d10cb24af0203be2abb8c88881 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 29 Sep 2010 00:01:05 -0400 Subject: [PATCH 02/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 98fc89541..2863f878b 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 09) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 28) +SET(KWSYS_DATE_STAMP_DAY 29) From a2bbe4bef93f9846144a738799f3b405e1666b9f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Sep 2010 08:38:18 -0400 Subject: [PATCH 03/77] Remove trailing whitespace from Xcode generator source Reverting abandoned topic xcode_source_group_fix_7932 left this source slightly different due to trailing whitespace removal on some lines. Remove all trailing whitespace from the file to make it consistent. --- Source/cmGlobalXCodeGenerator.cxx | 344 +++++++++++++++--------------- 1 file changed, 172 insertions(+), 172 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4e9969d0b..f989a5c20 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::vectorconst& 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::vectorconst& 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::vectorconst& //---------------------------------------------------------------------------- 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& 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::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 lfiles = mf->GetListFiles(); // sort the array - std::sort(lfiles.begin(), lfiles.end(), std::less()); - std::vector::iterator new_end = + std::sort(lfiles.begin(), lfiles.end(), std::less()); + std::vector::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(); @@ -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::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 const & prebuild + std::vector const & prebuild = cmtarget.GetPreBuildCommands(); - std::vector const & prelink + std::vector const & prelink = cmtarget.GetPreLinkCommands(); - std::vector const & postbuild + std::vector const & postbuild = cmtarget.GetPostBuildCommands(); std::vectorconst &classes = cmtarget.GetSourceFiles(); // add all the sources std::vector commands; - for(std::vector::const_iterator i = classes.begin(); + for(std::vector::const_iterator i = classes.begin(); i != classes.end(); ++i) { if((*i)->GetCustomCommand()) @@ -1082,7 +1082,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, } } std::vector 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 + std::vector 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::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; + cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { const std::vector& 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::const_iterator currentConfig= + + for (std::vector::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 +::CreateCustomRulesMakefile(const char* makefileBasename, + cmTarget& target, + std::vector const & commands, const char* configName, - const std::map& 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 tname; @@ -1285,7 +1285,7 @@ void cmGlobalXCodeGenerator for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; + cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { const std::vector& 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::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::const_iterator d = + for(std::vector::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::const_iterator o = @@ -1438,7 +1438,7 @@ 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); } @@ -1476,11 +1476,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 +1579,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 +1592,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 +1690,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 +1701,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } if(this->XcodeVersion >= 22) { - buildSettings->AddAttribute("PREBINDING", + buildSettings->AddAttribute("PREBINDING", this->CreateString("NO")); } @@ -1726,7 +1726,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 +1745,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 +1792,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 +1806,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 +1818,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { flags += " "; flags += defFlags; - buildSettings->AddAttribute("OTHER_CFLAGS", + buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags.c_str())); } @@ -1846,9 +1846,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 +1918,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 +1938,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 emptyContentVector; this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0, @@ -1960,7 +1960,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 +1988,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 configVectorIn; std::vector 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 +2005,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 +2022,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 +2079,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 +2097,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 +2115,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 +2156,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 +2177,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 +2243,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 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::iterator i = list.begin(); + for(std::vector::iterator i = list.begin(); i != list.end(); ++i) { if(configName) @@ -2412,7 +2412,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, std::vector 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 +2435,21 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, std::vector classes = cmtarget.GetSourceFiles(); - for(std::vector::const_iterator s = classes.begin(); + for(std::vector::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 +2475,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 +2498,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 +2518,19 @@ void cmGlobalXCodeGenerator std::vector& 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 +2546,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 +2560,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 +2570,7 @@ void cmGlobalXCodeGenerator mainGroup->AddAttribute("sourceTree", this->CreateString("")); 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 +2593,7 @@ void cmGlobalXCodeGenerator resourcesGroup->AddAttribute("sourceTree", this->CreateString("")); 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 +2603,16 @@ void cmGlobalXCodeGenerator productGroup->AddAttribute("refType", this->CreateString("4")); } productGroup->AddAttribute("sourceTree", this->CreateString("")); - 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 +2639,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 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 +2660,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 +2678,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 +2709,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 +2723,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::iterator i = + for( std::vector::iterator i = this->Architectures.begin(); i != this->Architectures.end(); ++i) { @@ -2735,12 +2735,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 +2776,7 @@ void cmGlobalXCodeGenerator (*i)->AddAttribute("buildSettings", buildSettings); } - this->RootObject->AddAttribute("buildConfigurationList", + this->RootObject->AddAttribute("buildConfigurationList", this->CreateObjectReference(configlist)); std::vector targets; @@ -2801,7 +2801,7 @@ void cmGlobalXCodeGenerator cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector::iterator i = targets.begin(); i != targets.end(); ++i) - { + { cmXCodeObject* t = *i; allTargets->AddObject(t); cmXCodeObject* productRef = t->GetObject("productReference"); @@ -2814,11 +2814,11 @@ void cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -void +void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::vector& targets) -{ - cmGeneratedFileStream +{ + cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile.c_str()); if(!makefileStream) { @@ -2864,9 +2864,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 emitted; @@ -2876,7 +2876,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( cmXCodeObject* target = *i; std::map const& deplibs = target->GetDependLibraries(); - for(std::map::const_iterator ci + for(std::map::const_iterator ci = deplibs.begin(); ci != deplibs.end(); ++ci) { for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); @@ -2884,7 +2884,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { if(emitted.insert(*d).second) { - makefileStream << + makefileStream << this->ConvertToRelativeForMake(d->c_str()) << ":\n"; } } @@ -2893,10 +2893,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::const_iterator ct = this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) @@ -2917,7 +2917,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 +2929,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( for(std::vector::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { - makefileStream << "\\\n\t" << + makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(d->c_str()); } } @@ -2951,7 +2951,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( universal += "/"; universal += t->GetName(); universal += ".build/Objects-normal/"; - for( std::vector::iterator arch = + for( std::vector::iterator arch = this->Architectures.begin(); arch != this->Architectures.end(); ++arch) { @@ -2960,7 +2960,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( universalFile += "/"; universalFile += t->GetFullName(configName); makefileStream << "\t/bin/rm -f " - << + << this->ConvertToRelativeForMake(universalFile.c_str()) << "\n"; } @@ -2974,7 +2974,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, - std::vector& + std::vector& generators) { if(generators.size() == 0) @@ -3014,7 +3014,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, } //---------------------------------------------------------------------------- -void +void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* , std::vector& ) @@ -3072,7 +3072,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 +3088,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 +3128,7 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator:: GetTargetObjectFileDirectories(cmTarget* target, - std::vector& + std::vector& dirs) { std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); @@ -3142,7 +3142,7 @@ GetTargetObjectFileDirectories(cmTarget* target, std::string dirsave = dir; if(this->Architectures.size()) { - for(std::vector::iterator i = this->Architectures.begin(); + for(std::vector::iterator i = this->Architectures.begin(); i != this->Architectures.end(); ++i) { dir += *i; From 525320679887d7df4bad5e619ceafdf2bfe891c5 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 29 Sep 2010 14:46:45 -0400 Subject: [PATCH 04/77] Add a new line to the end of the generated main.cxx for the hpux compiler. Some HPUX compilers give this error: Error 690: "/home/cport/Dashboards/My Tests/CMake-build/Tests/CheckCompilerRelatedVariables/main.cxx", line 1 # Nonempty source files must end with a newline that is not preceded by a backslash. --- Tests/CheckCompilerRelatedVariables/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 7206f1daf..8095a1cf1 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -76,7 +76,8 @@ endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" - "int main() { return 0; }" + "int main() { return 0; } +" ) add_executable( From 3d68dd230d84a1faac9b4d6750ec36cba3c6f8a2 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 29 Sep 2010 17:02:04 -0400 Subject: [PATCH 05/77] Fix for bug #11274, VS10 custom commands that create files in INTDIR fix. --- Source/cmMakefile.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c64053aa7..ef1511319 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -894,6 +894,14 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& 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) From 4e137de7b1e49db168228607864e80a6960ec52f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 30 Sep 2010 00:01:06 -0400 Subject: [PATCH 06/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 2863f878b..6a34e9296 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 09) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 29) +SET(KWSYS_DATE_STAMP_DAY 30) From 448661fbe5c93fb1f59ea45847b3eef75e7b4a8a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 30 Sep 2010 08:48:38 -0400 Subject: [PATCH 07/77] VS10: Skip targets with no linker language (#11230) In targets with no non-header files the linker language cannot be determined. Since the target project file cannot be generated at all in this case, give up as soon as it is detected. Otherwise the generation code may try to run with uninitialized information. --- Source/cmVisualStudio10TargetGenerator.cxx | 18 +++++++++++++----- Source/cmVisualStudio10TargetGenerator.h | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8dfafffbb..a92e56ff0 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -125,7 +125,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(); @@ -949,19 +952,23 @@ OutputLinkIncremental(std::string const& configName) } //---------------------------------------------------------------------------- -void cmVisualStudio10TargetGenerator::ComputeClOptions() +bool cmVisualStudio10TargetGenerator::ComputeClOptions() { std::vector const* configs = this->GlobalGenerator->GetConfigurations(); for(std::vector::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 +991,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 +1051,7 @@ void cmVisualStudio10TargetGenerator::ComputeClOptions( } this->ClOptions[configName] = pOptions.release(); + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 64b236147..c3c27f4ce 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 const & includes); void WriteRCOptions(std::string const& config, From 220c5dc45a61b37603e17c09d3ed9e030df55196 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 30 Sep 2010 11:01:35 -0400 Subject: [PATCH 08/77] Add test that CMake errors with empty libs When the library language cannot be determined, make sure CMake errors, not segfaults (bug #11230) --- Tests/CMakeLists.txt | 3 +++ Tests/EmptyLibrary/CMakeLists.txt | 4 ++++ Tests/EmptyLibrary/subdir/CMakeLists.txt | 1 + Tests/EmptyLibrary/subdir/test.h | 1 + 4 files changed, 9 insertions(+) create mode 100644 Tests/EmptyLibrary/CMakeLists.txt create mode 100644 Tests/EmptyLibrary/subdir/CMakeLists.txt create mode 100644 Tests/EmptyLibrary/subdir/test.h diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5e88b5c40..4de9ac35d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -153,6 +153,9 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) + ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) + SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES + PASS_REGULAR_EXPRESSION "CMake Error: Cannot determine link language for target \"test\"") ADD_TEST_MACRO(CrossCompile CrossCompile) SET_TESTS_PROPERTIES(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") diff --git a/Tests/EmptyLibrary/CMakeLists.txt b/Tests/EmptyLibrary/CMakeLists.txt new file mode 100644 index 000000000..baddbbf5e --- /dev/null +++ b/Tests/EmptyLibrary/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.6) +project(TestEmptyLibrary) + +add_subdirectory(subdir) diff --git a/Tests/EmptyLibrary/subdir/CMakeLists.txt b/Tests/EmptyLibrary/subdir/CMakeLists.txt new file mode 100644 index 000000000..e273f8db9 --- /dev/null +++ b/Tests/EmptyLibrary/subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(test test.h) diff --git a/Tests/EmptyLibrary/subdir/test.h b/Tests/EmptyLibrary/subdir/test.h new file mode 100644 index 000000000..8511f53d6 --- /dev/null +++ b/Tests/EmptyLibrary/subdir/test.h @@ -0,0 +1 @@ +extern int dummy; From d3a89432fd5d35a33ee37bca78bbc2cafa113c42 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 30 Sep 2010 11:39:26 -0400 Subject: [PATCH 09/77] Fix which string is checked for in the test GNU Makefiles have an extra line that Visual Studio doesn't output. --- Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4de9ac35d..c056e8612 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -155,7 +155,7 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Error: Cannot determine link language for target \"test\"") + PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) SET_TESTS_PROPERTIES(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") From 96a335fd8d43b1fd73de12d29c192a29eaf5231a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 30 Sep 2010 14:54:20 -0400 Subject: [PATCH 10/77] XCode generation should fail if lang isn't known --- Source/cmGlobalXCodeGenerator.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f989a5c20..0976a4d0b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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; @@ -1442,6 +1445,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // 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-> From aca758bf29b2a3516150dc24a2c941b13472fc59 Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Thu, 30 Sep 2010 21:24:28 -0400 Subject: [PATCH 11/77] Fixes issue 11279: CMakeDetermineVSServicePack support for VS10 Thanks to Aaron C. Meadows for the patch. --- Modules/CMakeDetermineVSServicePack.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 8e4eb34ea..a877e6ef7 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -23,8 +23,8 @@ # =========================== #============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman +# Copyright 2009-2010 Kitware, Inc. +# Copyright 2009-2010 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -47,6 +47,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc90") elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01") set(_version "vc90sp1") + elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") + set(_version "vc100") else() set(_version "") endif() From d69b129481ac9afd41d609eef0001bdb712201c8 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 1 Oct 2010 00:01:04 -0400 Subject: [PATCH 12/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 6a34e9296..f8fa675c9 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 30) +SET(KWSYS_DATE_STAMP_DAY 01) From 2596e16c8f241b52add4d54108fd5df4269cb2fc Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 1 Oct 2010 16:12:00 -0400 Subject: [PATCH 13/77] VS10: Encode custom command comments for echo (#11283) VS10 uses MSBuild underneath. The CDATA are just appended to "echo" and executed as a single command. Encode the message such that it can be passed to echo. Convert newlines to tabs since they cannot be printed this way. --- Source/cmVisualStudio10TargetGenerator.cxx | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8dfafffbb..642ae9429 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 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) @@ -325,6 +349,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string comment = lg->ConstructComment(command); + comment = cmVS10EscapeComment(comment); std::vector *configs = static_cast (this->GlobalGenerator)->GetConfigurations(); @@ -347,7 +372,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, command.GetEscapeAllowMakeVars()) ); this->WritePlatformConfigTag("Message",i->c_str(), 3); - (*this->BuildFileStream ) << comment << "\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "\n"; this->WritePlatformConfigTag("Command", i->c_str(), 3); (*this->BuildFileStream ) << script << "\n"; this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3); @@ -1433,8 +1458,9 @@ void cmVisualStudio10TargetGenerator::WriteEvent( command.GetEscapeAllowMakeVars()) ); } + comment = cmVS10EscapeComment(comment); this->WriteString("",3); - (*this->BuildFileStream ) << comment << "\n"; + (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "\n"; this->WriteString("", 3); (*this->BuildFileStream ) << script; (*this->BuildFileStream ) << "" << "\n"; From 2488c343f1c79e8fa598a1ba33fe347fcf7b2017 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 2 Oct 2010 00:01:07 -0400 Subject: [PATCH 14/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f8fa675c9..bd9f4755b 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 01) +SET(KWSYS_DATE_STAMP_DAY 02) From fd3249e11afeb38284ee8e2012134de4d410c92b Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 1 Oct 2010 17:23:53 -0400 Subject: [PATCH 15/77] New USE_FOLDERS property OFF by default. (#3796) Visual Studio Express editions do not support solution folders, so default behavior should be as if USE_FOLDERS global property is OFF. Also, allow folder names to be the same as target names: internally, use a prefix to distinguish folder GUIDs from target GUIDs. Add a target and folder with the same name in the ExternalProject test to exercise this code. For CMake itself, provide a new option CMAKE_USE_FOLDERS that defaults to ON so that Visual Studio users get a nicely organized CMake project. Express edition users will have to turn off the CMAKE_USE_FOLDERS option in order to build CMake in the VS Express IDE. --- CMakeLists.txt | 32 ++++++++++++++++++----- Source/cmGlobalGenerator.cxx | 5 ++-- Source/cmGlobalVisualStudio7Generator.cxx | 12 +++++++-- Source/cmake.cxx | 2 +- Tests/ExternalProject/CMakeLists.txt | 16 ++++++++++++ 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dec502b04..f5ec0f6b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,15 +173,33 @@ MACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING) +# Provide a way for Visual Studio Express users to turn OFF the new FOLDER +# organization feature. Default to ON for non-Express users. Express users must +# explicitly turn off this option to build CMake in the Express IDE... +# +OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) +MARK_AS_ADVANCED(CMAKE_USE_FOLDERS) + + +#----------------------------------------------------------------------- +# a macro that only sets the FOLDER target property if it's +# "appropriate" +#----------------------------------------------------------------------- MACRO(CMAKE_SET_TARGET_FOLDER tgt folder) - # Really, I just want this to be an "if(TARGET ${tgt})" ... - # but I'm not sure that our min req'd., CMake 2.4.5 can handle - # that... so I'm just activating this for now, with a version - # compare, and only for MSVC builds. - IF(MSVC) - IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + IF(CMAKE_USE_FOLDERS) + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) + + # Really, I just want this to be an "if(TARGET ${tgt})" ... + # but I'm not sure that our min req'd., CMake 2.4.5 can handle + # that... so I'm just activating this for now, with a version + # compare, and only for MSVC builds. + IF(MSVC) + IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) + SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + ENDIF() ENDIF() + ELSE() + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF) ENDIF() ENDMACRO(CMAKE_SET_TARGET_FOLDER) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8e77294ae..b9deaef90 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1863,9 +1863,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 f455810c2..e08b1ef2c 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 >::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/cmake.cxx b/Source/cmake.cxx index 37ff7c56d..db26b7334 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3486,7 +3486,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 " diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 00db5d484..45c114988 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -7,6 +7,13 @@ find_package(CVS) find_package(Subversion) find_package(Git) +option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakePredefinedTargets-in-ExternalProjectTest") @@ -60,6 +67,15 @@ ExternalProject_Add(${proj} INSTALL_COMMAND "" ) +set(proj TargetNameSameAsFolder) +ExternalProject_Add(${proj} + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "${proj}") + set(proj MinimalNoOpProject) ExternalProject_Add(${proj} BUILD_COMMAND "" From ef4263aad77cee19f99e069bca5d53439a8706ad Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 3 Oct 2010 00:01:04 -0400 Subject: [PATCH 16/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index bd9f4755b..bb8624e31 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 03) From 4a4a53f3dd9a49efa95119a4c38b25c2ff77476d Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 3 Oct 2010 23:29:34 +0200 Subject: [PATCH 17/77] CPackRPM Handle parenthesis in CPACK_SYSTEM_NAME (fix bug 10737) merge patch from Frank Stappers --- Modules/CPackRPM.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 3ade3aa2f..e2d788029 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -548,16 +548,16 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ # We do only save CPack installed tree in _prepr # and then restore it in build. %prep -mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot +mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" #p build %install if [ -e $RPM_BUILD_ROOT ]; then - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT + mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT else - mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT + mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT fi %clean From 5eca3dd0f0289a84c30c98887c053d4dad54b8a5 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 4 Oct 2010 00:01:04 -0400 Subject: [PATCH 18/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index bb8624e31..647130904 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 03) +SET(KWSYS_DATE_STAMP_DAY 04) From 1df8516c0eb88d01389c8601be97e3616b8b42dd Mon Sep 17 00:00:00 2001 From: James Bigler Date: Mon, 4 Oct 2010 16:11:08 -0600 Subject: [PATCH 19/77] Fix for bug 0011263. Added CUSDKCOMPUTE_ROOT to the list of paths when looking for CUDA_SDK_ROOT_DIR. --- Modules/FindCUDA.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index dad5709e0..0718aef75 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -612,8 +612,10 @@ else() endif() ######################## -# Look for the SDK stuff +# Look for the SDK stuff. As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with +# NVSDKCOMPUTE_ROOT with the old CUDA C contents moved into the C subdirectory find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h + "$ENV{NVSDKCOMPUTE_ROOT}/C" "$ENV{NVSDKCUDA_ROOT}" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]" "/Developer/GPU\ Computing/C" From 6916f8dba73069bce71c6032b9a90dd6579c0971 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Mon, 4 Oct 2010 16:42:21 -0600 Subject: [PATCH 20/77] Allow -g3 for CUDA v3.0+. In versions of the CUDA toolkit previous to version 3.0 the use of -g3 would cause compilation errors. This was fixed in version 3.0. --- Modules/FindCUDA.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index dad5709e0..5b189d4ae 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -941,8 +941,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # we convert the strings to lists (like we want). if(CUDA_PROPAGATE_HOST_FLAGS) - # nvcc chokes on -g3, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC) + # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g + if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0") string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") else() set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") From d0d8f029ab4f9deb4ff88a313fa5ba5c9247ab2b Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 5 Oct 2010 00:01:03 -0400 Subject: [PATCH 21/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 647130904..633e12e18 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 04) +SET(KWSYS_DATE_STAMP_DAY 05) From 9072535f836154c7a87bff4569741b86ccfc297f Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 5 Oct 2010 21:16:17 +0200 Subject: [PATCH 22/77] CodeBlocks Generator: Do not omit files in the project file listing. The CodeBlocks generator used to omit files that were in siblings directories. Though that filters out a few files that could be argued aren't of interest to the user, it also potentialy hides files that are relevant to the user. Patch by Daniel Teske. Alex See: http://bugreports.qt.nokia.com/browse/QTCREATORBUG-2250 for an example. --- Source/cmExtraCodeBlocksGenerator.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 4cb2b4860..e6d7a6d1f 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); From 3d0ace69c00080eb2253563254c8888db11410d3 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 6 Oct 2010 00:01:03 -0400 Subject: [PATCH 23/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 633e12e18..8cddd2fab 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 05) +SET(KWSYS_DATE_STAMP_DAY 06) From e1240326546c4e5db9a642d9a3b71497325d0f20 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 7 Oct 2010 00:01:03 -0400 Subject: [PATCH 24/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8cddd2fab..17447cf0d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 06) +SET(KWSYS_DATE_STAMP_DAY 07) From 973df7c0e94f0bbc0403c6e2038363a75bb81bca Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Oct 2010 09:54:24 -0400 Subject: [PATCH 25/77] VS10: Order .vcxproj dependencies deterministically (#10502) This avoids needless modification of the project files during regeneration. --- Source/cmGlobalVisualStudioGenerator.h | 16 ++++++++-------- Source/cmVisualStudio10TargetGenerator.cxx | 7 +++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index daa6b3a20..c8ea339ce 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 {}; class VSDependMap: public std::map {}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9c0364bc1..524be8b48 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1479,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("\n", 1); - for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin(); + for( OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { cmTarget* dt = *i; From 42126aaf6ca83bbfbebab364a026763f62770bf7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 7 Oct 2010 00:24:44 +0200 Subject: [PATCH 26/77] FindSubversion: Fix for German localized client (#11273) On a Win32 system with a German version of SilkSVN I couldn't run CMake again on the working copy as the cache is displayed as corrupted. The cause is that the regular expression to find the version number will not match and put everything from the "svn --version" output into the cache, which contains umlauts and other funny characters. Fix the regexp to not only match " version " but also " Version " as it's in the German output. I have no idea what will happen on a French or Japanese system. This should be easy to test as it happens also on a German Linux system. --- Modules/FindSubversion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index daf3d87f5..61e02535e 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -57,7 +57,7 @@ IF(Subversion_SVN_EXECUTABLE) OUTPUT_VARIABLE Subversion_VERSION_SVN OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" + STRING(REGEX REPLACE "^(.*\n)?svn, [Vv]ersion ([.0-9]+).*" "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") MACRO(Subversion_WC_INFO dir prefix) From d2f8c5f8ab657f35d71f1f4a67721ead7ee622c4 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 7 Oct 2010 16:30:01 +0200 Subject: [PATCH 27/77] FindSubversion: Use C locale to detect version (#11273) Force LC_ALL to C before the call of the svn executable as it is done in the Subversion_WC_INFO macro a few lines below. --- Modules/FindSubversion.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 61e02535e..3561a19d5 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -52,12 +52,19 @@ FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE) IF(Subversion_SVN_EXECUTABLE) + # the subversion commands should be executed with the C locale, otherwise + # the message (which are parsed) may be translated, Alex + SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + SET(ENV{LC_ALL} C) EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version OUTPUT_VARIABLE Subversion_VERSION_SVN OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(REGEX REPLACE "^(.*\n)?svn, [Vv]ersion ([.0-9]+).*" + # restore the previous LC_ALL + SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + + STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") MACRO(Subversion_WC_INFO dir prefix) From 7119b5f5bea6017f7ae50e90bc7ed44eafac28a1 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 8 Oct 2010 00:01:06 -0400 Subject: [PATCH 28/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 17447cf0d..5b0fbf47e 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 07) +SET(KWSYS_DATE_STAMP_DAY 08) From 2dae2f1a0b24c674b651fd6edf79c4b51177b4d6 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 8 Oct 2010 20:55:55 -0600 Subject: [PATCH 29/77] Find imports dir in Qt 4.7 --- Modules/FindQt4.cmake | 73 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d2d39e6bf..45bbd2e58 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -242,6 +242,7 @@ # QT_LIBRARY_DIR Path to "lib" of Qt4 # QT_PLUGINS_DIR Path to "plugins" for Qt4 # QT_TRANSLATIONS_DIR Path to "translations" of Qt4 +# QT_IMPORTS_DIR Path to "imports" of Qt4 # QT_DOC_DIR Path to "doc" of Qt4 # QT_MKSPECS_DIR Path to "mkspecs" of Qt4 # @@ -445,6 +446,14 @@ MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) ENDMACRO (_QT4_ADJUST_LIB_VARS) +function(_QT4_QUERY_QMAKE VAR RESULT) + exec_program(${QT_QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) + if(NOT return_code) + file(TO_CMAKE_PATH "${output}" output) + set(${RESULT} ${output} PARENT_SCOPE) + endif(NOT return_code) +endfunction(_QT4_QUERY_QMAKE) + SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) @@ -470,7 +479,7 @@ IF (QT_QMAKE_EXECUTABLE) SET(QT4_QMAKE_FOUND FALSE) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path IF("${QTVERSION}" MATCHES "Unknown") @@ -482,8 +491,7 @@ IF (QT_QMAKE_EXECUTABLE) DOC "The qmake executable for the Qt installation to use" ) IF(QT_QMAKE_EXECUTABLE) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + _qt4_query_qmake(QT_VERSION QTVERSION) ENDIF(QT_QMAKE_EXECUTABLE) ENDIF("${QTVERSION}" MATCHES "Unknown") @@ -559,9 +567,7 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the mkspecs directory # we do this first because QT_LIBINFIX might be set IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QMAKE_MKSPECS" - OUTPUT_VARIABLE qt_mkspecs_dirs ) + _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs) # do not replace : on windows as it might be a drive letter # and windows should already use ; as a separator IF(NOT WIN32) @@ -592,11 +598,7 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the # others and for setting QT_LIBRARY_DIR IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_LIBS" - OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP) + _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP) SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE @@ -649,21 +651,13 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the binary dir IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_BINS" - OUTPUT_VARIABLE qt_bins ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins) - SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) + _qt4_query_qmake(QT_INSTALL_BINS qt_bins) + SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) # ask qmake for the include dir IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_HEADERS" - OUTPUT_VARIABLE qt_headers ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers) + _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore HINTS ${qt_headers} @@ -703,22 +697,14 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the documentation directory IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_DOCS" - OUTPUT_VARIABLE qt_doc_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir) + _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_PLUGINS" - OUTPUT_VARIABLE qt_plugins_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir) + _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) SET(QT_PLUGINS_DIR NOTFOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") @@ -730,14 +716,27 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the translations directory IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} - ARGS "-query QT_INSTALL_TRANSLATIONS" - OUTPUT_VARIABLE qt_translations_dir ) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir) + _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir) SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) + # ask qmake for the imports directory + IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) + if(qt_imports_dir) + SET(QT_IMPORTS_DIR NOTFOUND) + foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) + set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") + endforeach(qt_cross_path) + FIND_PATH(QT_IMPORTS_DIR NAMES Qt + HINTS ${qt_cross_paths} ${qt_imports_dir} + DOC "The location of the Qt imports" + NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + mark_as_advanced(QT_IMPORTS_DIR) + endif(qt_imports_dir) + ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + # Make variables changeble to the advanced user MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) From 8af6a137285c091d16bb3d579f329dc259f42409 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 9 Oct 2010 00:01:10 -0400 Subject: [PATCH 30/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 5b0fbf47e..66ec5e62d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 08) +SET(KWSYS_DATE_STAMP_DAY 09) From c89527a4213958d3ed0895c22bc1a997264b24b6 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 10 Oct 2010 00:01:04 -0400 Subject: [PATCH 31/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 66ec5e62d..610ea2ffa 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 09) +SET(KWSYS_DATE_STAMP_DAY 10) From 3138cc503b3645a44f9457915d6987b96b828982 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 11 Oct 2010 00:01:04 -0400 Subject: [PATCH 32/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 610ea2ffa..ab5a1e0bc 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 10) +SET(KWSYS_DATE_STAMP_DAY 11) From abb6e755eb8387622710e547f2b1d131f96ca990 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Oct 2010 08:35:19 -0400 Subject: [PATCH 33/77] Document ENABLE_EXPORTS behavior on Mac (#11295) Mention that it is implemented with -bundle-loader on platforms that need link-time symbol resolution but that do not use DLL import libs. --- Source/cmTarget.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3ee329fc1..538025732 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, From 35d2770df93662844a9866634c4fa4b90b49cae8 Mon Sep 17 00:00:00 2001 From: David Partyka Date: Mon, 11 Oct 2010 09:20:07 -0400 Subject: [PATCH 34/77] Update module to locate newely released MS MPI HPC Pack R2. --- Modules/FindMPI.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 9fef8f90c..4d1da5b6d 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -81,6 +81,7 @@ set(_MPI_PACKAGE_DIR lib/openmpi "MPICH/SDK" "Microsoft Compute Cluster Pack" + "Microsoft HPC Pack 2008 R2" ) set(_MPI_PREFIX_PATH) @@ -306,7 +307,7 @@ else (MPI_COMPILE_CMDLINE) # No MPI compiler to interogate so attempt to find everything with find functions. find_path(MPI_INCLUDE_PATH mpi.h HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES include + PATH_SUFFIXES include Inc ) # Decide between 32-bit and 64-bit libraries for Microsoft's MPI From 344553265237e3bb5c82351f7829ac8ef396dd99 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Oct 2010 09:35:46 -0400 Subject: [PATCH 35/77] FindHDF5: Fix typo in parallel-IO support check (#11291) --- Modules/FindHDF5.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 467b09f99..30203f2b5 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -293,7 +293,7 @@ else() # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support set( HDF5_IS_PARALLEL FALSE ) - foreach( _dir HDF5_INCLUDE_DIRS ) + foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) if( EXISTS "${_dir}/H5pubconf.h" ) file( STRINGS "${_dir}/H5pubconf.h" HDF5_HAVE_PARALLEL_DEFINE From b867a3f1a81b2dcb399a3e39ea8b9454d8f0508f Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Mon, 11 Oct 2010 22:48:33 -0400 Subject: [PATCH 36/77] Remove superfluous variable Boost_COMPAT_STATIC_RUNTIME. There is no need to introduce this extra variable as FindBoost can simply rely on if Boost_USE_STATIC_RUNTIME is defined or not to disable the old searching behavior for static runtime libraries on WIN32. --- Modules/FindBoost.cmake | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 2377e1077..3ae4e1410 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -20,7 +20,6 @@ # set(Boost_USE_STATIC_LIBS ON) # set(Boost_USE_MULTITHREADED ON) # set(Boost_USE_STATIC_RUNTIME OFF) -# set(Boost_COMPAT_STATIC_RUNTIME OFF) # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) # # if(Boost_FOUND) @@ -94,7 +93,10 @@ # # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries # linked against a static C++ standard library -# ('s' ABI tag). Defaults to OFF. +# ('s' ABI tag). This option should be set to +# ON or OFF because the default behavior +# if not specified is platform dependent +# for backwards compatibility. # [Since CMake 2.8.3] # # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries @@ -114,14 +116,6 @@ # Defaults to OFF. # [Since CMake 2.8.3] # -# Boost_COMPAT_STATIC_RUNTIME Set to OFF to disable backwards compatible -# searching for libraries with the 's' ABI -# tag on WIN32 after normal searches. You -# should set this to OFF and also set -# Boost_USE_STATIC_RUNTIME appropriately. -# If not specified, defaults to ON. -# [Since CMake 2.8.3] -# # Other Variables used by this module which you may want to set. # # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching @@ -372,9 +366,6 @@ endfunction() IF(NOT DEFINED Boost_USE_MULTITHREADED) SET(Boost_USE_MULTITHREADED TRUE) ENDIF() -if(NOT DEFINED Boost_COMPAT_STATIC_RUNTIME) - set(Boost_COMPAT_STATIC_RUNTIME TRUE) -endif() if(Boost_FIND_VERSION_EXACT) # The version may appear in a directory with or without the patch @@ -868,11 +859,11 @@ ELSE (_boost_IN_CACHE) # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) # We maintain this behavior since changing it could break people's builds. - # To disable the ambiguous behavior, the user can - # set Boost_COMPAT_STATIC_RUNTIME to FALSE + # To disable the ambiguous behavior, the user need only + # set Boost_USE_STATIC_RUNTIME either ON or OFF. set(_boost_STATIC_RUNTIME_WORKAROUND false) - if(Boost_COMPAT_STATIC_RUNTIME AND WIN32 AND Boost_USE_STATIC_LIBS) - if(NOT Boost_USE_STATIC_RUNTIME) + if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) set(_boost_STATIC_RUNTIME_WORKAROUND true) endif() endif() From 3810da1a73de50da76aa014876e606819d51a945 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 12 Oct 2010 00:01:11 -0400 Subject: [PATCH 37/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index ab5a1e0bc..3de3ebaa8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 11) +SET(KWSYS_DATE_STAMP_DAY 12) From 8f0a70e5f03eabed8ba25ccf0c47bcbff1f4ff92 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 12 Oct 2010 09:06:33 -0400 Subject: [PATCH 38/77] Xcode: Recognize .hh as C++ (#11307) --- Source/cmGlobalXCodeGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0976a4d0b..2f7bc44ab 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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"; } From 68e0b6357d8ab1cdbad526d25ebca5abcc1466aa Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 13 Oct 2010 00:01:04 -0400 Subject: [PATCH 39/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 3de3ebaa8..cf92fb127 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 12) +SET(KWSYS_DATE_STAMP_DAY 13) From 3dc07529cfa5e494e282e139e02347dd5940c8dc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 14 Oct 2010 00:01:06 -0400 Subject: [PATCH 40/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index cf92fb127..2f2514e99 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 13) +SET(KWSYS_DATE_STAMP_DAY 14) From 57c04db124f71f608522a8631feb4b9fcb67e81f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 15 Oct 2010 00:01:06 -0400 Subject: [PATCH 41/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 2f2514e99..39c73df81 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 14) +SET(KWSYS_DATE_STAMP_DAY 15) From 0dc88cf8533fd3e7ba1b3322fc279c158b17b59f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 16 Oct 2010 00:01:02 -0400 Subject: [PATCH 42/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 39c73df81..48eddb81e 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 15) +SET(KWSYS_DATE_STAMP_DAY 16) From 76c8c6017c045f6b2390149a87c1c69b9166bedc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 17 Oct 2010 00:01:03 -0400 Subject: [PATCH 43/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 48eddb81e..8f920b8e8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 16) +SET(KWSYS_DATE_STAMP_DAY 17) From 00b327fed857ac1b7f21b941733be2f0e79f0d6f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 18 Oct 2010 00:01:07 -0400 Subject: [PATCH 44/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8f920b8e8..feab1e5c8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 17) +SET(KWSYS_DATE_STAMP_DAY 18) From 915e5805d997eb748688a093519c8fa548118aa7 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 19 Oct 2010 00:01:05 -0400 Subject: [PATCH 45/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index feab1e5c8..d2b91d004 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 18) +SET(KWSYS_DATE_STAMP_DAY 19) From 1f369a71c80d606c8610b7e79c8aeaecba81a87f Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Tue, 19 Oct 2010 14:53:33 -0400 Subject: [PATCH 46/77] ENH: Added case for Python 2.7. --- Modules/FindPythonLibs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 283c91433..2b9341cb4 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -27,7 +27,7 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) -FOREACH(_CURRENT_VERSION 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) +FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) IF(WIN32) FIND_LIBRARY(PYTHON_DEBUG_LIBRARY From 3f94c7cc395d3f20890a6c9a14aa2795a5a9ce87 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 19 Oct 2010 16:15:32 -0400 Subject: [PATCH 47/77] When processing DartMeasurements use the tests working directory. Restore CMake 2.6 behavoir where the dart processing apparently was run from within the tests directory instead of the root of the build tree. This addresses issue reported on the VTK Dashboard where the Testing/Temporary directory is defined as ../../../Testing/Temporary but the DartProcessing is run with respect to the root of the build tree. This causes the regression/difference images to not be located by ctest and thus not uploaded to the dashboard. --- Source/CTest/cmCTestRunTest.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 6570d0e2a..76ff23a0d 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) From 5bae7f3b19c0406234c9bc4f6d701da8100d4db3 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 20 Oct 2010 00:01:07 -0400 Subject: [PATCH 48/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index d2b91d004..e8165f01b 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 19) +SET(KWSYS_DATE_STAMP_DAY 20) From e42160f3e057a338f5f5ac22bd4362b779a66254 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 21 Oct 2010 00:01:05 -0400 Subject: [PATCH 49/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index e8165f01b..9d5fc69fa 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 20) +SET(KWSYS_DATE_STAMP_DAY 21) From 91b5bc3efa814ba27cbc52280edc363f8991d0cc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 22 Oct 2010 00:01:05 -0400 Subject: [PATCH 50/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 9d5fc69fa..f3f47602a 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 21) +SET(KWSYS_DATE_STAMP_DAY 22) From beeca11c9bcfd0cc211c8c73f4b00709c914eac3 Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Fri, 22 Oct 2010 11:16:21 -0400 Subject: [PATCH 51/77] Fixed parallel build for generators with EXTRA. Fixed parallel build for projects using generators that have the CMAKE_EXTRA_GENERATOR as well as CMAKE_GENERATOR. Thanks to Bill Hoffman for helping me to track this one down, I missed parallel builds. --- Modules/ExternalProject.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d76796f44..dfd96cd2c 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -597,8 +597,7 @@ function(_ep_get_build_command name step cmd_var) # CMake project. Select build command based on generator. get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) if("${CMAKE_GENERATOR}" MATCHES "Make" AND - ("${cmake_generator}" STREQUAL "${CMAKE_GENERATOR}" OR - NOT cmake_generator)) + ("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator)) # The project uses the same Makefile generator. Use recursive make. set(cmd "$(MAKE)") if(step STREQUAL "INSTALL") From 6e1282f840fe50707c928079465ab315f07a59fe Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 22 Oct 2010 16:09:07 -0400 Subject: [PATCH 52/77] ExternalProject: No svn --username if empty (#11173) Nor --password. But please do if non-empty. Thank you. --- Modules/ExternalProject.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d76796f44..f3c907fc3 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -985,8 +985,15 @@ function(_ep_add_download_command name) get_filename_component(src_name "${source_dir}" NAME) get_filename_component(work_dir "${source_dir}" PATH) set(comment "Performing download step (SVN checkout) for '${name}'") + set(svn_user_pw_args "") + if(svn_username) + set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") + endif() + if(svn_password) + set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") + endif() set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} - --username=${svn_username} --password=${svn_password} ${src_name}) + ${svn_user_pw_args} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) elseif(git_repository) find_package(Git) @@ -1125,8 +1132,15 @@ function(_ep_add_update_command name) get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) + set(svn_user_pw_args "") + if(svn_username) + set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") + endif() + if(svn_password) + set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") + endif() set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision} - --username=${svn_username} --password=${svn_password}) + ${svn_user_pw_args}) set(always 1) elseif(git_repository) if(NOT GIT_EXECUTABLE) From 185582d5feb2925975cb669b0874a4a9cbe452d9 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 23 Oct 2010 00:01:13 -0400 Subject: [PATCH 53/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f3f47602a..8230e19e7 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 22) +SET(KWSYS_DATE_STAMP_DAY 23) From de81f2a4ee5f704ebd22875ba368d5623f919fa4 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 24 Oct 2010 00:01:03 -0400 Subject: [PATCH 54/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8230e19e7..f55091aad 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 23) +SET(KWSYS_DATE_STAMP_DAY 24) From 06b5eaa3cf7dc534415473eb1f3bfef191008999 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 25 Oct 2010 00:01:03 -0400 Subject: [PATCH 55/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f55091aad..ce7226539 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 24) +SET(KWSYS_DATE_STAMP_DAY 25) From be94c494eda5437bd7c026f6619d6ab040593e7a Mon Sep 17 00:00:00 2001 From: David Partyka Date: Mon, 25 Oct 2010 13:40:35 -0400 Subject: [PATCH 56/77] Fixed appending PATH to dumpbin tool from growing without bounds. IF(... MATCHES ...) used for comparing directories chokes especially in the case of C:\Program Files (x86)\ because of regex pattern matching. Switched this to use STREQUAL in a loop instead. --- Modules/GetPrerequisites.cmake | 12 ++++++++++-- Tests/CMakeTests/GetPrerequisitesTest.cmake.in | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index c83da4f81..e1dae46c2 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -587,11 +587,19 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # get_filename_component(gp_cmd_dir "${gp_cmd}" PATH) get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE) + file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) if(EXISTS "${gp_cmd_dlls_dir}") # only add to the path if it is not already in the path - if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}") + set(gp_found_cmd_dlls_dir 0) + foreach(gp_env_path_element $ENV{PATH}) + if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}") + set(gp_found_cmd_dlls_dir 1) + endif() + endforeach(gp_env_path_element) + + if(NOT gp_found_cmd_dlls_dir) set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}") - endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}") + endif() endif(EXISTS "${gp_cmd_dlls_dir}") endif("${gp_tool}" STREQUAL "dumpbin") # diff --git a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in index e8bfb47ae..182c22332 100644 --- a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in +++ b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in @@ -77,6 +77,11 @@ message(STATUS "") list_prerequisites("${CMAKE_COMMAND}" 0 0 1) message(STATUS "") +message(STATUS "=============================================================================") +string(LENGTH "$ENV{PATH}" PATH_LENGTH_BEGIN) +message(STATUS "Begin PATH length is: ${PATH_LENGTH_BEGIN}") +message(STATUS "") + # Leave the code for these tests in here, but turn them off by default... they # take longer than they're worth during development... @@ -139,6 +144,15 @@ foreach(v ${vs}) endforeach(v) message(STATUS "") +message(STATUS "=============================================================================") +string(LENGTH "$ENV{PATH}" PATH_LENGTH_END) +message(STATUS "Final PATH length is: ${PATH_LENGTH_END}") + +if(PATH_LENGTH_END GREATER ${PATH_LENGTH_BEGIN}) + message(FATAL_ERROR "list_prerequisties is endlessly appending the path of gp_tool to the PATH.") +endif() +message(STATUS "") + message(STATUS "=============================================================================") message(STATUS "End of test") From a74972402910610ab3ab62066d6b9e65b5202078 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Mon, 25 Oct 2010 20:40:45 +0200 Subject: [PATCH 57/77] CPackDeb Added several optional debian binary package fields This fixes bugs #0011355 and 0008342. The merged patch is a contribution from Michael Lasmanis and Petri Hodju with some extra documentation added by the merger. --- Modules/CPackDeb.cmake | 38 +++++++++++++++++++++++- Source/CPack/cmCPackDebGenerator.cxx | 44 +++++++++++++++++++++++++--- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 07d6ff9eb..98d40d65e 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -62,7 +62,43 @@ # Default : - # May be set when invoking cpack in order to trace debug informations # during CPackDeb run. - +# CPACK_DEBIAN_PACKAGE_PREDEPENDS +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# This field is like Depends, except that it also forces dpkg to complete installation of +# the packages named before even starting the installation of the package which declares +# the pre-dependency. +# CPACK_DEBIAN_PACKAGE_ENHANCES +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# This field is similar to Suggests but works in the opposite direction. +# It is used to declare that a package can enhance the functionality of another package. +# CPACK_DEBIAN_PACKAGE_BREAKS +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# When one binary package declares that it breaks another, dpkg will refuse to allow the +# package which declares Breaks be installed unless the broken package is deconfigured first, +# and it will refuse to allow the broken package to be reconfigured. +# CPACK_DEBIAN_PACKAGE_CONFLICTS +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# When one binary package declares a conflict with another using a Conflicts field, +# dpkg will refuse to allow them to be installed on the system at the same time. +# CPACK_DEBIAN_PACKAGE_PROVIDES +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# A virtual package is one which appears in the Provides control field of another package. +# CPACK_DEBIAN_PACKAGE_REPLACES +# Mandatory : NO +# Default : - +# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps +# Packages can declare in their control file that they should overwrite +# files in certain other packages, or completely replace other packages. #============================================================================= # Copyright 2007-2009 Kitware, Inc. diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index ac2e151c5..47a1ff64c 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"); From c8f39193e01e15a13a37ca227f02a2e4472f3d8a Mon Sep 17 00:00:00 2001 From: David Cole Date: Mon, 25 Oct 2010 15:03:36 -0400 Subject: [PATCH 58/77] Avoid problem reading jni.h on Macs. Apple released an update recently in which there was a broken symlink for jni.h that pointed to a non-existent file. CMake had trouble configuring because it encountered an error trying to read jni.h. We avoid the problem here by introducing a variable CTEST_RUN_Java, which defaults to OFF on Macs, that indicates whether to even attempt finding java, reading jni.h and adding the "Java" CMake test. If you would like to test Java on a Mac where the jni.h symlink is not busted, feel free to pass in -DCTEST_RUN_Java:BOOL=ON when configuring CMake. --- Tests/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c056e8612..d618ab485 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1635,7 +1635,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF() ENDIF() - IF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode") + if(NOT DEFINED CTEST_RUN_Java) + if(APPLE) + set(CTEST_RUN_Java OFF) + else() + set(CTEST_RUN_Java ON) + endif() + endif() + + IF(CTEST_RUN_Java) find_package(Java QUIET) IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH) @@ -1659,7 +1667,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF("${JNI_FILE}" MATCHES "JDK1_2") ENDIF(JNI_H) ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) - ENDIF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode") + ENDIF(CTEST_RUN_Java) # add some cross compiler tests, for now only with makefile based generators IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") From 7db02e9b3a37e41f86431e0509b5935044e31b73 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 26 Oct 2010 00:01:05 -0400 Subject: [PATCH 59/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index ce7226539..cdce91169 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 25) +SET(KWSYS_DATE_STAMP_DAY 26) From 16841987064cb79d3556034384458a36c4ceecef Mon Sep 17 00:00:00 2001 From: David Partyka Date: Tue, 26 Oct 2010 10:03:21 -0400 Subject: [PATCH 60/77] Switch to CMAKE_PATH when doing PATH comparisons on Windows. Users PATH may contain elements that end with backslash. This will escape the semicolon when iterating resulting in mismatches. Fix indentation. Fix whitespace --- Modules/GetPrerequisites.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e1dae46c2..40b682e22 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -587,11 +587,14 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # get_filename_component(gp_cmd_dir "${gp_cmd}" PATH) get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE) - file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) + # Use cmake paths as a user may have a PATH element ending with a backslash. + # This will escape the list delimiter and create havoc! + file(TO_CMAKE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) if(EXISTS "${gp_cmd_dlls_dir}") # only add to the path if it is not already in the path set(gp_found_cmd_dlls_dir 0) - foreach(gp_env_path_element $ENV{PATH}) + file(TO_CMAKE_PATH "$ENV{PATH}" env_path) + foreach(gp_env_path_element ${env_path}) if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}") set(gp_found_cmd_dlls_dir 1) endif() From 8e550ba31e6b68d85f96bcb833d65e937a7139e2 Mon Sep 17 00:00:00 2001 From: David Partyka Date: Tue, 26 Oct 2010 10:27:41 -0400 Subject: [PATCH 61/77] Remove unecessary TO_CMAKE_PATH for gp_cmd_dir. It is already using CMAKE style paths. --- Modules/GetPrerequisites.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 40b682e22..e51ab576e 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -589,7 +589,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE) # Use cmake paths as a user may have a PATH element ending with a backslash. # This will escape the list delimiter and create havoc! - file(TO_CMAKE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) if(EXISTS "${gp_cmd_dlls_dir}") # only add to the path if it is not already in the path set(gp_found_cmd_dlls_dir 0) From bee4802840607c22d9d37cda8464c17fcdf26529 Mon Sep 17 00:00:00 2001 From: David Partyka Date: Tue, 26 Oct 2010 11:12:12 -0400 Subject: [PATCH 62/77] Append the gp_tool path to the system PATH using native slashes. --- Modules/GetPrerequisites.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e51ab576e..c877308bd 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -600,6 +600,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endforeach(gp_env_path_element) if(NOT gp_found_cmd_dlls_dir) + file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}") endif() endif(EXISTS "${gp_cmd_dlls_dir}") From 01a90e9622bc74cf9d32e550f9342374b082a7fd Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 27 Oct 2010 00:01:08 -0400 Subject: [PATCH 63/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index cdce91169..ba4462f37 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 27) From 48e80eb7246683f471f3886436020d34c784be86 Mon Sep 17 00:00:00 2001 From: David Partyka Date: Wed, 27 Oct 2010 17:23:00 -0400 Subject: [PATCH 64/77] Fixes to GetPrerequisites for cygwin Fix IF(WIN32) guards check for cygwin. Fix checking if the depenency is in a system location to use cygwin style paths on cygwin. Also change GetPrerequisites to switch gp_tool to tools that are very unlikely to be found, ie. dumpbin on Apple and otool on Windows/Unix. --- Modules/GetPrerequisites.cmake | 36 ++++++++++++++----- .../CMakeTests/GetPrerequisitesTest.cmake.in | 8 ++--- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index c877308bd..853b1a1b6 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -146,7 +146,7 @@ function(is_file_executable file result_var) # If file name ends in .exe on Windows, *assume* executable: # - if(WIN32) + if(WIN32 AND NOT UNIX) if("${file_full_lower}" MATCHES "\\.exe$") set(${result_var} 1 PARENT_SCOPE) return() @@ -156,7 +156,7 @@ function(is_file_executable file result_var) # to determine ${result_var}. In 99%+? practical cases, the exe name # match will be sufficient... # - endif(WIN32) + endif(WIN32 AND NOT UNIX) # Use the information returned from the Unix shell command "file" to # determine if ${file_full} should be considered an executable file... @@ -335,7 +335,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) # Using find_program on Windows will find dll files that are in the PATH. # (Converting simple file names into full path names if found.) # - if(WIN32) + if(WIN32 AND NOT UNIX) if(NOT resolved) set(ri "ri-NOTFOUND") find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH) @@ -347,7 +347,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) set(ri "ri-NOTFOUND") endif(ri) endif(NOT resolved) - endif(WIN32) + endif(WIN32 AND NOT UNIX) # Provide a hook so that projects can override item resolution # by whatever logic they choose: @@ -413,7 +413,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "${resolved_file}" lower) if(UNIX) - if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)") + if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)") set(is_system 1) endif() endif() @@ -434,7 +434,27 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() - endif() + + if(UNIX) + # if cygwin, we can get the properly formed windows paths from cygpath + find_program(CYGPATH_EXECUTABLE cygpath) + + if(CYGPATH_EXECUTABLE) + execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W + OUTPUT_VARIABLE env_windir + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S + OUTPUT_VARIABLE env_sysdir + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(TOLOWER "${env_windir}" windir) + string(TOLOWER "${env_sysdir}" sysroot) + + if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + set(is_system 1) + endif() + endif(CYGPATH_EXECUTABLE) + endif(UNIX) + endif(WIN32) if(NOT is_system) get_filename_component(original_path "${original_lower}" PATH) @@ -519,9 +539,9 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(APPLE) set(gp_tool "otool") endif(APPLE) - if(WIN32) + if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har! set(gp_tool "dumpbin") - endif(WIN32) + endif(WIN32 AND NOT UNIX) endif("${gp_tool}" STREQUAL "") set(gp_tool_known 0) diff --git a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in index 182c22332..daf467bcc 100644 --- a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in +++ b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in @@ -121,11 +121,11 @@ message(STATUS "") message(STATUS "=============================================================================") message(STATUS "Test overriding 'gp_tool' with value unlikely to be found") message(STATUS "") -if(WIN32 OR APPLE) - set(gp_tool "ldd") -else(WIN32 OR APPLE) +if(APPLE) + set(gp_tool "dumpbin") +else() set(gp_tool "otool") -endif(WIN32 OR APPLE) +endif() set(gp_cmd "gp_cmd-NOTFOUND") list_prerequisites("${CMAKE_COMMAND}" 0 0 0) set(gp_cmd) From 70101ee8e7da58e5729fdc0fbb6a48cb3740ba9e Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 28 Oct 2010 00:01:04 -0400 Subject: [PATCH 65/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index ba4462f37..8c487d62b 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 27) +SET(KWSYS_DATE_STAMP_DAY 28) From 57eea54720a378712735b5ec6386cef745855325 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 29 Oct 2010 00:01:13 -0400 Subject: [PATCH 66/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8c487d62b..8d44da067 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) 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 29) From 2d3952d5210546ec4a861676b12edac249dd2f18 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 30 Oct 2010 00:01:06 -0400 Subject: [PATCH 67/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8d44da067..53ab6aa6f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 29) +SET(KWSYS_DATE_STAMP_DAY 30) From e3c46e648bfc6e717f1850bcab62ded310313346 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 31 Oct 2010 00:01:02 -0400 Subject: [PATCH 68/77] KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 53ab6aa6f..a4306a5ae 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 30) +SET(KWSYS_DATE_STAMP_DAY 31) From f7d56df39eb4567c187e429a7162a1204f8d2d1b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 31 Oct 2010 14:46:09 +0100 Subject: [PATCH 69/77] Remove trailing whitespace and minor formatting changes for the dot-code Alex --- Source/cmake.cxx | 204 +++++++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 97 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2ebd16592..de8db7927 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -169,7 +169,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", @@ -382,7 +382,7 @@ bool cmake::SetCacheArgs(const std::vector& args) this->DoSuppressDevWarnings = true; } else if(arg.find("-Wdev",0) == 0) - { + { this->SuppressDevWarnings = false; this->DoSuppressDevWarnings = true; } @@ -406,7 +406,7 @@ bool cmake::SetCacheArgs(const std::vector& 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 entriesToDelete; - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(); for ( it.Begin(); !it.IsAtEnd(); it.Next() ) { @@ -422,8 +422,8 @@ bool cmake::SetCacheArgs(const std::vector& args) } // now remove them from the cache - for(std::vector::const_iterator currentEntry = - entriesToDelete.begin(); + for(std::vector::const_iterator currentEntry = + entriesToDelete.begin(); currentEntry != entriesToDelete.end(); ++currentEntry) { @@ -791,7 +791,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 ", @@ -802,12 +802,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 @@ -815,8 +815,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())) @@ -936,7 +936,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" @@ -1091,7 +1091,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) return 0; } #endif - + else if (args[1] == "make_directory" && args.size() == 3) { if(!cmSystemTools::MakeDirectory(args[2].c_str())) @@ -1342,7 +1342,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) } return 0; } - + // Command to create a symbolic link. Fails on platforms not // supporting them. else if (args[1] == "create_symlink" && args.size() == 4) @@ -1410,7 +1410,7 @@ int cmake::ExecuteCMakeCommand(std::vector& 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. @@ -1635,14 +1635,14 @@ int cmake::ExecuteCMakeCommand(std::vector& args) return 1; } -void cmake::AddExtraGenerator(const char* name, +void cmake::AddExtraGenerator(const char* name, CreateExtraGeneratorFunctionType newFunction) { cmExternalMakefileProjectGenerator* extraGenerator = newFunction(); const std::vector& supportedGlobalGenerators = extraGenerator->GetSupportedGlobalGenerators(); - for(std::vector::const_iterator + for(std::vector::const_iterator it = supportedGlobalGenerators.begin(); it != supportedGlobalGenerators.end(); ++it ) @@ -1670,11 +1670,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 @@ -1690,7 +1690,7 @@ void cmake::GetRegisteredGenerators(std::vector& names) { names.push_back(i->first); } - for(RegisteredExtraGeneratorsMap::const_iterator + for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { @@ -1828,7 +1828,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(); @@ -1872,13 +1872,13 @@ int cmake::HandleDeleteCacheVariables(const char* var) cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator(); std::vector 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::iterator i = argsSplit.begin(); i != argsSplit.end(); ++i) - { + { SaveCacheEntry save; save.key = *i; warning << *i << "= "; @@ -1892,7 +1892,7 @@ int cmake::HandleDeleteCacheVariables(const char* var) } saved.push_back(save); } - + // remove the cache this->CacheManager->DeleteCache(this->GetStartOutputDirectory()); // load the empty cache @@ -1964,7 +1964,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", @@ -1974,9 +1974,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) { @@ -1998,7 +1998,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\\"; @@ -2062,11 +2062,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); @@ -2205,7 +2205,7 @@ int cmake::Run(const std::vector& args, bool noconfigure) // set the cmake command this->CMakeCommand = args[0]; - + if ( !this->ScriptMode ) { // load the cache @@ -2330,7 +2330,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)); } @@ -2445,8 +2445,8 @@ void cmake::UpdateProgress(const char *msg, float prog) } } -void cmake::GetCommandDocumentation(std::vector& v, - bool withCurrentCommands, +void cmake::GetCommandDocumentation(std::vector& v, + bool withCurrentCommands, bool withCompatCommands) const { for(RegisteredCommandsMap::const_iterator j = this->Commands.begin(); @@ -2457,7 +2457,7 @@ void cmake::GetCommandDocumentation(std::vector& v, { continue; } - + cmDocumentationEntry e((*j).second->GetName(), (*j).second->GetTerseDocumentation(), (*j).second->GetFullDocumentation()); @@ -2493,7 +2493,7 @@ void cmake::GetGeneratorDocumentation(std::vector& 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; @@ -2508,7 +2508,7 @@ void cmake::GetGeneratorDocumentation(std::vector& 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) @@ -2540,7 +2540,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 @@ -2549,7 +2549,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; @@ -2565,7 +2565,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()); } @@ -2585,7 +2585,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()); } @@ -2902,7 +2902,7 @@ void cmake::GenerateGraphViz(const char* fileName) const str << graphHeader << std::endl; const cmGlobalGenerator* gg = this->GetGlobalGenerator(); - const std::vector& localGenerators = + const std::vector& localGenerators = gg->GetLocalGenerators(); std::vector::const_iterator lit; // for target deps @@ -2917,8 +2917,9 @@ void cmake::GenerateGraphViz(const char* fileName) const 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 ) + for ( cmTargets::const_iterator tit = targets->begin(); + tit != targets->end(); + ++ tit ) { const char* realTargetName = tit->first.c_str(); if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) @@ -2933,16 +2934,17 @@ void cmake::GenerateGraphViz(const char* fileName) const 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 ) + for ( cmTargets::const_iterator tit = targets->begin(); + tit != targets->end(); + ++ tit ) { - const cmTarget::LinkLibraryVectorType* ll - = &(tit->second.GetOriginalLinkLibraries()); - cmTarget::LinkLibraryVectorType::const_iterator llit; + const cmTarget::LinkLibraryVectorType* ll = + &(tit->second.GetOriginalLinkLibraries()); const char* realTargetName = tit->first.c_str(); if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) { @@ -2953,11 +2955,13 @@ void cmake::GenerateGraphViz(const char* fileName) const { targetDeps[realTargetName] = 1; } - for ( llit = ll->begin(); llit != ll->end(); ++ llit ) + for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); + llit != ll->end(); + ++ llit ) { const char* libName = llit->first.c_str(); - std::map::const_iterator tarIt - = targetNamesNodes.find(libName); + std::map::const_iterator tarIt = + targetNamesNodes.find(libName); if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() ) { // Skip ignored targets @@ -2986,31 +2990,34 @@ void cmake::GenerateGraphViz(const char* fileName) const } // Write out nodes - std::map::const_iterator depIt; - for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt ) + for(std::map::const_iterator depIt = targetDeps.begin(); + depIt != targetDeps.end(); + ++ depIt ) { const char* newTargetName = depIt->first.c_str(); - std::map::const_iterator tarIt - = targetNamesNodes.find(newTargetName); + std::map::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; + << " even though it was added in the previous pass" + << std::endl; abort(); } str << " \"" << tarIt->second.c_str() << "\" [ label=\"" - << newTargetName << "\" shape=\""; + << newTargetName << "\" shape=\""; if ( depIt->second == 1 ) { - std::map::const_iterator tarTypeIt = + std::map::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; + << " even though it was added in the previous pass" + << std::endl; abort(); } const cmTarget* tg = tarTypeIt->second; @@ -3043,25 +3050,28 @@ void cmake::GenerateGraphViz(const char* fileName) const 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 ) + for (cmTargets::const_iterator tit = targets->begin(); + tit != targets->end(); + ++ tit ) { std::map::iterator dependIt - = targetDeps.find(tit->first.c_str()); + = targetDeps.find(tit->first.c_str()); if ( dependIt == targetDeps.end() ) { continue; } - std::map::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 ) + std::map::iterator cmakeTarIt = + targetNamesNodes.find(tit->first.c_str()); + 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(); - std::map::const_iterator tarIt - = targetNamesNodes.find(libName); + std::map::const_iterator tarIt = + targetNamesNodes.find(libName); if ( tarIt == targetNamesNodes.end() ) { // We should not be here. @@ -3070,7 +3080,7 @@ void cmake::GenerateGraphViz(const char* fileName) const abort(); } str << " \"" << cmakeTarIt->second.c_str() << "\" -> \"" - << tarIt->second.c_str() << "\"" << std::endl; + << tarIt->second.c_str() << "\"" << std::endl; } } } @@ -3336,7 +3346,7 @@ int cmake::ExecuteLinkScript(std::vector& 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 " @@ -3344,7 +3354,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 " @@ -3381,7 +3391,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 _FOUND variables. Packages which are " @@ -3531,13 +3541,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)) @@ -3547,7 +3557,7 @@ cmPropertyDefinition *cmake return 0; } -void cmake::RecordPropertyAccess(const char *name, +void cmake::RecordPropertyAccess(const char *name, cmProperty::ScopeType scope) { this->AccessedProperties.insert @@ -3619,13 +3629,13 @@ void cmake::ReportUndefinedPropertyAccesses(const char *filename) { if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) && aliasedProperties.find(std::pair - (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: @@ -3727,7 +3737,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 ) { @@ -3835,14 +3845,14 @@ int cmake::GetSystemInformation(std::vector& 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())) { @@ -3850,7 +3860,7 @@ int cmake::GetSystemInformation(std::vector& args) << "\" to \"" << outFile.c_str() << "\".\n"; return 1; } - + // do we write to a file or to stdout? if (resultFile.size() == 0) { @@ -3876,7 +3886,7 @@ int cmake::GetSystemInformation(std::vector& args) // change back to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); - + // echo results to stdout if needed if (writeToStdout) { @@ -3897,7 +3907,7 @@ int cmake::GetSystemInformation(std::vector& args) fclose(fin); } } - + // clean up the directory cmSystemTools::RemoveADirectory(destPath.c_str()); return 0; @@ -4016,7 +4026,7 @@ int cmake::VisualStudioLink(std::vector& args, int type) for(std::vector::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()); @@ -4069,7 +4079,7 @@ int cmake::VisualStudioLink(std::vector& args, int type) type, hasManifest, verbose); } -int cmake::ParseVisualStudioLinkCommand(std::vector& args, +int cmake::ParseVisualStudioLinkCommand(std::vector& args, std::vector& command, std::string& targetName) { @@ -4120,7 +4130,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) @@ -4141,12 +4151,12 @@ bool cmake::RunCommand(const char* comment, return retCode == 0; } -int cmake::VisualStudioLinkIncremental(std::vector& args, +int cmake::VisualStudioLinkIncremental(std::vector& 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. @@ -4158,10 +4168,10 @@ int cmake::VisualStudioLinkIncremental(std::vector& 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 @@ -4220,7 +4230,7 @@ int cmake::VisualStudioLinkIncremental(std::vector& 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; @@ -4230,7 +4240,7 @@ int cmake::VisualStudioLinkIncremental(std::vector& args, { return -1; } - // create mt command + // create mt command std::string outArg("/out:"); outArg+= manifestFile; mtCommand.push_back("/nologo"); @@ -4281,7 +4291,7 @@ int cmake::VisualStudioLinkNonIncremental(std::vector& 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)) { @@ -4472,7 +4482,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); From de2b2bf9efe88bbde1b66857d00538084cc6c591 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 31 Oct 2010 15:58:18 +0100 Subject: [PATCH 70/77] Move the code for collecting targets and libraries into separate functions Found bug: targets which don't link to anything don't get inserted in the dot file. Alex --- Source/cmake.cxx | 208 ++++++++++++++++++++++++++++------------------- Source/cmake.h | 86 +++++++++++--------- 2 files changed, 175 insertions(+), 119 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index de8db7927..6ccb2d2dc 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2835,6 +2835,11 @@ const char* cmake::GetCPackCommand() return this->CPackCommand.c_str(); } +// for target deps +#define DOT_DEP_TARGET 1 +#define DOT_DEP_EXTERNAL 2 +#define DOT_DEP_NONE 0 + void cmake::GenerateGraphViz(const char* fileName) const { cmGeneratedFileStream str(fileName); @@ -2904,90 +2909,17 @@ void cmake::GenerateGraphViz(const char* fileName) const const cmGlobalGenerator* gg = this->GetGlobalGenerator(); const std::vector& localGenerators = gg->GetLocalGenerators(); - std::vector::const_iterator lit; - // for target deps - // 1 - cmake target - // 2 - external target - // 0 - no deps + std::map targetDeps; std::map targetPtrs; - std::map targetNamesNodes; + std::map targetNamesNodes; // maps from the actual strings to node names in dot 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()); - for ( cmTargets::const_iterator 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; - } - } + cnt += getAllTargets(ignoreTargetsSet, targetNamesNodes, targetPtrs, + graphNodePrefix); + + cnt += getAllExternalLibs(ignoreTargetsSet, targetNamesNodes, targetPtrs, + targetDeps, graphNodePrefix); - // 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()); - for ( cmTargets::const_iterator tit = targets->begin(); - tit != targets->end(); - ++ tit ) - { - const cmTarget::LinkLibraryVectorType* ll = - &(tit->second.GetOriginalLinkLibraries()); - 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 (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); - llit != ll->end(); - ++ llit ) - { - const char* libName = llit->first.c_str(); - std::map::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::const_iterator depIt - = targetDeps.find(libName); - if ( depIt == targetDeps.end() ) - { - targetDeps[libName] = 1; - } - } - } - } - } // Write out nodes for(std::map::const_iterator depIt = targetDeps.begin(); @@ -3008,7 +2940,7 @@ void cmake::GenerateGraphViz(const char* fileName) const str << " \"" << tarIt->second.c_str() << "\" [ label=\"" << newTargetName << "\" shape=\""; - if ( depIt->second == 1 ) + if ( depIt->second == DOT_DEP_TARGET ) { std::map::const_iterator tarTypeIt = targetPtrs.find(newTargetName); @@ -3047,7 +2979,10 @@ void cmake::GenerateGraphViz(const char* fileName) const } // Now generate the connectivity - for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit ) + for ( std::vector::const_iterator lit = + localGenerators.begin(); + lit != localGenerators.end(); + ++ lit ) { const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); for (cmTargets::const_iterator tit = targets->begin(); @@ -3092,6 +3027,115 @@ void cmake::GenerateGraphViz(const char* fileName) const str << "}" << std::endl; } + +int cmake::getAllTargets(const std::set& ignoreTargetsSet, + std::map& targetNamesNodes, + std::map& targetPtrs, + const char* graphNodePrefix) const +{ + int cnt = 0; + const std::vector& localGenerators = + this->GetGlobalGenerator()->GetLocalGenerators(); + // First pass get the list of all cmake targets + for (std::vector::const_iterator lit = + localGenerators.begin(); + lit != 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 ( 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; + } + } + + return cnt; +} + + +int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, + std::map& targetNamesNodes, + std::map& targetPtrs, + std::map& targetDeps, + const char* graphNodePrefix) const +{ + int cnt = 0; + + const std::vector& localGenerators = + this->GetGlobalGenerator()->GetLocalGenerators(); + // Ok, now find all the stuff we link to that is not in cmake + for (std::vector::const_iterator lit = + localGenerators.begin(); + lit != 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 ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) + { + // Skip ignored targets + continue; + } + const cmTarget::LinkLibraryVectorType* ll = + &(tit->second.GetOriginalLinkLibraries()); + if ( ll->size() > 0 ) + { + targetDeps[realTargetName] = DOT_DEP_TARGET; + fprintf(stderr, " + %s\n", realTargetName); + } + for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); + llit != ll->end(); + ++ llit ) + { + const char* libName = llit->first.c_str(); + if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() ) + { + // Skip ignored targets + continue; + } + + std::map::const_iterator tarIt = + targetNamesNodes.find(libName); + if ( tarIt == targetNamesNodes.end() ) + { + cmOStringStream ostr; + ostr << graphNodePrefix << cnt++; + targetDeps[libName] = DOT_DEP_EXTERNAL; + targetNamesNodes[libName] = ostr.str(); + //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName + //<< "\" shape=\"ellipse\"];" << std::endl; + } + else + { + std::map::const_iterator depIt = + targetDeps.find(libName); + if ( depIt == targetDeps.end() ) + { + targetDeps[libName] = DOT_DEP_TARGET; + } + } + } + } + } + return cnt; +} + //---------------------------------------------------------------------------- int cmake::SymlinkLibrary(std::vector& args) { diff --git a/Source/cmake.h b/Source/cmake.h index 8312795eb..6d6fd94ae 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,7 @@ class cmExternalMakefileProjectGenerator; class cmDocumentationSection; class cmPolicies; class cmListFileBacktrace; +class cmTarget; class cmake { @@ -73,14 +74,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 +101,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 +159,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 +170,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&); - /** + /** * Get the system information and write it to the file specified */ int GetSystemInformation(std::vector&); @@ -210,16 +211,16 @@ class cmake /** Check if a command exists. */ bool CommandExists(const char* name) const; - + ///! Parse command line arguments void SetArgs(const std::vector&); ///! 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&); @@ -227,9 +228,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); @@ -244,14 +245,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& entries, - bool withCurrentCommands = true, + void GetCommandDocumentation(std::vector& entries, + bool withCurrentCommands = true, bool withCompatCommands = true) const; void GetPropertiesDocumentation(std::map&); @@ -278,7 +279,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;} @@ -310,7 +311,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 @@ -338,7 +339,7 @@ class cmake } void SetSuppressDevWarnings(bool v) { - this->SuppressDevWarnings = v; + this->SuppressDevWarnings = v; this->DoSuppressDevWarnings = true; } @@ -357,10 +358,10 @@ protected: cmPropertyMap Properties; std::set > AccessedProperties; - std::map + std::map PropertyDefinitions; - typedef + typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map RegisteredExtraGeneratorsMap; @@ -374,15 +375,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; @@ -393,7 +394,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. @@ -416,24 +417,35 @@ protected: static int ExecuteLinkScript(std::vector& args); static int VisualStudioLink(std::vector& args, int type); static int VisualStudioLinkIncremental(std::vector& args, - int type, + int type, bool verbose); static int VisualStudioLinkNonIncremental(std::vector& args, int type, bool hasManifest, bool verbose); - static int ParseVisualStudioLinkCommand(std::vector& args, - std::vector& command, + static int ParseVisualStudioLinkCommand(std::vector& args, + std::vector& command, std::string& targetName); static bool RunCommand(const char* comment, std::vector& command, bool verbose, int* retCodeOut = 0); cmVariableWatch* VariableWatch; - + + int getAllTargets(const std::set& ignoreTargetsSet, + std::map& targetNamesNodes, + std::map& targetPtrs, + const char* graphNodePrefix) const; + + int getAllExternalLibs(const std::set& ignoreTargetsSet, + std::map& targetNamesNodes, + std::map& targetPtrs, + std::map& targetDeps, + const char* graphNodePrefix) const; + ///! 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; @@ -458,7 +470,7 @@ private: cmFileTimeComparison* FileComparison; std::string GraphVizFile; std::vector DebugConfigs; - + void UpdateConversionPathTable(); }; From 487bd571d56134b15b1060e1921a7e16711f12e6 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 31 Oct 2010 16:23:40 +0100 Subject: [PATCH 71/77] Properly insert all targets, also those which don't link to anything. Alex --- Source/cmake.cxx | 129 +++++++++++++++++------------------------------ Source/cmake.h | 1 - 2 files changed, 45 insertions(+), 85 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6ccb2d2dc..af01d0d18 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2835,10 +2835,31 @@ const char* cmake::GetCPackCommand() return this->CPackCommand.c_str(); } -// for target deps -#define DOT_DEP_TARGET 1 -#define DOT_DEP_EXTERNAL 2 -#define DOT_DEP_NONE 0 + +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"; +} + void cmake::GenerateGraphViz(const char* fileName) const { @@ -2910,7 +2931,6 @@ void cmake::GenerateGraphViz(const char* fileName) const const std::vector& localGenerators = gg->GetLocalGenerators(); - std::map targetDeps; std::map targetPtrs; std::map targetNamesNodes; // maps from the actual strings to node names in dot int cnt = 0; @@ -2918,64 +2938,20 @@ void cmake::GenerateGraphViz(const char* fileName) const graphNodePrefix); cnt += getAllExternalLibs(ignoreTargetsSet, targetNamesNodes, targetPtrs, - targetDeps, graphNodePrefix); + graphNodePrefix); // Write out nodes - for(std::map::const_iterator depIt = targetDeps.begin(); - depIt != targetDeps.end(); - ++ depIt ) + for(std::map::const_iterator tarIt = + targetPtrs.begin(); tarIt != targetPtrs.end(); ++ tarIt ) { - const char* newTargetName = depIt->first.c_str(); - std::map::const_iterator tarIt = + const char* newTargetName = tarIt->first.c_str(); + std::map::const_iterator nameIt = 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(); - } - str << " \"" << tarIt->second.c_str() << "\" [ label=\"" - << newTargetName << "\" shape=\""; - if ( depIt->second == DOT_DEP_TARGET ) - { - std::map::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; + str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + << newTargetName << "\" shape=\"" << getShapeForTarget(tarIt->second) + << "\"];" << std::endl; } // Now generate the connectivity @@ -2989,13 +2965,13 @@ void cmake::GenerateGraphViz(const char* fileName) const tit != targets->end(); ++ tit ) { - std::map::iterator dependIt - = targetDeps.find(tit->first.c_str()); - if ( dependIt == targetDeps.end() ) + std::map::iterator cmakeTarIt + = targetPtrs.find(tit->first.c_str()); + if ( cmakeTarIt == targetPtrs.end() ) // skip ignored targets { continue; } - std::map::iterator cmakeTarIt = + std::map::iterator targetNameIt = targetNamesNodes.find(tit->first.c_str()); const cmTarget::LinkLibraryVectorType* ll = &(tit->second.GetOriginalLinkLibraries()); @@ -3005,17 +2981,17 @@ void cmake::GenerateGraphViz(const char* fileName) const ++ llit ) { const char* libName = llit->first.c_str(); - std::map::const_iterator tarIt = + std::map::const_iterator libNameIt = targetNamesNodes.find(libName); - if ( tarIt == targetNamesNodes.end() ) + if ( libNameIt == 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; + str << " \"" << targetNameIt->second.c_str() << "\" -> \"" + << libNameIt->second.c_str() << "\"" << std::endl; } } } @@ -3068,7 +3044,6 @@ int cmake::getAllTargets(const std::set& ignoreTargetsSet, int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, std::map& targetNamesNodes, std::map& targetPtrs, - std::map& targetDeps, const char* graphNodePrefix) const { int cnt = 0; @@ -3094,11 +3069,6 @@ int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, } const cmTarget::LinkLibraryVectorType* ll = &(tit->second.GetOriginalLinkLibraries()); - if ( ll->size() > 0 ) - { - targetDeps[realTargetName] = DOT_DEP_TARGET; - fprintf(stderr, " + %s\n", realTargetName); - } for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); llit != ll->end(); ++ llit ) @@ -3110,26 +3080,17 @@ int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, continue; } - std::map::const_iterator tarIt = - targetNamesNodes.find(libName); - if ( tarIt == targetNamesNodes.end() ) + std::map::const_iterator tarIt = + targetPtrs.find(libName); + if ( tarIt == targetPtrs.end() ) { cmOStringStream ostr; ostr << graphNodePrefix << cnt++; - targetDeps[libName] = DOT_DEP_EXTERNAL; targetNamesNodes[libName] = ostr.str(); + targetPtrs[libName] = NULL; //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName //<< "\" shape=\"ellipse\"];" << std::endl; } - else - { - std::map::const_iterator depIt = - targetDeps.find(libName); - if ( depIt == targetDeps.end() ) - { - targetDeps[libName] = DOT_DEP_TARGET; - } - } } } } diff --git a/Source/cmake.h b/Source/cmake.h index 6d6fd94ae..b2cc7e7ad 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -440,7 +440,6 @@ protected: int getAllExternalLibs(const std::set& ignoreTargetsSet, std::map& targetNamesNodes, std::map& targetPtrs, - std::map& targetDeps, const char* graphNodePrefix) const; ///! Find the full path to one of the cmake programs like ctest, cpack, etc. From a60b09927d4c29756c428d4c38f5ee2810a8f66e Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 31 Oct 2010 17:40:46 +0100 Subject: [PATCH 72/77] Generate separate dot files for each target, and a big one with everything. The big all-in-one file is basically unusable for e.g. kdelibs, it contains around 1000 nodes and the created image is huuuuge ! Too big actually to be displayable or viewable or comprehensable. Alex --- Source/cmake.cxx | 216 +++++++++++++++++++++++++++++++---------------- Source/cmake.h | 10 ++- 2 files changed, 153 insertions(+), 73 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index af01d0d18..5386fb4f1 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2861,13 +2861,26 @@ static const char* getShapeForTarget(const cmTarget* target) } +static void writeNode(const char* targetName, const cmTarget* target, + const std::map& targetNamesNodes, + std::set& insertedNodes, + cmGeneratedFileStream& str) +{ + if (insertedNodes.find(targetName) == insertedNodes.end()) + { + insertedNodes.insert(targetName); + std::map::const_iterator nameIt = + targetNamesNodes.find(targetName); + + str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + << targetName << "\" shape=\"" << getShapeForTarget(target) + << "\"];" << std::endl; + } +} + + void cmake::GenerateGraphViz(const char* fileName) const { - cmGeneratedFileStream str(fileName); - if ( !str ) - { - return; - } cmake cm; cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); @@ -2924,83 +2937,144 @@ void cmake::GenerateGraphViz(const char* fileName) const } } + std::map targetPtrs; + std::map targetNamesNodes; // maps from the actual strings to node names in dot + int cnt = getAllTargets(ignoreTargetsSet, targetNamesNodes, targetPtrs, + graphNodePrefix); + + cnt = getAllExternalLibs(ignoreTargetsSet, targetNamesNodes, targetPtrs, + graphNodePrefix, cnt); + + for(std::map::const_iterator ptrIt = + targetPtrs.begin(); + ptrIt != targetPtrs.end(); + ++ptrIt) + { + if (ptrIt->second == NULL) + { + continue; + } + + if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) + && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + { + continue; + } + + std::set insertedConnections; + std::set insertedNodes; + + std::string currentFilename = fileName; + currentFilename += "."; + currentFilename += ptrIt->first; + cmGeneratedFileStream str(currentFilename.c_str()); + if ( !str ) + { + return; + } + + fprintf(stderr, "Writing %s...\n", currentFilename.c_str()); + str << graphType << " " << graphName << " {" << std::endl; + str << graphHeader << std::endl; + + writeDotConnections(ptrIt->first.c_str(), targetNamesNodes, targetPtrs, + insertedNodes, insertedConnections, str); + str << "}" << std::endl; + } + + cmGeneratedFileStream str(fileName); + if ( !str ) + { + return; + } str << graphType << " " << graphName << " {" << std::endl; str << graphHeader << std::endl; - const cmGlobalGenerator* gg = this->GetGlobalGenerator(); - const std::vector& localGenerators = - gg->GetLocalGenerators(); + fprintf(stderr, "Writing %s...\n", fileName); + std::set insertedConnections; + std::set insertedNodes; - std::map targetPtrs; - std::map targetNamesNodes; // maps from the actual strings to node names in dot - int cnt = 0; - cnt += getAllTargets(ignoreTargetsSet, targetNamesNodes, targetPtrs, - graphNodePrefix); - - cnt += getAllExternalLibs(ignoreTargetsSet, targetNamesNodes, targetPtrs, - graphNodePrefix); - - - // Write out nodes - for(std::map::const_iterator tarIt = - targetPtrs.begin(); tarIt != targetPtrs.end(); ++ tarIt ) + for(std::map::const_iterator ptrIt = + targetPtrs.begin(); + ptrIt != targetPtrs.end(); + ++ptrIt) { - const char* newTargetName = tarIt->first.c_str(); - std::map::const_iterator nameIt = - targetNamesNodes.find(newTargetName); + if (ptrIt->second == NULL) + { + continue; + } - str << " \"" << nameIt->second.c_str() << "\" [ label=\"" - << newTargetName << "\" shape=\"" << getShapeForTarget(tarIt->second) - << "\"];" << std::endl; + if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) + && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + { + continue; + } + + writeDotConnections(ptrIt->first.c_str(), targetNamesNodes, targetPtrs, + insertedNodes, insertedConnections, str); + } + str << "}" << std::endl; +} + + +void cmake::writeDotConnections(const char* targetName, + const std::map& targetNamesNodes, + const std::map& targetPtrs, + std::set& insertedNodes, + std::set& insertedConnections, + cmGeneratedFileStream& str) const +{ + std::map::const_iterator targetPtrIt = + targetPtrs.find(targetName); + + if (targetPtrIt == targetPtrs.end()) // not found at all + { + return; } - // Now generate the connectivity - for ( std::vector::const_iterator lit = - localGenerators.begin(); - lit != localGenerators.end(); - ++ lit ) - { - const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); - for (cmTargets::const_iterator tit = targets->begin(); - tit != targets->end(); - ++ tit ) - { - std::map::iterator cmakeTarIt - = targetPtrs.find(tit->first.c_str()); - if ( cmakeTarIt == targetPtrs.end() ) // skip ignored targets - { - continue; - } - std::map::iterator targetNameIt = - targetNamesNodes.find(tit->first.c_str()); - const cmTarget::LinkLibraryVectorType* ll = - &(tit->second.GetOriginalLinkLibraries()); + writeNode(targetName, targetPtrIt->second, targetNamesNodes, insertedNodes, + str); - for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); - llit != ll->end(); - ++ llit ) - { - const char* libName = llit->first.c_str(); - std::map::const_iterator libNameIt = + if (targetPtrIt->second == NULL) // it's an external library + { + return; + } + + + std::string myNodeName = 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::const_iterator libNameIt = targetNamesNodes.find(libName); - if ( libNameIt == 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 << " \"" << targetNameIt->second.c_str() << "\" -> \"" - << libNameIt->second.c_str() << "\"" << std::endl; - } + + std::string connectionName = myNodeName; + connectionName += "-"; + connectionName += libNameIt->second; + if (insertedConnections.find(connectionName) == insertedConnections.end()) + { + insertedConnections.insert(connectionName); + writeNode(libName, targetPtrs.find(libName)->second, targetNamesNodes, + insertedNodes, str); + + str << " \"" << myNodeName.c_str() << "\" -> \"" + << libNameIt->second.c_str() << "\""; + str << " // " << targetName << " -> " << libName << std::endl; + writeDotConnections(libName, targetNamesNodes, targetPtrs, insertedNodes, + insertedConnections, str); } } - // TODO: Use dotted or something for external libraries - //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]" - //<< std::endl; - // - str << "}" << std::endl; } @@ -3044,10 +3118,8 @@ int cmake::getAllTargets(const std::set& ignoreTargetsSet, int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, std::map& targetNamesNodes, std::map& targetPtrs, - const char* graphNodePrefix) const + const char* graphNodePrefix, int cnt) const { - int cnt = 0; - const std::vector& localGenerators = this->GetGlobalGenerator()->GetLocalGenerators(); // Ok, now find all the stuff we link to that is not in cmake diff --git a/Source/cmake.h b/Source/cmake.h index b2cc7e7ad..0de72d9d6 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -51,6 +51,7 @@ class cmDocumentationSection; class cmPolicies; class cmListFileBacktrace; class cmTarget; +class cmGeneratedFileStream; class cmake { @@ -440,7 +441,14 @@ protected: int getAllExternalLibs(const std::set& ignoreTargetsSet, std::map& targetNamesNodes, std::map& targetPtrs, - const char* graphNodePrefix) const; + const char* graphNodePrefix, int cnt) const; + + void writeDotConnections(const char* targetName, + const std::map& targetNamesNodes, + const std::map& targetPtrs, + std::set& insertedNodes, + std::set& insertedConnections, + cmGeneratedFileStream& str) const; ///! Find the full path to one of the cmake programs like ctest, cpack, etc. std::string FindCMakeProgram(const char* name) const; From 84ce612c65520c273aa3b1d2efd2f8f4de7d3867 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 9 Nov 2010 21:37:51 +0100 Subject: [PATCH 73/77] Move the code for generating dot-files into separate class cmGraphVizWriter Alex --- Source/CMakeLists.txt | 6 +- Source/cmGraphVizWriter.cxx | 370 ++++++++++++++++++++++++++++++++++++ Source/cmGraphVizWriter.h | 70 +++++++ Source/cmake.cxx | 336 ++------------------------------ Source/cmake.h | 17 -- 5 files changed, 456 insertions(+), 343 deletions(-) create mode 100644 Source/cmGraphVizWriter.cxx create mode 100644 Source/cmGraphVizWriter.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 71284b2dc..718e52e8e 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/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx new file mode 100644 index 000000000..749202b9a --- /dev/null +++ b/Source/cmGraphVizWriter.cxx @@ -0,0 +1,370 @@ +/*============================================================================ + 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 + + + +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& + localGenerators) +:GraphType("digraph") +,GraphName("GG") +,GraphHeader("node [\n fontsize = \"12\"\n];") +,GraphNodePrefix("node") +,LocalGenerators(localGenerators) +{ + int cnt = collectAllTargets(); + collectAllExternalLibs(cnt); +} + + +void cmGraphVizWriter::ReadSettings(const char* settingsFileName, + const char* fallbackSettingsFileName) +{ + cmake cm; + cmGlobalGenerator ggi; + ggi.SetCMakeInstance(&cm); + std::auto_ptr 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"); + + this->TargetsToIgnore.clear(); + const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); + if ( ignoreTargets ) + { + std::vector ignoreTargetsVector; + cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); + for(std::vector::iterator itvIt = ignoreTargetsVector.begin(); + itvIt != ignoreTargetsVector.end(); + ++ itvIt ) + { + this->TargetsToIgnore.insert(itvIt->c_str()); + } + } + +} + + +void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) +{ + for(std::map::const_iterator ptrIt = + this->TargetPtrs.begin(); + ptrIt != this->TargetPtrs.end(); + ++ptrIt) + { + if (ptrIt->second == NULL) + { + continue; + } + + if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) + && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + { + continue; + } + + std::set insertedConnections; + std::set insertedNodes; + + std::string currentFilename = fileName; + currentFilename += "."; + currentFilename += ptrIt->first; + cmGeneratedFileStream str(currentFilename.c_str()); + if ( !str ) + { + return; + } + + fprintf(stderr, "Writing %s...\n", currentFilename.c_str()); + this->WriteHeader(str); + + this->WriteConnections(ptrIt->first.c_str(), + insertedNodes, insertedConnections, str); + this->WriteFooter(str); + } + +} + + +void cmGraphVizWriter::WriteGlobalFile(const char* fileName) +{ + cmGeneratedFileStream str(fileName); + if ( !str ) + { + return; + } + this->WriteHeader(str); + + fprintf(stderr, "Writing %s...\n", fileName); + std::set insertedConnections; + std::set insertedNodes; + + for(std::map::const_iterator ptrIt = + this->TargetPtrs.begin(); + ptrIt != this->TargetPtrs.end(); + ++ptrIt) + { + if (ptrIt->second == NULL) + { + continue; + } + + if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) + && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) + && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + { + 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& insertedNodes, + std::set& insertedConnections, + cmGeneratedFileStream& str) const +{ + std::map::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::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& insertedNodes, + cmGeneratedFileStream& str) const +{ + if (insertedNodes.find(targetName) == insertedNodes.end()) + { + insertedNodes.insert(targetName); + std::map::const_iterator nameIt = + this->TargetNamesNodes.find(targetName); + + str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + << targetName << "\" shape=\"" << getShapeForTarget(target) + << "\"];" << std::endl; + } +} + + +int cmGraphVizWriter::collectAllTargets() +{ + int cnt = 0; + // First pass get the list of all cmake targets + for (std::vector::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::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::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) const +{ + return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end()); +} diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h new file mode 100644 index 000000000..fd3d3e20c --- /dev/null +++ b/Source/cmGraphVizWriter.h @@ -0,0 +1,70 @@ +#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" + + +/** 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& localGenerators); + + void ReadSettings(const char* settingsFileName, + const char* fallbackSettingsFileName); + + void WritePerTargetFiles(const char* fileName); + + void WriteGlobalFile(const char* fileName); + +protected: + + int collectAllTargets(); + + int collectAllExternalLibs(int cnt); + + void WriteHeader(cmGeneratedFileStream& str) const; + + void WriteConnections(const char* targetName, + std::set& insertedNodes, + std::set& insertedConnections, + cmGeneratedFileStream& str) const; + + void WriteNode(const char* targetName, const cmTarget* target, + std::set& insertedNodes, + cmGeneratedFileStream& str) const; + + void WriteFooter(cmGeneratedFileStream& str) const; + + bool IgnoreThisTarget(const char* name) const; + + cmStdString GraphType; + cmStdString GraphName; + cmStdString GraphHeader; + cmStdString GraphNodePrefix; + + const std::vector& LocalGenerators; + + std::map TargetPtrs; + // maps from the actual target names to node names in dot: + std::map TargetNamesNodes; + + std::set TargetsToIgnore; + +}; + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5386fb4f1..aec8e0619 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 @@ -2836,339 +2837,26 @@ const char* cmake::GetCPackCommand() } -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"; -} - - -static void writeNode(const char* targetName, const cmTarget* target, - const std::map& targetNamesNodes, - std::set& insertedNodes, - cmGeneratedFileStream& str) -{ - if (insertedNodes.find(targetName) == insertedNodes.end()) - { - insertedNodes.insert(targetName); - std::map::const_iterator nameIt = - targetNamesNodes.find(targetName); - - str << " \"" << nameIt->second.c_str() << "\" [ label=\"" - << targetName << "\" shape=\"" << getShapeForTarget(target) - << "\"];" << std::endl; - } -} - - void cmake::GenerateGraphViz(const char* fileName) const { - cmake cm; - cmGlobalGenerator ggi; - ggi.SetCMakeInstance(&cm); - std::auto_ptr lg(ggi.CreateLocalGenerator()); - cmMakefile *mf = lg->GetMakefile(); +#ifdef CMAKE_BUILD_WITH_CMAKE + std::auto_ptr gvWriter( + new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); - 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 = ""; - } - } + std::string settingsFile = this->GetHomeOutputDirectory(); + settingsFile += "/CMakeGraphVizOptions.cmake"; + std::string fallbackSettingsFile = this->GetHomeDirectory(); + fallbackSettingsFile += "/CMakeGraphVizOptions.cmake"; - 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; - } + gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str()); -#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 ignoreTargetsSet; - if ( ignoreTargets ) - { - std::vector ignoreTargetsVector; - cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); - std::vector::iterator itvIt; - for ( itvIt = ignoreTargetsVector.begin(); - itvIt != ignoreTargetsVector.end(); - ++ itvIt ) - { - ignoreTargetsSet.insert(itvIt->c_str()); - } - } + gvWriter->WritePerTargetFiles(fileName); + gvWriter->WriteGlobalFile(fileName); - std::map targetPtrs; - std::map targetNamesNodes; // maps from the actual strings to node names in dot - int cnt = getAllTargets(ignoreTargetsSet, targetNamesNodes, targetPtrs, - graphNodePrefix); - - cnt = getAllExternalLibs(ignoreTargetsSet, targetNamesNodes, targetPtrs, - graphNodePrefix, cnt); - - for(std::map::const_iterator ptrIt = - targetPtrs.begin(); - ptrIt != targetPtrs.end(); - ++ptrIt) - { - if (ptrIt->second == NULL) - { - continue; - } - - if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) - && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) - { - continue; - } - - std::set insertedConnections; - std::set insertedNodes; - - std::string currentFilename = fileName; - currentFilename += "."; - currentFilename += ptrIt->first; - cmGeneratedFileStream str(currentFilename.c_str()); - if ( !str ) - { - return; - } - - fprintf(stderr, "Writing %s...\n", currentFilename.c_str()); - str << graphType << " " << graphName << " {" << std::endl; - str << graphHeader << std::endl; - - writeDotConnections(ptrIt->first.c_str(), targetNamesNodes, targetPtrs, - insertedNodes, insertedConnections, str); - str << "}" << std::endl; - } - - cmGeneratedFileStream str(fileName); - if ( !str ) - { - return; - } - str << graphType << " " << graphName << " {" << std::endl; - str << graphHeader << std::endl; - - fprintf(stderr, "Writing %s...\n", fileName); - std::set insertedConnections; - std::set insertedNodes; - - for(std::map::const_iterator ptrIt = - targetPtrs.begin(); - ptrIt != targetPtrs.end(); - ++ptrIt) - { - if (ptrIt->second == NULL) - { - continue; - } - - if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) - && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) - { - continue; - } - - writeDotConnections(ptrIt->first.c_str(), targetNamesNodes, targetPtrs, - insertedNodes, insertedConnections, str); - } - str << "}" << std::endl; +#endif } -void cmake::writeDotConnections(const char* targetName, - const std::map& targetNamesNodes, - const std::map& targetPtrs, - std::set& insertedNodes, - std::set& insertedConnections, - cmGeneratedFileStream& str) const -{ - std::map::const_iterator targetPtrIt = - targetPtrs.find(targetName); - - if (targetPtrIt == targetPtrs.end()) // not found at all - { - return; - } - - writeNode(targetName, targetPtrIt->second, targetNamesNodes, insertedNodes, - str); - - if (targetPtrIt->second == NULL) // it's an external library - { - return; - } - - - std::string myNodeName = 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::const_iterator libNameIt = - targetNamesNodes.find(libName); - - std::string connectionName = myNodeName; - connectionName += "-"; - connectionName += libNameIt->second; - if (insertedConnections.find(connectionName) == insertedConnections.end()) - { - insertedConnections.insert(connectionName); - writeNode(libName, targetPtrs.find(libName)->second, targetNamesNodes, - insertedNodes, str); - - str << " \"" << myNodeName.c_str() << "\" -> \"" - << libNameIt->second.c_str() << "\""; - str << " // " << targetName << " -> " << libName << std::endl; - writeDotConnections(libName, targetNamesNodes, targetPtrs, insertedNodes, - insertedConnections, str); - } - } - -} - - -int cmake::getAllTargets(const std::set& ignoreTargetsSet, - std::map& targetNamesNodes, - std::map& targetPtrs, - const char* graphNodePrefix) const -{ - int cnt = 0; - const std::vector& localGenerators = - this->GetGlobalGenerator()->GetLocalGenerators(); - // First pass get the list of all cmake targets - for (std::vector::const_iterator lit = - localGenerators.begin(); - lit != 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 ( 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; - } - } - - return cnt; -} - - -int cmake::getAllExternalLibs(const std::set& ignoreTargetsSet, - std::map& targetNamesNodes, - std::map& targetPtrs, - const char* graphNodePrefix, int cnt) const -{ - const std::vector& localGenerators = - this->GetGlobalGenerator()->GetLocalGenerators(); - // Ok, now find all the stuff we link to that is not in cmake - for (std::vector::const_iterator lit = - localGenerators.begin(); - lit != 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 ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) - { - // 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 ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() ) - { - // Skip ignored targets - continue; - } - - std::map::const_iterator tarIt = - targetPtrs.find(libName); - if ( tarIt == targetPtrs.end() ) - { - cmOStringStream ostr; - ostr << graphNodePrefix << cnt++; - targetNamesNodes[libName] = ostr.str(); - targetPtrs[libName] = NULL; - //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName - //<< "\" shape=\"ellipse\"];" << std::endl; - } - } - } - } - return cnt; -} - //---------------------------------------------------------------------------- int cmake::SymlinkLibrary(std::vector& args) { diff --git a/Source/cmake.h b/Source/cmake.h index 0de72d9d6..435d38bfa 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -433,23 +433,6 @@ protected: int* retCodeOut = 0); cmVariableWatch* VariableWatch; - int getAllTargets(const std::set& ignoreTargetsSet, - std::map& targetNamesNodes, - std::map& targetPtrs, - const char* graphNodePrefix) const; - - int getAllExternalLibs(const std::set& ignoreTargetsSet, - std::map& targetNamesNodes, - std::map& targetPtrs, - const char* graphNodePrefix, int cnt) const; - - void writeDotConnections(const char* targetName, - const std::map& targetNamesNodes, - const std::map& targetPtrs, - std::set& insertedNodes, - std::set& insertedConnections, - cmGeneratedFileStream& str) const; - ///! Find the full path to one of the cmake programs like ctest, cpack, etc. std::string FindCMakeProgram(const char* name) const; private: From 7ba2d365858d259572b22ab35ea6c709ba1514ea Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 14 Nov 2010 19:30:58 +0100 Subject: [PATCH 74/77] Enable/disable generating graphs depending on the target type In CMakeGraphVizOptions.cmake you can now set GRAPHVIZ_EXECUTABLES, GRAPHVIZ_STATIC_LIBS, GRAPHVIZ_SHARED_LIBS and GRAPHVIZ_MODULE_LIBS to TRUE or FALSE depending on whether you want graphs for the targets of the respective types. Alex --- Source/cmGraphVizWriter.cxx | 48 ++++++++++++++++++++++++++++++------- Source/cmGraphVizWriter.h | 8 +++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 749202b9a..b62badfbe 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -50,6 +50,10 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector& ,GraphName("GG") ,GraphHeader("node [\n fontsize = \"12\"\n];") ,GraphNodePrefix("node") +,GenerateForExecutables(true) +,GenerateForStaticLibs(true) +,GenerateForSharedLibs(true) +,GenerateForModuleLibs(true) ,LocalGenerators(localGenerators) { int cnt = collectAllTargets(); @@ -100,6 +104,20 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __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"); + this->TargetsToIgnore.clear(); const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); if ( ignoreTargets ) @@ -129,10 +147,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) continue; } - if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) - && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) { continue; } @@ -183,10 +198,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) continue; } - if ((ptrIt->second->GetType() != cmTarget::EXECUTABLE) - && (ptrIt->second->GetType() != cmTarget::STATIC_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::SHARED_LIBRARY) - && (ptrIt->second->GetType() != cmTarget::MODULE_LIBRARY)) + if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) { continue; } @@ -368,3 +380,23 @@ bool cmGraphVizWriter::IgnoreThisTarget(const char* name) const { 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 index fd3d3e20c..af8b71638 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" #include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" +#include "cmTarget.h" /** This class implements writing files for graphviz (dot) for graphs @@ -52,11 +53,18 @@ protected: bool IgnoreThisTarget(const char* name) const; + bool GenerateForTargetType(cmTarget::TargetType targetType) const; + cmStdString GraphType; cmStdString GraphName; cmStdString GraphHeader; cmStdString GraphNodePrefix; + bool GenerateForExecutables; + bool GenerateForStaticLibs; + bool GenerateForSharedLibs; + bool GenerateForModuleLibs; + const std::vector& LocalGenerators; std::map TargetPtrs; From 2a5790a080d86c63daf3d2c17d533c919cbef582 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 14 Nov 2010 19:33:12 +0100 Subject: [PATCH 75/77] Use std::cout instead of fprintf Alex --- Source/cmGraphVizWriter.cxx | 5 +++-- Source/cmGraphVizWriter.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index b62badfbe..94918a5e6 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -164,7 +164,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) return; } - fprintf(stderr, "Writing %s...\n", currentFilename.c_str()); + std::cout << "Writing " << currentFilename << "..." << std::endl; this->WriteHeader(str); this->WriteConnections(ptrIt->first.c_str(), @@ -184,7 +184,8 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) } this->WriteHeader(str); - fprintf(stderr, "Writing %s...\n", fileName); + std::cout << "Writing " << fileName << "..." << std::endl; + std::set insertedConnections; std::set insertedNodes; diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index af8b71638..c9e5fbdc4 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -65,14 +65,14 @@ protected: bool GenerateForSharedLibs; bool GenerateForModuleLibs; + std::set TargetsToIgnore; + const std::vector& LocalGenerators; std::map TargetPtrs; // maps from the actual target names to node names in dot: std::map TargetNamesNodes; - std::set TargetsToIgnore; - }; #endif From 5ea1e4cb36d813bcb1377637779a54f18411763b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 14 Nov 2010 19:37:03 +0100 Subject: [PATCH 76/77] Collect targets and libs on demand instead of in the ctor This is necessary for the next commit which requires that the targets are collected after the settings have been read. Alex --- Source/cmGraphVizWriter.cxx | 22 ++++++++++++++++++---- Source/cmGraphVizWriter.h | 10 ++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 94918a5e6..00befec3f 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -55,9 +55,8 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector& ,GenerateForSharedLibs(true) ,GenerateForModuleLibs(true) ,LocalGenerators(localGenerators) +,HaveTargetsAndLibs(false) { - int cnt = collectAllTargets(); - collectAllExternalLibs(cnt); } @@ -137,6 +136,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) { + this->CollectTargetsAndLibs(); + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); @@ -177,6 +178,8 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) void cmGraphVizWriter::WriteGlobalFile(const char* fileName) { + this->CollectTargetsAndLibs(); + cmGeneratedFileStream str(fileName); if ( !str ) { @@ -295,7 +298,18 @@ void cmGraphVizWriter::WriteNode(const char* targetName, } -int cmGraphVizWriter::collectAllTargets() +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 @@ -327,7 +341,7 @@ int cmGraphVizWriter::collectAllTargets() } -int cmGraphVizWriter::collectAllExternalLibs(int cnt) +int cmGraphVizWriter::CollectAllExternalLibs(int cnt) { // Ok, now find all the stuff we link to that is not in cmake for (std::vector::const_iterator lit = diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index c9e5fbdc4..88842a6f0 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmTarget.h" +#include /** This class implements writing files for graphviz (dot) for graphs @@ -34,9 +35,11 @@ public: protected: - int collectAllTargets(); + void CollectTargetsAndLibs(); - int collectAllExternalLibs(int cnt); + int CollectAllTargets(); + + int CollectAllExternalLibs(int cnt); void WriteHeader(cmGeneratedFileStream& str) const; @@ -65,6 +68,8 @@ protected: bool GenerateForSharedLibs; bool GenerateForModuleLibs; + cmsys::RegularExpression TargetIgnoreRegex; + std::set TargetsToIgnore; const std::vector& LocalGenerators; @@ -73,6 +78,7 @@ protected: // maps from the actual target names to node names in dot: std::map TargetNamesNodes; + bool HaveTargetsAndLibs; }; #endif From 78c86f454272a2ac417ad6a89e4c7ed7e4975adb Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 14 Nov 2010 19:47:28 +0100 Subject: [PATCH 77/77] Exclude targets from the graphviz file based on a regex This commit adds support for a GRAPHVIZ_TARGET_IGNORE_REGEX variable which can be set() in CMakeGraphVizOptions.cmake. Targets matching this regex will be skipped when generating the graphviz graphs. Alex --- Source/cmGraphVizWriter.cxx | 20 +++++++++++++++++++- Source/cmGraphVizWriter.h | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 00befec3f..bdb33bcdf 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -117,6 +117,17 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __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 ) @@ -391,8 +402,15 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) } -bool cmGraphVizWriter::IgnoreThisTarget(const char* name) const +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()); } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 88842a6f0..105eb9635 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -54,7 +54,7 @@ protected: void WriteFooter(cmGeneratedFileStream& str) const; - bool IgnoreThisTarget(const char* name) const; + bool IgnoreThisTarget(const char* name); bool GenerateForTargetType(cmTarget::TargetType targetType) const;