summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx436
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h46
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackGenerator.cxx91
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackTGZGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.cxx4
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackZIPGenerator.cxx4
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx42
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx9
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx14
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h5
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx176
-rw-r--r--Source/cmCTest.cxx10
-rw-r--r--Source/cmCTest.h3
-rw-r--r--Source/cmComputeComponentGraph.cxx13
-rw-r--r--Source/cmComputeComponentGraph.h3
-rw-r--r--Source/cmComputeLinkDepends.cxx23
-rw-r--r--Source/cmComputeLinkDepends.h1
-rw-r--r--Source/cmComputeTargetDepends.cxx149
-rw-r--r--Source/cmComputeTargetDepends.h11
-rw-r--r--Source/cmELF.cxx3
-rw-r--r--Source/cmExportCommand.cxx12
-rw-r--r--Source/cmFileCommand.cxx103
-rw-r--r--Source/cmFindPackageCommand.cxx157
-rw-r--r--Source/cmFindPackageCommand.h6
-rw-r--r--Source/cmGlobalGenerator.cxx72
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx99
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx99
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx233
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx26
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h7
-rw-r--r--Source/cmGlobalVisualStudio8Win64Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio8Win64Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio9Win64Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio9Win64Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx208
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h19
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx24
-rw-r--r--Source/cmGraphAdjacencyList.h22
-rw-r--r--Source/cmInstallCommand.h1
-rw-r--r--Source/cmInstallGenerator.cxx20
-rw-r--r--Source/cmLocalGenerator.cxx38
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx11
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx17
-rw-r--r--Source/cmMakefile.cxx36
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx7
-rw-r--r--Source/cmOptionCommand.h5
-rw-r--r--Source/cmPolicies.cxx55
-rw-r--r--Source/cmPolicies.h7
-rw-r--r--Source/cmSourceFile.cxx15
-rw-r--r--Source/cmSourceFile.h4
-rw-r--r--Source/cmSystemTools.cxx32
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmTarget.cxx51
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx63
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx83
-rw-r--r--Source/cmXCodeObject.cxx2
-rw-r--r--Source/cmake.cxx35
-rw-r--r--Source/ctest.cxx5
-rw-r--r--Source/kwsys/MD5.c9
-rw-r--r--Source/kwsys/SystemTools.cxx23
-rw-r--r--Source/kwsys/SystemTools.hxx.in6
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
77 files changed, 1778 insertions, 963 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 8799330..c86434e 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -22,11 +22,12 @@
#include <errno.h>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Directory.hxx>
#include <cm_libarchive.h>
//----------------------------------------------------------------------
-cmCPackArchiveGenerator::cmCPackArchiveGenerator(CompressType t,
- ArchiveType at)
+cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
+ cmArchiveWrite::Type at)
{
this->Compress = t;
this->Archive = at;
@@ -37,222 +38,291 @@ cmCPackArchiveGenerator::~cmCPackArchiveGenerator()
{
}
-static const size_t cmCPackTGZ_Data_BlockSize = 16384;
-
-// make this an anonymous namespace so that archive.h does not
-// have to be included in the .h file for this class
-namespace
+//----------------------------------------------------------------------
+int cmCPackArchiveGenerator::InitializeInternal()
{
-bool SetArchiveType(struct archive* a,
- cmCPackArchiveGenerator::CompressType ct,
- cmCPackArchiveGenerator::ArchiveType at)
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
+ return this->Superclass::InitializeInternal();
+}
+//----------------------------------------------------------------------
+int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
+ cmCPackComponent* component)
{
- int res = 0;
- // pick the archive type
- switch(at)
- {
- case cmCPackArchiveGenerator::TAR:
- // maybe this:
- res = archive_write_set_format_pax_restricted(a);
- break;
- case cmCPackArchiveGenerator::ZIP:
- res = archive_write_set_format_zip(a);
- break;
- }
- if(res != ARCHIVE_OK)
- {
- return false;
- }
-
- // pick a compression type
- switch(ct)
- {
- case cmCPackArchiveGenerator::GZIP:
- res = archive_write_set_compression_gzip(a);
- break;
- case cmCPackArchiveGenerator::BZIP2:
- res = archive_write_set_compression_bzip2(a);
- break;
- case cmCPackArchiveGenerator::COMPRESS:
- res = archive_write_set_compression_compress(a);
- break;
- case cmCPackArchiveGenerator::LZMA:
- res = archive_write_set_compression_lzma(a);
- break;
- case cmCPackArchiveGenerator::NONE:
- default:
- res = archive_write_set_compression_none(a);
- }
- if(res != ARCHIVE_OK)
- {
- return false;
- }
- // do not pad the last block!!
- res = archive_write_set_bytes_in_last_block(a, 1);
- if(res != ARCHIVE_OK)
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, " - packaging component: "
+ << component->Name
+ << std::endl);
+ // Add the files of this component to the archive
+ std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
+ localToplevel += "/"+ component->Name;
+ std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
+ // Change to local toplevel
+ cmSystemTools::ChangeDirectory(localToplevel.c_str());
+ std::vector<std::string>::const_iterator fileIt;
+ for (fileIt = component->Files.begin(); fileIt != component->Files.end();
+ ++fileIt )
{
- return false;
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: "
+ << (*fileIt) << std::endl);
+ archive.Add(*fileIt);
+ if (!archive)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
+ << archive.GetError()
+ << std::endl);
+ return 0;
+ }
}
-
- return true;
+ // Go back to previous dir
+ cmSystemTools::ChangeDirectory(dir.c_str());
+ return 1;
}
-
-struct StreamData
-{
- StreamData(cmGeneratedFileStream* gfs,
- cmCPackArchiveGenerator* ag)
- {
- this->GeneratedFileStream = gfs;
- this->Generator = ag;
- }
- cmGeneratedFileStream* GeneratedFileStream;
- cmCPackArchiveGenerator* Generator;
-};
+/*
+ * The macro will open/create a file 'filename'
+ * an declare and open the associated
+ * cmArchiveWrite 'archive' object.
+ */
+#define DECLARE_AND_OPEN_ARCHIVE(filename,archive) \
+cmGeneratedFileStream gf; \
+gf.Open(filename.c_str(), false, true); \
+if (!GenerateHeader(&gf)) \
+ { \
+ cmCPackLogger(cmCPackLog::LOG_ERROR, \
+ "Problem to generate Header for archive < " \
+ << filename \
+ << ">." << std::endl); \
+ return 0; \
+ } \
+cmArchiveWrite archive(gf,this->Compress, this->Archive); \
+if (!archive) \
+ { \
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
+ << filename \
+ << ">. ERROR =" \
+ << archive.GetError() \
+ << std::endl); \
+ return 0; \
+ }
-extern "C"
-{
-int OpenArchive(struct archive *, void *client_data)
+//----------------------------------------------------------------------
+int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup)
{
- struct StreamData *data = (StreamData*)client_data;
- if(data->GeneratedFileStream &&
- *data->GeneratedFileStream)
+ packageFileNames.clear();
+ // The default behavior is to have one package by component group
+ // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
+ if (!ignoreComponentGroup)
{
- if(data->Generator->
- GenerateHeader(data->GeneratedFileStream))
+ std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
+ for (compGIt=this->ComponentGroups.begin();
+ compGIt!=this->ComponentGroups.end(); ++compGIt)
+ {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
+ << compGIt->first
+ << std::endl);
+ // Begin the archive for this group
+ std::string packageFileName= std::string(toplevel);
+ packageFileName += "/"
+ +std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+ +"-"+compGIt->first + this->GetOutputExtension();
+ // open a block in order to automatically close archive
+ // at the end of the block
{
- return ARCHIVE_OK;
+ DECLARE_AND_OPEN_ARCHIVE(packageFileName,archive);
+ // now iterate over the component of this group
+ std::vector<cmCPackComponent*>::iterator compIt;
+ for (compIt=(compGIt->second).Components.begin();
+ compIt!=(compGIt->second).Components.end();
+ ++compIt)
+ {
+ // Add the files of this component to the archive
+ addOneComponentToArchive(archive,*compIt);
+ }
+ }
+ // add the generated package to package file names list
+ packageFileNames.push_back(packageFileName);
}
}
- return (ARCHIVE_FATAL);
-}
-
-__LA_SSIZE_T WriteArchive(struct archive *,
- void *client_data,
- const void *buff,
- size_t n)
-{
- struct StreamData *data = (StreamData*)client_data;
- data->GeneratedFileStream->
- write(reinterpret_cast<const char*>(buff),n);
- if(!data->GeneratedFileStream->bad())
+ // CPACK_COMPONENTS_IGNORE_GROUPS is set
+ // We build 1 package per component
+ else
{
- return n;
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt=this->Components.begin();
+ compIt!=this->Components.end(); ++compIt )
+ {
+ std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
+ std::string packageFileName = std::string(toplevel);
+
+ localToplevel += "/"+ compIt->first;
+ packageFileName += "/"
+ +std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+ +"-"+compIt->first + this->GetOutputExtension();
+ {
+ DECLARE_AND_OPEN_ARCHIVE(packageFileName,archive);
+ // Add the files of this component to the archive
+ addOneComponentToArchive(archive,&(compIt->second));
+ }
+ // add the generated package to package file names list
+ packageFileNames.push_back(packageFileName);
+ }
}
- return 0;
+ return 1;
}
-
-int CloseArchive(struct archive *, void *client_data)
+//----------------------------------------------------------------------
+int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne)
{
- struct StreamData *data = (StreamData*)client_data;
- if(data->GeneratedFileStream->Close())
+ // reset the package file names
+ packageFileNames.clear();
+ packageFileNames.push_back(std::string(toplevel));
+ packageFileNames[0] += "/"
+ +std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME"))
+ +"-ALL" + this->GetOutputExtension();
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Packaging all groups in one package..."
+ "(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE is set)"
+ << std::endl);
+ DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive);
+
+ // The ALL GROUP in ONE package case
+ if (! allComponentInOne) {
+ // iterate over the component groups
+ std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
+ for (compGIt=this->ComponentGroups.begin();
+ compGIt!=this->ComponentGroups.end(); ++compGIt)
+ {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
+ << compGIt->first
+ << std::endl);
+ // now iterate over the component of this group
+ std::vector<cmCPackComponent*>::iterator compIt;
+ for (compIt=(compGIt->second).Components.begin();
+ compIt!=(compGIt->second).Components.end();
+ ++compIt)
+ {
+ // Add the files of this component to the archive
+ addOneComponentToArchive(archive,*compIt);
+ }
+ }
+ }
+ // The ALL COMPONENT in ONE package case
+ else
{
- delete data->GeneratedFileStream;
- return ARCHIVE_OK;
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt=this->Components.begin();compIt!=this->Components.end();
+ ++compIt )
+ {
+ // Add the files of this component to the archive
+ addOneComponentToArchive(archive,&(compIt->second));
+ }
}
- return ARCHIVE_FATAL;
+ // archive goes out of scope so it will finalized and closed.
+ return 1;
}
-} //extern C
-} // anon name space
-
//----------------------------------------------------------------------
-int cmCPackArchiveGenerator::InitializeInternal()
-{
- this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
- return this->Superclass::InitializeInternal();
-}
-
int cmCPackArchiveGenerator::PackageFiles()
{
- int res = ARCHIVE_OK;
-#define CHECK_ARCHIVE_ERROR(res, msg) \
- if(res != ARCHIVE_OK) \
- {\
- cmCPackLogger(cmCPackLog::LOG_ERROR, msg \
- << archive_error_string(a) \
- << cmSystemTools::GetLastSystemError() \
- << " " << res \
- << "\n"); \
- }
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< toplevel << std::endl);
- // create a new archive
- struct archive* a = archive_write_new();
- // Set the compress and archive types for the archive
- SetArchiveType(a, this->Compress, this->Archive);
- // Open binary stream
- cmGeneratedFileStream* gf = new cmGeneratedFileStream;
- gf->Open(packageFileNames[0].c_str(), false, true);
- StreamData data(gf, this);
- // pass callbacks to archive_write_open to handle stream
- res = archive_write_open(a,
- &data,
- OpenArchive,
- WriteArchive,
- CloseArchive);
- CHECK_ARCHIVE_ERROR(res, "archive_write_open:");
- // create a new disk struct
- struct archive* disk = archive_read_disk_new();
-#if !defined(_WIN32) || defined(__CYGWIN__)
- res = archive_read_disk_set_standard_lookup(disk);
-#endif
- CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:");
+ // 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")));
+
+ 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;
+ }
+ // 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);
std::vector<std::string>::const_iterator fileIt;
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(toplevel.c_str());
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
- // create a new entry for each file
- struct archive_entry *entry = archive_entry_new();
// Get the relative path to the file
- std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str());
- // Set the name of the entry to the file name
- archive_entry_set_pathname(entry, rp.c_str());
- res = archive_read_disk_entry_from_file(disk, entry, -1, 0);
- CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:");
- // write entry header
- res = archive_write_header(a, entry);
- CHECK_ARCHIVE_ERROR(res, "archive_write_header:");
- // the entry size can be 0 if it is a symlink
- if(archive_entry_size(entry) > 0)
+ std::string rp = cmSystemTools::RelativePath(toplevel.c_str(),
+ fileIt->c_str());
+ archive.Add(rp);
+ if(!archive)
{
- // now copy contents of file into archive a
- FILE* file = fopen(fileIt->c_str(), "rb");
- if(!file)
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): "
- << fileIt->c_str()
- << strerror(errno)
- << std::endl);
- return 0;
- }
- char buff[cmCPackTGZ_Data_BlockSize];
- size_t len = fread(buff, 1, sizeof(buff), file);
- while (len > 0)
- {
- size_t wlen = archive_write_data(a, buff, len);
- if(wlen != len)
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "archive_write_data(): "
- << "tried to write " << len << "\n"
- << "write " << wlen << "\n");
- return 0;
- }
- len = fread(buff, 1, sizeof(buff), file);
- }
- // close the file and free the entry
- fclose(file);
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
+ << *fileIt
+ << "> to archive <"
+ << packageFileNames[0] << "> .ERROR ="
+ << archive.GetError()
+ << std::endl);
+ return 0;
}
- archive_entry_free(entry);
}
cmSystemTools::ChangeDirectory(dir.c_str());
- // close the archive and finish the write
- archive_write_close(a);
- archive_write_finish(a);
- archive_read_finish(disk);
+ // The destructor of cmArchiveWrite will close and finish the write
return 1;
}
@@ -261,3 +331,7 @@ int cmCPackArchiveGenerator::GenerateHeader(std::ostream*)
{
return 1;
}
+
+bool cmCPackArchiveGenerator::SupportsComponentInstallation() const {
+ return true;
+}
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index d3409ae..6e173bd 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -13,34 +13,62 @@
#ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h
+#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
/** \class cmCPackArchiveGenerator
- * \brief A generator base for libarchive generation
+ * \brief A generator base for libarchive generation.
+ * The generator itself uses the libarchive wrapper
+ * \ref cmArchiveWrite.
*
*/
class cmCPackArchiveGenerator : public cmCPackGenerator
-{
+ {
public:
- enum CompressType{ GZIP, BZIP2, COMPRESS, LZMA, NONE};
- enum ArchiveType{ TAR, ZIP};
cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator);
/**
* Construct generator
*/
- cmCPackArchiveGenerator(CompressType, ArchiveType);
+ cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type);
virtual ~cmCPackArchiveGenerator();
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
-
+ // component support
+ virtual bool SupportsComponentInstallation() const;
protected:
virtual int InitializeInternal();
+ /**
+ * Add the files belonging to the specified component
+ * to the provided (already opened) archive.
+ * @param[in,out] archive the archive object
+ * @param[in] component the component whose file will be added to archive
+ */
+ int addOneComponentToArchive(cmArchiveWrite& archive,
+ cmCPackComponent* component);
+
+ /**
+ * The main package file method.
+ * If component install was required this
+ * method will call either PackageComponents or
+ * PackageComponentsAllInOne.
+ */
int PackageFiles();
+ /**
+ * The method used to package files when component
+ * install is used. This will create one
+ * archive for each component group.
+ */
+ int PackageComponents(bool ignoreComponentGroup);
+ /**
+ * Special case of component install where all
+ * components will be put in a single installer.
+ */
+ int PackageComponentsAllInOne(bool allComponentInOne);
virtual const char* GetOutputExtension() = 0;
- CompressType Compress;
- ArchiveType Archive;
-};
+ cmArchiveWrite::Compress Compress;
+ cmArchiveWrite::Type Archive;
+ };
#endif
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index f4ae35f..5979729 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -59,7 +59,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// skip one parent up to the cmCPackTarBZip2Generator
// to create tar.bz2 file with the list of source
// files
- this->Compress = BZIP2;
+ this->Compress = cmArchiveWrite::CompressBZip2;
if ( !this->cmCPackTarBZip2Generator::PackageFiles() )
{
return 0;
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 58c6dc3..ac2e151 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -43,7 +43,10 @@ cmCPackDebGenerator::~cmCPackDebGenerator()
int cmCPackDebGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
-
+ if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_SET_DESTDIR", "I_ON");
+ }
return this->Superclass::InitializeInternal();
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4ae2d1f..c39aea4 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -171,7 +171,9 @@ int cmCPackGenerator::InstallProject()
std::string bareTempInstallDirectory
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
std::string tempInstallDirectoryStr = bareTempInstallDirectory;
- bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"));
+ bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"))
+ | cmSystemTools::IsInternallyOn(
+ this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir)
{
tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
@@ -329,6 +331,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
it != installDirectoriesVector.end();
++it )
{
+ std::list<std::pair<std::string,std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = it->c_str();
@@ -372,7 +375,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
+ cmSystemTools::RelativePath(top.c_str(), gfit->c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
- if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
+ /* If the file is a symlink we will have to re-create it */
+ if ( cmSystemTools::FileIsSymlink(inFile.c_str()))
+ {
+ std::string targetFile;
+ std::string inFileRelative =
+ cmSystemTools::RelativePath(top.c_str(),inFile.c_str());
+ cmSystemTools::ReadSymlink(inFile.c_str(),targetFile);
+ symlinkedFiles.push_back(std::pair<std::string,
+ std::string>(targetFile,inFileRelative));
+ }
+ /* If it is not a symlink then do a plain copy */
+ else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
filePath.c_str()) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: "
@@ -380,6 +394,36 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
}
+ /* rebuild symlinks in the installed tree */
+ if (symlinkedFiles.size()>0)
+ {
+ std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
+ std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string goToDir = tempDir;
+ goToDir += "/"+subdir;
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Change dir to: " << goToDir <<std::endl);
+ cmSystemTools::ChangeDirectory(goToDir.c_str());
+ for (symlinkedIt=symlinkedFiles.begin();
+ symlinkedIt != symlinkedFiles.end();
+ ++symlinkedIt)
+ {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first << std::endl);
+ if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(),
+ (symlinkedIt->second).c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first << std::endl);
+ return 0;
+ }
+ }
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: "
+ << curDir <<std::endl);
+ cmSystemTools::ChangeDirectory(curDir.c_str());
+ }
}
}
return 1;
@@ -414,7 +458,8 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
// underneath the tempInstallDirectory. The value of the project's
// CMAKE_INSTALL_PREFIX is sent in here as the value of the
// CPACK_INSTALL_PREFIX variable.
- std::string dir;
+
+ std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX"))
{
dir += this->GetOption("CPACK_INSTALL_PREFIX");
@@ -459,6 +504,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
const char* cmakeGenerator
= this->GetOption("CPACK_CMAKE_GENERATOR");
+ std::string absoluteDestFiles;
if ( cmakeProjects && *cmakeProjects )
{
if ( !cmakeGenerator )
@@ -643,6 +689,18 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// value of the project's CMAKE_INSTALL_PREFIX is sent in here as
// the value of the CPACK_INSTALL_PREFIX variable.
//
+ // 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
+ // CPACK_PACKAGING_INSTALL_PREFIX
+ // I know this is tricky and awkward but it's the price for
+ // CPACK_SET_DESTDIR backward compatibility.
+ if (cmSystemTools::IsInternallyOn(
+ this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_INSTALL_PREFIX",
+ this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"));
+ }
std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX"))
{
@@ -723,6 +781,16 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
}
int res = mf->ReadListFile(0, installFile.c_str());
+ if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (absoluteDestFiles.length()>0) {
+ absoluteDestFiles +=";";
+ }
+ absoluteDestFiles +=
+ mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Got some ABSOLUTE DESTINATION FILES: "
+ << absoluteDestFiles << std::endl);
+ }
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
{
return 0;
@@ -730,6 +798,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
}
}
+ this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",
+ absoluteDestFiles.c_str());
return 1;
}
@@ -828,8 +898,8 @@ int cmCPackGenerator::DoPackage()
return 0;
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Compress package" << std::endl);
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress files to: "
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Package files to: "
<< (tempPackageFileName ? tempPackageFileName : "(NULL)") << std::endl);
if ( cmSystemTools::FileExists(tempPackageFileName) )
{
@@ -853,8 +923,12 @@ int cmCPackGenerator::DoPackage()
std::vector<std::string>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++ it )
{
- std::string fileN = cmSystemTools::RelativePath(tempDirectory,
- it->c_str());
+ // beware we cannot just use tempDirectory as before
+ // because some generator will "CPACK_INCLUDE_TOPLEVEL_DIRECTORY"
+ // we really want "CPACK_TEMPORARY_DIRECTORY"
+ std::string fileN =
+ cmSystemTools::RelativePath(
+ this->GetOption("CPACK_TEMPORARY_DIRECTORY"), it->c_str());
// Determine which component we are in.
std::string componentName = fileN.substr(0, fileN.find('/'));
@@ -864,6 +938,9 @@ int cmCPackGenerator::DoPackage()
// Add this file to the list of files for the component.
this->Components[componentName].Files.push_back(fileN);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
+ <<fileN<<"> to component <"
+ <<componentName<<">"<<std::endl);
}
}
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index f6f9fbc..d0eda81 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -93,7 +93,8 @@ int cmCPackNSISGenerator::PackageFiles()
for ( sit = dirs.begin(); sit != dirs.end(); ++ sit )
{
std::string componentName;
- std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(), sit->c_str());
+ std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(),
+ sit->c_str());
if ( fileN.empty() )
{
continue;
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 01b6b06..0641418 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmCPackRPMGenerator.h"
#include "cmCPackLog.h"
+#include "cmSystemTools.h"
//----------------------------------------------------------------------
cmCPackRPMGenerator::cmCPackRPMGenerator()
@@ -26,7 +27,10 @@ cmCPackRPMGenerator::~cmCPackRPMGenerator()
int cmCPackRPMGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
-
+ if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_SET_DESTDIR", "I_ON");
+ }
return this->Superclass::InitializeInternal();
}
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx
index c6ef8ae..509c7f8 100644
--- a/Source/CPack/cmCPackTGZGenerator.cxx
+++ b/Source/CPack/cmCPackTGZGenerator.cxx
@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackTGZGenerator::cmCPackTGZGenerator()
- :cmCPackArchiveGenerator(cmCPackArchiveGenerator::GZIP,
- cmCPackArchiveGenerator::TAR)
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip,
+ cmArchiveWrite::TypeTAR)
{
}
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
index 52826dc..971d166 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ b/Source/CPack/cmCPackTarBZip2Generator.cxx
@@ -13,8 +13,8 @@
#include "cmCPackTarBZip2Generator.h"
//----------------------------------------------------------------------
cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
- :cmCPackArchiveGenerator(cmCPackArchiveGenerator::BZIP2,
- cmCPackArchiveGenerator::TAR)
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2,
+ cmArchiveWrite::TypeTAR)
{
}
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx
index e9b5e2e..7a8f697 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.cxx
+++ b/Source/CPack/cmCPackTarCompressGenerator.cxx
@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
- :cmCPackArchiveGenerator(cmCPackArchiveGenerator::COMPRESS,
- cmCPackArchiveGenerator::TAR)
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress,
+ cmArchiveWrite::TypeTAR)
{
}
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx
index e195f83..e6e4e77 100644
--- a/Source/CPack/cmCPackZIPGenerator.cxx
+++ b/Source/CPack/cmCPackZIPGenerator.cxx
@@ -14,8 +14,8 @@
//----------------------------------------------------------------------
cmCPackZIPGenerator::cmCPackZIPGenerator()
- :cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE,
- cmCPackArchiveGenerator::ZIP)
+ :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
+ cmArchiveWrite::TypeZIP)
{
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index d50eaaa..0d14c2d 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -516,11 +516,13 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
int count = 0;
+
for (PropertiesMap::iterator it = this->Properties.begin();
it != this->Properties.end(); ++it)
{
count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+
//push working dir
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(p.Directory.c_str());
@@ -530,6 +532,20 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode
+ if(p.Labels.size()) //print the labels
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
+ }
+ for(std::vector<std::string>::iterator label = p.Labels.begin();
+ label != p.Labels.end(); ++label)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
+ }
+ if(p.Labels.size()) //print the labels
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
+ }
+
if (this->TestHandler->MemCheck)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check");
@@ -548,10 +564,36 @@ void cmCTestMultiProcessHandler::PrintTestList()
//pop working dir
cmSystemTools::ChangeDirectory(current_dir.c_str());
}
+
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl);
}
+void cmCTestMultiProcessHandler::PrintLabels()
+{
+ std::set<std::string> allLabels;
+ for (PropertiesMap::iterator it = this->Properties.begin();
+ it != this->Properties.end(); ++it)
+ {
+ cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+ allLabels.insert(p.Labels.begin(), p.Labels.end());
+ }
+
+ if(allLabels.size())
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl);
+ }
+ for(std::set<std::string>::iterator label = allLabels.begin();
+ label != allLabels.end(); ++label)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl);
+ }
+}
+
//---------------------------------------------------------
void cmCTestMultiProcessHandler::CheckResume()
{
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index cc330f7..1483440 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -39,6 +39,7 @@ public:
void SetParallelLevel(size_t);
virtual void RunTests();
void PrintTestList();
+ void PrintLabels();
void SetPassFailVectors(std::vector<cmStdString>* passed,
std::vector<cmStdString>* failed)
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index a4a4863..6dd348d 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -567,7 +567,7 @@ int cmCTestTestHandler::ProcessHandler()
if (total == 0)
{
- if ( !this->CTest->GetShowOnly() )
+ if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!"
<< std::endl);
@@ -1079,7 +1079,12 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
parallel->SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
parallel->SetTestResults(&this->TestResults);
- if(this->CTest->GetShowOnly())
+
+ if(this->CTest->ShouldPrintLabels())
+ {
+ parallel->PrintLabels();
+ }
+ else if(this->CTest->GetShowOnly())
{
parallel->PrintTestList();
}
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 389ec7f..7f3e360 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -902,7 +902,7 @@ void cmCursesMainForm::HandleInput()
this->SearchMode = false;
if ( this->SearchString.size() > 0 )
{
- this->JumpToCacheEntry(-1, this->SearchString.c_str());
+ this->JumpToCacheEntry(this->SearchString.c_str());
this->OldSearchString = this->SearchString;
}
this->SearchString = "";
@@ -1076,7 +1076,7 @@ void cmCursesMainForm::HandleInput()
{
if ( this->OldSearchString.size() > 0 )
{
- this->JumpToCacheEntry(-1, this->OldSearchString.c_str());
+ this->JumpToCacheEntry(this->OldSearchString.c_str());
}
}
// switch advanced on/off
@@ -1191,7 +1191,7 @@ int cmCursesMainForm::LoadCache(const char *)
return r;
}
-void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
+void cmCursesMainForm::JumpToCacheEntry(const char* astr)
{
std::string str;
if ( astr )
@@ -1199,18 +1199,14 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
str = cmSystemTools::LowerCase(astr);
}
- if ( size_t(idx) > this->NumberOfVisibleEntries )
- {
- return;
- }
- if ( idx < 0 && str.size() == 0)
+ if(str.empty())
{
return;
}
FIELD* cur = current_field(this->Form);
int start_index = field_index(cur);
int findex = start_index;
- while ( (findex / 3) != idx )
+ for(;;)
{
if ( str.size() > 0 )
{
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 4084415..3e191b4 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -122,9 +122,8 @@ protected:
// Remove an entry from the interface and the cache.
void RemoveEntry(const char* value);
- // Jump to the cache value with index idx. If string str is
- // specified, it will stop on widget that contain that string.
- void JumpToCacheEntry(int idx, const char* str);
+ // Jump to the cache entry whose name matches the string.
+ void JumpToCacheEntry(const char* str);
// Copies of cache entries stored in the user interface
std::vector<cmCursesCacheEntryComposite*>* Entries;
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 663753e..779c14e 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -34,7 +34,7 @@
#include "FirstConfigure.h"
#include "cmVersion.h"
-QCMakeThread::QCMakeThread(QObject* p)
+QCMakeThread::QCMakeThread(QObject* p)
: QThread(p), CMakeInstance(NULL)
{
}
@@ -76,7 +76,7 @@ CMakeSetupDialog::CMakeSetupDialog()
this->ProgressBar->reset();
this->RemoveEntry->setEnabled(false);
this->AddEntry->setEnabled(false);
-
+
QByteArray p = settings.value("SplitterSizes").toByteArray();
this->Splitter->restoreState(p);
@@ -84,35 +84,39 @@ CMakeSetupDialog::CMakeSetupDialog()
this->setGroupedView(groupView);
this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked);
+ bool advancedView = settings.value("AdvancedView", false).toBool();
+ this->setAdvancedView(advancedView);
+ this->advancedCheck->setCheckState(advancedView?Qt::Checked : Qt::Unchecked);
+
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
- QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)),
this, SLOT(doReloadCache()));
this->DeleteCacheAction = FileMenu->addAction(tr("&Delete Cache"));
- QObject::connect(this->DeleteCacheAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->DeleteCacheAction, SIGNAL(triggered(bool)),
this, SLOT(doDeleteCache()));
this->ExitAction = FileMenu->addAction(tr("E&xit"));
- QObject::connect(this->ExitAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->ExitAction, SIGNAL(triggered(bool)),
this, SLOT(close()));
QMenu* ToolsMenu = this->menuBar()->addMenu(tr("&Tools"));
this->ConfigureAction = ToolsMenu->addAction(tr("&Configure"));
// prevent merging with Preferences menu item on Mac OS X
this->ConfigureAction->setMenuRole(QAction::NoRole);
- QObject::connect(this->ConfigureAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->ConfigureAction, SIGNAL(triggered(bool)),
this, SLOT(doConfigure()));
this->GenerateAction = ToolsMenu->addAction(tr("&Generate"));
- QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
this, SLOT(doGenerate()));
QAction* showChangesAction = ToolsMenu->addAction(tr("&Show My Changes"));
- QObject::connect(showChangesAction, SIGNAL(triggered(bool)),
+ QObject::connect(showChangesAction, SIGNAL(triggered(bool)),
this, SLOT(showUserChanges()));
#if defined(Q_WS_MAC)
- this->InstallForCommandLineAction
+ this->InstallForCommandLineAction
= ToolsMenu->addAction(tr("&Install For Command Line Use"));
- QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)),
this, SLOT(doInstallForCommandLine()));
-#endif
+#endif
QMenu* OptionsMenu = this->menuBar()->addMenu(tr("&Options"));
this->SuppressDevWarningsAction =
OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)"));
@@ -126,15 +130,15 @@ CMakeSetupDialog::CMakeSetupDialog()
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
debugAction->setCheckable(true);
- QObject::connect(debugAction, SIGNAL(toggled(bool)),
+ QObject::connect(debugAction, SIGNAL(toggled(bool)),
this, SLOT(setDebugOutput(bool)));
-
+
OptionsMenu->addSeparator();
QAction* expandAction = OptionsMenu->addAction(tr("&Expand Grouped Entries"));
- QObject::connect(expandAction, SIGNAL(triggered(bool)),
+ QObject::connect(expandAction, SIGNAL(triggered(bool)),
this->CacheValues, SLOT(expandAll()));
QAction* collapseAction = OptionsMenu->addAction(tr("&Collapse Grouped Entries"));
- QObject::connect(collapseAction, SIGNAL(triggered(bool)),
+ QObject::connect(collapseAction, SIGNAL(triggered(bool)),
this->CacheValues, SLOT(collapseAll()));
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
@@ -144,17 +148,17 @@ CMakeSetupDialog::CMakeSetupDialog()
a = HelpMenu->addAction(tr("Help"));
QObject::connect(a, SIGNAL(triggered(bool)),
this, SLOT(doHelp()));
-
+
QShortcut* filterShortcut = new QShortcut(QKeySequence::Find, this);
- QObject::connect(filterShortcut, SIGNAL(activated()),
+ QObject::connect(filterShortcut, SIGNAL(activated()),
this, SLOT(startSearch()));
-
+
this->setAcceptDrops(true);
-
+
// get the saved binary directories
QStringList buildPaths = this->loadBuildPaths();
this->BinaryDirectory->addItems(buildPaths);
-
+
this->BinaryDirectory->setCompleter(new QCMakeFileCompleter(this, true));
this->SourceDirectory->setCompleter(new QCMakeFileCompleter(this, true));
@@ -166,23 +170,23 @@ CMakeSetupDialog::CMakeSetupDialog()
// start the cmake worker thread
this->CMakeThread = new QCMakeThread(this);
QObject::connect(this->CMakeThread, SIGNAL(cmakeInitialized()),
- this, SLOT(initialize()), Qt::QueuedConnection);
+ this, SLOT(initialize()), Qt::QueuedConnection);
this->CMakeThread->start();
-
+
this->enterState(ReadyConfigure);
}
void CMakeSetupDialog::initialize()
{
// now the cmake worker thread is running, lets make our connections to it
- QObject::connect(this->CMakeThread->cmakeInstance(),
+ QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(propertiesChanged(const QCMakePropertyList&)),
this->CacheValues->cacheModel(),
SLOT(setProperties(const QCMakePropertyList&)));
QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)),
this, SLOT(doConfigure()));
- QObject::connect(this->CMakeThread->cmakeInstance(),
+ QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(configureDone(int)),
this, SLOT(finishConfigure(int)));
QObject::connect(this->CMakeThread->cmakeInstance(),
@@ -191,12 +195,12 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
this, SLOT(doGenerate()));
-
+
QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
this, SLOT(doSourceBrowse()));
QObject::connect(this->BrowseBinaryDirectoryButton, SIGNAL(clicked(bool)),
this, SLOT(doBinaryBrowse()));
-
+
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
this, SLOT(onBinaryDirectoryChanged(QString)));
QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
@@ -208,11 +212,11 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(binaryDirChanged(QString)),
this, SLOT(updateBinaryDirectory(QString)));
-
+
QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(progressChanged(QString, float)),
this, SLOT(showProgress(QString,float)));
-
+
QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(errorMessage(QString)),
this, SLOT(error(QString)));
@@ -225,35 +229,36 @@ void CMakeSetupDialog::initialize()
this, SLOT(setGroupedView(bool)));
QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)),
this, SLOT(setAdvancedView(bool)));
- QObject::connect(this->Search, SIGNAL(textChanged(QString)),
+ QObject::connect(this->Search, SIGNAL(textChanged(QString)),
this, SLOT(setSearchFilter(QString)));
-
+
QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(generatorChanged(QString)),
this, SLOT(updateGeneratorLabel(QString)));
this->updateGeneratorLabel(QString());
-
+
QObject::connect(this->CacheValues->cacheModel(),
- SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(setCacheModified()));
-
+
QObject::connect(this->CacheValues->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged()));
- QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
+ QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
this, SLOT(removeSelectedCacheEntries()));
- QObject::connect(this->AddEntry, SIGNAL(clicked(bool)),
+ QObject::connect(this->AddEntry, SIGNAL(clicked(bool)),
this, SLOT(addCacheEntry()));
- QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
+ QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
+
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
SLOT(setWarnUninitializedMode(bool)));
QObject::connect(this->WarnUnusedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
SLOT(setWarnUnusedMode(bool)));
-
+
if(!this->SourceDirectory->text().isEmpty() ||
!this->BinaryDirectory->lineEdit()->text().isEmpty())
{
@@ -278,7 +283,7 @@ CMakeSetupDialog::~CMakeSetupDialog()
this->CMakeThread->quit();
this->CMakeThread->wait(2000);
}
-
+
void CMakeSetupDialog::doConfigure()
{
if(this->CurrentState == Configuring)
@@ -300,7 +305,7 @@ void CMakeSetupDialog::doConfigure()
msg += bindir;
QString title = tr("Create Directory");
QMessageBox::StandardButton btn;
- btn = QMessageBox::information(this, title, msg,
+ btn = QMessageBox::information(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
if(btn == QMessageBox::No)
{
@@ -308,8 +313,8 @@ void CMakeSetupDialog::doConfigure()
}
if(!dir.mkpath("."))
{
- QMessageBox::information(this, tr("Create Directory Failed"),
- QString(tr("Failed to create directory %1")).arg(dir.path()),
+ QMessageBox::information(this, tr("Create Directory Failed"),
+ QString(tr("Failed to create directory %1")).arg(dir.path()),
QMessageBox::Ok);
return;
@@ -327,12 +332,12 @@ void CMakeSetupDialog::doConfigure()
// remember path
this->addBinaryPath(dir.absolutePath());
-
+
this->enterState(Configuring);
this->CacheValues->selectionModel()->clear();
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setProperties", Qt::QueuedConnection,
+ "setProperties", Qt::QueuedConnection,
Q_ARG(QCMakePropertyList,
this->CacheValues->cacheModel()->properties()));
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
@@ -350,11 +355,11 @@ void CMakeSetupDialog::finishConfigure(int err)
this->enterState(ReadyConfigure);
this->CacheValues->scrollToTop();
}
-
+
if(err != 0)
{
- QMessageBox::critical(this, tr("Error"),
- tr("Error in configuration process, project files may be invalid"),
+ QMessageBox::critical(this, tr("Error"),
+ tr("Error in configuration process, project files may be invalid"),
QMessageBox::Ok);
}
}
@@ -364,7 +369,7 @@ void CMakeSetupDialog::finishGenerate(int err)
this->enterState(ReadyConfigure);
if(err != 0)
{
- QMessageBox::critical(this, tr("Error"),
+ QMessageBox::critical(this, tr("Error"),
tr("Error in generation process, project files may be invalid"),
QMessageBox::Ok);
}
@@ -388,7 +393,7 @@ void CMakeSetupDialog::doGenerate()
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
"generate", Qt::QueuedConnection);
}
-
+
void CMakeSetupDialog::closeEvent(QCloseEvent* e)
{
// prompt for close if there are unsaved changes, and we're not busy
@@ -479,7 +484,7 @@ void CMakeSetupDialog::doInterrupt()
void CMakeSetupDialog::doSourceBrowse()
{
- QString dir = QFileDialog::getExistingDirectory(this,
+ QString dir = QFileDialog::getExistingDirectory(this,
tr("Enter Path to Source"), this->SourceDirectory->text());
if(!dir.isEmpty())
{
@@ -509,7 +514,7 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir)
void CMakeSetupDialog::doBinaryBrowse()
{
- QString dir = QFileDialog::getExistingDirectory(this,
+ QString dir = QFileDialog::getExistingDirectory(this,
tr("Enter Path to Build"), this->BinaryDirectory->currentText());
if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText())
{
@@ -598,7 +603,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
{
dialog.saveToSettings();
this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator());
-
+
QCMakeCacheModel* m = this->CacheValues->cacheModel();
if(dialog.compilerSetup())
@@ -606,20 +611,20 @@ bool CMakeSetupDialog::setupFirstConfigure()
QString fortranCompiler = dialog.getFortranCompiler();
if(!fortranCompiler.isEmpty())
{
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
"Fortran compiler.", fortranCompiler, false);
}
QString cxxCompiler = dialog.getCXXCompiler();
if(!cxxCompiler.isEmpty())
{
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
"CXX compiler.", cxxCompiler, false);
}
-
+
QString cCompiler = dialog.getCCompiler();
if(!cCompiler.isEmpty())
{
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
"C compiler.", cCompiler, false);
}
}
@@ -628,38 +633,38 @@ bool CMakeSetupDialog::setupFirstConfigure()
QString fortranCompiler = dialog.getFortranCompiler();
if(!fortranCompiler.isEmpty())
{
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
"Fortran compiler.", fortranCompiler, false);
}
QString mode = dialog.getCrossIncludeMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE",
+ m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE",
"CMake Find Include Mode", mode, false);
mode = dialog.getCrossLibraryMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY",
+ m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY",
"CMake Find Library Mode", mode, false);
mode = dialog.getCrossProgramMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM",
+ m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM",
"CMake Find Program Mode", mode, false);
-
+
QString rootPath = dialog.getCrossRoot();
- m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH",
+ m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH",
"CMake Find Root Path", rootPath, false);
QString systemName = dialog.getSystemName();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME",
+ m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME",
"CMake System Name", systemName, false);
QString cxxCompiler = dialog.getCXXCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
"CXX compiler.", cxxCompiler, false);
QString cCompiler = dialog.getCCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
"C compiler.", cCompiler, false);
}
else if(dialog.crossCompilerToolChainFile())
{
QString toolchainFile = dialog.getCrossCompilerToolChainFile();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE",
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE",
"Cross Compile ToolChain File", toolchainFile, false);
}
return true;
@@ -689,11 +694,11 @@ void CMakeSetupDialog::doReloadCache()
}
void CMakeSetupDialog::doDeleteCache()
-{
+{
QString title = tr("Delete Cache");
QString msg = "Are you sure you want to delete the cache?";
QMessageBox::StandardButton btn;
- btn = QMessageBox::information(this, title, msg,
+ btn = QMessageBox::information(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
if(btn == QMessageBox::No)
{
@@ -734,7 +739,7 @@ void CMakeSetupDialog::setExitAfterGenerate(bool b)
void CMakeSetupDialog::addBinaryPath(const QString& path)
{
QString cleanpath = QDir::cleanPath(path);
-
+
// update UI
this->BinaryDirectory->blockSignals(true);
int idx = this->BinaryDirectory->findText(cleanpath);
@@ -745,7 +750,7 @@ void CMakeSetupDialog::addBinaryPath(const QString& path)
this->BinaryDirectory->insertItem(0, cleanpath);
this->BinaryDirectory->setCurrentIndex(0);
this->BinaryDirectory->blockSignals(false);
-
+
// save to registry
QStringList buildPaths = this->loadBuildPaths();
buildPaths.removeAll(cleanpath);
@@ -755,7 +760,7 @@ void CMakeSetupDialog::addBinaryPath(const QString& path)
void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
{
- if(!(this->CurrentState == ReadyConfigure ||
+ if(!(this->CurrentState == ReadyConfigure ||
this->CurrentState == ReadyGenerate))
{
e->ignore();
@@ -765,7 +770,7 @@ void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
const QMimeData* dat = e->mimeData();
QList<QUrl> urls = dat->urls();
QString file = urls.count() ? urls[0].toLocalFile() : QString();
- if(!file.isEmpty() &&
+ if(!file.isEmpty() &&
(file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) ||
file.endsWith("CMakeLists.txt", Qt::CaseInsensitive) ) )
{
@@ -779,7 +784,7 @@ void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
void CMakeSetupDialog::dropEvent(QDropEvent* e)
{
- if(!(this->CurrentState == ReadyConfigure ||
+ if(!(this->CurrentState == ReadyConfigure ||
this->CurrentState == ReadyGenerate))
{
return;
@@ -814,7 +819,7 @@ QStringList CMakeSetupDialog::loadBuildPaths()
QStringList buildPaths;
for(int i=0; i<10; i++)
- {
+ {
QString p = settings.value(QString("WhereBuild%1").arg(i)).toString();
if(!p.isEmpty())
{
@@ -836,11 +841,11 @@ void CMakeSetupDialog::saveBuildPaths(const QStringList& paths)
}
for(int i=0; i<num; i++)
- {
+ {
settings.setValue(QString("WhereBuild%1").arg(i), paths[i]);
}
}
-
+
void CMakeSetupDialog::setCacheModified()
{
this->CacheModified = true;
@@ -864,8 +869,8 @@ void CMakeSetupDialog::removeSelectedCacheEntries()
void CMakeSetupDialog::selectionChanged()
{
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
- if(idxs.count() &&
- (this->CurrentState == ReadyConfigure ||
+ if(idxs.count() &&
+ (this->CurrentState == ReadyConfigure ||
this->CurrentState == ReadyGenerate) )
{
this->RemoveEntry->setEnabled(true);
@@ -875,7 +880,7 @@ void CMakeSetupDialog::selectionChanged()
this->RemoveEntry->setEnabled(false);
}
}
-
+
void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
{
if(s == this->CurrentState)
@@ -966,16 +971,19 @@ void CMakeSetupDialog::setGroupedView(bool v)
{
this->CacheValues->cacheModel()->setViewType(v ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView);
this->CacheValues->setRootIsDecorated(v);
-
+
QSettings settings;
settings.beginGroup("Settings/StartPath");
settings.setValue("GroupView", v);
-
+
}
void CMakeSetupDialog::setAdvancedView(bool v)
{
this->CacheValues->setShowAdvanced(v);
+ QSettings settings;
+ settings.beginGroup("Settings/StartPath");
+ settings.setValue("AdvancedView", v);
}
void CMakeSetupDialog::showUserChanges()
@@ -997,7 +1005,7 @@ void CMakeSetupDialog::showUserChanges()
QString command;
QString cache;
-
+
foreach(QCMakeProperty prop, changes)
{
QString type;
@@ -1033,13 +1041,13 @@ void CMakeSetupDialog::showUserChanges()
command += QString("-D%1\"%2\" ").arg(line).arg(value);
cache += QString("%1%2\n").arg(line).arg(value);
}
-
+
textedit->append(tr("Commandline options:"));
textedit->append(command);
textedit->append("\n");
textedit->append(tr("Cache file:"));
textedit->append(cache);
-
+
dialog.exec();
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d12fde0..2e05883 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -304,6 +304,7 @@ cmCTest::cmCTest()
this->ShowOnly = false;
this->RunConfigurationScript = false;
this->UseHTTP10 = false;
+ this->PrintLabels = false;
this->CompressTestOutput = true;
this->ComputedCompressOutput = false;
this->TestModel = cmCTest::EXPERIMENTAL;
@@ -489,10 +490,6 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
return 0;
}
- // call this so that the information is cached up front
- // and not the first time EndTest is called.
- this->ShouldCompressTestOutput();
-
if ( this->ProduceXML )
{
// Verify "Testing" directory exists:
@@ -1877,6 +1874,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->CompressTestOutput = false;
}
+ if(this->CheckArgument(arg, "--print-labels"))
+ {
+ this->PrintLabels = true;
+ }
+
if(this->CheckArgument(arg, "--http1.0"))
{
this->UseHTTP10 = true;
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 3d7d117..e54a205 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -210,6 +210,8 @@ public:
bool ShouldUseHTTP10() { return this->UseHTTP10; }
+ bool ShouldPrintLabels() { return this->PrintLabels; }
+
bool ShouldCompressTestOutput();
std::string GetCDashVersion();
@@ -413,6 +415,7 @@ private:
bool ProduceXML;
bool LabelSummary;
bool UseHTTP10;
+ bool PrintLabels;
bool Failover;
bool BatchJobs;
diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx
index 3f2a361..5bec6a1 100644
--- a/Source/cmComputeComponentGraph.cxx
+++ b/Source/cmComputeComponentGraph.cxx
@@ -71,8 +71,8 @@ void cmComputeComponentGraph::TarjanVisit(int i)
this->TarjanStack.push(i);
// Follow outgoing edges.
- NodeList const& nl = this->InputGraph[i];
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ EdgeList const& nl = this->InputGraph[i];
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int j = *ni;
@@ -142,14 +142,17 @@ void cmComputeComponentGraph::TransferEdges()
for(int i=0; i < n; ++i)
{
int i_component = this->TarjanComponents[i];
- NodeList const& nl = this->InputGraph[i];
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ EdgeList const& nl = this->InputGraph[i];
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int j = *ni;
int j_component = this->TarjanComponents[j];
if(i_component != j_component)
{
- this->ComponentGraph[i_component].push_back(j_component);
+ // We do not attempt to combine duplicate edges, but instead
+ // store the inter-component edges with suitable multiplicity.
+ this->ComponentGraph[i_component].push_back(
+ cmGraphEdge(j_component, ni->IsStrong()));
}
}
}
diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h
index 855a141..a2ce946 100644
--- a/Source/cmComputeComponentGraph.h
+++ b/Source/cmComputeComponentGraph.h
@@ -33,6 +33,7 @@ class cmComputeComponentGraph
public:
// Represent the graph with an adjacency list.
typedef cmGraphNodeList NodeList;
+ typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph;
cmComputeComponentGraph(Graph const& input);
@@ -41,7 +42,7 @@ public:
/** Get the adjacency list of the component graph. */
Graph const& GetComponentGraph() const
{ return this->ComponentGraph; }
- NodeList const& GetComponentGraphEdges(int c) const
+ EdgeList const& GetComponentGraphEdges(int c) const
{ return this->ComponentGraph[c]; }
/** Get map from component index to original node indices. */
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 24410ec..342c217 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -285,7 +285,7 @@ cmComputeLinkDepends::AllocateLinkEntry(std::string const& item)
lei = this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.push_back(LinkEntry());
this->InferredDependSets.push_back(0);
- this->EntryConstraintGraph.push_back(NodeList());
+ this->EntryConstraintGraph.push_back(EdgeList());
return lei;
}
@@ -669,7 +669,7 @@ void cmComputeLinkDepends::CleanConstraintGraph()
cmsys_stl::sort(i->begin(), i->end());
// Make the edge list unique.
- NodeList::iterator last = cmsys_stl::unique(i->begin(), i->end());
+ EdgeList::iterator last = cmsys_stl::unique(i->begin(), i->end());
i->erase(last, i->end());
}
}
@@ -681,9 +681,9 @@ void cmComputeLinkDepends::DisplayConstraintGraph()
cmOStringStream e;
for(unsigned int i=0; i < this->EntryConstraintGraph.size(); ++i)
{
- NodeList const& nl = this->EntryConstraintGraph[i];
+ EdgeList const& nl = this->EntryConstraintGraph[i];
e << "item " << i << " is [" << this->EntryList[i].Item << "]\n";
- for(NodeList::const_iterator j = nl.begin(); j != nl.end(); ++j)
+ for(EdgeList::const_iterator j = nl.begin(); j != nl.end(); ++j)
{
e << " item " << *j << " must follow it\n";
}
@@ -758,10 +758,11 @@ cmComputeLinkDepends::DisplayComponents()
fprintf(stderr, " item %d [%s]\n", i,
this->EntryList[i].Item.c_str());
}
- NodeList const& ol = this->CCG->GetComponentGraphEdges(c);
- for(NodeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
+ EdgeList const& ol = this->CCG->GetComponentGraphEdges(c);
+ for(EdgeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
{
- fprintf(stderr, " followed by Component (%d)\n", *oi);
+ int i = *oi;
+ fprintf(stderr, " followed by Component (%d)\n", i);
}
fprintf(stderr, " topo order index %d\n",
this->ComponentOrder[c]);
@@ -784,8 +785,8 @@ void cmComputeLinkDepends::VisitComponent(unsigned int c)
// Visit the neighbors of the component first.
// Run in reverse order so the topological order will preserve the
// original order where there are no constraints.
- NodeList const& nl = this->CCG->GetComponentGraphEdges(c);
- for(NodeList::const_reverse_iterator ni = nl.rbegin();
+ EdgeList const& nl = this->CCG->GetComponentGraphEdges(c);
+ for(EdgeList::const_reverse_iterator ni = nl.rbegin();
ni != nl.rend(); ++ni)
{
this->VisitComponent(*ni);
@@ -856,8 +857,8 @@ void cmComputeLinkDepends::VisitEntry(int index)
// are now pending.
if(completed)
{
- NodeList const& ol = this->CCG->GetComponentGraphEdges(component);
- for(NodeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
+ EdgeList const& ol = this->CCG->GetComponentGraphEdges(component);
+ for(EdgeList::const_iterator oi = ol.begin(); oi != ol.end(); ++oi)
{
// This entire component is now pending no matter whether it has
// been partially seen already.
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index a08afb6..e196e00 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -117,6 +117,7 @@ private:
// Ordering constraint graph adjacency list.
typedef cmGraphNodeList NodeList;
+ typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph;
Graph EntryConstraintGraph;
void CleanConstraintGraph();
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 94b8527..313c680 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -129,7 +129,10 @@ bool cmComputeTargetDepends::Compute()
}
// Compute the final dependency graph.
- this->ComputeFinalDepends(ccg);
+ if(!this->ComputeFinalDepends(ccg))
+ {
+ return false;
+ }
if(this->DebugMode)
{
this->DisplayGraph(this->FinalGraph, "final");
@@ -150,8 +153,8 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
int i = tii->second;
// Get its final dependencies.
- NodeList const& nl = this->FinalGraph[i];
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ EdgeList const& nl = this->FinalGraph[i];
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
deps.insert(this->Targets[*ni]);
}
@@ -195,15 +198,13 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Get the depender.
cmTarget* depender = this->Targets[depender_index];
- // Keep track of dependencies already listed.
- std::set<cmStdString> emitted;
-
- // A target should not depend on itself.
- emitted.insert(depender->GetName());
-
// Loop over all targets linked directly.
+ {
cmTarget::LinkLibraryVectorType const& tlibs =
depender->GetOriginalLinkLibraries();
+ std::set<cmStdString> emitted;
+ // A target should not depend on itself.
+ emitted.insert(depender->GetName());
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib)
{
@@ -213,9 +214,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
this->AddTargetDepend(depender_index, lib->first.c_str(), true);
}
}
+ }
// Loop over all utility dependencies.
+ {
std::set<cmStdString> const& tutils = depender->GetUtilities();
+ std::set<cmStdString> emitted;
+ // A target should not depend on itself.
+ emitted.insert(depender->GetName());
for(std::set<cmStdString>::const_iterator util = tutils.begin();
util != tutils.end(); ++util)
{
@@ -225,6 +231,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
this->AddTargetDepend(depender_index, util->c_str(), false);
}
}
+ }
}
//----------------------------------------------------------------------------
@@ -272,7 +279,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
int dependee_index = tii->second;
// Add this entry to the dependency graph.
- this->InitialGraph[depender_index].push_back(dependee_index);
+ this->InitialGraph[depender_index].push_back(
+ cmGraphEdge(dependee_index, !linking));
}
//----------------------------------------------------------------------------
@@ -283,16 +291,16 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name)
int n = static_cast<int>(graph.size());
for(int depender_index = 0; depender_index < n; ++depender_index)
{
- NodeList const& nl = graph[depender_index];
+ EdgeList const& nl = graph[depender_index];
cmTarget* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName());
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
cmTarget* dependee = this->Targets[dependee_index];
- fprintf(stderr, " depends on target %d [%s]\n", dependee_index,
- dependee->GetName());
+ fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
+ dependee->GetName(), ni->IsStrong()? "strong" : "weak");
}
}
fprintf(stderr, "\n");
@@ -363,7 +371,8 @@ cmComputeTargetDepends
//----------------------------------------------------------------------------
void
cmComputeTargetDepends
-::ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c)
+::ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c,
+ bool strong)
{
// Construct the error message.
cmOStringStream e;
@@ -383,18 +392,27 @@ cmComputeTargetDepends
<< cmTarget::TargetTypeNames[depender->GetType()] << "\n";
// List its dependencies that are inside the component.
- NodeList const& nl = this->InitialGraph[i];
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ EdgeList const& nl = this->InitialGraph[i];
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int j = *ni;
if(cmap[j] == c)
{
cmTarget* dependee = this->Targets[j];
- e << " depends on \"" << dependee->GetName() << "\"\n";
+ e << " depends on \"" << dependee->GetName() << "\""
+ << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n";
}
}
}
- if(this->NoCycles)
+ if(strong)
+ {
+ // Custom command executable dependencies cannot occur within a
+ // component of static libraries. The cycle must appear in calls
+ // to add_dependencies.
+ e << "The component contains at least one cycle consisting of strong "
+ << "dependencies (created by add_dependencies) that cannot be broken.";
+ }
+ else if(this->NoCycles)
{
e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so "
<< "cyclic dependencies are not allowed even among static libraries.";
@@ -408,7 +426,49 @@ cmComputeTargetDepends
}
//----------------------------------------------------------------------------
-void
+bool
+cmComputeTargetDepends
+::IntraComponent(std::vector<int> const& cmap, int c, int i, int* head,
+ std::set<int>& emitted, std::set<int>& visited)
+{
+ if(!visited.insert(i).second)
+ {
+ // Cycle in utility depends!
+ return false;
+ }
+ if(emitted.insert(i).second)
+ {
+ // Honor strong intra-component edges in the final order.
+ EdgeList const& el = this->InitialGraph[i];
+ for(EdgeList::const_iterator ei = el.begin(); ei != el.end(); ++ei)
+ {
+ int j = *ei;
+ if(cmap[j] == c && ei->IsStrong())
+ {
+ this->FinalGraph[i].push_back(j);
+ if(!this->IntraComponent(cmap, c, j, head, emitted, visited))
+ {
+ return false;
+ }
+ }
+ }
+
+ // Prepend to a linear linked-list of intra-component edges.
+ if(*head >= 0)
+ {
+ this->FinalGraph[i].push_back(*head);
+ }
+ else
+ {
+ this->ComponentTail[c] = i;
+ }
+ *head = i;
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool
cmComputeTargetDepends
::ComputeFinalDepends(cmComputeComponentGraph const& ccg)
{
@@ -420,34 +480,43 @@ cmComputeTargetDepends
this->FinalGraph.resize(0);
this->FinalGraph.resize(this->InitialGraph.size());
+ // Choose intra-component edges to linearize dependencies.
+ std::vector<int> const& cmap = ccg.GetComponentMap();
+ this->ComponentHead.resize(components.size());
+ this->ComponentTail.resize(components.size());
+ int nc = static_cast<int>(components.size());
+ for(int c=0; c < nc; ++c)
+ {
+ int head = -1;
+ std::set<int> emitted;
+ NodeList const& nl = components[c];
+ for(NodeList::const_reverse_iterator ni = nl.rbegin();
+ ni != nl.rend(); ++ni)
+ {
+ std::set<int> visited;
+ if(!this->IntraComponent(cmap, c, *ni, &head, emitted, visited))
+ {
+ // Cycle in add_dependencies within component!
+ this->ComplainAboutBadComponent(ccg, c, true);
+ return false;
+ }
+ }
+ this->ComponentHead[c] = head;
+ }
+
// Convert inter-component edges to connect component tails to heads.
int n = static_cast<int>(cgraph.size());
for(int depender_component=0; depender_component < n; ++depender_component)
{
- int depender_component_tail = components[depender_component].back();
- NodeList const& nl = cgraph[depender_component];
- for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
+ int depender_component_tail = this->ComponentTail[depender_component];
+ EdgeList const& nl = cgraph[depender_component];
+ for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_component = *ni;
- int dependee_component_head = components[dependee_component].front();
+ int dependee_component_head = this->ComponentHead[dependee_component];
this->FinalGraph[depender_component_tail]
.push_back(dependee_component_head);
}
}
-
- // Compute intra-component edges.
- int nc = static_cast<int>(components.size());
- for(int c=0; c < nc; ++c)
- {
- // Within the component each target depends on that following it.
- NodeList const& nl = components[c];
- NodeList::const_iterator ni = nl.begin();
- int last_i = *ni;
- for(++ni; ni != nl.end(); ++ni)
- {
- int i = *ni;
- this->FinalGraph[last_i].push_back(i);
- last_i = i;
- }
- }
+ return true;
}
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 68e3e47..240de76 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -45,7 +45,7 @@ private:
void CollectTargetDepends(int depender_index);
void AddTargetDepend(int depender_index, const char* dependee_name,
bool linking);
- void ComputeFinalDepends(cmComputeComponentGraph const& ccg);
+ bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
cmGlobalGenerator* GlobalGenerator;
bool DebugMode;
@@ -59,6 +59,7 @@ private:
// top-level index corresponds to a depender whose dependencies are
// listed.
typedef cmGraphNodeList NodeList;
+ typedef cmGraphEdgeList EdgeList;
typedef cmGraphAdjacencyList Graph;
Graph InitialGraph;
Graph FinalGraph;
@@ -67,7 +68,13 @@ private:
// Deal with connected components.
void DisplayComponents(cmComputeComponentGraph const& ccg);
bool CheckComponents(cmComputeComponentGraph const& ccg);
- void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c);
+ void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c,
+ bool strong = false);
+
+ std::vector<int> ComponentHead;
+ std::vector<int> ComponentTail;
+ bool IntraComponent(std::vector<int> const& cmap, int c, int i, int* head,
+ std::set<int>& emitted, std::set<int>& visited);
};
#endif
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index c198727..1158fc0 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -687,7 +687,8 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
// The value has been read successfully. Report it.
se.Position = static_cast<unsigned long>(strtab.sh_offset + first);
se.Size = last - first;
- se.IndexInSection = static_cast<int>(di - this->DynamicSectionEntries.begin());
+ se.IndexInSection =
+ static_cast<int>(di - this->DynamicSectionEntries.begin());
return &se;
}
}
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 48c5c6e..cb614d4 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -152,11 +152,10 @@ bool cmExportCommand
ebfg.SetCommand(this);
// Compute the set of configurations exported.
- if(const char* types =
- this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
+ std::vector<std::string> configurationTypes;
+ this->Makefile->GetConfigurations(configurationTypes);
+ if(!configurationTypes.empty())
{
- std::vector<std::string> configurationTypes;
- cmSystemTools::ExpandListArgument(types, configurationTypes);
for(std::vector<std::string>::const_iterator
ci = configurationTypes.begin();
ci != configurationTypes.end(); ++ci)
@@ -164,11 +163,6 @@ bool cmExportCommand
ebfg.AddConfiguration(ci->c_str());
}
}
- else if(const char* config =
- this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- ebfg.AddConfiguration(config);
- }
else
{
ebfg.AddConfiguration("");
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 133c1a1..8ebd41f 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2571,8 +2571,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
std::vector<std::string>::const_iterator i = args.begin();
if(args.size() < 3)
{
- this->SetError("FILE(DOWNLOAD url file) must be called with "
- "at least three arguments.");
+ this->SetError("DOWNLOAD must be called with at least three arguments.");
return false;
}
++i; // Get rid of subcommand
@@ -2598,8 +2597,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
}
else
{
- this->SetError("FILE(DOWNLOAD url file TIMEOUT time) missing "
- "time for TIMEOUT.");
+ this->SetError("DOWNLOAD missing time for TIMEOUT.");
return false;
}
}
@@ -2608,8 +2606,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i;
if( i == args.end())
{
- this->SetError("FILE(DOWNLOAD url file LOG VAR) missing "
- "VAR for LOG.");
+ this->SetError("DOWNLOAD missing VAR for LOG.");
return false;
}
verboseLog = *i;
@@ -2619,8 +2616,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i;
if( i == args.end())
{
- this->SetError("FILE(DOWNLOAD url file STATUS VAR) missing "
- "VAR for STATUS.");
+ this->SetError("DOWNLOAD missing VAR for STATUS.");
return false;
}
statusVar = *i;
@@ -2630,8 +2626,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
++i;
if( i == args.end())
{
- this->SetError("FILE(DOWNLOAD url file EXPECTED_MD5 sum) missing "
- "sum value for EXPECTED_MD5.");
+ this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false;
}
expectedMD5sum = cmSystemTools::LowerCase(*i);
@@ -2654,8 +2649,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5))
{
- this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on "
- "pre-existing file");
+ this->SetError("DOWNLOAD cannot compute MD5 sum on pre-existing file");
return false;
}
@@ -2665,7 +2659,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (expectedMD5sum == actualMD5sum)
{
this->Makefile->DisplayStatus(
- "FILE(DOWNLOAD ) returning early: file already exists with "
+ "FILE(DOWNLOAD) returning early: file already exists with "
"expected MD5 sum", -1);
if(statusVar.size())
@@ -2698,8 +2692,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
std::ofstream fout(file.c_str(), std::ios::binary);
if(!fout)
{
- this->SetError("FILE(DOWNLOAD url file TIMEOUT time) can not open "
- "file for write.");
+ this->SetError("DOWNLOAD cannot open file for write.");
return false;
}
@@ -2708,8 +2701,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
curl = ::curl_easy_init();
if(!curl)
{
- this->SetError("FILE(DOWNLOAD ) error "
- "initializing curl.");
+ this->SetError("DOWNLOAD error initializing curl.");
return false;
}
@@ -2718,9 +2710,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set url: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2728,10 +2720,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
cmFileCommandWriteMemoryCallback);
if (res != CURLE_OK)
{
- std::string errstring =
- "FILE(DOWNLOAD ) error; cannot set write function: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set write function: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2739,10 +2730,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
cmFileCommandCurlDebugCallback);
if (res != CURLE_OK)
{
- std::string errstring =
- "FILE(DOWNLOAD ) error; cannot set debug function: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set debug function: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2752,27 +2742,27 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set write data: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set debug data: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set debug data: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set follow-redirect option: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set follow-redirect option: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2782,9 +2772,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set verbose: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
}
@@ -2795,9 +2785,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set timeout: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set timeout: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
}
@@ -2815,9 +2805,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_NOPROGRESS, 0);
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set noprogress value: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set noprogress value: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2825,9 +2815,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_PROGRESSFUNCTION, cmFileCommandCurlProgressCallback);
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress function: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set progress function: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
@@ -2835,9 +2825,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
CURLOPT_PROGRESSDATA, reinterpret_cast<void*>(&helper));
if (res != CURLE_OK)
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress data: ";
- errstring += ::curl_easy_strerror(res);
- this->SetError(errstring.c_str());
+ std::string e = "DOWNLOAD cannot set progress data: ";
+ e += ::curl_easy_strerror(res);
+ this->SetError(e.c_str());
return false;
}
}
@@ -2871,8 +2861,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5))
{
- this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on "
- "downloaded file");
+ this->SetError("DOWNLOAD cannot compute MD5 sum on downloaded file");
return false;
}
@@ -2882,8 +2871,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
if (expectedMD5sum != actualMD5sum)
{
cmOStringStream oss;
- oss << "FILE(DOWNLOAD ) error; expected and actual MD5 sums differ"
- << std::endl
+ oss << "DOWNLOAD MD5 mismatch" << std::endl
<< " for file: [" << file << "]" << std::endl
<< " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl
<< " actual MD5 sum: [" << actualMD5sum << "]" << std::endl
@@ -2913,8 +2901,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
return true;
#else
- this->SetError("FILE(DOWNLOAD ) "
- "not supported in bootstrap cmake ");
+ this->SetError("DOWNLOAD not supported by bootstrap cmake.");
return false;
#endif
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index eb86014..ef0197a 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -156,6 +156,11 @@ cmFindPackageCommand::cmFindPackageCommand()
"The full path to the configuration file is stored in the cmake "
"variable <package>_CONFIG."
"\n"
+ "All configuration files which have been considered by CMake while "
+ "searching for an installation of the package with an appropriate "
+ "version are stored in the cmake variable <package>_CONSIDERED_CONFIGS, "
+ "the associated versions in <package>_CONSIDERED_VERSIONS. "
+ "\n"
"If the package configuration file cannot be found CMake "
"will generate an error describing the problem unless the QUIET "
"argument is specified. If REQUIRED is specified and the package "
@@ -618,7 +623,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components)
// Store the list of components.
std::string components_var = this->Name + "_FIND_COMPONENTS";
this->AddFindDefinition(components_var.c_str(), components.c_str());
-
+
if(this->Quiet)
{
// Tell the module that is about to be read that it should find
@@ -721,6 +726,8 @@ bool cmFindPackageCommand::FindModule(bool& found)
//----------------------------------------------------------------------------
bool cmFindPackageCommand::HandlePackageMode()
{
+ this->ConsideredConfigs.clear();
+
// Support old capitalization behavior.
std::string upperDir = cmSystemTools::UpperCase(this->Name);
std::string upperFound = cmSystemTools::UpperCase(this->Name);
@@ -809,36 +816,58 @@ bool cmFindPackageCommand::HandlePackageMode()
{
// The variable is not set.
cmOStringStream e;
- e << "Could not find ";
- if(!this->NoModule)
- {
- e << "module Find" << this->Name << ".cmake or ";
- }
- e << "a configuration file for package " << this->Name << ".\n";
- if(!this->NoModule)
- {
- e << "Adjust CMAKE_MODULE_PATH to find Find"
- << this->Name << ".cmake or set ";
- }
- else
- {
- e << "Set ";
- }
- e << this->Variable << " to the directory containing a CMake "
- << "configuration file for " << this->Name << ". ";
- if(this->Configs.size() == 1)
- {
- e << "The file will be called " << this->Configs[0];
+ // If there are files in ConsideredConfigs, it means that FooConfig.cmake
+ // have been found, but they didn't have appropriate versions.
+ if (this->ConsideredConfigs.size() > 0)
+ {
+ e << "Could not find a configuration file for package \""
+ << this->Name << "\" that "
+ << (this->VersionExact? "exactly matches" : "is compatible with")
+ << " requested version \"" << this->Version << "\".\n"
+ << "The following configuration files were considered but not "
+ "accepted:\n";
+ for(std::vector<ConfigFileInfo>::size_type i=0;
+ i<this->ConsideredConfigs.size(); i++)
+ {
+ e << " " << this->ConsideredConfigs[i].filename
+ << ", version: " << this->ConsideredConfigs[i].version << "\n";
+ }
}
else
{
- e << "The file will have one of the following names:\n";
- for(std::vector<std::string>::const_iterator ci = this->Configs.begin();
- ci != this->Configs.end(); ++ci)
+ e << "Could not find ";
+ if(!this->NoModule)
+ {
+ e << "module Find" << this->Name << ".cmake or ";
+ }
+ e << "a configuration file for package " << this->Name << ".\n";
+ if(!this->NoModule)
+ {
+ e << "Adjust CMAKE_MODULE_PATH to find Find"
+ << this->Name << ".cmake or set ";
+ }
+ else
{
- e << " " << *ci << "\n";
+ e << "Set ";
+ }
+ e << this->Variable << " to the directory containing a CMake "
+ << "configuration file for " << this->Name << ". ";
+ if(this->Configs.size() == 1)
+ {
+ e << "The file will be called " << this->Configs[0];
+ }
+ else
+ {
+ e << "The file will have one of the following names:\n";
+ for(std::vector<std::string>::const_iterator ci=this->Configs.begin();
+ ci != this->Configs.end(); ++ci)
+ {
+ e << " " << *ci << "\n";
+ }
}
}
+
+
this->Makefile->IssueMessage(
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
}
@@ -897,6 +926,31 @@ bool cmFindPackageCommand::HandlePackageMode()
}
#endif
+ std::string consideredConfigsVar = this->Name;
+ consideredConfigsVar += "_CONSIDERED_CONFIGS";
+ std::string consideredVersionsVar = this->Name;
+ consideredVersionsVar += "_CONSIDERED_VERSIONS";
+
+ std::string consideredConfigFiles;
+ std::string consideredVersions;
+
+ const char* sep = "";
+ for(std::vector<ConfigFileInfo>::size_type i=0;
+ i<this->ConsideredConfigs.size(); i++)
+ {
+ consideredConfigFiles += sep;
+ consideredVersions += sep;
+ consideredConfigFiles += this->ConsideredConfigs[i].filename;
+ consideredVersions += this->ConsideredConfigs[i].version;
+ sep = ";";
+ }
+
+ this->Makefile->AddDefinition(consideredConfigsVar.c_str(),
+ consideredConfigFiles.c_str());
+
+ this->Makefile->AddDefinition(consideredVersionsVar.c_str(),
+ consideredVersions.c_str());
+
return result;
}
@@ -1083,6 +1137,20 @@ void cmFindPackageCommand::AppendSuccessInformation()
}
}
+ // set a global property to record the required version of this package
+ std::string versionInfoPropName = "_CMAKE_";
+ versionInfoPropName += this->Name;
+ versionInfoPropName += "_REQUIRED_VERSION";
+ std::string versionInfo;
+ if(!this->Version.empty())
+ {
+ versionInfo = this->VersionExact ? "==" : ">=";
+ versionInfo += " ";
+ versionInfo += this->Version;
+ }
+ this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(),
+ versionInfo.c_str());
+
// Restore original state of "_FIND_" variables we set.
this->RestoreFindDefinitions();
}
@@ -1467,6 +1535,10 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
//----------------------------------------------------------------------------
bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
{
+ bool result = false; // by default, assume the version is not ok.
+ bool haveResult = false;
+ std::string version = "unknown";
+
// Get the filename without the .cmake extension.
std::string::size_type pos = config_file.rfind('.');
std::string version_file_base = config_file.substr(0, pos);
@@ -1474,31 +1546,42 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for foo-config-version.cmake
std::string version_file = version_file_base;
version_file += "-version.cmake";
- if(cmSystemTools::FileExists(version_file.c_str(), true))
+ if ((haveResult == false)
+ && (cmSystemTools::FileExists(version_file.c_str(), true)))
{
- return this->CheckVersionFile(version_file);
+ result = this->CheckVersionFile(version_file, version);
+ haveResult = true;
}
// Look for fooConfigVersion.cmake
version_file = version_file_base;
version_file += "Version.cmake";
- if(cmSystemTools::FileExists(version_file.c_str(), true))
+ if ((haveResult == false)
+ && (cmSystemTools::FileExists(version_file.c_str(), true)))
{
- return this->CheckVersionFile(version_file);
+ result = this->CheckVersionFile(version_file, version);
+ haveResult = true;
}
+
// If no version was requested a versionless package is acceptable.
- if(this->Version.empty())
+ if ((haveResult == false) && (this->Version.empty()))
{
- return true;
+ result = true;
+ haveResult = true;
}
- // No version file found. Assume the version is incompatible.
- return false;
+ ConfigFileInfo configFileInfo;
+ configFileInfo.filename = config_file;
+ configFileInfo.version = version;
+ this->ConsideredConfigs.push_back(configFileInfo);
+
+ return result;
}
//----------------------------------------------------------------------------
-bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
+bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
+ std::string& result_version)
{
// The version file will be loaded in an isolated scope.
cmMakefile::ScopePushPop varScope(this->Makefile);
@@ -1571,6 +1654,12 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
}
}
+ result_version = this->Makefile->GetSafeDefinition("PACKAGE_VERSION");
+ if (result_version.empty())
+ {
+ result_version = "unknown";
+ }
+
// Succeed if the version is suitable.
return suitable;
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 53ea4fc..57aeab9 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -98,7 +98,8 @@ private:
bool CheckDirectory(std::string const& dir);
bool FindConfigFile(std::string const& dir, std::string& file);
bool CheckVersion(std::string const& config_file);
- bool CheckVersionFile(std::string const& version_file);
+ bool CheckVersionFile(std::string const& version_file,
+ std::string& result_version);
bool SearchPrefix(std::string const& prefix);
bool SearchFrameworkPrefix(std::string const& prefix_in);
bool SearchAppBundlePrefix(std::string const& prefix_in);
@@ -137,6 +138,9 @@ private:
std::vector<std::string> Names;
std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths;
+
+ struct ConfigFileInfo { std::string filename; std::string version; };
+ std::vector<ConfigFileInfo> ConsideredConfigs;
};
#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 201fceb..e4c169a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -863,19 +863,10 @@ void cmGlobalGenerator::Generate()
}
// Compute the inter-target dependencies.
- {
- cmComputeTargetDepends ctd(this);
- if(!ctd.Compute())
+ if(!this->ComputeTargetDepends())
{
return;
}
- std::vector<cmTarget*> const& targets = ctd.GetTargets();
- for(std::vector<cmTarget*>::const_iterator ti = targets.begin();
- ti != targets.end(); ++ti)
- {
- ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
- }
- }
// Create a map from local generator to the complete set of targets
// it builds by default.
@@ -910,6 +901,23 @@ void cmGlobalGenerator::Generate()
}
//----------------------------------------------------------------------------
+bool cmGlobalGenerator::ComputeTargetDepends()
+{
+ cmComputeTargetDepends ctd(this);
+ if(!ctd.Compute())
+ {
+ return false;
+ }
+ std::vector<cmTarget*> const& targets = ctd.GetTargets();
+ for(std::vector<cmTarget*>::const_iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalGenerator::CheckTargets()
{
// Make sure all targets can find their source files.
@@ -1489,7 +1497,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
// Add dependencies of the included target. An excluded
// target may still be included if it is a dependency of a
// non-excluded target.
- TargetDependSet & tgtdeps = this->GetTargetDirectDepends(target);
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
@@ -1839,6 +1847,38 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
}
+//----------------------------------------------------------------------------
+const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
+{
+ const char* prop =
+ this->GetCMakeInstance()->GetProperty("PREDEFINED_TARGETS_FOLDER");
+
+ if (prop)
+ {
+ return prop;
+ }
+
+ return "CMakePredefinedTargets";
+}
+
+//----------------------------------------------------------------------------
+bool cmGlobalGenerator::UseFolderProperty()
+{
+ const char* prop = this->GetCMakeInstance()->GetProperty("USE_FOLDERS");
+
+ // If this property is defined, let the setter turn this on or off...
+ //
+ if (prop)
+ {
+ return cmSystemTools::IsOn(prop);
+ }
+
+ // By default, this feature is ON:
+ //
+ return true;
+}
+
+//----------------------------------------------------------------------------
cmTarget cmGlobalGenerator::CreateGlobalTarget(
const char* name, const char* message,
const cmCustomCommandLines* commandLines,
@@ -1868,6 +1908,14 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
{
target.AddUtility(dit->c_str());
}
+
+ // Organize in the "predefined targets" folder:
+ //
+ if (this->UseFolderProperty())
+ {
+ target.SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
+ }
+
return target;
}
@@ -1881,7 +1929,7 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
}
//----------------------------------------------------------------------------
-cmGlobalGenerator::TargetDependSet &
+cmGlobalGenerator::TargetDependSet const&
cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target)
{
return this->TargetDependencies[&target];
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 878be11..2aec19f 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -238,7 +238,7 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
- TargetDependSet & GetTargetDirectDepends(cmTarget & target);
+ TargetDependSet const& GetTargetDirectDepends(cmTarget & target);
const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;}
@@ -275,6 +275,8 @@ protected:
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);
+ virtual bool ComputeTargetDepends();
+
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
bool CheckTargets();
@@ -320,6 +322,9 @@ protected:
// All targets in the entire project.
std::map<cmStdString,cmTarget *> TotalTargets;
+ virtual const char* GetPredefinedTargetsFolder();
+ virtual bool UseFolderProperty();
+
private:
float FirstTimeProgress;
// If you add a new map here, make sure it is copied
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 691502f..403507f 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -40,7 +40,7 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{
cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator;
- lg->SetPlatformName(this->PlatformName.c_str());
+ lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx
index 1004fa9..109b60d 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx
@@ -16,7 +16,6 @@
//----------------------------------------------------------------------------
cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
{
- this->PlatformName = "x64";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
index 98ba03c..39c9d08 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.h
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -27,6 +27,8 @@ public:
return cmGlobalVisualStudio10Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 10 Win64";}
+ virtual const char* GetPlatformName() const {return "x64";}
+
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index d053ca2..203ca77 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -13,6 +13,7 @@
#include "cmLocalVisualStudio6Generator.h"
#include "cmMakefile.h"
#include "cmake.h"
+#include "cmGeneratedFileStream.h"
// Utility function to make a valid VS6 *.dsp filename out
// of a CMake target name:
@@ -274,44 +275,33 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n";
fout << "{{{\n";
-
- // insert Begin Project Dependency Project_Dep_Name project stuff here
- if (target.GetType() != cmTarget::STATIC_LIBRARY)
+ VSDependSet const& depends = this->VSTargetDepends[&target];
+ for(VSDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
{
- cmTarget::LinkLibraryVectorType::const_iterator j, jend;
- j = target.GetLinkLibraries().begin();
- jend = target.GetLinkLibraries().end();
- for(;j!= jend; ++j)
- {
- if(j->first != dspname)
- {
- // is the library part of this DSW ? If so add dependency
- if(this->FindTarget(0, j->first.c_str()))
- {
- fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name "
- << GetVS6TargetName(j->first.c_str()) << "\n";
- fout << "End Project Dependency\n";
- }
- }
- }
+ const char* name = di->c_str();
+ fout << "Begin Project Dependency\n";
+ fout << "Project_Dep_Name " << GetVS6TargetName(name) << "\n";
+ fout << "End Project Dependency\n";
}
+ fout << "}}}\n\n";
- std::set<cmStdString>::const_iterator i, end;
- // write utility dependencies.
- i = target.GetUtilities().begin();
- end = target.GetUtilities().end();
- for(;i!= end; ++i)
+ UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
+ if(ui != this->UtilityDepends.end())
{
- if(*i != dspname)
- {
- std::string depName = this->GetUtilityForTarget(target, i->c_str());
- fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << GetVS6TargetName(depName) << "\n";
- fout << "End Project Dependency\n";
- }
+ const char* uname = ui->second.c_str();
+ fout << "Project: \"" << uname << "\"="
+ << dir << "\\" << uname << ".dsp - Package Owner=<4>\n\n";
+ fout <<
+ "Package=<5>\n{{{\n}}}\n\n"
+ "Package=<4>\n"
+ "{{{\n"
+ "Begin Project Dependency\n"
+ "Project_Dep_Name " << dspname << "\n"
+ "End Project Dependency\n"
+ "}}}\n\n";
+ ;
}
- fout << "}}}\n\n";
}
@@ -368,6 +358,49 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
}
//----------------------------------------------------------------------------
+std::string
+cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target)
+{
+ std::string pname = target->GetName();
+ pname += "_UTILITY";
+ pname = GetVS6TargetName(pname.c_str());
+ std::string fname = target->GetMakefile()->GetStartOutputDirectory();
+ fname += "/";
+ fname += pname;
+ fname += ".dsp";
+ cmGeneratedFileStream fout(fname.c_str());
+ fout.SetCopyIfDifferent(true);
+ fout <<
+ "# Microsoft Developer Studio Project File - Name=\""
+ << pname << "\" - Package Owner=<4>\n"
+ "# Microsoft Developer Studio Generated Build File, Format Version 6.00\n"
+ "# ** DO NOT EDIT **\n"
+ "\n"
+ "# TARGTYPE \"Win32 (x86) Generic Project\" 0x010a\n"
+ "\n"
+ "CFG=" << pname << " - Win32 Debug\n"
+ "!MESSAGE \"" << pname << " - Win32 Debug\""
+ " (based on \"Win32 (x86) Generic Project\")\n"
+ "!MESSAGE \"" << pname << " - Win32 Release\" "
+ "(based on \"Win32 (x86) Generic Project\")\n"
+ "!MESSAGE \"" << pname << " - Win32 MinSizeRel\" "
+ "(based on \"Win32 (x86) Generic Project\")\n"
+ "!MESSAGE \"" << pname << " - Win32 RelWithDebInfo\" "
+ "(based on \"Win32 (x86) Generic Project\")\n"
+ "\n"
+ "# Begin Project\n"
+ "# Begin Target\n"
+ "# Name \"" << pname << " - Win32 Debug\"\n"
+ "# Name \"" << pname << " - Win32 Release\"\n"
+ "# Name \"" << pname << " - Win32 MinSizeRel\"\n"
+ "# Name \"" << pname << " - Win32 RelWithDebInfo\"\n"
+ "# End Target\n"
+ "# End Project\n"
+ ;
+ return pname;
+}
+
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio6Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 553c7be..77d5370 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -96,6 +96,7 @@ private:
const char* name, const char* path,
const std::set<cmStdString>& dependencies);
void WriteDSWFooter(std::ostream& fout);
+ virtual std::string WriteUtilityDepend(cmTarget* target);
};
#endif
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 1191575..ba18687 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -111,6 +111,13 @@ void cmGlobalVisualStudio71Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
+
+ bool useFolderProperty = this->UseFolderProperty();
+ if (useFolderProperty)
+ {
+ this->WriteFolders(fout);
+ }
+
// Write out the configurations information for the solution
fout << "Global\n";
// Write out the configurations for the solution
@@ -120,6 +127,15 @@ void cmGlobalVisualStudio71Generator
// Write out the configurations for all the targets in the project
this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
+
+ if (useFolderProperty)
+ {
+ // Write out project folders
+ fout << "\tGlobalSection(NestedProjects) = preSolution\n";
+ this->WriteFoldersContent(fout);
+ fout << "\tEndGlobalSection\n";
+ }
+
// Write the footer for the SLN file
this->WriteSLNFooter(fout);
}
@@ -163,16 +179,31 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
ext = targetExt;
}
+ std::string guid = this->GetGUID(dspname);
fout << project
<< dspname << "\", \""
<< this->ConvertToSolutionPath(dir)
- << "\\" << dspname << ext << "\", \"{"
- << this->GetGUID(dspname) << "}\"\n";
+ << "\\" << dspname << ext << "\", \"{" << guid << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
fout << "\tEndProjectSection\n";
fout <<"EndProject\n";
+
+ UtilityDependsMap::iterator ui = this->UtilityDepends.find(&t);
+ if(ui != this->UtilityDepends.end())
+ {
+ const char* uname = ui->second.c_str();
+ fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ << uname << "\", \""
+ << this->ConvertToSolutionPath(dir)
+ << "\\" << uname << ".vcproj" << "\", \"{"
+ << this->GetGUID(uname) << "}\"\n"
+ << "\tProjectSection(ProjectDependencies) = postProject\n"
+ << "\t\t{" << guid << "} = {" << guid << "}\n"
+ << "\tEndProjectSection\n"
+ << "EndProject\n";
+ }
}
//----------------------------------------------------------------------------
@@ -182,62 +213,24 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
void
cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout,
- const char* dspname,
+ const char*,
const char*, cmTarget& target)
{
-#if 0
- // Create inter-target dependencies in the solution file. For VS
- // 7.1 and below we cannot let static libraries depend directly on
- // targets to which they "link" because the librarian tool will copy
- // the targets into the static library. See
- // cmGlobalVisualStudioGenerator::FixUtilityDependsForTarget for a
- // work-around. VS 8 and above do not have this problem.
- if (!this->VSLinksDependencies() ||
- target.GetType() != cmTarget::STATIC_LIBRARY);
-#else
- if (target.GetType() != cmTarget::STATIC_LIBRARY)
-#endif
+ VSDependSet const& depends = this->VSTargetDepends[&target];
+ for(VSDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
{
- cmTarget::LinkLibraryVectorType::const_iterator j, jend;
- j = target.GetLinkLibraries().begin();
- jend = target.GetLinkLibraries().end();
- for(;j!= jend; ++j)
+ const char* name = di->c_str();
+ std::string guid = this->GetGUID(name);
+ if(guid.size() == 0)
{
- if(j->first != dspname)
- {
- // is the library part of this SLN ? If so add dependency
- // find target anywhere because all depend libraries are
- // brought in as well
- if(this->FindTarget(0, j->first.c_str()))
- {
- fout << "\t\t{" << this->GetGUID(j->first.c_str()) << "} = {"
- << this->GetGUID(j->first.c_str()) << "}\n";
- }
- }
- }
- }
-
- std::set<cmStdString>::const_iterator i, end;
- // write utility dependencies.
- i = target.GetUtilities().begin();
- end = target.GetUtilities().end();
- for(;i!= end; ++i)
- {
- if(*i != dspname)
- {
- std::string name = this->GetUtilityForTarget(target, i->c_str());
- std::string guid = this->GetGUID(name.c_str());
- if(guid.size() == 0)
- {
- std::string m = "Target: ";
- m += target.GetName();
- m += " depends on unknown target: ";
- m += name;
- cmSystemTools::Error(m.c_str());
- }
-
- fout << "\t\t{" << guid << "} = {" << guid << "}\n";
+ std::string m = "Target: ";
+ m += target.GetName();
+ m += " depends on unknown target: ";
+ m += name;
+ cmSystemTools::Error(m.c_str());
}
+ fout << "\t\t{" << guid << "} = {" << guid << "}\n";
}
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 9631e9a..751dc24 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -300,6 +300,48 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, vcprojName, dir.c_str(),
*target);
+
+ // Create "solution folder" information from FOLDER target property
+ //
+ if (this->UseFolderProperty())
+ {
+ const char *targetFolder = target->GetProperty("FOLDER");
+ if (targetFolder)
+ {
+ std::vector<cmsys::String> tokens =
+ cmSystemTools::SplitString(targetFolder, '/', false);
+
+ std::string cumulativePath = "";
+
+ for(std::vector<cmsys::String>::iterator iter = tokens.begin();
+ iter != tokens.end(); ++iter)
+ {
+ if(!iter->size())
+ {
+ continue;
+ }
+
+ if (cumulativePath.empty())
+ {
+ cumulativePath = *iter;
+ }
+ else
+ {
+ VisualStudioFolders[cumulativePath].insert(
+ cumulativePath + "/" + *iter);
+
+ cumulativePath = cumulativePath + "/" + *iter;
+ }
+
+ this->CreateGUID(cumulativePath.c_str());
+ }
+
+ if (!cumulativePath.empty())
+ {
+ VisualStudioFolders[cumulativePath].insert(target->GetName());
+ }
+ }
+ }
}
}
}
@@ -327,6 +369,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
}
}
+//----------------------------------------------------------------------------
// Write a SLN file to the stream
void cmGlobalVisualStudio7Generator
::WriteSLNFile(std::ostream& fout,
@@ -344,6 +387,13 @@ void cmGlobalVisualStudio7Generator
OrderedTargetDependSet orderedProjectTargets(projectTargets);
this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
+
+ bool useFolderProperty = this->UseFolderProperty();
+ if (useFolderProperty)
+ {
+ this->WriteFolders(fout);
+ }
+
// Write out the configurations information for the solution
fout << "Global\n"
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n";
@@ -361,6 +411,14 @@ void cmGlobalVisualStudio7Generator
this->WriteTargetDepends(fout, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
+ if (useFolderProperty)
+ {
+ // Write out project folders
+ fout << "\tGlobalSection(NestedProjects) = preSolution\n";
+ this->WriteFoldersContent(fout);
+ fout << "\tEndGlobalSection\n";
+ }
+
// Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
@@ -371,6 +429,47 @@ void cmGlobalVisualStudio7Generator
}
//----------------------------------------------------------------------------
+void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
+{
+ std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
+ for(std::map<std::string,std::set<std::string> >::iterator iter =
+ VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
+ {
+ std::string fullName = iter->first;
+ std::string guid = this->GetGUID(fullName.c_str());
+ std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
+ cmSystemTools::ReplaceString(fullName, "/", "\\");
+
+ fout << "Project(\"{" <<
+ guidProjectTypeFolder << "}\") = \"" <<
+ nameOnly << "\", \"" <<
+ fullName << "\", \"{" <<
+ guid <<
+ "}\"\nEndProject\n";
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
+{
+ for(std::map<std::string,std::set<std::string> >::iterator iter =
+ VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
+ {
+ std::string key(iter->first);
+ std::string guidParent(this->GetGUID(key.c_str()));
+
+ for(std::set<std::string>::iterator it = iter->second.begin();
+ it != iter->second.end(); ++it)
+ {
+ std::string value(*it);
+ std::string guid(this->GetGUID(value.c_str()));
+
+ fout << "\t\t{" << guid << "} = {" << guidParent << "}\n";
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
std::string
cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
{
@@ -408,6 +507,18 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
<< this->ConvertToSolutionPath(dir)
<< "\\" << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n";
+
+ UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
+ if(ui != this->UtilityDepends.end())
+ {
+ const char* uname = ui->second.c_str();
+ fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
+ << uname << "\", \""
+ << this->ConvertToSolutionPath(dir)
+ << "\\" << uname << ".vcproj" << "\", \"{"
+ << this->GetGUID(uname) << "}\"\n"
+ << "EndProject\n";
+ }
}
@@ -422,59 +533,30 @@ cmGlobalVisualStudio7Generator
const char*, cmTarget& target)
{
int depcount = 0;
- // insert Begin Project Dependency Project_Dep_Name project stuff here
- if (target.GetType() != cmTarget::STATIC_LIBRARY)
- {
- cmTarget::LinkLibraryVectorType::const_iterator j, jend;
- j = target.GetLinkLibraries().begin();
- jend = target.GetLinkLibraries().end();
- for(;j!= jend; ++j)
+ std::string dspguid = this->GetGUID(dspname);
+ VSDependSet const& depends = this->VSTargetDepends[&target];
+ for(VSDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
+ {
+ const char* name = di->c_str();
+ std::string guid = this->GetGUID(name);
+ if(guid.size() == 0)
{
- if(j->first != dspname)
- {
- // is the library part of this SLN ? If so add dependency
- if(this->FindTarget(0, j->first.c_str()))
- {
- std::string guid = this->GetGUID(j->first.c_str());
- if(guid.size() == 0)
- {
- std::string m = "Target: ";
- m += dspname;
- m += " depends on unknown target: ";
- m += j->first.c_str();
- cmSystemTools::Error(m.c_str());
- }
- fout << "\t\t{" << this->GetGUID(dspname) << "}."
- << depcount << " = {" << guid << "}\n";
- depcount++;
- }
- }
+ std::string m = "Target: ";
+ m += target.GetName();
+ m += " depends on unknown target: ";
+ m += name;
+ cmSystemTools::Error(m.c_str());
}
+ fout << "\t\t{" << dspguid << "}." << depcount << " = {" << guid << "}\n";
+ depcount++;
}
- std::set<cmStdString>::const_iterator i, end;
- // write utility dependencies.
- i = target.GetUtilities().begin();
- end = target.GetUtilities().end();
- for(;i!= end; ++i)
+ UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
+ if(ui != this->UtilityDepends.end())
{
- if(*i != dspname)
- {
- std::string name = this->GetUtilityForTarget(target, i->c_str());
- std::string guid = this->GetGUID(name.c_str());
- if(guid.size() == 0)
- {
- std::string m = "Target: ";
- m += dspname;
- m += " depends on unknown target: ";
- m += name.c_str();
- cmSystemTools::Error(m.c_str());
- }
-
- fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {"
- << guid << "}\n";
- depcount++;
- }
+ const char* uname = ui->second.c_str();
+ fout << "\t\t{" << this->GetGUID(uname) << "}.0 = {" << dspguid << "}\n";
}
}
@@ -537,6 +619,61 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout)
fout << "Microsoft Visual Studio Solution File, Format Version 7.00\n";
}
+//----------------------------------------------------------------------------
+std::string
+cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget* target)
+{
+ std::string pname = target->GetName();
+ pname += "_UTILITY";
+ std::string fname = target->GetMakefile()->GetStartOutputDirectory();
+ fname += "/";
+ fname += pname;
+ fname += ".vcproj";
+ cmGeneratedFileStream fout(fname.c_str());
+ fout.SetCopyIfDifferent(true);
+ this->CreateGUID(pname.c_str());
+ std::string guid = this->GetGUID(pname.c_str());
+
+ fout <<
+ "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
+ "<VisualStudioProject\n"
+ "\tProjectType=\"Visual C++\"\n"
+ "\tVersion=\"" << this->GetIDEVersion() << "0\"\n"
+ "\tName=\"" << pname << "\"\n"
+ "\tProjectGUID=\"{" << guid << "}\"\n"
+ "\tKeyword=\"Win32Proj\">\n"
+ "\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
+ "\t<Configurations>\n"
+ ;
+ for(std::vector<std::string>::iterator i = this->Configurations.begin();
+ i != this->Configurations.end(); ++i)
+ {
+ fout <<
+ "\t\t<Configuration\n"
+ "\t\t\tName=\"" << *i << "|Win32\"\n"
+ "\t\t\tOutputDirectory=\"" << *i << "\"\n"
+ "\t\t\tIntermediateDirectory=\"" << pname << ".dir\\" << *i << "\"\n"
+ "\t\t\tConfigurationType=\"10\"\n"
+ "\t\t\tUseOfMFC=\"0\"\n"
+ "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"
+ "\t\t\tCharacterSet=\"2\">\n"
+ "\t\t</Configuration>\n"
+ ;
+ }
+ fout <<
+ "\t</Configurations>\n"
+ "\t<Files></Files>\n"
+ "\t<Globals></Globals>\n"
+ "</VisualStudioProject>\n"
+ ;
+
+ if(fout.Close())
+ {
+ this->FileReplacedDuringGenerate(fname);
+ }
+ return pname;
+}
+
std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name)
{
std::string guidStoreName = name;
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 85ba244..b6c84e8 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -113,6 +113,7 @@ protected:
bool partOfDefaultBuild);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
+ virtual std::string WriteUtilityDepend(cmTarget* target);
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteTargetsToSolution(
@@ -142,6 +143,10 @@ protected:
std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap;
+ virtual void WriteFolders(std::ostream& fout);
+ virtual void WriteFoldersContent(std::ostream& fout);
+ std::map<std::string,std::set<std::string> > VisualStudioFolders;
+
// Set during OutputSLNFile with the name of the current project.
// There is one SLN file per project.
std::string CurrentProject;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 6e0f048..7c65c32 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -21,7 +21,7 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
{
this->FindMakeProgramFile = "CMakeVS8FindMake.cmake";
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
- this->PlatformName = "Win32";
+ this->ArchitectureId = "X86";
}
//----------------------------------------------------------------------------
@@ -30,6 +30,7 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
+ lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
@@ -55,8 +56,8 @@ void cmGlobalVisualStudio8Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{
- mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86");
- mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC80", "1");
}
@@ -136,6 +137,13 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
no_working_directory, no_depends,
noCommandLines);
+ // Organize in the "predefined targets" folder:
+ //
+ if (this->UseFolderProperty())
+ {
+ tgt->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
+ }
+
// Create a list of all stamp files for this project.
std::vector<std::string> stamps;
std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -252,8 +260,8 @@ cmGlobalVisualStudio8Generator
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
- fout << "\t\t" << *i << "|" << this->PlatformName << " = " << *i << "|"
- << this->PlatformName << "\n";
+ fout << "\t\t" << *i << "|" << this->GetPlatformName()
+ << " = " << *i << "|" << this->GetPlatformName() << "\n";
}
fout << "\tEndGlobalSection\n";
}
@@ -269,13 +277,13 @@ cmGlobalVisualStudio8Generator
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
- << "|" << this->PlatformName << ".ActiveCfg = "
- << *i << "|" << this->PlatformName << "\n";
+ << "|" << this->GetPlatformName() << ".ActiveCfg = "
+ << *i << "|" << this->GetPlatformName() << "\n";
if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
- << "|" << this->PlatformName << ".Build.0 = "
- << *i << "|" << this->PlatformName << "\n";
+ << "|" << this->GetPlatformName() << ".Build.0 = "
+ << *i << "|" << this->GetPlatformName() << "\n";
}
}
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 9d836bd..e0d5d80 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -32,14 +32,14 @@ public:
return cmGlobalVisualStudio8Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005";}
+ virtual const char* GetPlatformName() const {return "Win32";}
+
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator();
- std::string const& GetPlatformName() const { return this->PlatformName; }
-
/**
* Override Configure and Generate to add the build-system check
* target.
@@ -78,6 +78,7 @@ protected:
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
bool partOfDefaultBuild);
- std::string PlatformName; // Win32 or x64
+
+ const char* ArchitectureId;
};
#endif
diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx
index d5558bb..3469b17 100644
--- a/Source/cmGlobalVisualStudio8Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx
@@ -19,7 +19,7 @@
cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
{
- this->PlatformName = "x64";
+ this->ArchitectureId = "x64";
}
///! Create a local generator appropriate to this Global Generator
@@ -27,7 +27,7 @@ cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
- lg->SetPlatformName(this->PlatformName.c_str());
+ lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
@@ -48,6 +48,4 @@ void cmGlobalVisualStudio8Win64Generator
{
this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
- mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
- mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
}
diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h
index 44c237c..084ba69 100644
--- a/Source/cmGlobalVisualStudio8Win64Generator.h
+++ b/Source/cmGlobalVisualStudio8Win64Generator.h
@@ -33,6 +33,8 @@ public:
return cmGlobalVisualStudio8Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 8 2005 Win64";}
+ virtual const char* GetPlatformName() const {return "x64";}
+
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index f6ae705..f8ceea0 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -25,8 +25,8 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator()
//----------------------------------------------------------------------------
void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf)
{
- mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86");
- mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC90", "1");
}
@@ -42,6 +42,7 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9();
+ lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx
index c5b9bab..ff4fd4f 100644
--- a/Source/cmGlobalVisualStudio9Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Win64Generator.cxx
@@ -16,7 +16,7 @@
cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator()
{
- this->PlatformName = "x64";
+ this->ArchitectureId = "x64";
}
///! Create a local generator appropriate to this Global Generator
@@ -24,7 +24,7 @@ cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9();
- lg->SetPlatformName(this->PlatformName.c_str());
+ lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
return lg;
@@ -45,6 +45,4 @@ void cmGlobalVisualStudio9Win64Generator
{
cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
- mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
- mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
}
diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h
index 55abcfc..f6dcc03 100644
--- a/Source/cmGlobalVisualStudio9Win64Generator.h
+++ b/Source/cmGlobalVisualStudio9Win64Generator.h
@@ -33,6 +33,8 @@ public:
return cmGlobalVisualStudio9Win64Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 9 2008 Win64";}
+ virtual const char* GetPlatformName() const {return "x64";}
+
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 85b4a71..bae18a3 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -56,6 +56,21 @@ void cmGlobalVisualStudioGenerator::Generate()
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false,
"Build all projects");
+
+#if 0
+ // Can't activate this code because we want ALL_BUILD
+ // selected as the default "startup project" when first
+ // opened in Visual Studio... And if it's nested in a
+ // folder, then that doesn't happen.
+ //
+ // Organize in the "predefined targets" folder:
+ //
+ if (this->UseFolderProperty())
+ {
+ allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
+ }
+#endif
+
// Now make all targets depend on the ALL_BUILD target
cmTargets targets;
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
@@ -74,9 +89,6 @@ void cmGlobalVisualStudioGenerator::Generate()
}
}
- // Fix utility dependencies to avoid linking to libraries.
- this->FixUtilityDepends();
-
// Configure CMake Visual Studio macros, for this user on this version
// of Visual Studio.
this->ConfigureCMakeVisualStudioMacros();
@@ -225,129 +237,59 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudioGenerator::FixUtilityDepends()
+bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
{
- // Skip for VS versions 8 and above.
- if(!this->VSLinksDependencies())
+ if(!this->cmGlobalGenerator::ComputeTargetDepends())
{
- return;
+ return false;
}
-
- // For VS versions before 8:
- //
- // When a target that links contains a project-level dependency on a
- // library target that library is automatically linked. In order to
- // allow utility-style project-level dependencies that do not
- // actually link we need to automatically insert an intermediate
- // custom target.
- //
- // Here we edit the utility dependencies of a target to add the
- // intermediate custom target when necessary.
- for(unsigned i = 0; i < this->LocalGenerators.size(); ++i)
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
- cmTargets* targets =
- &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
- for(cmTargets::iterator tarIt = targets->begin();
- tarIt != targets->end(); ++tarIt)
+ std::vector<cmLocalGenerator*>& gen = it->second;
+ for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
+ i != gen.end(); ++i)
{
- this->FixUtilityDependsForTarget(tarIt->second);
+ cmTargets& targets = (*i)->GetMakefile()->GetTargets();
+ for(cmTargets::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ this->ComputeVSTargetDepends(ti->second);
+ }
}
}
+ return true;
}
//----------------------------------------------------------------------------
-void
-cmGlobalVisualStudioGenerator::FixUtilityDependsForTarget(cmTarget& target)
+void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
{
- // Only targets that link need to be fixed.
- if(target.GetType() != cmTarget::STATIC_LIBRARY &&
- target.GetType() != cmTarget::SHARED_LIBRARY &&
- target.GetType() != cmTarget::MODULE_LIBRARY &&
- target.GetType() != cmTarget::EXECUTABLE)
+ if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end())
{
return;
}
-
-#if 0
- // This feature makes a mess in SLN files for VS 7.1 and below. It
- // creates an extra target for every target that is "linked" by a
- // static library. Without this feature static libraries do not
- // wait until their "link" dependencies are built to build. This is
- // not a problem 99.9% of the time, and projects that do have the
- // problem can enable this work-around by using add_dependencies.
-
- // Static libraries cannot depend directly on the targets to which
- // they link because VS will copy those targets into the library
- // (for VS < 8). To work around the problem we copy the
- // dependencies to be utility dependencies so that the work-around
- // below is used.
- if(target.GetType() == cmTarget::STATIC_LIBRARY)
+ VSDependSet& vsTargetDepend = this->VSTargetDepends[&target];
+ if(target.GetType() != cmTarget::STATIC_LIBRARY)
{
cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator i = libs.begin();
- i != libs.end(); ++i)
- {
- if(cmTarget* depTarget = this->FindTarget(0, i->first.c_str(), false))
- {
- target.AddUtility(depTarget->GetName());
- }
- }
- }
-#endif
-
- // Look at each utility dependency.
- for(std::set<cmStdString>::const_iterator ui =
- target.GetUtilities().begin();
- ui != target.GetUtilities().end(); ++ui)
- {
- if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
+ for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin();
+ j != libs.end(); ++j)
{
- if(depTarget->GetType() == cmTarget::STATIC_LIBRARY ||
- depTarget->GetType() == cmTarget::SHARED_LIBRARY ||
- depTarget->GetType() == cmTarget::MODULE_LIBRARY)
+ if(j->first != target.GetName() &&
+ this->FindTarget(0, j->first.c_str()))
{
- // This utility dependency will cause an attempt to link. If
- // the depender does not already link the dependee we need an
- // intermediate target.
- if(!this->CheckTargetLinks(target, ui->c_str()))
- {
- this->CreateUtilityDependTarget(*depTarget);
- }
+ vsTargetDepend.insert(j->first);
}
}
}
-}
-
-//----------------------------------------------------------------------------
-void
-cmGlobalVisualStudioGenerator::CreateUtilityDependTarget(cmTarget& target)
-{
- // This target is a library on which a utility dependency exists.
- // We need to create an intermediate custom target to hook up the
- // dependency without causing a link.
- const char* altName = target.GetProperty("ALTERNATIVE_DEPENDENCY_NAME");
- if(!altName)
+ std::set<cmStdString> const& utils = target.GetUtilities();
+ for(std::set<cmStdString>::const_iterator i = utils.begin();
+ i != utils.end(); ++i)
{
- // Create the intermediate utility target.
- std::string altNameStr = target.GetName();
- altNameStr += "_UTILITY";
- const std::vector<std::string> no_depends;
- cmCustomCommandLines no_commands;
- const char* no_working_dir = 0;
- const char* no_comment = 0;
- target.GetMakefile()->AddUtilityCommand(altNameStr.c_str(), true,
- no_working_dir, no_depends,
- no_commands, false, no_comment);
- target.SetProperty("ALTERNATIVE_DEPENDENCY_NAME", altNameStr.c_str());
-
- // Most targets have a GUID created in ConfigureFinalPass. Since
- // that has already been called, create one for this target now.
- this->CreateGUID(altNameStr.c_str());
-
- // The intermediate target should depend on the original target.
- if(cmTarget* alt = this->FindTarget(0, altNameStr.c_str()))
+ if(*i != target.GetName())
{
- alt->AddUtility(target.GetName());
+ std::string name = this->GetUtilityForTarget(target, i->c_str());
+ vsTargetDepend.insert(name);
}
}
}
@@ -375,10 +317,28 @@ bool cmGlobalVisualStudioGenerator::CheckTargetLinks(cmTarget& target,
}
//----------------------------------------------------------------------------
-const char*
+std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target)
+{
+ UtilityDependsMap::iterator i = this->UtilityDepends.find(target);
+ if(i == this->UtilityDepends.end())
+ {
+ std::string name = this->WriteUtilityDepend(target);
+ UtilityDependsMap::value_type entry(target, name);
+ i = this->UtilityDepends.insert(entry).first;
+ }
+ return i->second;
+}
+
+//----------------------------------------------------------------------------
+std::string
cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
const char* name)
{
+ if(!this->VSLinksDependencies())
+ {
+ return name;
+ }
+
// Possibly depend on an intermediate utility target to avoid
// linking.
if(target.GetType() == cmTarget::STATIC_LIBRARY ||
@@ -386,19 +346,19 @@ cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
target.GetType() == cmTarget::MODULE_LIBRARY ||
target.GetType() == cmTarget::EXECUTABLE)
{
- // The depender is a target that links. Lookup the dependee to
- // see if it provides an alternative dependency name.
+ // The depender is a target that links.
if(cmTarget* depTarget = this->FindTarget(0, name))
{
- // Check for an alternative name created by FixUtilityDepends.
- if(const char* altName =
- depTarget->GetProperty("ALTERNATIVE_DEPENDENCY_NAME"))
+ if(depTarget->GetType() == cmTarget::STATIC_LIBRARY ||
+ depTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+ depTarget->GetType() == cmTarget::MODULE_LIBRARY)
{
- // The alternative name is needed only if the depender does
- // not really link to the dependee.
+ // This utility dependency will cause an attempt to link. If
+ // the depender does not already link the dependee we need an
+ // intermediate target.
if(!this->CheckTargetLinks(target, name))
{
- return altName;
+ return this->GetUtilityDepend(depTarget);
}
}
}
@@ -409,30 +369,6 @@ cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudioGenerator::GetTargetSets(
- TargetDependSet& projectTargets, TargetDependSet& originalTargets,
- cmLocalGenerator* root, GeneratorVector const& generators
- )
-{
- this->cmGlobalGenerator::GetTargetSets(projectTargets, originalTargets,
- root, generators);
-
- // Add alternative dependency targets created by FixUtilityDepends.
- for(TargetDependSet::iterator ti = projectTargets.begin();
- ti != projectTargets.end(); ++ti)
- {
- cmTarget* tgt = *ti;
- if(const char* altName = tgt->GetProperty("ALTERNATIVE_DEPENDENCY_NAME"))
- {
- if(cmTarget* alt = tgt->GetMakefile()->FindTarget(altName))
- {
- projectTargets.insert(alt);
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
#include <windows.h>
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index b0be087..daa6b3a 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -61,7 +61,6 @@ public:
// return true if target is fortran only
bool TargetIsFortranOnly(cmTarget& t);
- const char* GetUtilityForTarget(cmTarget& target, const char*);
/** Get the top-level registry key for this VS version. */
std::string GetRegistryBase();
@@ -71,8 +70,6 @@ public:
virtual bool IsMultiConfig() { return true; }
protected:
- void FixUtilityDepends();
-
// 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.
@@ -90,14 +87,18 @@ protected:
OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
};
- virtual void GetTargetSets(TargetDependSet& projectTargets,
- TargetDependSet& originalTargets,
- cmLocalGenerator* root, GeneratorVector const&);
+ virtual bool ComputeTargetDepends();
+ class VSDependSet: public std::set<cmStdString> {};
+ class VSDependMap: public std::map<cmTarget*, VSDependSet> {};
+ VSDependMap VSTargetDepends;
+ void ComputeVSTargetDepends(cmTarget&);
bool CheckTargetLinks(cmTarget& target, const char* name);
-private:
- void FixUtilityDependsForTarget(cmTarget& target);
- void CreateUtilityDependTarget(cmTarget& target);
+ std::string GetUtilityForTarget(cmTarget& target, const char*);
+ virtual std::string WriteUtilityDepend(cmTarget*) = 0;
+ std::string GetUtilityDepend(cmTarget* target);
+ typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
+ UtilityDependsMap UtilityDepends;
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 537a88f..4e9969d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -722,26 +722,10 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
// Select the current set of configuration types.
this->CurrentConfigurationTypes.clear();
- if(this->XcodeVersion > 20)
- {
- if(const char* types =
- this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(types,
- this->CurrentConfigurationTypes);
- }
- }
+ this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes);
if(this->CurrentConfigurationTypes.empty())
{
- if(const char* buildType =
- this->CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- this->CurrentConfigurationTypes.push_back(buildType);
- }
- else
- {
- this->CurrentConfigurationTypes.push_back("");
- }
+ this->CurrentConfigurationTypes.push_back("");
}
}
@@ -2742,12 +2726,14 @@ void cmGlobalXCodeGenerator
buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
std::string archString;
+ const char* sep = "";
for( std::vector<std::string>::iterator i =
this->Architectures.begin();
i != this->Architectures.end(); ++i)
{
+ archString += sep;
archString += *i;
- archString += " ";
+ sep = " ";
}
buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index 7794840..0149d33 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -14,7 +14,27 @@
#include "cmStandardIncludes.h"
+/**
+ * Graph edge representation. Most use cases just need the
+ * destination vertex, so we support conversion to/from an int. We
+ * also store boolean to indicate whether an edge is "strong".
+ */
+class cmGraphEdge
+{
+public:
+ cmGraphEdge(): Dest(0), Strong(true) {}
+ cmGraphEdge(int n): Dest(n), Strong(true) {}
+ cmGraphEdge(int n, bool s): Dest(n), Strong(s) {}
+ cmGraphEdge(cmGraphEdge const& r): Dest(r.Dest), Strong(r.Strong) {}
+ operator int() const { return this->Dest; }
+
+ bool IsStrong() const { return this->Strong; }
+private:
+ int Dest;
+ bool Strong;
+};
+struct cmGraphEdgeList: public std::vector<cmGraphEdge> {};
struct cmGraphNodeList: public std::vector<int> {};
-struct cmGraphAdjacencyList: public std::vector<cmGraphNodeList> {};
+struct cmGraphAdjacencyList: public std::vector<cmGraphEdgeList> {};
#endif
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index ea0a1ec..8f62322 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -175,6 +175,7 @@ public:
"The EXPORT option associates the installed target files with an "
"export called <export-name>. "
"It must appear before any RUNTIME, LIBRARY, or ARCHIVE options. "
+ "To actually install the export file itself, call install(EXPORT). "
"See documentation of the install(EXPORT ...) signature below for "
"details."
"\n"
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 47ca769..9d5e416 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -60,6 +60,26 @@ void cmInstallGenerator
}
os << indent;
std::string dest = this->GetInstallDestination();
+ if (cmSystemTools::FileIsFullPath(dest.c_str()))
+ {
+ os << "list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES\n";
+ os << indent << " \"";
+ for(std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi)
+ {
+ if (fi!=files.begin()) os << ";";
+ os << dest << cmSystemTools::ConvertToOutputPath("/");
+ if (rename && *rename)
+ {
+ os << rename;
+ }
+ else
+ {
+ os << cmSystemTools::GetFilenameName(*fi);
+ }
+ }
+ os << "\")\n";
+ }
os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional)
{
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index bac0223..5bffd52 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -278,16 +278,8 @@ void cmLocalGenerator::GenerateTestFiles()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
- if(const char* types =
- this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(types, configurationTypes);
- }
- const char* config = 0;
- if(configurationTypes.empty())
- {
- config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
- }
+ const char* config =
+ this->Makefile->GetConfigurations(configurationTypes, false);
std::string file = this->Makefile->GetStartOutputDirectory();
file += "/";
@@ -383,16 +375,8 @@ void cmLocalGenerator::GenerateInstallRules()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
- if(const char* types =
- this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(types, configurationTypes);
- }
- const char* config = 0;
- if(configurationTypes.empty())
- {
- config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
- }
+ const char* config =
+ this->Makefile->GetConfigurations(configurationTypes, false);
// Choose a default install configuration.
const char* default_config = config;
@@ -546,19 +530,7 @@ void cmLocalGenerator::GenerateTargetManifest()
{
// Collect the set of configuration types.
std::vector<std::string> configNames;
- if(const char* configurationTypes =
- this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(configurationTypes, configNames);
- }
- else if(const char* buildType =
- this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- if(*buildType)
- {
- configNames.push_back(buildType);
- }
- }
+ this->Makefile->GetConfigurations(configNames);
// Add our targets to the manifest for each configuration.
cmTargets& targets = this->Makefile->GetTargets();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 004d19a..f04d0a0 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1062,9 +1062,16 @@ cmLocalUnixMakefileGenerator3
}
}
}
- if (useCall && launcher.empty())
+ if (launcher.empty())
{
- cmd = "call " + cmd;
+ if (useCall)
+ {
+ cmd = "call " + cmd;
+ }
+ else if (this->NMake && cmd[0]=='"')
+ {
+ cmd = "echo >nul && " + cmd;
+ }
}
commands1.push_back(cmd);
}
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 539816d..eb4e4a4 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1187,7 +1187,8 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsMinSizeRel += targetLinkFlags;
}
- if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELWITHDEBINFO"))
+ if(const char* targetLinkFlags =
+ target.GetProperty("LINK_FLAGS_RELWITHDEBINFO"))
{
extraLinkOptionsRelWithDebInfo += " ";
extraLinkOptionsRelWithDebInfo += targetLinkFlags;
@@ -1304,7 +1305,8 @@ void cmLocalVisualStudio6Generator
optionsRelease);
this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptionsMinSizeRel,
optionsMinSizeRel);
- this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptionsRelWithDebInfo,
+ this->ComputeLinkOptions(target, "RelWithDebInfo",
+ extraLinkOptionsRelWithDebInfo,
optionsRelWithDebInfo);
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index e411d3e..cb34bb6 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -466,6 +466,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE", 0},
{"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0},
{"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0},
+ {"EntryPointSymbol", "ENTRY:", "sets the starting address", "",
+ cmVS7FlagTable::UserValue},
{"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
{"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs",
@@ -480,6 +482,21 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{"OptimizeReferences", "OPT:REF", "Eliminate unreferenced data", "2", 0},
{"TargetMachine", "MACHINE:I386", "Machine x86", "1", 0},
{"TargetMachine", "MACHINE:X86", "Machine x86", "1", 0},
+ {"TargetMachine", "MACHINE:AM33", "Machine AM33", "2", 0},
+ {"TargetMachine", "MACHINE:ARM", "Machine ARM", "3", 0},
+ {"TargetMachine", "MACHINE:EBC", "Machine EBC", "4", 0},
+ {"TargetMachine", "MACHINE:IA64", "Machine IA64", "5", 0},
+ {"TargetMachine", "MACHINE:M32R", "Machine M32R", "6", 0},
+ {"TargetMachine", "MACHINE:MIPS", "Machine MIPS", "7", 0},
+ {"TargetMachine", "MACHINE:MIPS16", "Machine MIPS16", "8", 0},
+ {"TargetMachine", "MACHINE:MIPSFPU)", "Machine MIPSFPU", "9", 0},
+ {"TargetMachine", "MACHINE:MIPSFPU16", "Machine MIPSFPU16", "10", 0},
+ {"TargetMachine", "MACHINE:MIPSR41XX", "Machine MIPSR41XX", "11", 0},
+ {"TargetMachine", "MACHINE:SH3", "Machine SH3", "12", 0},
+ {"TargetMachine", "MACHINE:SH3DSP", "Machine SH3DSP", "13", 0},
+ {"TargetMachine", "MACHINE:SH4", "Machine SH4", "14", 0},
+ {"TargetMachine", "MACHINE:SH5", "Machine SH5", "15", 0},
+ {"TargetMachine", "MACHINE:THUMB", "Machine THUMB", "16", 0},
{"TargetMachine", "MACHINE:X64", "Machine x64", "17", 0},
{"ModuleDefinitionFile", "DEF:", "add an export def file", "",
cmVS7FlagTable::UserValue},
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9ccde8f..a97ec10 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1461,16 +1461,7 @@ void cmMakefile::InitializeFromParent()
this->SetProperty("COMPILE_DEFINITIONS",
parent->GetProperty("COMPILE_DEFINITIONS"));
std::vector<std::string> configs;
- if(const char* configTypes =
- this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(configTypes, configs);
- }
- else if(const char* buildType =
- this->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- configs.push_back(buildType);
- }
+ this->GetConfigurations(configs);
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
@@ -2491,6 +2482,31 @@ void cmMakefile::AddDefaultDefinitions()
cmake::GetCMakeFilesDirectory());
}
+//----------------------------------------------------------------------------
+const char*
+cmMakefile::GetConfigurations(std::vector<std::string>& configs,
+ bool single) const
+{
+ if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig())
+ {
+ if(const char* configTypes =
+ this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
+ {
+ cmSystemTools::ExpandListArgument(configTypes, configs);
+ }
+ return 0;
+ }
+ else
+ {
+ const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE");
+ if(single && buildType && *buildType)
+ {
+ configs.push_back(buildType);
+ }
+ return buildType;
+ }
+}
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
* Find a source group whose regular expression matches the filename
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 240a9cf..837a352 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -317,7 +317,11 @@ public:
{
return this->ProjectName.c_str();
}
-
+
+ /** Get the configurations to be generated. */
+ const char* GetConfigurations(std::vector<std::string>& configs,
+ bool single = true) const;
+
/**
* Set the name of the library.
*/
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 93c981a..a5e319d 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -345,6 +345,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTarget = this->Target;
vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str();
+ std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash();
+ objdir += this->Target->GetName();
+ objdir += ".dir";
+ objdir = this->Convert(objdir.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ vars.ObjectDir = objdir.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 8670fc4..fa5abd8 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -59,7 +59,10 @@ public:
" option(<option_variable> \"help string describing option\"\n"
" [initial value])\n"
"Provide an option for the user to select as ON or OFF. If no "
- "initial value is provided, OFF is used.";
+ "initial value is provided, OFF is used.\n"
+ "If you have options that depend on the values of other "
+ "options, see the module help for CMakeDependentOption."
+ ;
}
/**
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 69d3e51..3fe92de 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -15,8 +15,8 @@ const char* cmPolicies::PolicyStatusNames[] = {
class cmPolicy
{
-public:
- cmPolicy(cmPolicies::PolicyID iD,
+public:
+ cmPolicy(cmPolicies::PolicyID iD,
const char *idString,
const char *shortDescription,
const char *longDescription,
@@ -55,7 +55,7 @@ public:
return v.str();
}
- bool IsPolicyNewerThan(unsigned int majorV,
+ bool IsPolicyNewerThan(unsigned int majorV,
unsigned int minorV,
unsigned int patchV,
unsigned int tweakV)
@@ -86,7 +86,7 @@ public:
}
return (tweakV < this->TweakVersionIntroduced);
}
-
+
cmPolicies::PolicyID ID;
std::string IDString;
std::string ShortDescription;
@@ -285,12 +285,12 @@ cmPolicies::cmPolicies()
"The NEW behavior for this policy is to produce an error if a bundle "
"target is installed without a BUNDLE DESTINATION.",
2,6,0,0, cmPolicies::WARN);
-
+
this->DefinePolicy(
CMP0007, "CMP0007",
"list command no longer ignores empty elements.",
"This policy determines whether the list command will "
- "ignore empty elements in the list. "
+ "ignore empty elements in the list. "
"CMake 2.4 and below list commands ignored all empty elements"
" in the list. For example, a;b;;c would have length 3 and not 4. "
"The OLD behavior for this policy is to ignore empty list elements. "
@@ -426,7 +426,7 @@ cmPolicies::cmPolicies()
this->DefinePolicy(
CMP0015, "CMP0015",
"link_directories() treats paths relative to the source dir.",
- "In CMake 2.6.4 and lower the link_directories() command passed relative "
+ "In CMake 2.8.0 and lower the link_directories() command passed relative "
"paths unchanged to the linker. "
"In CMake 2.8.1 and above the link_directories() command prefers to "
"interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, "
@@ -437,12 +437,21 @@ cmPolicies::cmPolicies()
"absolute paths by appending the relative path to "
"CMAKE_CURRENT_SOURCE_DIR.",
2,8,1,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0016, "CMP0016",
+ "target_link_libraries() reports error if only argument is not a target.",
+ "In CMake 2.8.2 and lower the target_link_libraries() command silently "
+ "ignored if it was called with only one argument, and this argument "
+ "wasn't a valid target. "
+ "In CMake 2.8.3 and above it reports an error in this case.",
+ 2,8,3,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
{
// free the policies
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
{
@@ -451,7 +460,7 @@ cmPolicies::~cmPolicies()
}
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
- const char *idString,
+ const char *idString,
const char *shortDescription,
const char *longDescription,
unsigned int majorVersionIntroduced,
@@ -467,7 +476,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
"ID ", this->GetPolicyIDString(iD).c_str());
return;
}
-
+
this->Policies[iD] = new cmPolicy(iD, idString,
shortDescription,
longDescription,
@@ -480,7 +489,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
}
//----------------------------------------------------------------------------
-bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
+bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
const char *version)
{
std::string ver = "2.4.0";
@@ -505,7 +514,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
-
+
// it is an error if the policy version is less than 2.4
if (majorVer < 2 || (majorVer == 2 && minorVer < 4))
{
@@ -547,7 +556,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// now loop over all the policies and set them as appropriate
std::vector<cmPolicies::PolicyID> ancientPolicies;
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
{
@@ -589,7 +598,7 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
return false;
}
- std::map<std::string,cmPolicies::PolicyID>::iterator pos =
+ std::map<std::string,cmPolicies::PolicyID>::iterator pos =
this->PolicyStringMap.find(id);
if (pos == this->PolicyStringMap.end())
{
@@ -601,7 +610,7 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(pid);
if (pos == this->Policies.end())
{
@@ -614,7 +623,7 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
///! return a warning string for a given policy
std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
{
@@ -633,12 +642,12 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
"and suppress this warning.";
return msg.str();
}
-
-
+
+
///! return an error string for when a required policy is unspecified
std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
{
@@ -664,25 +673,25 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
}
///! Get the default status for a policy
-cmPolicies::PolicyStatus
+cmPolicies::PolicyStatus
cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
{
// if the policy is not know then what?
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
{
// TODO is this right?
return cmPolicies::WARN;
}
-
+
return pos->second->Status;
}
void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
{
// now loop over all the policies and set them as appropriate
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
+ std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
{
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 23064dc..fce33ac 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -51,6 +51,7 @@ public:
CMP0013, // Duplicate binary directories not allowed
CMP0014, // Input directories must have CMakeLists.txt
CMP0015, // link_directories() treats paths relative to source dir
+ CMP0016, // target_link_libraries() fails if only argument is not a target
// Always the last entry. Useful mostly to avoid adding a comma
// the last policy when adding a new one.
@@ -60,10 +61,10 @@ public:
///! convert a string policy ID into a number
bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
std::string GetPolicyIDString(cmPolicies::PolicyID pid);
-
+
///! Get the default status for a policy
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
-
+
///! Define a Policy for CMake
void DefinePolicy(cmPolicies::PolicyID id,
const char *stringID,
@@ -80,7 +81,7 @@ public:
///! return a warning string for a given policy
std::string GetPolicyWarning(cmPolicies::PolicyID id);
-
+
///! return an error string for when a required policy is unspecified
std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index bc52d7f..b793cd5 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -101,11 +101,11 @@ cmSourceFileLocation const& cmSourceFile::GetLocation() const
}
//----------------------------------------------------------------------------
-std::string const& cmSourceFile::GetFullPath()
+std::string const& cmSourceFile::GetFullPath(std::string* error)
{
if(this->FullPath.empty())
{
- if(this->FindFullPath())
+ if(this->FindFullPath(error))
{
this->CheckExtension();
}
@@ -120,7 +120,7 @@ std::string const& cmSourceFile::GetFullPath() const
}
//----------------------------------------------------------------------------
-bool cmSourceFile::FindFullPath()
+bool cmSourceFile::FindFullPath(std::string* error)
{
// If thie method has already failed once do not try again.
if(this->FindFullPathFailed)
@@ -199,7 +199,14 @@ bool cmSourceFile::FindFullPath()
{
e << " ." << *ext;
}
- this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if(error)
+ {
+ *error = e.str();
+ }
+ else
+ {
+ this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
this->FindFullPathFailed = true;
return false;
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 937e4b7..2dc8488 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -60,7 +60,7 @@ public:
* horrible interface, but is necessary for backwards
* compatibility).
*/
- std::string const& GetFullPath();
+ std::string const& GetFullPath(std::string* error = 0);
std::string const& GetFullPath() const;
/**
@@ -108,7 +108,7 @@ private:
std::string FullPath;
bool FindFullPathFailed;
- bool FindFullPath();
+ bool FindFullPath(std::string* error);
bool TryFullPath(const char* tryPath, const char* ext);
void CheckExtension();
void CheckLanguage(std::string const& ext);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 271a662..7bc89a4 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -283,7 +283,22 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
cmSystemTools::Error(m.c_str());
}
-
+bool cmSystemTools::IsInternallyOn(const char* val)
+{
+ if (!val)
+ {
+ return false;
+ }
+ std::basic_string<char> v = val;
+
+ for(std::basic_string<char>::iterator c = v.begin();
+ c != v.end(); c++)
+ {
+ *c = static_cast<char>(toupper(*c));
+ }
+ return (v == "I_ON" || v == "i_on");
+}
+
bool cmSystemTools::IsOn(const char* val)
{
if (!val)
@@ -1161,7 +1176,8 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
// Should be efficient enough on most system:
const int bufferSize = 4096;
char buffer[bufferSize];
- unsigned char const* buffer_uc = reinterpret_cast<unsigned char const*>(buffer);
+ unsigned char const* buffer_uc =
+ reinterpret_cast<unsigned char const*>(buffer);
// This copy loop is very sensitive on certain platforms with
// slightly broken stream libraries (like HPUX). Normally, it is
// incorrect to not check the error condition on the fin.read()
@@ -1916,12 +1932,20 @@ bool extract_tar(const char* outFileName, bool verbose,
}
if(extract)
{
+ r = archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME);
+ if (r != ARCHIVE_OK)
+ {
+ cmSystemTools::Error(
+ "Problem with archive_write_disk_set_options(): ",
+ archive_error_string(ext));
+ }
+
r = archive_write_header(ext, entry);
if (r != ARCHIVE_OK)
{
cmSystemTools::Error("Problem with archive_write_header(): ",
- archive_error_string(a));
- cmSystemTools::Error("Curren file:",
+ archive_error_string(ext));
+ cmSystemTools::Error("Current file:",
archive_entry_pathname(entry));
}
else
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6a9d849..6f9147c 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -103,6 +103,12 @@ public:
cmSystemTools::s_ErrorOccured = false;
}
+ /**
+ * Does a string indicates that CMake/CPack/CTest internally
+ * forced this value. This is not the same as On, but this
+ * may be considered as "internally switched on".
+ */
+ static bool IsInternallyOn(const char* val);
/**
* does a string indicate a true or on value ? This is not the same
* as ifdef.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 45ba358..3ee329f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -393,6 +393,24 @@ void cmTarget::DefineProperties(cmake *cm)
"from which the target is imported.");
cm->DefineProperty
+ ("IMPORTED_NO_SONAME", cmProperty::TARGET,
+ "Specifies that an IMPORTED shared library target has no \"soname\". ",
+ "Set this property to true for an imported shared library file that "
+ "has no \"soname\" field. "
+ "CMake may adjust generated link commands for some platforms to prevent "
+ "the linker from using the path to the library in place of its missing "
+ "soname. "
+ "Ignored for non-imported targets.");
+
+ cm->DefineProperty
+ ("IMPORTED_NO_SONAME_<CONFIG>", cmProperty::TARGET,
+ "Per-configuration version of IMPORTED_NO_SONAME property.",
+ "This property is used when loading settings for the <CONFIG> "
+ "configuration of an imported target. "
+ "Configuration names correspond to those provided by the project "
+ "from which the target is imported.");
+
+ cm->DefineProperty
("EXCLUDE_FROM_ALL", cmProperty::TARGET,
"Exclude the target from the all target.",
"A property on a target that indicates if the target is excluded "
@@ -854,10 +872,19 @@ void cmTarget::DefineProperties(cmake *cm)
"set_source_files_properties command.");
cm->DefineProperty
+ ("FOLDER", cmProperty::TARGET,
+ "Set the folder name. Use to organize targets in an IDE.",
+ "Targets with no FOLDER property will appear as top level "
+ "entities in IDEs like Visual Studio. Targets with the same "
+ "FOLDER property value will appear next to each other in a "
+ "folder of that name. To nest folders, use FOLDER values such "
+ "as 'GUI/Dialogs' with '/' characters separating folder levels.");
+
+ cm->DefineProperty
("PROJECT_LABEL", cmProperty::TARGET,
"Change the name of a target in an IDE.",
"Can be used to change the name of the target in an IDE "
- "like visual stuido. ");
+ "like Visual Studio. ");
cm->DefineProperty
("VS_KEYWORD", cmProperty::TARGET,
"Visual Studio project keyword.",
@@ -1031,18 +1058,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Collect the set of configuration types.
std::vector<std::string> configNames;
- if(const char* configurationTypes =
- mf->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
- {
- cmSystemTools::ExpandListArgument(configurationTypes, configNames);
- }
- else if(const char* buildType = mf->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- if(*buildType)
- {
- configNames.push_back(buildType);
- }
- }
+ mf->GetConfigurations(configNames);
// Setup per-configuration property default values.
const char* configProps[] = {
@@ -1430,8 +1446,15 @@ bool cmTarget::FindSourceFiles()
si = this->SourceFiles.begin();
si != this->SourceFiles.end(); ++si)
{
- if((*si)->GetFullPath().empty())
+ std::string e;
+ if((*si)->GetFullPath(&e).empty())
{
+ if(!e.empty())
+ {
+ cmake* cm = this->Makefile->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, e,
+ this->GetBacktrace());
+ }
return false;
}
}
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index f1f76c8..805959d 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -29,23 +29,64 @@ bool cmTargetLinkLibrariesCommand
return false;
}
- // but we might not have any libs after variable expansion
- if(args.size() < 2)
- {
- return true;
- }
-
// Lookup the target for which libraries are specified.
this->Target =
this->Makefile->GetCMakeInstance()
->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
if(!this->Target)
{
+ cmake::MessageType t = cmake::FATAL_ERROR; // fail by default
cmOStringStream e;
e << "Cannot specify link libraries for target \"" << args[0] << "\" "
<< "which is not built by this project.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- cmSystemTools::SetFatalErrorOccured();
+ // The bad target is the only argument. Check how policy CMP0016 is set,
+ // and accept, warn or fail respectively:
+ if (args.size() < 2)
+ {
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0016))
+ {
+ case cmPolicies::WARN:
+ t = cmake::AUTHOR_WARNING;
+ // Print the warning.
+ e << "\n"
+ << "CMake does not support this but it used to work accidentally "
+ << "and is being allowed for compatibility."
+ << "\n" << this->Makefile->GetPolicies()->
+ GetPolicyWarning(cmPolicies::CMP0016);
+ break;
+ case cmPolicies::OLD: // OLD behavior does not warn.
+ t = cmake::MESSAGE;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ e << "\n" << this->Makefile->GetPolicies()->
+ GetRequiredPolicyError(cmPolicies::CMP0016);
+ break;
+ case cmPolicies::NEW: // NEW behavior prints the error.
+ default:
+ break;
+ }
+ }
+
+ // now actually print the message
+ switch(t)
+ {
+ case cmake::AUTHOR_WARNING:
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ break;
+ case cmake::FATAL_ERROR:
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+
+ // but we might not have any libs after variable expansion
+ if(args.size() < 2)
+ {
return true;
}
@@ -57,7 +98,7 @@ bool cmTargetLinkLibrariesCommand
// specification when the keyword is encountered.
this->DoingInterface = false;
- // add libraries, nothe that there is an optional prefix
+ // add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
for(unsigned int i=1; i < args.size(); ++i)
{
@@ -118,7 +159,7 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::GENERAL;
std::string linkType = args[0];
linkType += "_LINK_TYPE";
- const char* linkTypeString =
+ const char* linkTypeString =
this->Makefile->GetDefinition( linkType.c_str() );
if(linkTypeString)
{
@@ -133,7 +174,7 @@ bool cmTargetLinkLibrariesCommand
}
this->HandleLibrary(args[i].c_str(), llt);
}
- }
+ }
// Make sure the last argument was not a library type specifier.
if(haveLLT)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ca522bb..b290aed 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -155,6 +155,13 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
+ if(!projLabel)
+ {
+ projLabel = this->Name.c_str();
+ }
+ this->WriteString("<ProjectName>", 2);
+ (*this->BuildFileStream) << projLabel << "</ProjectName>\n";
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
@@ -807,10 +814,12 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
{
- if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+ cmTarget::TargetType ttype = this->Target->GetType();
+ if(ttype > cmTarget::GLOBAL_TARGET)
{
return;
}
+
this->WriteString("<PropertyGroup>\n", 2);
this->WriteString("<_ProjectFileVersion>10.0.20506.1"
"</_ProjectFileVersion>\n", 3);
@@ -820,36 +829,50 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
for(std::vector<std::string>::iterator config = configs->begin();
config != configs->end(); ++config)
{
- std::string targetNameFull =
- this->Target->GetFullName(config->c_str());
- std::string intermediateDir = this->LocalGenerator->
- GetTargetDirectory(*this->Target);
- intermediateDir += "/";
- intermediateDir += *config;
- intermediateDir += "/";
- this->ConvertToWindowsSlash(intermediateDir);
- std::string outDir = this->Target->GetDirectory(config->c_str());
- this->ConvertToWindowsSlash(outDir);
- this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
- *this->BuildFileStream << outDir
- << "\\"
- << "</OutDir>\n";
- this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
- *this->BuildFileStream << intermediateDir
- << "</IntDir>\n";
- this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
- *this->BuildFileStream << cmSystemTools::GetFilenameWithoutExtension(
- targetNameFull.c_str())
- << "</TargetName>\n";
-
- this->WritePlatformConfigTag("TargetExt", config->c_str(), 3);
- *this->BuildFileStream << cmSystemTools::GetFilenameLastExtension(
- targetNameFull.c_str())
- << "</TargetExt>\n";
- this->OutputLinkIncremental(*config);
+ if(ttype >= cmTarget::UTILITY)
+ {
+ this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
+ *this->BuildFileStream
+ << "$(Platform)\\$(Configuration)\\$(ProjectName)\\"
+ << "</IntDir>\n";
+ }
+ else
+ {
+ std::string targetNameFull =
+ this->Target->GetFullName(config->c_str());
+ std::string intermediateDir = this->LocalGenerator->
+ GetTargetDirectory(*this->Target);
+ intermediateDir += "/";
+ intermediateDir += *config;
+ intermediateDir += "/";
+ this->ConvertToWindowsSlash(intermediateDir);
+ std::string outDir = this->Target->GetDirectory(config->c_str());
+ this->ConvertToWindowsSlash(outDir);
+
+ this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
+ *this->BuildFileStream << outDir
+ << "\\"
+ << "</OutDir>\n";
+
+ this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
+ *this->BuildFileStream << intermediateDir
+ << "</IntDir>\n";
+
+ this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
+ *this->BuildFileStream
+ << cmSystemTools::GetFilenameWithoutLastExtension(
+ targetNameFull.c_str())
+ << "</TargetName>\n";
+
+ this->WritePlatformConfigTag("TargetExt", config->c_str(), 3);
+ *this->BuildFileStream
+ << cmSystemTools::GetFilenameLastExtension(targetNameFull.c_str())
+ << "</TargetExt>\n";
+
+ this->OutputLinkIncremental(*config);
+ }
}
this->WriteString("</PropertyGroup>\n", 2);
-
}
@@ -1422,7 +1445,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{
- cmGlobalGenerator::TargetDependSet& depends
+ cmGlobalGenerator::TargetDependSet const& depends
= this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
this->WriteString("<ItemGroup>\n", 1);
for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin();
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 07c7b8c..5920470 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -236,7 +236,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const
// considered special by the Xcode project file parser.
bool needQuote =
(this->String.empty() ||
- this->String.find_first_of(" <>.+-=@") != this->String.npos);
+ this->String.find_first_of(" <>.+-=@$") != this->String.npos);
const char* quote = needQuote? "\"" : "";
// Print the string, quoted and escaped as necessary.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 8c12ca9..3aa4aa0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1612,6 +1612,24 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
return 1;
}
+#ifdef WIN32
+ // OK, on windows 7 after we untar some files,
+ // sometimes we can not rename the directory after
+ // the untar is done. This breaks the external project
+ // untar and rename code. So, by default we will wait
+ // 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
+ // is set in the env, its value will be used instead of 100.
+ int delay = 100;
+ const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
+ if(delayVar)
+ {
+ delay = atoi(delayVar);
+ }
+ if(delay)
+ {
+ cmSystemTools::Delay(delay);
+ }
+#endif
}
return 0;
}
@@ -3532,6 +3550,23 @@ void cmake::DefineProperties(cmake *cm)
"the value of this property. "
"Non-Makefile generators currently ignore this property.");
+ 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. "
+ "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 "
+ "for the FOLDER target property.");
+
+ cm->DefineProperty
+ ("PREDEFINED_TARGETS_FOLDER", cmProperty::GLOBAL,
+ "Name of FOLDER for targets that are added automatically by CMake.",
+ "If not set, CMake uses \"CMakePredefinedTargets\" as a default "
+ "value for this property. Targets such as INSTALL, PACKAGE and "
+ "RUN_TESTS will be organized into this FOLDER. See also the "
+ "documentation for the FOLDER target property.");
+
// ================================================================
// define variables as well
// ================================================================
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 24921c4..3937d8d 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -152,7 +152,7 @@ static const char * cmDocumentationOptions[][3] =
"popups and interactive "
"debugging."},
{"--no-label-summary", "Disable timing summary information for labels.",
- "This option tells ctest to not print summary information for each label "
+ "This option tells ctest not to print summary information for each label "
"associated with the tests run. If there are no labels on the "
"tests, nothing extra is printed."},
{"--build-and-test", "Configure, build and run a test.",
@@ -229,6 +229,9 @@ static const char * cmDocumentationOptions[][3] =
"This flag will turn off automatic compression of test output. Use this "
"to maintain compatibility with an older version of CDash which doesn't "
"support compressed test output."},
+ {"--print-labels", "Print all available test labels.",
+ "This option will not run any tests, it will simply print the list of "
+ "all labels associated with the test set."},
{"--help-command <cmd> [<file>]", "Show help for a single command and exit.",
"Prints the help for the command to stdout or to the specified file." },
{"--help-command-list [<file>]", "List available commands and exit.",
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index 1ea0a66..56776a3 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -29,6 +29,11 @@
it in a single source file instead of a separate header and
implementation file. */
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wcast-align"
+#endif
+
/*
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
@@ -428,6 +433,10 @@ static void md5_finish(md5_state_t *pms, md5_byte_t digest[16])
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
/*--------------------------------------------------------------------------*/
/* Wrap up the MD5 state in our opaque structure. */
struct kwsysMD5_s
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index bcdb193..8aa99eb 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1405,6 +1405,10 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
{
kwsys_stl::string path = p;
kwsys_stl::vector<kwsys::String> paths;
+ if(path.empty())
+ {
+ return paths;
+ }
if(isPath && path[0] == '/')
{
path.erase(path.begin());
@@ -3059,30 +3063,35 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
static int GetCasePathName(const kwsys_stl::string & pathIn,
kwsys_stl::string & casePath)
{
- kwsys_stl::vector<kwsys::String> path_components =
- SystemTools::SplitString(pathIn.c_str(), '/', true);
- if(path_components.empty())
+ kwsys_stl::vector<kwsys_stl::string> path_components;
+ SystemTools::SplitPath(pathIn.c_str(), path_components);
+ if(path_components[0].empty()) // First component always exists.
{
+ // Relative paths cannot be converted.
casePath = "";
return 0;
}
+
+ // Start with root component.
kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
- // assume always absolute path, so just take first
casePath = path_components[idx++];
+ const char* sep = "";
+
// If network path, fill casePath with server/share so FindFirstFile
// will work after that. Maybe someday call other APIs to get
// actual case of servers and shares.
- if(path_components.size() > 2 && pathIn.size() >= 2 &&
- pathIn[0] == '/' && pathIn[1] == '/')
+ if(path_components.size() > 2 && path_components[0] == "//")
{
casePath += path_components[idx++];
casePath += "/";
casePath += path_components[idx++];
+ sep = "/";
}
for(; idx < path_components.size(); idx++)
{
- casePath += "/";
+ casePath += sep;
+ sep = "/";
kwsys_stl::string test_str = casePath;
test_str += path_components[idx];
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index ec70320..cf47923 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -372,8 +372,8 @@ public:
* "c:/" = Windows full path (can be any drive letter)
* "c:" = Windows drive-letter relative path (can be any drive letter)
* "//" = Network path
- * "~" = Home path for current user
- * "~u" = Home path for user 'u'
+ * "~/" = Home path for current user
+ * "~u/" = Home path for user 'u'
* "" = Relative path
*
* A pointer to the rest of the path after the root component is
@@ -385,7 +385,7 @@ public:
/**
* Split a path name into its basic components. The first component
- * is one of the roots returned by SplitPathRootComponent.
+ * always exists and is the root returned by SplitPathRootComponent.
* The remaining components form the path. If there is a trailing
* slash then the last component is the empty string. The
* components can be recombined as "c[0]c[1]/c[2]/.../c[n]" to
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 8691e1a..7694753 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 08)
+SET(KWSYS_DATE_STAMP_MONTH 09)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 25)
+SET(KWSYS_DATE_STAMP_DAY 23)