diff options
Diffstat (limited to 'Source')
32 files changed, 990 insertions, 508 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 71284b2..718e52e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -183,6 +183,8 @@ SET(SRCS cmGlobalUnixMakefileGenerator3.cxx cmGlobalUnixMakefileGenerator3.h cmGraphAdjacencyList.h + cmGraphVizWriter.cxx + cmGraphVizWriter.h cmInstallGenerator.h cmInstallGenerator.cxx cmInstallExportGenerator.cxx @@ -332,7 +334,7 @@ ENDIF (WIN32) # create a library used by the command line and the GUI ADD_LIBRARY(CMakeLib ${SRCS}) -TARGET_LINK_LIBRARIES(CMakeLib cmsys +TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ) @@ -432,7 +434,7 @@ IF(CYGWIN) CPack/cmCPackCygwinSourceGenerator.cxx ) ENDIF(CYGWIN) - + IF(UNIX) SET(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackDebGenerator.cxx diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index c86434e..ded329d 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -105,12 +105,12 @@ if (!archive) \ } //---------------------------------------------------------------------- -int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup) +int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { packageFileNames.clear(); // The default behavior is to have one package by component group // unless CPACK_COMPONENTS_IGNORE_GROUP is specified. - if (!ignoreComponentGroup) + if (!ignoreGroup) { std::map<std::string, cmCPackComponentGroup>::iterator compGIt; for (compGIt=this->ComponentGroups.begin(); @@ -170,7 +170,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup) } //---------------------------------------------------------------------- -int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne) +int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent) { // reset the package file names packageFileNames.clear(); @@ -185,7 +185,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne) DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); // The ALL GROUP in ONE package case - if (! allComponentInOne) { + if (! allComponent) { // iterate over the component groups std::map<std::string, cmCPackComponentGroup>::iterator compGIt; for (compGIt=this->ComponentGroups.begin(); @@ -226,78 +226,27 @@ int cmCPackArchiveGenerator::PackageFiles() cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); - // The default behavior is to create 1 package by component group - // unless the user asked to put all COMPONENTS in a single package - bool allGroupInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE"))); - bool allComponentInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))); - bool ignoreComponentGroup = ( NULL != - (this->GetOption( - "CPACK_COMPONENTS_IGNORE_GROUPS"))); + PrepareGroupingKind(); - std::string groupingType; - - // Second way to specify grouping - if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) { - groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING"); - } - - if (groupingType.length()>0) - { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" - << this->Name << "]" - << " requested component grouping = "<< groupingType <<std::endl); - if (groupingType == "ALL_GROUP_IN_ONE") - { - allGroupInOne = true; - } - else if (groupingType == "ALL_COMPONENT_IN_ONE") - { - allComponentInOne = true; - } - else if (groupingType == "IGNORE") + if (SupportsComponentInstallation()) { + // CASE 1 : COMPONENT ALL-IN-ONE package + // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested + // then the package file is unique and should be open here. + if (allComponentInOne || + (allGroupInOne && (!this->ComponentGroups.empty())) + ) { - ignoreComponentGroup = true; + return PackageComponentsAllInOne(allComponentInOne); } - else + // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) + // There will be 1 package for each component group + // however one may require to ignore component group and + // in this case you'll get 1 package for each component. + else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " requested component grouping type <"<< groupingType - << "> UNKNOWN not in (ALL_GROUP_IN_ONE," - "ALL_COMPONENT_IN_ONE,IGNORE)" <<std::endl); + return PackageComponents(ignoreComponentGroup); } - } - - // Some components were defined but NO group - // force ignoreGroups - if (this->ComponentGroups.empty() && (!this->Components.empty()) - && (!ignoreComponentGroup)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " Some Components defined but NO component group:" - << " Ignoring component group." - << std::endl); - ignoreComponentGroup = true; } - // CASE 1 : COMPONENT ALL-IN-ONE package - // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested - // then the package file is unique and should be open here. - if (allComponentInOne || (allGroupInOne && (!this->ComponentGroups.empty()))) - { - return PackageComponentsAllInOne(allComponentInOne); - } - // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) - // There will be 1 package for each component group - // however one may require to ignore component group and - // in this case you'll get 1 package for each component. - else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) - { - return PackageComponents(ignoreComponentGroup); - } // CASE 3 : NON COMPONENT package. DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); @@ -333,5 +282,15 @@ int cmCPackArchiveGenerator::GenerateHeader(std::ostream*) } bool cmCPackArchiveGenerator::SupportsComponentInstallation() const { - return true; + // The Component installation support should only + // be activated if explicitly requested by the user + // (for backward compatibility reason) + if (IsSet("CPACK_ARCHIVE_COMPONENT_INSTALL")) + { + return true; + } + else + { + return false; + } } diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 6e173bd..dc17257 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -60,12 +60,12 @@ protected: * install is used. This will create one * archive for each component group. */ - int PackageComponents(bool ignoreComponentGroup); + int PackageComponents(bool ignoreGroup); /** * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(bool allComponentInOne); + int PackageComponentsAllInOne(bool allComponent); virtual const char* GetOutputExtension() = 0; cmArchiveWrite::Compress Compress; cmArchiveWrite::Type Archive; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index c39aea4..92e5b6a 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -35,6 +35,9 @@ cmCPackGenerator::cmCPackGenerator() this->GeneratorVerbose = false; this->MakefileMap = 0; this->Logger = 0; + this->allGroupInOne = false; + this->allComponentInOne = false; + this->ignoreComponentGroup = false; } //---------------------------------------------------------------------- @@ -220,7 +223,7 @@ int cmCPackGenerator::InstallProject() // If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES // then glob it and copy it to CPACK_TEMPORARY_DIRECTORY - // This is used in Source packageing + // This is used in Source packaging if ( !this->InstallProjectViaInstalledDirectories( setDestDir, tempInstallDirectory) ) { @@ -691,7 +694,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // // If DESTDIR has been 'internally set ON' this means that // the underlying CPack specific generator did ask for that - // In this case we may overrode CPACK_INSTALL_PREFIX with + // In this case we may override CPACK_INSTALL_PREFIX with // CPACK_PACKAGING_INSTALL_PREFIX // I know this is tricky and awkward but it's the price for // CPACK_SET_DESTDIR backward compatibility. @@ -727,7 +730,20 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { dir = tempInstallDirectory + "/" + dir; } - + /* + * We must re-set DESTDIR for each component + * We must not add the CPACK_INSTALL_PREFIX part because + * it will be added using the override of CMAKE_INSTALL_PREFIX + * The main reason for this awkward trick is that + * are using DESTDIR for 2 different reasons: + * - Because it was asked by the CPack Generator or the user + * using CPACK_SET_DESTDIR + * - Because it was already used for component install + * in order to put things in subdirs... + */ + cmSystemTools::PutEnv( + (std::string("DESTDIR=")+tempInstallDirectory).c_str() + ); cmCPackLogger(cmCPackLog::LOG_DEBUG, "- Creating directory: '" << dir << "'" << std::endl); @@ -1196,6 +1212,70 @@ int cmCPackGenerator::CleanTemporaryDirectory() } //---------------------------------------------------------------------- +int cmCPackGenerator::PrepareGroupingKind() +{ + // The default behavior is to create 1 package by component group + // unless the user asked to put all COMPONENTS in a single package + allGroupInOne = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE"))); + allComponentInOne = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))); + ignoreComponentGroup = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_IGNORE_GROUPS"))); + + std::string groupingType; + + // Second way to specify grouping + if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) { + groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING"); + } + + if (groupingType.length()>0) + { + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" + << this->Name << "]" + << " requested component grouping = "<< groupingType <<std::endl); + if (groupingType == "ALL_GROUP_IN_ONE") + { + allGroupInOne = true; + } + else if (groupingType == "ALL_COMPONENT_IN_ONE") + { + allComponentInOne = true; + } + else if (groupingType == "IGNORE") + { + ignoreComponentGroup = true; + } + else + { + cmCPackLogger(cmCPackLog::LOG_WARNING, "[" + << this->Name << "]" + << " requested component grouping type <"<< groupingType + << "> UNKNOWN not in (ALL_GROUP_IN_ONE," + "ALL_COMPONENT_IN_ONE,IGNORE)" <<std::endl); + } + } + + // Some components were defined but NO group + // force ignoreGroups + if (this->ComponentGroups.empty() && (!this->Components.empty()) + && (!ignoreComponentGroup)) { + cmCPackLogger(cmCPackLog::LOG_WARNING, "[" + << this->Name << "]" + << " Some Components defined but NO component group:" + << " Ignoring component group." + << std::endl); + ignoreComponentGroup = true; + } + + return 1; +} + +//---------------------------------------------------------------------- bool cmCPackGenerator::SupportsComponentInstallation() const { return false; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 74b780d..c450763 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -120,6 +120,17 @@ protected: virtual const char* GetOutputPostfix() { return 0; } /** + * Prepare requested grouping kind from CPACK_xxx vars + * CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE + * CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE + * CPACK_COMPONENTS_IGNORE_GROUPS + * or + * CPACK_COMPONENTS_GROUPING + * @return 1 on success 0 on failure. + */ + virtual int PrepareGroupingKind(); + + /** * Package the list of files and/or components which * has been prepared by the beginning of DoPackage. * @pre @ref toplevel has been filled-in @@ -200,6 +211,20 @@ protected: */ std::map<std::string, cmCPackComponent> Components; std::map<std::string, cmCPackComponentGroup> ComponentGroups; + /** + * If true All component groups will be put in a single package. + */ + bool allGroupInOne; + /** + * If true All component will be put in a single package. + */ + bool allComponentInOne; + /** + * If true component grouping will be ignored. + * You will still get 1 package for each component unless + * allComponentInOne is true. + */ + bool ignoreComponentGroup; cmCPackLog* Logger; private: diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 0641418..34e93d3 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -37,13 +37,84 @@ int cmCPackRPMGenerator::InitializeInternal() //---------------------------------------------------------------------- int cmCPackRPMGenerator::PackageFiles() { - this->ReadListFile("CPackRPM.cmake"); + int retval = 1; + /* Digest Component grouping specification */ + retval = PrepareGroupingKind(); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " + << toplevel << std::endl); + + /* Are we in the component packaging case */ + if (SupportsComponentInstallation() & (!this->ComponentGroups.empty())) + { + /* Reset package file name list it will be populated during the + * component packaging run*/ + packageFileNames.clear(); + std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); + /* One Package per component CASE */ + /* Iterate over components */ + std::map<std::string, cmCPackComponent>::iterator compIt; + for (compIt=this->Components.begin(); + compIt!=this->Components.end(); ++compIt ) + { + std::string localToplevel(initialTopLevel); + std::string packageFileName( + cmSystemTools::GetParentDirectory(toplevel.c_str()) + ); + std::string outputFileName( + std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME") + ) + +"-"+compIt->first + this->GetOutputExtension()); + + localToplevel += "/"+ compIt->first; + /* replace the TEMP DIRECTORY with the component one */ + this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); + packageFileName += "/"+ outputFileName; + /* replace proposed CPACK_OUTPUT_FILE_NAME */ + this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); + /* replace the TEMPORARY package file name */ + this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", + packageFileName.c_str()); + + this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str()); + if (!this->ReadListFile("CPackRPM.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackRPM.cmake" << std::endl); + retval = 0; + } + + // add the generated package to package file names list + packageFileNames.push_back(packageFileName); + } + } + /* This is the non component case */ + else + { + if (!this->ReadListFile("CPackRPM.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackRPM.cmake" << std::endl); + retval = 0; + } + } + if (!this->IsSet("RPMBUILD_EXECUTABLE")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find rpmbuild" << std::endl); - return 0; + retval = 0; } - return 1; + return retval; } +bool cmCPackRPMGenerator::SupportsComponentInstallation() const + { + if (IsSet("CPACK_RPM_COMPONENT_INSTALL")) + { + return true; + } + else + { + return false; + } + } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 570e45f..57d5cca 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -39,6 +39,7 @@ protected: virtual int InitializeInternal(); virtual int PackageFiles(); virtual const char* GetOutputExtension() { return ".rpm"; } + virtual bool SupportsComponentInstallation() const; }; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 0d14c2d..93c2963 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -275,12 +275,6 @@ void cmCTestMultiProcessHandler::StartNextTests() } numToStart -= processors; } - else - { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl - << "Test did not start waiting on depends to finish: " - << *test << "\n"); - } if(numToStart == 0) { return; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 2aa6236..c8374db 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -93,14 +93,14 @@ bool cmCacheManager::LoadCache(const char* path, return this->LoadCache(path, internal, emptySet, emptySet); } -bool cmCacheManager::ParseEntry(const char* entry, - std::string& var, - std::string& value) +static bool ParseEntryWithoutType(const char* entry, + std::string& var, + std::string& value) { - // input line is: key:type=value + // input line is: key=value static cmsys::RegularExpression reg( - "^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key":type=value + "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); + // input line is: "key"=value static cmsys::RegularExpression regQuoted( "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); bool flag = false; @@ -169,6 +169,11 @@ bool cmCacheManager::ParseEntry(const char* entry, value.size() - 2); } + if (!flag) + { + return ParseEntryWithoutType(entry, var, value); + } + return flag; } @@ -336,7 +341,7 @@ bool cmCacheManager::LoadCache(const char* path, std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + - std::string(" where CMackeCache.txt was created. This may result " + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); cmSystemTools::Error(message.c_str()); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index da14966..314017b 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -139,10 +139,6 @@ public: std::string& value, CacheEntryType& type); - static bool ParseEntry(const char* entry, - std::string& var, - std::string& value); - ///! Get a value from the cache given a key const char* GetCacheValue(const char* key) const; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 1cabed2..d53200c 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -923,7 +923,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo() //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddLinkPrefix(const char* p) { - if(p) + if(p && *p) { this->LinkPrefixes.insert(p); } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 0416538..d0fe99f 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -164,6 +164,11 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) } } } + if(args.size() < 2 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } this->VariableName = args[0]; if(this->CheckForVariableInCache()) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 15abd02..ea091f9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -814,24 +814,11 @@ void cmGlobalGenerator::Generate() // For each existing cmLocalGenerator unsigned int i; - // Consolidate global targets + // Put a copy of each global target in every directory. cmTargets globalTargets; this->CreateDefaultGlobalTargets(&globalTargets); for (i = 0; i < this->LocalGenerators.size(); ++i) { - cmTargets* targets = - &(this->LocalGenerators[i]->GetMakefile()->GetTargets()); - cmTargets::iterator tarIt; - for ( tarIt = targets->begin(); tarIt != targets->end(); ++ tarIt ) - { - if ( tarIt->second.GetType() == cmTarget::GLOBAL_TARGET ) - { - globalTargets[tarIt->first] = tarIt->second; - } - } - } - for (i = 0; i < this->LocalGenerators.size(); ++i) - { cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; @@ -1881,8 +1868,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* name, const char* message, const cmCustomCommandLines* commandLines, std::vector<std::string> depends, - const char* workingDirectory, - bool depends_on_all /* = false */) + const char* workingDirectory) { // Package cmTarget target; @@ -1897,10 +1883,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( workingDirectory); target.GetPostBuildCommands().push_back(cc); target.SetProperty("EchoString", message); - if ( depends_on_all ) - { - target.AddUtility("all"); - } std::vector<std::string>::iterator dit; for ( dit = depends.begin(); dit != depends.end(); ++ dit ) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7e43124..6a1aa53 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -291,8 +291,7 @@ protected: void CreateDefaultGlobalTargets(cmTargets* targets); cmTarget CreateGlobalTarget(const char* name, const char* message, const cmCustomCommandLines* commandLines, - std::vector<std::string> depends, const char* workingDir, - bool depends_on_all = false); + std::vector<std::string> depends, const char* workingDir); bool NeedSymbolicMark; bool UseLinkScript; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 403507f..0b939af 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -19,6 +19,10 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() { this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; + std::string vc10Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" + "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } //---------------------------------------------------------------------------- @@ -63,6 +67,16 @@ void cmGlobalVisualStudio10Generator } //---------------------------------------------------------------------------- +const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() +{ + if(!this->PlatformToolset.empty()) + { + return this->PlatformToolset.c_str(); + } + return 0; +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory() { std::string base; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 219c36e..bef5642 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -54,6 +54,12 @@ public: cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); + /** Is the installed VS an Express edition? */ + bool IsExpressEdition() const { return this->ExpressEdition; } + + /** The toolset name for the target platform. */ + const char* GetPlatformToolset(); + /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual @@ -70,5 +76,9 @@ public: { return "$(Configuration)";} protected: virtual const char* GetIDEVersion() { return "10.0"; } + + std::string PlatformToolset; +private: + bool ExpressEdition; }; #endif diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx index 109b60d..8600777 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -36,3 +36,52 @@ void cmGlobalVisualStudio10Win64Generator mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf) +{ + if(!this->PlatformToolset.empty()) + { + return true; + } + // This edition does not come with 64-bit tools. Look for them. + // + // TODO: Detect available tools? x64\v100 exists but does not work? + // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath + // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/ + // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK} + std::string winSDK_7_1; + if(cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\" + "Windows\\v7.1;InstallationFolder", winSDK_7_1)) + { + cmOStringStream m; + m << "Found Windows SDK v7.1: " << winSDK_7_1; + mf->DisplayStatus(m.str().c_str(), -1); + this->PlatformToolset = "Windows7.1SDK"; + return true; + } + else + { + cmOStringStream e; + e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" + << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" + << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; + mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Win64Generator +::EnableLanguage(std::vector<std::string> const& languages, + cmMakefile* mf, bool optional) +{ + if(this->IsExpressEdition() && !this->Find64BitTools(mf)) + { + return; + } + this->cmGlobalVisualStudio10Generator + ::EnableLanguage(languages, mf, optional); +} diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h index 39c9d08..e6d3dc5 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.h +++ b/Source/cmGlobalVisualStudio10Win64Generator.h @@ -34,5 +34,8 @@ public: virtual void AddPlatformDefinitions(cmMakefile* mf); + bool Find64BitTools(cmMakefile* mf); + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); }; #endif diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 76d01e7..2d080df 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -289,6 +289,14 @@ cmGlobalVisualStudio8Generator } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() +{ + // Skip over the cmGlobalVisualStudioGenerator implementation! + // We do not need the support that VS <= 7.1 needs. + return this->cmGlobalGenerator::ComputeTargetDepends(); +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::WriteProjectDepends( std::ostream& fout, const char*, const char*, cmTarget& t) { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 95b6a17..e0913ed 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -78,6 +78,7 @@ protected: virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, bool partOfDefaultBuild); + virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx new file mode 100644 index 0000000..bdb33bc --- /dev/null +++ b/Source/cmGraphVizWriter.cxx @@ -0,0 +1,435 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGraphVizWriter.h" +#include "cmMakefile.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" +#include "cmGeneratedFileStream.h" + +#include <memory> + + + +static const char* getShapeForTarget(const cmTarget* target) +{ + if (!target) + { + return "ellipse"; + } + + switch ( target->GetType() ) + { + case cmTarget::EXECUTABLE: + return "house"; + case cmTarget::STATIC_LIBRARY: + return "diamond"; + case cmTarget::SHARED_LIBRARY: + return "polygon"; + case cmTarget::MODULE_LIBRARY: + return "octagon"; + default: + break; + } + + return "box"; +} + + +cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>& + localGenerators) +:GraphType("digraph") +,GraphName("GG") +,GraphHeader("node [\n fontsize = \"12\"\n];") +,GraphNodePrefix("node") +,GenerateForExecutables(true) +,GenerateForStaticLibs(true) +,GenerateForSharedLibs(true) +,GenerateForModuleLibs(true) +,LocalGenerators(localGenerators) +,HaveTargetsAndLibs(false) +{ +} + + +void cmGraphVizWriter::ReadSettings(const char* settingsFileName, + const char* fallbackSettingsFileName) +{ + cmake cm; + cmGlobalGenerator ggi; + ggi.SetCMakeInstance(&cm); + std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); + cmMakefile *mf = lg->GetMakefile(); + + const char* inFileName = settingsFileName; + + if ( !cmSystemTools::FileExists(inFileName) ) + { + inFileName = fallbackSettingsFileName; + if ( !cmSystemTools::FileExists(inFileName) ) + { + return; + } + } + + if ( !mf->ReadListFile(0, inFileName) ) + { + cmSystemTools::Error("Problem opening GraphViz options file: ", + inFileName); + return; + } + + std::cout << "Reading GraphViz options file: " << inFileName << std::endl; + +#define __set_if_set(var, cmakeDefinition) \ + { \ + const char* value = mf->GetDefinition(cmakeDefinition); \ + if ( value ) \ + { \ + var = value; \ + } \ + } + + __set_if_set(this->GraphType, "GRAPHVIZ_GRAPH_TYPE"); + __set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME"); + __set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER"); + __set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX"); + +#define __set_bool_if_set(var, cmakeDefinition) \ + { \ + const char* value = mf->GetDefinition(cmakeDefinition); \ + if ( value ) \ + { \ + var = mf->IsOn(cmakeDefinition); \ + } \ + } + + __set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES"); + __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS"); + __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS"); + __set_bool_if_set(this->GenerateForModuleLibs , "GRAPHVIZ_MODULE_LIBS"); + + cmStdString tmpRegexString; + __set_if_set(tmpRegexString, "GRAPHVIZ_TARGET_IGNORE_REGEX"); + if (tmpRegexString.size() > 0) + { + if (!this->TargetIgnoreRegex.compile(tmpRegexString.c_str())) + { + std::cerr << "Could not compile bad regex \"" << tmpRegexString << "\"" + << std::endl; + } + } + + this->TargetsToIgnore.clear(); + const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); + if ( ignoreTargets ) + { + std::vector<std::string> ignoreTargetsVector; + cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); + for(std::vector<std::string>::iterator itvIt = ignoreTargetsVector.begin(); + itvIt != ignoreTargetsVector.end(); + ++ itvIt ) + { + this->TargetsToIgnore.insert(itvIt->c_str()); + } + } + +} + + +void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) +{ + this->CollectTargetsAndLibs(); + + for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt = + this->TargetPtrs.begin(); + ptrIt != this->TargetPtrs.end(); + ++ptrIt) + { + if (ptrIt->second == NULL) + { + continue; + } + + if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) + { + continue; + } + + std::set<std::string> insertedConnections; + std::set<std::string> insertedNodes; + + std::string currentFilename = fileName; + currentFilename += "."; + currentFilename += ptrIt->first; + cmGeneratedFileStream str(currentFilename.c_str()); + if ( !str ) + { + return; + } + + std::cout << "Writing " << currentFilename << "..." << std::endl; + this->WriteHeader(str); + + this->WriteConnections(ptrIt->first.c_str(), + insertedNodes, insertedConnections, str); + this->WriteFooter(str); + } + +} + + +void cmGraphVizWriter::WriteGlobalFile(const char* fileName) +{ + this->CollectTargetsAndLibs(); + + cmGeneratedFileStream str(fileName); + if ( !str ) + { + return; + } + this->WriteHeader(str); + + std::cout << "Writing " << fileName << "..." << std::endl; + + std::set<std::string> insertedConnections; + std::set<std::string> insertedNodes; + + for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt = + this->TargetPtrs.begin(); + ptrIt != this->TargetPtrs.end(); + ++ptrIt) + { + if (ptrIt->second == NULL) + { + continue; + } + + if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) + { + continue; + } + + this->WriteConnections(ptrIt->first.c_str(), + insertedNodes, insertedConnections, str); + } + this->WriteFooter(str); +} + + +void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const +{ + str << this->GraphType << " " << this->GraphName << " {" << std::endl; + str << this->GraphHeader << std::endl; +} + + +void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const +{ + str << "}" << std::endl; +} + + +void cmGraphVizWriter::WriteConnections(const char* targetName, + std::set<std::string>& insertedNodes, + std::set<std::string>& insertedConnections, + cmGeneratedFileStream& str) const +{ + std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt = + this->TargetPtrs.find(targetName); + + if (targetPtrIt == this->TargetPtrs.end()) // not found at all + { + return; + } + + this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str); + + if (targetPtrIt->second == NULL) // it's an external library + { + return; + } + + + std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; + + const cmTarget::LinkLibraryVectorType* ll = + &(targetPtrIt->second->GetOriginalLinkLibraries()); + + for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); + llit != ll->end(); + ++ llit ) + { + const char* libName = llit->first.c_str(); + std::map<cmStdString, cmStdString>::const_iterator libNameIt = + this->TargetNamesNodes.find(libName); + + std::string connectionName = myNodeName; + connectionName += "-"; + connectionName += libNameIt->second; + if (insertedConnections.find(connectionName) == insertedConnections.end()) + { + insertedConnections.insert(connectionName); + this->WriteNode(libName, this->TargetPtrs.find(libName)->second, + insertedNodes, str); + + str << " \"" << myNodeName.c_str() << "\" -> \"" + << libNameIt->second.c_str() << "\""; + str << " // " << targetName << " -> " << libName << std::endl; + this->WriteConnections(libName, insertedNodes, insertedConnections, str); + } + } + +} + + +void cmGraphVizWriter::WriteNode(const char* targetName, + const cmTarget* target, + std::set<std::string>& insertedNodes, + cmGeneratedFileStream& str) const +{ + if (insertedNodes.find(targetName) == insertedNodes.end()) + { + insertedNodes.insert(targetName); + std::map<cmStdString, cmStdString>::const_iterator nameIt = + this->TargetNamesNodes.find(targetName); + + str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + << targetName << "\" shape=\"" << getShapeForTarget(target) + << "\"];" << std::endl; + } +} + + +void cmGraphVizWriter::CollectTargetsAndLibs() +{ + if (this->HaveTargetsAndLibs == false) + { + this->HaveTargetsAndLibs = true; + int cnt = this->CollectAllTargets(); + this->CollectAllExternalLibs(cnt); + } +} + + +int cmGraphVizWriter::CollectAllTargets() +{ + int cnt = 0; + // First pass get the list of all cmake targets + for (std::vector<cmLocalGenerator*>::const_iterator lit = + this->LocalGenerators.begin(); + lit != this->LocalGenerators.end(); + ++ lit ) + { + const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); + for ( cmTargets::const_iterator tit = targets->begin(); + tit != targets->end(); + ++ tit ) + { + const char* realTargetName = tit->first.c_str(); + if(this->IgnoreThisTarget(realTargetName)) + { + // Skip ignored targets + continue; + } + //std::cout << "Found target: " << tit->first.c_str() << std::endl; + cmOStringStream ostr; + ostr << this->GraphNodePrefix << cnt++; + this->TargetNamesNodes[realTargetName] = ostr.str(); + this->TargetPtrs[realTargetName] = &tit->second; + } + } + + return cnt; +} + + +int cmGraphVizWriter::CollectAllExternalLibs(int cnt) +{ + // Ok, now find all the stuff we link to that is not in cmake + for (std::vector<cmLocalGenerator*>::const_iterator lit = + this->LocalGenerators.begin(); + lit != this->LocalGenerators.end(); + ++ lit ) + { + const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); + for ( cmTargets::const_iterator tit = targets->begin(); + tit != targets->end(); + ++ tit ) + { + const char* realTargetName = tit->first.c_str(); + if (this->IgnoreThisTarget(realTargetName)) + { + // Skip ignored targets + continue; + } + const cmTarget::LinkLibraryVectorType* ll = + &(tit->second.GetOriginalLinkLibraries()); + for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); + llit != ll->end(); + ++ llit ) + { + const char* libName = llit->first.c_str(); + if (this->IgnoreThisTarget(libName)) + { + // Skip ignored targets + continue; + } + + std::map<cmStdString, const cmTarget*>::const_iterator tarIt = + this->TargetPtrs.find(libName); + if ( tarIt == this->TargetPtrs.end() ) + { + cmOStringStream ostr; + ostr << this->GraphNodePrefix << cnt++; + this->TargetNamesNodes[libName] = ostr.str(); + this->TargetPtrs[libName] = NULL; + //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName + //<< "\" shape=\"ellipse\"];" << std::endl; + } + } + } + } + return cnt; +} + + +bool cmGraphVizWriter::IgnoreThisTarget(const char* name) +{ + if (this->TargetIgnoreRegex.is_valid()) + { + if (this->TargetIgnoreRegex.find(name)) + { + return true; + } + } + return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end()); +} + + +bool cmGraphVizWriter::GenerateForTargetType(cmTarget::TargetType targetType) + const +{ + switch (targetType) + { + case cmTarget::EXECUTABLE: + return this->GenerateForExecutables; + case cmTarget::STATIC_LIBRARY: + return this->GenerateForStaticLibs; + case cmTarget::SHARED_LIBRARY: + return this->GenerateForSharedLibs; + case cmTarget::MODULE_LIBRARY: + return this->GenerateForModuleLibs; + default: + break; + } + return false; +} diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h new file mode 100644 index 0000000..105eb96 --- /dev/null +++ b/Source/cmGraphVizWriter.h @@ -0,0 +1,84 @@ +#ifndef CMGRAPHVIZWRITER_H +#define CMGRAPHVIZWRITER_H +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmStandardIncludes.h" +#include "cmLocalGenerator.h" +#include "cmGeneratedFileStream.h" +#include "cmTarget.h" +#include <cmsys/RegularExpression.hxx> + + +/** This class implements writing files for graphviz (dot) for graphs + * representing the dependencies between the targets in the project. */ +class cmGraphVizWriter +{ +public: + + cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators); + + void ReadSettings(const char* settingsFileName, + const char* fallbackSettingsFileName); + + void WritePerTargetFiles(const char* fileName); + + void WriteGlobalFile(const char* fileName); + +protected: + + void CollectTargetsAndLibs(); + + int CollectAllTargets(); + + int CollectAllExternalLibs(int cnt); + + void WriteHeader(cmGeneratedFileStream& str) const; + + void WriteConnections(const char* targetName, + std::set<std::string>& insertedNodes, + std::set<std::string>& insertedConnections, + cmGeneratedFileStream& str) const; + + void WriteNode(const char* targetName, const cmTarget* target, + std::set<std::string>& insertedNodes, + cmGeneratedFileStream& str) const; + + void WriteFooter(cmGeneratedFileStream& str) const; + + bool IgnoreThisTarget(const char* name); + + bool GenerateForTargetType(cmTarget::TargetType targetType) const; + + cmStdString GraphType; + cmStdString GraphName; + cmStdString GraphHeader; + cmStdString GraphNodePrefix; + + bool GenerateForExecutables; + bool GenerateForStaticLibs; + bool GenerateForSharedLibs; + bool GenerateForModuleLibs; + + cmsys::RegularExpression TargetIgnoreRegex; + + std::set<cmStdString> TargetsToIgnore; + + const std::vector<cmLocalGenerator*>& LocalGenerators; + + std::map<cmStdString, const cmTarget*> TargetPtrs; + // maps from the actual target names to node names in dot: + std::map<cmStdString, cmStdString> TargetNamesNodes; + + bool HaveTargetsAndLibs; +}; + +#endif diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index d2a07dc..a239e55 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -174,7 +174,8 @@ void cmLoadCacheCommand::CheckLine(const char* line) // Check one line of the cache file. std::string var; std::string value; - if(this->ParseEntry(line, var, value)) + cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + if(cmCacheManager::ParseEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if(this->VariablesToRead.find(var) != this->VariablesToRead.end()) @@ -193,38 +194,3 @@ void cmLoadCacheCommand::CheckLine(const char* line) } } } - -//---------------------------------------------------------------------------- -bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var, - std::string& value) -{ - // input line is: key:type=value - cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); - // input line is: "key":type=value - cmsys::RegularExpression - regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); - bool flag = false; - if(regQuoted.find(entry)) - { - var = regQuoted.match(1); - value = regQuoted.match(3); - flag = true; - } - else if (reg.find(entry)) - { - var = reg.match(1); - value = reg.match(3); - flag = true; - } - - // if value is enclosed in single quotes ('foo') then remove them - // it is used to enclose trailing space or tab - if (flag && - value.size() >= 2 && - value[0] == '\'' && - value[value.size() - 1] == '\'') - { - value = value.substr(1, value.size() - 2); - } - return flag; -} diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index b06d94d..8ecee4a 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -83,7 +83,6 @@ protected: bool ReadWithPrefix(std::vector<std::string> const& args); void CheckLine(const char* line); - bool ParseEntry(const char* entry, std::string& var, std::string& value); }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 56e0ed9..9983e5d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3590,6 +3590,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name) return imported->second; } + // Look for a target built in this directory. + if(cmTarget* t = this->FindTarget(name)) + { + return t; + } + // Look for a target built in this project. return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6b290ab..969cfdb 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -849,7 +849,7 @@ cmMakefileTargetGenerator p_depends.push_back(relativeObj); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, temp.c_str(), p_depends, no_commands, - true); + false); } //---------------------------------------------------------------------------- diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 524be8b..8e55a0f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -244,6 +244,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); @@ -291,6 +293,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); } + if(const char* toolset = gg->GetPlatformToolset()) + { + std::string pts = "<PlatformToolset>"; + pts += toolset; + pts += "</PlatformToolset>\n"; + this->WriteString(pts.c_str(), 2); + } this->WriteString("</PropertyGroup>\n", 1); } } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2ebd165..ddfdc24 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -26,6 +26,7 @@ #include "cmDocumentationFormatterText.h" #if defined(CMAKE_BUILD_WITH_CMAKE) +# include "cmGraphVizWriter.h" # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. # include "cmVariableWatch.h" # include <cmsys/Terminal.h> @@ -169,7 +170,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", @@ -362,8 +363,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } std::string var, value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) || - cmCacheManager::ParseEntry(entry.c_str(), var, value)) + if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type)) { this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(), "No help, variable specified on the command line.", type); @@ -382,7 +382,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) this->DoSuppressDevWarnings = true; } else if(arg.find("-Wdev",0) == 0) - { + { this->SuppressDevWarnings = false; this->DoSuppressDevWarnings = true; } @@ -406,7 +406,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector<std::string> entriesToDelete; - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = this->CacheManager->GetCacheIterator(); for ( it.Begin(); !it.IsAtEnd(); it.Next() ) { @@ -422,8 +422,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } // now remove them from the cache - for(std::vector<std::string>::const_iterator currentEntry = - entriesToDelete.begin(); + for(std::vector<std::string>::const_iterator currentEntry = + entriesToDelete.begin(); currentEntry != entriesToDelete.end(); ++currentEntry) { @@ -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<std::string>& 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<std::string>& args) } return 0; } - + // Command to create a symbolic link. Fails on platforms not // supporting them. else if (args[1] == "create_symlink" && args.size() == 4) @@ -1410,7 +1410,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) // Use the make system's VERBOSE environment variable to enable // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE // (which is set by the Eclipse and KDevelop generators). - bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) + bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0)); // Create a cmake object instance to process dependencies. @@ -1635,14 +1635,14 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } -void cmake::AddExtraGenerator(const char* name, +void cmake::AddExtraGenerator(const char* name, CreateExtraGeneratorFunctionType newFunction) { cmExternalMakefileProjectGenerator* extraGenerator = newFunction(); const std::vector<std::string>& supportedGlobalGenerators = extraGenerator->GetSupportedGlobalGenerators(); - for(std::vector<std::string>::const_iterator + for(std::vector<std::string>::const_iterator it = supportedGlobalGenerators.begin(); it != supportedGlobalGenerators.end(); ++it ) @@ -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<std::string>& names) { names.push_back(i->first); } - for(RegisteredExtraGeneratorsMap::const_iterator + for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { @@ -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<SaveCacheEntry> saved; cmOStringStream warning; - warning + warning << "You have changed variables that require your cache to be deleted.\n" << "Configure will be re-run and you may have to reset some variables.\n" << "The following variables have changed:\n"; for(std::vector<std::string>::iterator i = argsSplit.begin(); i != argsSplit.end(); ++i) - { + { SaveCacheEntry save; save.key = *i; warning << *i << "= "; @@ -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<std::string>& 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<cmDocumentationEntry>& v, - bool withCurrentCommands, +void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v, + bool withCurrentCommands, bool withCompatCommands) const { for(RegisteredCommandsMap::const_iterator j = this->Commands.begin(); @@ -2457,7 +2457,7 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v, { continue; } - + cmDocumentationEntry e((*j).second->GetName(), (*j).second->GetTerseDocumentation(), (*j).second->GetFullDocumentation()); @@ -2493,7 +2493,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) delete generator; v.push_back(e); } - for(RegisteredExtraGeneratorsMap::const_iterator + for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { cmDocumentationEntry e; @@ -2508,7 +2508,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: - const char* tablepath = + const char* tablepath = this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) @@ -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()); } @@ -2835,253 +2835,27 @@ const char* cmake::GetCPackCommand() return this->CPackCommand.c_str(); } + void cmake::GenerateGraphViz(const char* fileName) const { - cmGeneratedFileStream str(fileName); - if ( !str ) - { - return; - } - cmake cm; - cmGlobalGenerator ggi; - ggi.SetCMakeInstance(&cm); - std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); - cmMakefile *mf = lg->GetMakefile(); - - std::string infile = this->GetHomeOutputDirectory(); - infile += "/CMakeGraphVizOptions.cmake"; - if ( !cmSystemTools::FileExists(infile.c_str()) ) - { - infile = this->GetHomeDirectory(); - infile += "/CMakeGraphVizOptions.cmake"; - if ( !cmSystemTools::FileExists(infile.c_str()) ) - { - infile = ""; - } - } - - if ( !infile.empty() ) - { - if ( !mf->ReadListFile(0, infile.c_str()) ) - { - cmSystemTools::Error("Problem opening GraphViz options file: ", - infile.c_str()); - return; - } - std::cout << "Read GraphViz options file: " << infile.c_str() - << std::endl; - } - -#define __set_if_not_set(var, value, cmakeDefinition) \ - const char* var = mf->GetDefinition(cmakeDefinition); \ - if ( !var ) \ - { \ - var = value; \ - } - __set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE"); - __set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME"); - __set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];", - "GRAPHVIZ_GRAPH_HEADER"); - __set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX"); - const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); - std::set<cmStdString> ignoreTargetsSet; - if ( ignoreTargets ) - { - std::vector<std::string> ignoreTargetsVector; - cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); - std::vector<std::string>::iterator itvIt; - for ( itvIt = ignoreTargetsVector.begin(); - itvIt != ignoreTargetsVector.end(); - ++ itvIt ) - { - ignoreTargetsSet.insert(itvIt->c_str()); - } - } - - str << graphType << " " << graphName << " {" << std::endl; - str << graphHeader << std::endl; - - const cmGlobalGenerator* gg = this->GetGlobalGenerator(); - const std::vector<cmLocalGenerator*>& localGenerators = - gg->GetLocalGenerators(); - std::vector<cmLocalGenerator*>::const_iterator lit; - // for target deps - // 1 - cmake target - // 2 - external target - // 0 - no deps - std::map<cmStdString, int> targetDeps; - std::map<cmStdString, const cmTarget*> targetPtrs; - std::map<cmStdString, cmStdString> targetNamesNodes; - int cnt = 0; - // First pass get the list of all cmake targets - for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit ) - { - const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); - cmTargets::const_iterator tit; - for ( tit = targets->begin(); tit != targets->end(); ++ tit ) - { - const char* realTargetName = tit->first.c_str(); - if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) - { - // Skip ignored targets - continue; - } - //std::cout << "Found target: " << tit->first.c_str() << std::endl; - cmOStringStream ostr; - ostr << graphNodePrefix << cnt++; - targetNamesNodes[realTargetName] = ostr.str(); - targetPtrs[realTargetName] = &tit->second; - } - } - // Ok, now find all the stuff we link to that is not in cmake - for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit ) - { - const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); - cmTargets::const_iterator tit; - for ( tit = targets->begin(); tit != targets->end(); ++ tit ) - { - const cmTarget::LinkLibraryVectorType* ll - = &(tit->second.GetOriginalLinkLibraries()); - cmTarget::LinkLibraryVectorType::const_iterator llit; - const char* realTargetName = tit->first.c_str(); - if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) - { - // Skip ignored targets - continue; - } - if ( ll->size() > 0 ) - { - targetDeps[realTargetName] = 1; - } - for ( llit = ll->begin(); llit != ll->end(); ++ llit ) - { - const char* libName = llit->first.c_str(); - std::map<cmStdString, cmStdString>::const_iterator tarIt - = targetNamesNodes.find(libName); - if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() ) - { - // Skip ignored targets - continue; - } - if ( tarIt == targetNamesNodes.end() ) - { - cmOStringStream ostr; - ostr << graphNodePrefix << cnt++; - targetDeps[libName] = 2; - targetNamesNodes[libName] = ostr.str(); - //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName - //<< "\" shape=\"ellipse\"];" << std::endl; - } - else - { - std::map<cmStdString, int>::const_iterator depIt - = targetDeps.find(libName); - if ( depIt == targetDeps.end() ) - { - targetDeps[libName] = 1; - } - } - } - } - } +#ifdef CMAKE_BUILD_WITH_CMAKE + std::auto_ptr<cmGraphVizWriter> gvWriter( + new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); - // Write out nodes - std::map<cmStdString, int>::const_iterator depIt; - for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt ) - { - const char* newTargetName = depIt->first.c_str(); - std::map<cmStdString, cmStdString>::const_iterator tarIt - = targetNamesNodes.find(newTargetName); - if ( tarIt == targetNamesNodes.end() ) - { - // We should not be here. - std::cout << __LINE__ << " Cannot find library: " << newTargetName - << " even though it was added in the previous pass" << std::endl; - abort(); - } + std::string settingsFile = this->GetHomeOutputDirectory(); + settingsFile += "/CMakeGraphVizOptions.cmake"; + std::string fallbackSettingsFile = this->GetHomeDirectory(); + fallbackSettingsFile += "/CMakeGraphVizOptions.cmake"; - str << " \"" << tarIt->second.c_str() << "\" [ label=\"" - << newTargetName << "\" shape=\""; - if ( depIt->second == 1 ) - { - std::map<cmStdString, const cmTarget*>::const_iterator tarTypeIt = - targetPtrs.find(newTargetName); - if ( tarTypeIt == targetPtrs.end() ) - { - // We should not be here. - std::cout << __LINE__ << " Cannot find library: " << newTargetName - << " even though it was added in the previous pass" << std::endl; - abort(); - } - const cmTarget* tg = tarTypeIt->second; - switch ( tg->GetType() ) - { - case cmTarget::EXECUTABLE: - str << "house"; - break; - case cmTarget::STATIC_LIBRARY: - str << "diamond"; - break; - case cmTarget::SHARED_LIBRARY: - str << "polygon"; - break; - case cmTarget::MODULE_LIBRARY: - str << "octagon"; - break; - default: - str << "box"; - } - } - else - { - str << "ellipse"; - } - str << "\"];" << std::endl; - } + gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str()); - // Now generate the connectivity - for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit ) - { - const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); - cmTargets::const_iterator tit; - for ( tit = targets->begin(); tit != targets->end(); ++ tit ) - { - std::map<cmStdString, int>::iterator dependIt - = targetDeps.find(tit->first.c_str()); - if ( dependIt == targetDeps.end() ) - { - continue; - } - std::map<cmStdString, cmStdString>::iterator cmakeTarIt - = targetNamesNodes.find(tit->first.c_str()); - const cmTarget::LinkLibraryVectorType* ll - = &(tit->second.GetOriginalLinkLibraries()); - cmTarget::LinkLibraryVectorType::const_iterator llit; - for ( llit = ll->begin(); llit != ll->end(); ++ llit ) - { - const char* libName = llit->first.c_str(); - std::map<cmStdString, cmStdString>::const_iterator tarIt - = targetNamesNodes.find(libName); - if ( tarIt == targetNamesNodes.end() ) - { - // We should not be here. - std::cout << __LINE__ << " Cannot find library: " << libName - << " even though it was added in the previous pass" << std::endl; - abort(); - } - str << " \"" << cmakeTarIt->second.c_str() << "\" -> \"" - << tarIt->second.c_str() << "\"" << std::endl; - } - } - } + gvWriter->WritePerTargetFiles(fileName); + gvWriter->WriteGlobalFile(fileName); - // TODO: Use dotted or something for external libraries - //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]" - //<< std::endl; - // - str << "}" << std::endl; +#endif } + //---------------------------------------------------------------------------- int cmake::SymlinkLibrary(std::vector<std::string>& args) { @@ -3336,7 +3110,7 @@ int cmake::ExecuteLinkScript(std::vector<std::string>& args) void cmake::DefineProperties(cmake *cm) { cm->DefineProperty - ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL, + ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL, "If set, report any undefined properties to this file.", "If this property is set to a filename then when CMake runs " "it will report any properties or variables that were accessed " @@ -3344,7 +3118,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 +3155,7 @@ void cmake::DefineProperties(cmake *cm) "this list.This property is used by the macros in FeatureSummary.cmake."); cm->DefineProperty ("DISABLED_FEATURES", cmProperty::GLOBAL, - "List of features which are disabled during the CMake run.", + "List of features which are disabled during the CMake run.", "List of features which are disabled during the CMake run. Be default " "it contains the names of all packages which were not found. This is " "determined using the <NAME>_FOUND variables. Packages which are " @@ -3531,13 +3305,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 +3321,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 +3393,13 @@ void cmake::ReportUndefinedPropertyAccesses(const char *filename) { if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) && aliasedProperties.find(std::pair<cmStdString,cmProperty::ScopeType> - (ap->first,ap->second)) == + (ap->first,ap->second)) == aliasedProperties.end()) { const char *scopeStr = ""; switch (ap->second) { - case cmProperty::TARGET: + case cmProperty::TARGET: scopeStr = "TARGET"; break; case cmProperty::SOURCE_FILE: @@ -3727,7 +3501,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 +3609,14 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) // we have to find the module directory, so we can copy the files this->AddCMakePaths(); - std::string modulesPath = + std::string modulesPath = this->CacheManager->GetCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; std::string outFile = destPath; outFile += "/CMakeLists.txt"; - + // Copy file if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) { @@ -3850,7 +3624,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) << "\" to \"" << outFile.c_str() << "\".\n"; return 1; } - + // do we write to a file or to stdout? if (resultFile.size() == 0) { @@ -3876,7 +3650,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) // change back to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); - + // echo results to stdout if needed if (writeToStdout) { @@ -3897,7 +3671,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) fclose(fin); } } - + // clean up the directory cmSystemTools::RemoveADirectory(destPath.c_str()); return 0; @@ -4016,7 +3790,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type) for(std::vector<std::string>::iterator i = args.begin(); i != args.end(); ++i) { - // check for nmake temporary files + // check for nmake temporary files if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) { std::ifstream fin(i->substr(1).c_str()); @@ -4069,7 +3843,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type) type, hasManifest, verbose); } -int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args, +int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args, std::vector<cmStdString>& command, std::string& targetName) { @@ -4120,7 +3894,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 +3915,12 @@ bool cmake::RunCommand(const char* comment, return retCode == 0; } -int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, +int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, int type, bool verbose) { // This follows the steps listed here: // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx - + // 1. Compiler compiles the application and generates the *.obj files. // 2. An empty manifest file is generated if this is a clean build and if // not the previous one is reused. @@ -4158,10 +3932,10 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, // on. // 5. The manifest tool (mt.exe) is then used to generate the final // manifest. - + // If the final manifest is changed, then 6 and 7 are run, if not // they are skipped, and it is done. - + // 6. The resource compiler is invoked one more time. // 7. Finally, the Linker does another incremental link, but since the // only thing that has changed is the *.res file that contains the @@ -4220,7 +3994,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, outputOpt += resourceFile; rcCommand.push_back(outputOpt); rcCommand.push_back(resourceInputFile); - // Run rc command to create resource + // Run rc command to create resource if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose)) { return -1; @@ -4230,7 +4004,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args, { return -1; } - // create mt command + // create mt command std::string outArg("/out:"); outArg+= manifestFile; mtCommand.push_back("/nologo"); @@ -4281,7 +4055,7 @@ int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args, { return -1; } - // Run the link command as given + // Run the link command as given linkCommand.push_back("/MANIFEST"); if(!cmake::RunCommand("LINK", linkCommand, verbose)) { @@ -4472,7 +4246,7 @@ int cmake::Build(const std::string& dir, makeProgram = it.GetValue(); return gen->Build(0, dir.c_str(), projName.c_str(), target.c_str(), - &output, + &output, makeProgram.c_str(), config.c_str(), clean, false, 0, true, 0, nativeOptions); diff --git a/Source/cmake.h b/Source/cmake.h index 8312795..435d38b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -21,14 +21,14 @@ // command line arguments. // 3) Load the cache by calling LoadCache (duh) // 4) if you are using command line arguments with -D or -C flags then -// call SetCacheArgs (or if for some other reason you want to modify the +// call SetCacheArgs (or if for some other reason you want to modify the // cache, do it now. // 5) Finally call Configure // 6) Let the user change values and go back to step 5 // 7) call Generate // // If your GUI allows the user to change the start & home directories then -// you must at a minimum redo steps 2 through 7. +// you must at a minimum redo steps 2 through 7. // @@ -50,6 +50,8 @@ class cmExternalMakefileProjectGenerator; class cmDocumentationSection; class cmPolicies; class cmListFileBacktrace; +class cmTarget; +class cmGeneratedFileStream; class cmake { @@ -73,14 +75,14 @@ class cmake static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; static const char *GetCMakeFilesDirectoryPostSlash() { return "CMakeFiles/";}; - + //@{ /** * Set/Get the home directory (or output directory) in the project. The * home directory is the top directory of the project. It is where * cmake was run. Remember that CMake processes * CMakeLists files by recursing up the tree starting at the StartDirectory - * and going up until it reaches the HomeDirectory. + * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const char* dir); const char* GetHomeDirectory() const @@ -100,9 +102,9 @@ class cmake * is the directory of the CMakeLists.txt file that started the current * round of processing. Remember that CMake processes CMakeLists files by * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. + * it reaches the HomeDirectory. */ - void SetStartDirectory(const char* dir) + void SetStartDirectory(const char* dir) { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); @@ -158,7 +160,7 @@ class cmake ///! Return the global generator assigned to this instance of cmake cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } ///! Return the global generator assigned to this instance of cmake, const - const cmGlobalGenerator* GetGlobalGenerator() const + const cmGlobalGenerator* GetGlobalGenerator() const { return this->GlobalGenerator; } ///! Return the global generator assigned to this instance of cmake @@ -169,25 +171,25 @@ class cmake ///! get the cmCachemManager used by this invocation of cmake cmCacheManager *GetCacheManager() { return this->CacheManager; } - + ///! set the cmake command this instance of cmake should use void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; } - + /** * Given a variable name, return its value (as a string). */ const char* GetCacheDefinition(const char*) const; ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, - const char* helpString, + void AddCacheEntry(const char* key, const char* value, + const char* helpString, int type); - /** + /** * Execute commands during the build process. Supports options such * as echo, remove file etc. */ static int ExecuteCMakeCommand(std::vector<std::string>&); - /** + /** * Get the system information and write it to the file specified */ int GetSystemInformation(std::vector<std::string>&); @@ -210,16 +212,16 @@ class cmake /** Check if a command exists. */ bool CommandExists(const char* name) const; - + ///! Parse command line arguments void SetArgs(const std::vector<std::string>&); ///! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() { return this->InTryCompile; } - + ///! Is this cmake running as a result of a TRY_COMPILE command void SetIsInTryCompile(bool i) { this->InTryCompile = i; } - + ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector<std::string>&); @@ -227,9 +229,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 +246,14 @@ class cmake cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } /** Get the documentation entries for the supported commands. - * If withCurrentCommands is true, the documentation for the + * If withCurrentCommands is true, the documentation for the * recommended set of commands is included. * If withCompatCommands is true, the documentation for discouraged * (compatibility) commands is included. * You probably don't want to set both to false. */ - void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries, - bool withCurrentCommands = true, + void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries, + bool withCurrentCommands = true, bool withCompatCommands = true) const; void GetPropertiesDocumentation(std::map<std::string, cmDocumentationSection *>&); @@ -278,7 +280,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 +312,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 +340,7 @@ class cmake } void SetSuppressDevWarnings(bool v) { - this->SuppressDevWarnings = v; + this->SuppressDevWarnings = v; this->DoSuppressDevWarnings = true; } @@ -357,10 +359,10 @@ protected: cmPropertyMap Properties; std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties; - std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> + std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; - typedef + typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map<cmStdString, CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap; @@ -374,15 +376,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 +395,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 +418,24 @@ protected: static int ExecuteLinkScript(std::vector<std::string>& args); static int VisualStudioLink(std::vector<std::string>& args, int type); static int VisualStudioLinkIncremental(std::vector<std::string>& args, - int type, + int type, bool verbose); static int VisualStudioLinkNonIncremental(std::vector<std::string>& args, int type, bool hasManifest, bool verbose); - static int ParseVisualStudioLinkCommand(std::vector<std::string>& args, - std::vector<cmStdString>& command, + static int ParseVisualStudioLinkCommand(std::vector<std::string>& args, + std::vector<cmStdString>& command, std::string& targetName); static bool RunCommand(const char* comment, std::vector<cmStdString>& command, bool verbose, int* retCodeOut = 0); cmVariableWatch* VariableWatch; - + ///! Find the full path to one of the cmake programs like ctest, cpack, etc. std::string FindCMakeProgram(const char* name) const; -private: +private: cmake(const cmake&); // Not implemented. void operator=(const cmake&); // Not implemented. ProgressCallbackType ProgressCallback; @@ -458,7 +460,7 @@ private: cmFileTimeComparison* FileComparison; std::string GraphVizFile; std::vector<std::string> DebugConfigs; - + void UpdateConversionPathTable(); }; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index bcc7a96..a35a01f 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -61,6 +61,8 @@ # If not given the install rules # will not be in any component. # +# KWSYS_INSTALL_EXPORT_NAME = The EXPORT option value for install(TARGETS) calls. +# # Example: # # SET(KWSYS_INSTALL_BIN_DIR bin) @@ -236,6 +238,9 @@ IF(COMMAND INSTALL) # Setup library install rules. SET(KWSYS_INSTALL_LIBRARY_RULE) IF(KWSYS_INSTALL_LIB_DIR) + IF(KWSYS_INSTALL_EXPORT_NAME) + LIST(APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${KWSYS_INSTALL_EXPORT_NAME}) + ENDIF() # Install the shared library to the lib directory. SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE} LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR} diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8aa99eb..7638e4a 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -378,9 +378,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start); if(endpos != kwsys_stl::string::npos) { - kwsys_stl::string convertedPath; - Realpath(pathEnv.substr(start, endpos-start).c_str(), convertedPath); - path.push_back(convertedPath); + path.push_back(pathEnv.substr(start, endpos-start)); start = endpos+1; } else diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f25048a..7a9d2ca 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 11) +SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 19) +SET(KWSYS_DATE_STAMP_DAY 14) |