Merge branch 'master' into AutomocIncludedDotMocFileHandling

Conflicts:
	Source/cmTarget.cxx
This commit is contained in:
David Cole
2011-12-07 16:29:13 -05:00
201 changed files with 7588 additions and 567 deletions
+2
View File
@@ -0,0 +1,2 @@
# Preserve upstream indentation style.
cm_sha2.* whitespace=indent-with-non-tab
+7
View File
@@ -129,6 +129,8 @@ SET(SRCS
cmComputeLinkInformation.h
cmComputeTargetDepends.h
cmComputeTargetDepends.cxx
cmCryptoHash.cxx
cmCryptoHash.h
cmCustomCommand.cxx
cmCustomCommand.h
cmCustomCommandGenerator.cxx
@@ -160,6 +162,7 @@ SET(SRCS
cmDocumentationSection.cxx
cmDocumentCompileDefinitions.h
cmDocumentGeneratorExpressions.h
cmDocumentLocationUndefined.h
cmDocumentVariables.cxx
cmDynamicLoader.cxx
cmDynamicLoader.h
@@ -214,6 +217,8 @@ SET(SRCS
cmMakefileExecutableTargetGenerator.cxx
cmMakefileLibraryTargetGenerator.cxx
cmMakefileUtilityTargetGenerator.cxx
cmNewLineStyle.h
cmNewLineStyle.cxx
cmOrderDirectories.cxx
cmOrderDirectories.h
cmPolicies.h
@@ -259,6 +264,8 @@ SET(SRCS
cmakewizard.cxx
cmakewizard.h
cm_sha2.h
cm_sha2.c
cm_utf8.h
cm_utf8.c
)
+7 -5
View File
@@ -12,15 +12,16 @@
#include "AddCacheEntry.h"
#include <QMetaProperty>
#include <QCompleter>
static const int NumTypes = 4;
static const QString TypeStrings[NumTypes] =
static const QString TypeStrings[NumTypes] =
{ "BOOL", "PATH", "FILEPATH", "STRING" };
static const QCMakeProperty::PropertyType Types[NumTypes] =
{ QCMakeProperty::BOOL, QCMakeProperty::PATH,
QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
static const QCMakeProperty::PropertyType Types[NumTypes] =
{ QCMakeProperty::BOOL, QCMakeProperty::PATH,
QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
AddCacheEntry::AddCacheEntry(QWidget* p)
AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions)
: QWidget(p)
{
this->setupUi(this);
@@ -42,6 +43,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p)
this->setTabOrder(path, filepath);
this->setTabOrder(filepath, string);
this->setTabOrder(string, this->Description);
this->Name->setCompleter(new QCompleter(completions, this));
}
QString AddCacheEntry::name() const
+2 -1
View File
@@ -15,6 +15,7 @@
#include <QWidget>
#include <QCheckBox>
#include <QStringList>
#include "QCMake.h"
#include "ui_AddCacheEntry.h"
@@ -23,7 +24,7 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry
{
Q_OBJECT
public:
AddCacheEntry(QWidget* p);
AddCacheEntry(QWidget* p, const QStringList& completions);
QString name() const;
QVariant value() const;
+24 -1
View File
@@ -68,6 +68,9 @@ CMakeSetupDialog::CMakeSetupDialog()
int w = settings.value("Width", 700).toInt();
this->resize(w, h);
this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
QWidget* cont = new QWidget(this);
this->setupUi(cont);
this->Splitter->setStretchFactor(0, 3);
@@ -1008,7 +1011,7 @@ void CMakeSetupDialog::addCacheEntry()
dialog.resize(400, 200);
dialog.setWindowTitle(tr("Add Cache Entry"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
AddCacheEntry* w = new AddCacheEntry(&dialog);
AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions);
QDialogButtonBox* btns = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
@@ -1021,6 +1024,26 @@ void CMakeSetupDialog::addCacheEntry()
{
QCMakeCacheModel* m = this->CacheValues->cacheModel();
m->insertProperty(w->type(), w->name(), w->description(), w->value(), false);
// only add variable names to the completion which are new
if (!this->AddVariableCompletions.contains(w->name()))
{
this->AddVariableCompletions << w->name();
// limit to at most 100 completion items
if (this->AddVariableCompletions.size() > 100)
{
this->AddVariableCompletions.removeFirst();
}
// make sure CMAKE_INSTALL_PREFIX is always there
if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX"))
{
this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX");
}
QSettings settings;
settings.beginGroup("Settings/StartPath");
settings.setValue("AddVariableCompletionEntries",
this->AddVariableCompletions);
}
}
}
+6 -4
View File
@@ -36,7 +36,7 @@ public slots:
void setBinaryDirectory(const QString& dir);
void setSourceDirectory(const QString& dir);
protected slots:
protected slots:
void initialize();
void doConfigure();
void doGenerate();
@@ -46,7 +46,7 @@ protected slots:
void doInterrupt();
void error(const QString& message);
void message(const QString& message);
void doSourceBrowse();
void doBinaryBrowse();
void doReloadCache();
@@ -105,6 +105,8 @@ protected:
QTextCharFormat ErrorFormat;
QTextCharFormat MessageFormat;
QStringList AddVariableCompletions;
QEventLoop LocalLoop;
float ProgressOffset;
@@ -118,8 +120,8 @@ class QCMakeThread : public QThread
public:
QCMakeThread(QObject* p);
QCMake* cmakeInstance() const;
signals:
signals:
void cmakeInitialized();
protected:
+51 -6
View File
@@ -1440,6 +1440,43 @@ int cmCTest::RunTest(std::vector<const char*> argv,
return result;
}
//----------------------------------------------------------------------
std::string cmCTest::SafeBuildIdField(const std::string& value)
{
std::string safevalue(value);
if (safevalue != "")
{
// Disallow non-filename and non-space whitespace characters.
// If they occur, replace them with ""
//
const char *disallowed = "\\/:*?\"<>|\n\r\t\f\v";
if (safevalue.find_first_of(disallowed) != value.npos)
{
std::string::size_type i = 0;
std::string::size_type n = strlen(disallowed);
char replace[2];
replace[1] = 0;
for (i= 0; i<n; ++i)
{
replace[0] = disallowed[i];
cmSystemTools::ReplaceString(safevalue, replace, "");
}
}
safevalue = cmXMLSafe(safevalue).str();
}
if (safevalue == "")
{
safevalue = "(empty)";
}
return safevalue;
}
//----------------------------------------------------------------------
void cmCTest::StartXML(std::ostream& ostr, bool append)
{
@@ -1450,19 +1487,27 @@ void cmCTest::StartXML(std::ostream& ostr, bool append)
" NightlStartTime was not set correctly." << std::endl);
cmSystemTools::SetFatalErrorOccured();
}
// find out about the system
cmsys::SystemInformation info;
info.RunCPUCheck();
info.RunOSCheck();
info.RunMemoryCheck();
std::string buildname = cmCTest::SafeBuildIdField(
this->GetCTestConfiguration("BuildName"));
std::string stamp = cmCTest::SafeBuildIdField(
this->CurrentTag + "-" + this->GetTestModelString());
std::string site = cmCTest::SafeBuildIdField(
this->GetCTestConfiguration("Site"));
ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName")
<< "\"\n\tBuildStamp=\"" << this->CurrentTag << "-"
<< this->GetTestModelString() << "\"\n\tName=\""
<< this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-"
<< cmVersion::GetCMakeVersion() << "\"\n"
<< "<Site BuildName=\"" << buildname << "\"\n"
<< "\tBuildStamp=\"" << stamp << "\"\n"
<< "\tName=\"" << site << "\"\n"
<< "\tGenerator=\"ctest-" << cmVersion::GetCMakeVersion() << "\"\n"
<< (append? "\tAppend=\"true\"\n":"")
<< "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
<< "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
<< "\"\n"
#ifdef _COMPILER_VERSION
<< "\tCompilerVersion=\"_COMPILER_VERSION\"\n"
+4
View File
@@ -259,6 +259,10 @@ public:
std::string* stdOut, std::string* stdErr,
int* retVal = 0, const char* dir = 0, double timeout = 0.0);
//! Clean/make safe for xml the given value such that it may be used as
// one of the key fields by CDash when computing the buildid.
static std::string SafeBuildIdField(const std::string& value);
//! Start CTest XML output file
void StartXML(std::ostream& ostr, bool append);
+3 -2
View File
@@ -1318,8 +1318,9 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
this->AddFrameworkPath(this->SplitFramework.match(1));
// Add the item using the -framework option.
std::string fw = "-framework ";
fw += this->SplitFramework.match(2);
this->Items.push_back(Item("-framework", false));
std::string fw = this->SplitFramework.match(2);
fw = this->LocalGenerator->EscapeForShell(fw.c_str());
this->Items.push_back(Item(fw, false));
}
+14 -1
View File
@@ -65,6 +65,12 @@ bool cmConfigureFileCommand
cmSystemTools::SetFatalErrorOccured();
return false;
}
std::string errorMessage;
if (!this->NewLineStyle.ReadFromArguments(args, errorMessage))
{
this->SetError(errorMessage.c_str());
return false;
}
this->CopyOnly = false;
this->EscapeQuotes = false;
@@ -78,6 +84,12 @@ bool cmConfigureFileCommand
if(args[i] == "COPYONLY")
{
this->CopyOnly = true;
if (this->NewLineStyle.IsValid())
{
this->SetError("COPYONLY could not be used in combination "
"with NEWLINE_STYLE");
return false;
}
}
else if(args[i] == "ESCAPE_QUOTES")
{
@@ -122,7 +134,8 @@ int cmConfigureFileCommand::ConfigureFile()
this->OutputFile.c_str(),
this->CopyOnly,
this->AtOnly,
this->EscapeQuotes);
this->EscapeQuotes,
this->NewLineStyle);
}
+9 -2
View File
@@ -56,7 +56,8 @@ public:
{
return
" configure_file(<input> <output>\n"
" [COPYONLY] [ESCAPE_QUOTES] [@ONLY])\n"
" [COPYONLY] [ESCAPE_QUOTES] [@ONLY] \n"
" [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])\n"
"Copies a file <input> to file <output> and substitutes variable "
"values referenced in the file content. "
"If <input> is a relative path it is evaluated with respect to "
@@ -81,14 +82,20 @@ public:
"either #define VAR or /* #undef VAR */ depending on "
"the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR "
"will be replaced with either #define VAR 1 or #define VAR 0 "
"depending on whether VAR evaluates to TRUE or FALSE in CMake";
"depending on whether VAR evaluates to TRUE or FALSE in CMake.\n"
"With NEWLINE_STYLE the line ending could be adjusted: \n"
" 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n"
"COPYONLY must not be used with NEWLINE_STYLE.\n";
}
virtual void FinalPass();
virtual bool HasFinalPass() const { return !this->Immediate; }
private:
int ConfigureFile();
cmNewLineStyle NewLineStyle;
std::string InputFile;
std::string OutputFile;
bool CopyOnly;
+130
View File
@@ -0,0 +1,130 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmCryptoHash.h"
#include <cmsys/MD5.h>
#include "cm_sha2.h"
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
{
if(strcmp(algo,"MD5") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashMD5); }
else if(strcmp(algo,"SHA1") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA1); }
else if(strcmp(algo,"SHA224") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA224); }
else if(strcmp(algo,"SHA256") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA256); }
else if(strcmp(algo,"SHA384") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA384); }
else if(strcmp(algo,"SHA512") == 0)
{ return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512); }
else
{ return cmsys::auto_ptr<cmCryptoHash>(0); }
}
//----------------------------------------------------------------------------
std::string cmCryptoHash::HashString(const char* input)
{
this->Initialize();
this->Append(reinterpret_cast<unsigned char const*>(input),
static_cast<int>(strlen(input)));
return this->Finalize();
}
//----------------------------------------------------------------------------
std::string cmCryptoHash::HashFile(const char* file)
{
std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
if(!fin)
{
return "";
}
this->Initialize();
// 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);
// 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()
// before using the data, but the fin.gcount() will be zero if an
// error occurred. Therefore, the loop should be safe everywhere.
while(fin)
{
fin.read(buffer, bufferSize);
if(int gcount = static_cast<int>(fin.gcount()))
{
this->Append(buffer_uc, gcount);
}
}
if(fin.eof())
{
return this->Finalize();
}
return "";
}
//----------------------------------------------------------------------------
cmCryptoHashMD5::cmCryptoHashMD5(): MD5(cmsysMD5_New())
{
}
//----------------------------------------------------------------------------
cmCryptoHashMD5::~cmCryptoHashMD5()
{
cmsysMD5_Delete(this->MD5);
}
//----------------------------------------------------------------------------
void cmCryptoHashMD5::Initialize()
{
cmsysMD5_Initialize(this->MD5);
}
//----------------------------------------------------------------------------
void cmCryptoHashMD5::Append(unsigned char const* buf, int sz)
{
cmsysMD5_Append(this->MD5, buf, sz);
}
//----------------------------------------------------------------------------
std::string cmCryptoHashMD5::Finalize()
{
char md5out[32];
cmsysMD5_FinalizeHex(this->MD5, md5out);
return std::string(md5out, 32);
}
#define cmCryptoHash_SHA_CLASS_IMPL(SHA) \
cmCryptoHash##SHA::cmCryptoHash##SHA(): SHA(new SHA_CTX) {} \
cmCryptoHash##SHA::~cmCryptoHash##SHA() { delete this->SHA; } \
void cmCryptoHash##SHA::Initialize() { SHA##_Init(this->SHA); } \
void cmCryptoHash##SHA::Append(unsigned char const* buf, int sz) \
{ SHA##_Update(this->SHA, buf, sz); } \
std::string cmCryptoHash##SHA::Finalize() \
{ \
char out[SHA##_DIGEST_STRING_LENGTH]; \
SHA##_End(this->SHA, out); \
return std::string(out, SHA##_DIGEST_STRING_LENGTH-1); \
}
cmCryptoHash_SHA_CLASS_IMPL(SHA1)
cmCryptoHash_SHA_CLASS_IMPL(SHA224)
cmCryptoHash_SHA_CLASS_IMPL(SHA256)
cmCryptoHash_SHA_CLASS_IMPL(SHA384)
cmCryptoHash_SHA_CLASS_IMPL(SHA512)
+65
View File
@@ -0,0 +1,65 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmCryptoHash_h
#define cmCryptoHash_h
#include "cmStandardIncludes.h"
#include <cmsys/auto_ptr.hxx>
class cmCryptoHash
{
public:
virtual ~cmCryptoHash() {}
static cmsys::auto_ptr<cmCryptoHash> New(const char* algo);
std::string HashString(const char* input);
std::string HashFile(const char* file);
protected:
virtual void Initialize()=0;
virtual void Append(unsigned char const*, int)=0;
virtual std::string Finalize()=0;
};
class cmCryptoHashMD5: public cmCryptoHash
{
struct cmsysMD5_s* MD5;
public:
cmCryptoHashMD5();
~cmCryptoHashMD5();
protected:
virtual void Initialize();
virtual void Append(unsigned char const* buf, int sz);
virtual std::string Finalize();
};
#define cmCryptoHash_SHA_CLASS_DECL(SHA) \
class cmCryptoHash##SHA: public cmCryptoHash \
{ \
union _SHA_CTX* SHA; \
public: \
cmCryptoHash##SHA(); \
~cmCryptoHash##SHA(); \
protected: \
virtual void Initialize(); \
virtual void Append(unsigned char const* buf, int sz); \
virtual std::string Finalize(); \
}
cmCryptoHash_SHA_CLASS_DECL(SHA1);
cmCryptoHash_SHA_CLASS_DECL(SHA224);
cmCryptoHash_SHA_CLASS_DECL(SHA256);
cmCryptoHash_SHA_CLASS_DECL(SHA384);
cmCryptoHash_SHA_CLASS_DECL(SHA512);
#undef cmCryptoHash_SHA_CLASS_DECL
#endif
+24
View File
@@ -0,0 +1,24 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmDocumentLocationUndefined_h
#define cmDocumentLocationUndefined_h
#define CM_LOCATION_UNDEFINED_BEHAVIOR(action) \
"\n" \
"Do not set properties that affect the location of a target after " \
action ". These include properties whose names match " \
"\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?\" " \
"or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \
"Failure to follow this rule is not diagnosed and leaves the location " \
"of the target undefined."
#endif
+20
View File
@@ -1116,6 +1116,24 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
false,
"Variables that Control the Build");
cm->DefineProperty
("CMAKE_AUTOMOC_MOC_OPTIONS", cmProperty::VARIABLE,
"Additional options for moc when using automoc (see CMAKE_AUTOMOC).",
"This variable is used to initialize the "
"AUTOMOC_MOC_OPTIONS property on all the targets. "
"See that target property for additional information.",
false,
"Variables that Control the Build");
cm->DefineProperty
("CMAKE_GNUtoMS", cmProperty::VARIABLE,
"Convert GNU import libraries (.dll.a) to MS format (.lib).",
"This variable is used to initialize the GNUtoMS property on targets "
"when they are created. "
"See that target property for additional information.",
false,
"Variables that Control the Build");
cm->DefineProperty
("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE,
"See variable CMAKE_<CONFIG>_POSTFIX.",
@@ -1520,6 +1538,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_COMPILER_ID_RUN",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_ABI_FILES",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE",
+2
View File
@@ -125,6 +125,8 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
std::string value = target->GetFullPath(config, true);
target->GetImplibGNUtoMS(value, value,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value;
}
}
+2
View File
@@ -13,6 +13,7 @@
#define cmExportCommand_h
#include "cmCommand.h"
#include "cmDocumentLocationUndefined.h"
class cmExportBuildFileGenerator;
@@ -80,6 +81,7 @@ public:
"should never be installed. "
"See the install(EXPORT) command to export targets from an "
"installation tree."
CM_LOCATION_UNDEFINED_BEHAVIOR("passing it to this command")
"\n"
" export(PACKAGE <name>)\n"
"Store the current build directory in the CMake user package registry "
+63
View File
@@ -368,3 +368,66 @@ cmExportFileGenerator
os << " )\n"
<< "\n";
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
{
// Add code which verifies at cmake time that the file which is being
// imported actually exists on disk. This should in theory always be theory
// case, but still when packages are split into normal and development
// packages this might get broken (e.g. the Config.cmake could be part of
// the non-development package, something similar happened to me without
// on SUSE with a mysql pkg-config file, which claimed everything is fine,
// but the development package was not installed.).
os << "# Loop over all imported files and verify that they actually exist\n"
"FOREACH(target ${_IMPORT_CHECK_TARGETS} )\n"
" FOREACH(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
" IF(NOT EXISTS \"${file}\" )\n"
" MESSAGE(FATAL_ERROR \"The imported target \\\"${target}\\\""
" references the file\n"
" \\\"${file}\\\"\n"
"but this file does not exist. Possible reasons include:\n"
"* The file was deleted, renamed, or moved to another location.\n"
"* An install or uninstall procedure did not complete successfully.\n"
"* The installation package was faulty and contained\n"
" \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n"
"but not all the files it references.\n"
"\")\n"
" ENDIF()\n"
" ENDFOREACH()\n"
" UNSET(_IMPORT_CHECK_FILES_FOR_${target})\n"
"ENDFOREACH()\n"
"UNSET(_IMPORT_CHECK_TARGETS)\n"
"\n";
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations)
{
// Construct the imported target name.
std::string targetName = this->Namespace;
targetName += target->GetName();
os << "LIST(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n"
"LIST(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " ";
for(std::set<std::string>::const_iterator li = importedLocations.begin();
li != importedLocations.end();
++li)
{
ImportPropertyMap::const_iterator pi = properties.find(*li);
if (pi != properties.end())
{
os << "\"" << pi->second << "\" ";
}
}
os << ")\n\n";
}
+5
View File
@@ -56,6 +56,11 @@ protected:
void GenerateImportPropertyCode(std::ostream& os, const char* config,
cmTarget* target,
ImportPropertyMap const& properties);
void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations);
void GenerateImportedFileCheckLoop(std::ostream& os);
// Collect properties with detailed information about targets beyond
// their location on disk.
+20 -10
View File
@@ -167,16 +167,18 @@ cmExportInstallFileGenerator
// Collect import properties for this target.
cmTargetExport* te = *tei;
ImportPropertyMap properties;
std::set<std::string> importedLocations;
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix,
te->ArchiveGenerator, properties);
this->SetImportLocationProperty(config, suffix,
te->LibraryGenerator, properties);
this->SetImportLocationProperty(config, suffix,
te->RuntimeGenerator, properties);
this->SetImportLocationProperty(config, suffix,
te->FrameworkGenerator, properties);
this->SetImportLocationProperty(config, suffix,
te->BundleGenerator, properties);
te->RuntimeGenerator, properties,
importedLocations);
this->SetImportLocationProperty(config, suffix, te->FrameworkGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->BundleGenerator,
properties, importedLocations);
// If any file location was set for the target add it to the
// import file.
@@ -194,9 +196,13 @@ cmExportInstallFileGenerator
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, te->Target, properties);
this->GenerateImportedFileChecksCode(os, te->Target, properties,
importedLocations);
}
}
this->GenerateImportedFileCheckLoop(os);
// Cleanup the import prefix variable.
if(!this->ImportPrefix.empty())
{
@@ -211,7 +217,9 @@ void
cmExportInstallFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties)
ImportPropertyMap& properties,
std::set<std::string>& importedLocations
)
{
// Skip rules that do not match this configuration.
if(!(itgen && itgen->InstallsForConfig(config)))
@@ -249,6 +257,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
importedLocations.insert(prop);
}
else
{
@@ -291,6 +300,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
importedLocations.insert(prop);
}
}
+3 -1
View File
@@ -75,7 +75,9 @@ protected:
void SetImportLocationProperty(const char* config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties);
ImportPropertyMap& properties,
std::set<std::string>& importedLocations
);
void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
+40 -7
View File
@@ -85,7 +85,26 @@ void cmExtraEclipseCDT4Generator::Generate()
this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory);
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"));
mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT"));
if ((this->GenerateSourceProject == false)
&& (mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT")))
{
mf->IssueMessage(cmake::WARNING,
"ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT is set to TRUE, "
"but this variable is not supported anymore since CMake 2.8.7.\n"
"Enable CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT instead.");
}
if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
this->HomeDirectory.c_str()))
{
mf->IssueMessage(cmake::WARNING, "The build directory is a subdirectory "
"of the source directory.\n"
"This is not supported well by Eclipse. It is strongly "
"recommended to use a build directory which is a "
"sibling of the source directory.");
}
// NOTE: This is not good, since it pollutes the source tree. However,
// Eclipse doesn't allow CVS/SVN to work when the .project is not in
@@ -103,7 +122,7 @@ void cmExtraEclipseCDT4Generator::Generate()
this->CreateCProjectFile();
}
void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
{
assert(this->HomeDirectory != this->HomeOutputDirectory);
@@ -131,6 +150,16 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
"\t</buildSpec>\n"
"\t<natures>\n"
"\t</natures>\n"
"\t<linkedResources>\n";
if (this->SupportsVirtualFolders)
{
this->CreateLinksToSubprojects(fout, this->HomeDirectory);
this->SrcLinkedResources.clear();
}
fout <<
"\t</linkedResources>\n"
"</projectDescription>\n"
;
}
@@ -424,7 +453,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->SupportsVirtualFolders)
{
this->CreateLinksToSubprojects(fout);
this->CreateLinksToSubprojects(fout, this->HomeOutputDirectory);
this->CreateLinksForTargets(fout);
}
@@ -531,7 +560,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
cmGeneratedFileStream& fout)
cmGeneratedFileStream& fout, const std::string& baseDir)
{
// for each sub project create a linked resource to the source dir
// - only if it is an out-of-source build
@@ -547,8 +576,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
it->second[0]->GetMakefile()->GetStartDirectory());
// a linked resource must not point to a parent directory of .project or
// .project itself
if ((this->HomeOutputDirectory != linkSourceDirectory) &&
!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
if ((baseDir != linkSourceDirectory) &&
!cmSystemTools::IsSubDirectory(baseDir.c_str(),
linkSourceDirectory.c_str()))
{
std::string linkName = "[Subprojects]/";
@@ -998,7 +1027,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string virtDir = "[Targets]/";
virtDir += prefix;
virtDir += ti->first;
this->AppendTarget(fout, "Build", make, makeArgs, virtDir, "",
std::string buildArgs = "-C \"";
buildArgs += makefile->GetHomeOutputDirectory();
buildArgs += "\" ";
buildArgs += makeArgs;
this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
ti->first.c_str());
std::string cleanArgs = "-E chdir \"";
+3 -2
View File
@@ -46,7 +46,7 @@ public:
private:
// create .project file in the source tree
void CreateSourceProjectFile() const;
void CreateSourceProjectFile();
// create .project file
void CreateProjectFile();
@@ -104,7 +104,8 @@ private:
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
const std::string& baseDir);
void CreateLinksForTargets(cmGeneratedFileStream& fout);
std::vector<std::string> SrcLinkedResources;
+46
View File
@@ -13,6 +13,7 @@
#include "cmake.h"
#include "cmHexFileConverter.h"
#include "cmFileTimeComparison.h"
#include "cmCryptoHash.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_curl.h"
@@ -22,6 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cmsys/auto_ptr.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -83,6 +85,15 @@ bool cmFileCommand
{
return this->HandleReadCommand(args);
}
else if ( subCommand == "MD5" ||
subCommand == "SHA1" ||
subCommand == "SHA224" ||
subCommand == "SHA256" ||
subCommand == "SHA384" ||
subCommand == "SHA512" )
{
return this->HandleHashCommand(args);
}
else if ( subCommand == "STRINGS" )
{
return this->HandleStringsCommand(args);
@@ -338,6 +349,41 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
return true;
}
//----------------------------------------------------------------------------
bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
if(args.size() != 3)
{
cmOStringStream e;
e << args[0] << " requires a file name and output variable";
this->SetError(e.str().c_str());
return false;
}
cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if(hash.get())
{
std::string out = hash->HashFile(args[1].c_str());
if(!out.empty())
{
this->Makefile->AddDefinition(args[2].c_str(), out.c_str());
return true;
}
cmOStringStream e;
e << args[0] << " failed to read file \"" << args[1] << "\": "
<< cmSystemTools::GetLastSystemError();
this->SetError(e.str().c_str());
}
return false;
#else
cmOStringStream e;
e << args[0] << " not available during bootstrap";
this->SetError(e.str().c_str());
return false;
#endif
}
//----------------------------------------------------------------------------
bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{
+4
View File
@@ -65,6 +65,7 @@ public:
" file(WRITE filename \"message to write\"... )\n"
" file(APPEND filename \"message to write\"... )\n"
" file(READ filename variable [LIMIT numBytes] [OFFSET offset] [HEX])\n"
" file(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512> filename variable)\n"
" file(STRINGS filename variable [LIMIT_COUNT num]\n"
" [LIMIT_INPUT numBytes] [LIMIT_OUTPUT numBytes]\n"
" [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n"
@@ -94,6 +95,8 @@ public:
"variable. It will start at the given offset and read up to numBytes. "
"If the argument HEX is given, the binary data will be converted to "
"hexadecimal representation and this will be stored in the variable.\n"
"MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 "
"will compute a cryptographic hash of the content of a file.\n"
"STRINGS will parse a list of ASCII strings from a file and "
"store it in a variable. Binary data in the file are ignored. Carriage "
"return (CR) characters are ignored. It works also for Intel Hex and "
@@ -227,6 +230,7 @@ protected:
bool HandleRemove(std::vector<std::string> const& args, bool recurse);
bool HandleWriteCommand(std::vector<std::string> const& args, bool append);
bool HandleReadCommand(std::vector<std::string> const& args);
bool HandleHashCommand(std::vector<std::string> const& args);
bool HandleStringsCommand(std::vector<std::string> const& args);
bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse);
bool HandleMakeDirectoryCommand(std::vector<std::string> const& args);
+2 -1
View File
@@ -43,7 +43,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{
cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator;
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this);
return lg;
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmGlobalVisualStudio11Generator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
//----------------------------------------------------------------------------
@@ -35,6 +36,16 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
fout << "# Visual Studio 11\n";
}
//----------------------------------------------------------------------------
cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
{
cmLocalVisualStudio10Generator* lg =
new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11);
lg->SetPlatformName(this->GetPlatformName());
lg->SetGlobalGenerator(this);
return lg;
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio11Generator
::GetDocumentation(cmDocumentationEntry& entry) const
+3
View File
@@ -35,6 +35,9 @@ public:
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
/** TODO: VS 11 user macro support. */
virtual std::string GetUserMacrosDirectory() { return ""; }
protected:
+2 -2
View File
@@ -26,8 +26,8 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion71();
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
lg->SetGlobalGenerator(this);
return lg;
+2 -1
View File
@@ -133,7 +133,8 @@ std::string cmGlobalVisualStudio7Generator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
lg->SetGlobalGenerator(this);
return lg;
+2 -2
View File
@@ -28,8 +28,8 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
@@ -25,8 +25,8 @@ cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion8();
cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
+2 -2
View File
@@ -40,8 +40,8 @@ void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout)
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9();
cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
@@ -22,8 +22,8 @@ cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9();
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
@@ -22,8 +22,8 @@ cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator()
{
cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
lg->SetVersion9();
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9);
lg->SetPlatformName(this->GetPlatformName());
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
lg->SetGlobalGenerator(this);
+24 -2
View File
@@ -101,6 +101,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetNameImport;
filesFrom.push_back(from1);
filesTo.push_back(to1);
std::string targetNameImportLib;
if(this->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib))
{
filesFrom.push_back(fromDirConfig + targetNameImportLib);
filesTo.push_back(toDir + targetNameImportLib);
}
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
@@ -157,6 +164,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetNameImport;
filesFrom.push_back(from1);
filesTo.push_back(to1);
std::string targetNameImportLib;
if(this->Target->GetImplibGNUtoMS(targetNameImport,
targetNameImportLib))
{
filesFrom.push_back(fromDirConfig + targetNameImportLib);
filesTo.push_back(toDir + targetNameImportLib);
}
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
@@ -314,7 +328,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
if(nameType == NameImplib)
{
// Use the import library name.
fname = targetNameImport;
if(!target->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{
fname = targetNameImport;
}
}
else if(nameType == NameReal)
{
@@ -339,7 +357,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
if(nameType == NameImplib)
{
// Use the import library name.
fname = targetNameImport;
if(!target->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{
fname = targetNameImport;
}
}
else if(nameType == NameSO)
{
+73 -73
View File
@@ -96,14 +96,14 @@ void cmLocalGenerator::Configure()
std::string filesDir = this->Makefile->GetStartOutputDirectory();
filesDir += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(filesDir.c_str());
// find & read the list file
this->ReadInputFile();
// at the end of the ReadListFile handle any old style subdirs
// first get all the subdirectories
std::vector<cmLocalGenerator *> subdirs = this->GetChildren();
// for each subdir recurse
std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi)
@@ -112,7 +112,7 @@ void cmLocalGenerator::Configure()
{
this->Makefile->ConfigureSubDirectory(*sdi);
}
}
}
// Check whether relative paths should be used for optionally
// relative paths.
@@ -212,10 +212,10 @@ void cmLocalGenerator::ReadInputFile()
}
void cmLocalGenerator::SetupPathConversions()
{
{
// Setup the current output directory components for use by
// Convert
std::string outdir;
std::string outdir;
outdir =
cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory());
cmSystemTools::SplitPath(outdir.c_str(), this->HomeDirectoryComponents);
@@ -225,12 +225,12 @@ void cmLocalGenerator::SetupPathConversions()
outdir = cmSystemTools::CollapseFullPath
(this->Makefile->GetHomeOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(),
cmSystemTools::SplitPath(outdir.c_str(),
this->HomeOutputDirectoryComponents);
outdir = cmSystemTools::CollapseFullPath
(this->Makefile->GetStartOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(),
cmSystemTools::SplitPath(outdir.c_str(),
this->StartOutputDirectoryComponents);
}
@@ -289,17 +289,17 @@ void cmLocalGenerator::GenerateTestFiles()
fout.SetCopyIfDifferent(true);
fout << "# CMake generated Testfile for " << std::endl
<< "# Source directory: "
<< "# Source directory: "
<< this->Makefile->GetStartDirectory() << std::endl
<< "# Build directory: "
<< "# Build directory: "
<< this->Makefile->GetStartOutputDirectory() << std::endl
<< "# " << std::endl
<< "# This file includes the relevent testing commands "
<< "required for " << std::endl
<< "# testing this directory and lists subdirectories to "
<< "be tested as well." << std::endl;
const char* testIncludeFile =
const char* testIncludeFile =
this->Makefile->GetProperty("TEST_INCLUDE_FILE");
if ( testIncludeFile )
{
@@ -320,7 +320,7 @@ void cmLocalGenerator::GenerateTestFiles()
for(i = 0; i < this->Children.size(); ++i)
{
fout << "SUBDIRS(";
std::string outP =
std::string outP =
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
fout << this->Convert(outP.c_str(),START_OUTPUT);
fout << ")" << std::endl;
@@ -472,7 +472,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Ask each install generator to write its code.
std::vector<cmInstallGenerator*> const& installers =
this->Makefile->GetInstallGenerators();
for(std::vector<cmInstallGenerator*>::const_iterator
for(std::vector<cmInstallGenerator*>::const_iterator
gi = installers.begin();
gi != installers.end(); ++gi)
{
@@ -553,15 +553,15 @@ void cmLocalGenerator::GenerateTargetManifest()
}
}
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
cmSourceFile& source,
cmTarget& )
{
{
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
std::string sourceFile =
std::string sourceFile =
this->Convert(source.GetFullPath().c_str(),START_OUTPUT,SHELL,true);
std::string varString = "CMAKE_";
varString += lang;
@@ -655,7 +655,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
ofname += "/";
ofname += obj;
objVector.push_back(ofname);
this->AddCustomCommandToCreateObject(ofname.c_str(),
this->AddCustomCommandToCreateObject(ofname.c_str(),
llang, *(*i), target);
objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE);
objs += " ";
@@ -672,7 +672,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
// Shared Module:
std::string linkLibs; // should be set
std::string flags; // should be set
std::string linkFlags; // should be set
std::string linkFlags; // should be set
this->GetTargetFlags(linkLibs, flags, linkFlags, target);
cmLocalGenerator::RuleVariables vars;
vars.Language = llang;
@@ -682,17 +682,17 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
std::string langFlags;
this->AddLanguageFlags(langFlags, llang, 0);
this->AddArchitectureFlags(langFlags, &target, llang, 0);
vars.LanguageCompileFlags = langFlags.c_str();
cmCustomCommandLines commandLines;
std::vector<std::string> rules;
rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str()));
std::vector<std::string> commands;
cmSystemTools::ExpandList(rules, commands);
cmSystemTools::ExpandList(rules, commands);
for(std::vector<std::string>::iterator i = commands.begin();
i != commands.end(); ++i)
{
@@ -728,21 +728,21 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
(this->Makefile->GetSource(targetFullPath.c_str()));
}
void cmLocalGenerator
::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang)
{
{
cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin();
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
cmTarget& target = l->second;
switch(target.GetType())
{
{
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
case cmTarget::EXECUTABLE:
case cmTarget::EXECUTABLE:
{
const char* llang = target.GetLinkerLanguage();
if(!llang)
@@ -759,7 +759,7 @@ void cmLocalGenerator
this->AddBuildTargetRule(llang, target);
}
}
break;
break;
default:
break;
}
@@ -769,14 +769,14 @@ void cmLocalGenerator
// List of variables that are replaced when
// rules are expanced. These variables are
// replaced in the form <var> with GetSafeDefinition(var).
// ${LANG} is replaced in the variable first with all enabled
// ${LANG} is replaced in the variable first with all enabled
// languages.
static const char* ruleReplaceVars[] =
{
"CMAKE_${LANG}_COMPILER",
"CMAKE_SHARED_LIBRARY_CREATE_${LANG}_FLAGS",
"CMAKE_SHARED_MODULE_CREATE_${LANG}_FLAGS",
"CMAKE_SHARED_MODULE_${LANG}_FLAGS",
"CMAKE_SHARED_MODULE_${LANG}_FLAGS",
"CMAKE_SHARED_LIBRARY_${LANG}_FLAGS",
"CMAKE_${LANG}_LINK_FLAGS",
"CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG",
@@ -807,7 +807,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.Flags;
}
}
if(replaceValues.Source)
{
if(variable == "SOURCE")
@@ -870,7 +870,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(replaceValues.Target)
{
{
if(variable == "TARGET_QUOTED")
{
std::string targetQuoted = replaceValues.Target;
@@ -1018,13 +1018,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
int pos = 0;
while(ruleReplaceVars[pos])
{
for(std::vector<std::string>::iterator i = enabledLanguages.begin();
i != enabledLanguages.end(); ++i)
{
for(std::vector<std::string>::iterator i = enabledLanguages.begin();
i != enabledLanguages.end(); ++i)
{
const char* lang = i->c_str();
std::string actualReplace = ruleReplaceVars[pos];
// If this is the compiler then look for the extra variable
// _COMPILER_ARG1 which must be the first argument to the compiler
// _COMPILER_ARG1 which must be the first argument to the compiler
const char* compilerArg1 = 0;
if(actualReplace == "CMAKE_${LANG}_COMPILER")
{
@@ -1038,7 +1038,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(actualReplace == variable)
{
std::string replace =
std::string replace =
this->Makefile->GetSafeDefinition(variable.c_str());
// if the variable is not a FLAG then treat it like a path
if(variable.find("_FLAG") == variable.npos)
@@ -1062,7 +1062,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
void
void
cmLocalGenerator::ExpandRuleVariables(std::string& s,
const RuleVariables& replaceValues)
{
@@ -1213,7 +1213,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
const char* includeFlag =
const char* includeFlag =
this->Makefile->GetSafeDefinition(flagVar.c_str());
flagVar = "CMAKE_INCLUDE_FLAG_SEP_";
flagVar += lang;
@@ -1223,7 +1223,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
{
quotePaths = true;
}
bool repeatFlag = true;
bool repeatFlag = true;
// should the include flag be repeated like ie. -IA -IB
if(!sep)
{
@@ -1354,15 +1354,15 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
this->Makefile->GetDefinition("VTK_SOURCE_DIR");
if(vtkSourceDir)
{
const char* vtk_major =
const char* vtk_major =
this->Makefile->GetDefinition("VTK_MAJOR_VERSION");
const char* vtk_minor =
const char* vtk_minor =
this->Makefile->GetDefinition("VTK_MINOR_VERSION");
vtk_major = vtk_major? vtk_major : "4";
vtk_minor = vtk_minor? vtk_minor : "4";
int vmajor = 0;
int vminor = 0;
if(sscanf(vtk_major, "%d", &vmajor) &&
if(sscanf(vtk_major, "%d", &vmajor) &&
sscanf(vtk_minor, "%d", &vminor) && vmajor == 4 && vminor <= 4)
{
includeSourceDir = true;
@@ -1403,7 +1403,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Get the project-specified include directories.
std::vector<std::string>& includes =
std::vector<std::string>& includes =
this->Makefile->GetIncludeDirectories();
// Support putting all the in-project include directories first if
@@ -1446,17 +1446,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
std::string& linkFlags,
cmTarget& target)
{
std::string buildType =
std::string buildType =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
buildType = cmSystemTools::UpperCase(buildType);
const char* libraryLinkVariable =
buildType = cmSystemTools::UpperCase(buildType);
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
switch(target.GetType())
{
case cmTarget::STATIC_LIBRARY:
case cmTarget::STATIC_LIBRARY:
{
const char* targetLinkFlags =
const char* targetLinkFlags =
target.GetProperty("STATIC_LIBRARY_FLAGS");
if(targetLinkFlags)
{
@@ -1475,11 +1475,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
}
}
break;
break;
case cmTarget::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
case cmTarget::SHARED_LIBRARY:
{
{
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
if(!buildType.empty())
@@ -1489,8 +1489,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
if(this->Makefile->IsOn("WIN32") &&
}
if(this->Makefile->IsOn("WIN32") &&
!(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
{
const std::vector<cmSourceFile*>& sources = target.GetSourceFiles();
@@ -1500,14 +1500,14 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
cmSourceFile* sf = *i;
if(sf->GetExtension() == "def")
{
linkFlags +=
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->Convert(sf->GetFullPath().c_str(),
START_OUTPUT, SHELL);
linkFlags += " ";
}
}
}
}
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
if(targetLinkFlags)
{
@@ -1520,11 +1520,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
{
{
linkFlags += targetLinkFlags;
linkFlags += " ";
}
}
}
cmOStringStream linklibsStr;
this->OutputLinkLibraries(linklibsStr, target, false);
linkLibs = linklibsStr.str();
@@ -1532,7 +1532,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
break;
case cmTarget::EXECUTABLE:
{
linkFlags +=
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if(!buildType.empty())
@@ -1541,7 +1541,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
}
const char* linkLanguage = target.GetLinkerLanguage();
if(!linkLanguage)
{
@@ -1566,7 +1566,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if(cmSystemTools::IsOn
(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
{
std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_")
std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_")
+ linkLanguage + std::string("_FLAGS");
linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str());
linkFlags += " ";
@@ -1579,7 +1579,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
else
{
linkFlags +=
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
linkFlags += " ";
}
@@ -1595,13 +1595,13 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
{
{
linkFlags += targetLinkFlags;
linkFlags += " ";
}
}
}
break;
break;
default:
break;
}
@@ -1661,9 +1661,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
const char* linkLanguage = cli.GetLinkLanguage();
std::string libPathFlag =
std::string libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
std::string libPathTerminator =
std::string libPathTerminator =
this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
// Flags to link an executable to shared libraries.
@@ -1786,11 +1786,11 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
{
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
const char* sysroot =
const char* sysroot =
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
const char* sysrootDefault =
const char* sysrootDefault =
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
const char* deploymentTarget =
const char* deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT";
bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str());
@@ -1876,7 +1876,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
if(cmSystemTools::FileIsFullPath(inName))
{
std::string tLocation;
if(target->GetType() >= cmTarget::EXECUTABLE &&
if(target->GetType() >= cmTarget::EXECUTABLE &&
target->GetType() <= cmTarget::MODULE_LIBRARY)
{
tLocation = target->GetLocation(config);
@@ -2904,7 +2904,7 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
else
{
cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags);
}
}
return std::string(&arg[0]);
}
@@ -2976,9 +2976,9 @@ cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
//----------------------------------------------------------------------------
void
void
cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* ,
std::vector<std::string>&
std::vector<std::string>&
)
{
cmSystemTools::Error("GetTargetObjectFileDirectories"
+26 -18
View File
@@ -607,6 +607,27 @@ cmLocalUnixMakefileGenerator3
}
}
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
{
if(this->WatcomWMake &&
cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos)
{
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
// lines with shell redirection operators.
std::string scmd;
if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
{
return this->Convert(scmd.c_str(), NONE, SHELL);
}
}
return this->Convert(cmd.c_str(), root, SHELL);
}
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3
@@ -646,13 +667,13 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
<< this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
<< this->ConvertShellCommand(cmakecommand, FULL)
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
<< this->Convert(cmakecommand.c_str(),FULL,SHELL).c_str()
<< this->ConvertShellCommand(cmakecommand, FULL)
<< " -E remove -f\n"
<< "\n";
@@ -662,7 +683,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The program to use to edit the cache.\n"
<< "CMAKE_EDIT_COMMAND = "
<< this->Convert(edit_cmd,FULL,SHELL) << "\n"
<< this->ConvertShellCommand(edit_cmd, FULL) << "\n"
<< "\n";
}
@@ -697,7 +718,7 @@ cmLocalUnixMakefileGenerator3
// This should be the first target except for the default_target in
// the interface Makefile.
this->WriteMakeRule(
makefileStream, "Disable implicit rules so canoncical targets will work.",
makefileStream, "Disable implicit rules so canonical targets will work.",
".SUFFIXES", no_depends, no_commands, false);
if(!this->NMake && !this->WatcomWMake && !this->BorlandMakeCurlyHack)
@@ -1019,22 +1040,9 @@ cmLocalUnixMakefileGenerator3
// without the current directory being in the search path.
cmd = "./" + cmd;
}
if(this->WatcomWMake &&
cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find(" ") != cmd.npos)
{
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
// lines with shell redirection operators.
std::string scmd;
if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
{
cmd = scmd;
}
}
std::string launcher =
this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
cmd = launcher + this->ConvertShellCommand(cmd, NONE);
ccg.AppendArguments(c, cmd);
if(content)
+1
View File
@@ -340,6 +340,7 @@ protected:
void CheckMultipleOutputs(bool verbose);
private:
std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
RelativeRoot relative);
+2 -1
View File
@@ -61,7 +61,8 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator(VSVersion v):
cmLocalVisualStudio7Generator(v)
{
}
+1 -1
View File
@@ -25,7 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio10Generator();
cmLocalVisualStudio10Generator(VSVersion v);
virtual ~cmLocalVisualStudio10Generator();
+2 -1
View File
@@ -21,7 +21,8 @@
#include <cmsys/RegularExpression.hxx>
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator()
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator():
cmLocalVisualStudioGenerator(VS6)
{
}
+16 -9
View File
@@ -45,9 +45,9 @@ private:
extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator()
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v):
cmLocalVisualStudioGenerator(v)
{
this->Version = 7;
this->PlatformName = "Win32";
this->ExtraFlagTable = 0;
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
@@ -719,7 +719,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
t = Options::FortranCompiler;
table = cmLocalVisualStudio7GeneratorFortranFlagTable;
}
Options targetOptions(this, this->Version, t,
Options targetOptions(this, t,
table,
this->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
@@ -888,7 +888,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// end of <Tool Name=VCMIDLTool
// Check if we need the FAT32 workaround.
if(targetBuilds && this->Version >= 8)
if(targetBuilds && this->Version >= VS8)
{
// Check the filesystem type where the target will be written.
if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str()))
@@ -975,7 +975,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags;
}
Options linkOptions(this, this->Version, Options::Linker,
Options linkOptions(this, Options::Linker,
cmLocalVisualStudio7GeneratorLinkFlagTable);
linkOptions.Parse(extraLinkOptions.c_str());
if(!this->ModuleDefinitionFile.empty())
@@ -1604,7 +1604,7 @@ void cmLocalVisualStudio7Generator
tool = Options::FortranCompiler;
table = cmLocalVisualStudio7GeneratorFortranFlagTable;
}
Options fileOptions(this, this->Version, tool, table,
Options fileOptions(this, tool, table,
this->ExtraFlagTable);
fileOptions.Parse(fc.CompileFlags.c_str());
fileOptions.AddDefines(fc.CompileDefs.c_str());
@@ -1811,11 +1811,18 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER");
if(vsProvider && vsLocalpath && vsProjectname)
{
fout << "\tSccProjectName=\"" << vsProjectname << "\"\n"
<< "\tSccLocalPath=\"" << vsLocalpath << "\"\n"
<< "\tSccProvider=\"" << vsProvider << "\"\n";
const char* vsAuxPath = target.GetProperty("VS_SCC_AUXPATH");
if(vsAuxPath)
{
fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n";
}
}
}
@@ -1913,13 +1920,13 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
<< "<VisualStudioProject\n"
<< "\tProjectType=\"Visual C++\"\n";
if(this->Version == 71)
if(this->Version == VS71)
{
fout << "\tVersion=\"7.10\"\n";
}
else
{
fout << "\tVersion=\"" << this->Version << ".00\"\n";
fout << "\tVersion=\"" << (this->Version/10) << ".00\"\n";
}
const char* projLabel = target.GetProperty("PROJECT_LABEL");
if(!projLabel)
@@ -1934,7 +1941,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
fout << "\tName=\"" << projLabel << "\"\n";
if(this->Version >= 8)
if(this->Version >= VS8)
{
fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n";
}
+1 -5
View File
@@ -35,7 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio7Generator();
cmLocalVisualStudio7Generator(VSVersion v);
virtual ~cmLocalVisualStudio7Generator();
@@ -53,9 +53,6 @@ public:
*/
void SetBuildType(BuildType,const char *name);
void SetVersion71() {this->Version = 71;}
void SetVersion8() {this->Version = 8;}
void SetVersion9() {this->Version = 9;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
@@ -130,7 +127,6 @@ private:
cmVS7FlagTable const* ExtraFlagTable;
std::string ModuleDefinitionFile;
int Version;
bool FortranProject;
std::string PlatformName; // Win32 or x64
cmLocalVisualStudio7GeneratorInternals* Internal;
+16 -1
View File
@@ -18,10 +18,11 @@
#include "windows.h"
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator(VSVersion v)
{
this->WindowsShell = true;
this->WindowsVSIDE = true;
this->Version = v;
}
//----------------------------------------------------------------------------
@@ -249,6 +250,20 @@ cmLocalVisualStudioGenerator
// Add this command line.
std::string cmd = ccg.GetCommand(c);
// Use "call " before any invocations of .bat or .cmd files
// invoked as custom commands.
//
std::string suffix;
if (cmd.size() > 4)
{
suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size()-4));
if (suffix == ".bat" || suffix == ".cmd")
{
script += "call ";
}
}
script += this->Convert(cmd.c_str(), relativeRoot, SHELL);
ccg.AppendArguments(c, script);
+18 -1
View File
@@ -29,7 +29,19 @@ class cmCustomCommand;
class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
cmLocalVisualStudioGenerator();
/** Known versions of Visual Studio. */
enum VSVersion
{
VS6 = 60,
VS7 = 70,
VS71 = 71,
VS8 = 80,
VS9 = 90,
VS10 = 100,
VS11 = 110
};
cmLocalVisualStudioGenerator(VSVersion v);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
@@ -41,6 +53,9 @@ public:
sequence of custom commands. */
const char* GetReportErrorLabel() const;
/** Version of Visual Studio. */
VSVersion GetVersion() const { return this->Version; }
protected:
virtual const char* ReportErrorLabel() const;
virtual bool CustomCommandUseLocal() const { return false; }
@@ -58,6 +73,8 @@ protected:
std::map<cmStdString, int>& count);
std::set<const cmSourceFile*> NeedObjectName;
friend class cmVisualStudio10TargetGenerator;
VSVersion Version;
};
#endif
+15 -3
View File
@@ -3213,7 +3213,8 @@ void cmMakefile::ConfigureString(const std::string& input,
}
int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
bool copyonly, bool atOnly, bool escapeQuotes)
bool copyonly, bool atOnly, bool escapeQuotes,
const cmNewLineStyle& newLine)
{
int res = 1;
if ( !this->CanIWriteThisFile(outfile) )
@@ -3250,9 +3251,20 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
else
{
std::string newLineCharacters;
std::ios_base::openmode omode = std::ios_base::out | std::ios_base::trunc;
if (newLine.IsValid())
{
newLineCharacters = newLine.GetCharacters();
omode |= std::ios::binary;
}
else
{
newLineCharacters = "\n";
}
std::string tempOutputFile = soutfile;
tempOutputFile += ".tmp";
std::ofstream fout(tempOutputFile.c_str());
std::ofstream fout(tempOutputFile.c_str(), omode);
if(!fout)
{
cmSystemTools::Error(
@@ -3277,7 +3289,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
{
outLine = "";
this->ConfigureString(inLine, outLine, atOnly, escapeQuotes);
fout << outLine.c_str() << "\n";
fout << outLine.c_str() << newLineCharacters;
}
// close the files before attempting to copy
fin.close();
+4 -1
View File
@@ -19,6 +19,7 @@
#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmNewLineStyle.h"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -703,7 +704,9 @@ public:
* Copy file but change lines acording to ConfigureString
*/
int ConfigureFile(const char* infile, const char* outfile,
bool copyonly, bool atOnly, bool escapeQuotes);
bool copyonly, bool atOnly, bool escapeQuotes,
const cmNewLineStyle& = cmNewLineStyle());
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
@@ -241,6 +241,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
std::string implib;
if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
{
exeCleanFiles.push_back(this->Convert(implib.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
}
// List the PDB for cleaning only when the whole target is
@@ -270,8 +277,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage;
linkRuleVar += "_LINK_EXECUTABLE";
std::string linkRule =
this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
std::string linkRule = this->GetLinkRule(linkRuleVar.c_str());
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if(this->Target->IsExecutableWithExports())
+8 -1
View File
@@ -512,6 +512,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
std::string implib;
if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
{
libCleanFiles.push_back(this->Convert(implib.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
}
// List the PDB for cleaning only when the whole target is
@@ -772,7 +779,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
else
{
// Get the set of commands.
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
std::string linkRule = this->GetLinkRule(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
// Expand placeholders.
+17
View File
@@ -1633,6 +1633,23 @@ void cmMakefileTargetGenerator
}
}
//----------------------------------------------------------------------------
std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
{
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
if(this->Target->HasImplibGNUtoMS())
{
std::string ruleVar = "CMAKE_";
ruleVar += this->Target->GetLinkerLanguage(this->ConfigName);
ruleVar += "_GNUtoMS_RULE";
if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str()))
{
linkRule += rule;
}
}
return linkRule;
}
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
::CloseFileStreams()
+3
View File
@@ -120,6 +120,9 @@ protected:
// Append link rule dependencies (objects, etc.).
void AppendLinkDepends(std::vector<std::string>& depends);
// Lookup the link rule for this target.
std::string GetLinkRule(const char* linkRuleVar);
/** In order to support parallel builds for custom commands with
multiple outputs the outputs are given a serial order, and only
the first output actually has the build rule. Other outputs
+95
View File
@@ -0,0 +1,95 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2011 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmNewLineStyle.h"
cmNewLineStyle::cmNewLineStyle() : NewLineStyle(Invalid)
{
}
bool cmNewLineStyle::IsValid() const
{
return NewLineStyle != Invalid;
}
bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
std::string& errorString)
{
NewLineStyle = Invalid;
for (size_t i = 0; i< args.size(); i++)
{
if (args[i] == "NEWLINE_STYLE")
{
size_t const styleIndex = i + 1;
if (args.size() > styleIndex)
{
const std::string eol = args[styleIndex];
if (eol == "LF" || eol == "UNIX")
{
NewLineStyle = LF;
return true;
}
else if (eol == "CRLF" || eol == "WIN32" || eol == "DOS")
{
NewLineStyle = CRLF;
return true;
}
else
{
errorString = "NEWLINE_STYLE sets an unknown style, only LF, "
"CRLF, UNIX, DOS, and WIN32 are supported";
return false;
}
}
else
{
errorString = "NEWLINE_STYLE must set a style: "
"LF, CRLF, UNIX, DOS, or WIN32";
return false;
}
}
}
return true;
}
const std::string cmNewLineStyle::GetCharacters() const
{
switch (NewLineStyle)
{
case Invalid:
return "";
case LF:
return "\n";
case CRLF:
return "\r\n";
default:
;
};
return "";
}
void cmNewLineStyle::SetStyle(Style style)
{
NewLineStyle = style;
}
cmNewLineStyle::Style cmNewLineStyle::GetStyle() const
{
return NewLineStyle;
}
+46
View File
@@ -0,0 +1,46 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2011 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmNewLineStyle_h
#define cmNewLineStyle_h
#include "cmStandardIncludes.h"
class cmNewLineStyle
{
public:
cmNewLineStyle();
enum Style
{
Invalid,
// LF = '\n', 0x0A, 10
// CR = '\r', 0x0D, 13
LF, // Unix
CRLF // Dos
};
void SetStyle(Style);
Style GetStyle() const;
bool IsValid() const;
bool ReadFromArguments(const std::vector<std::string>& args,
std::string &errorString);
const std::string GetCharacters() const;
private:
Style NewLineStyle;
};
#endif
+35 -10
View File
@@ -108,9 +108,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
{
cmMakefile* makefile = target->GetMakefile();
const char* targetName = target->GetName();
// don't do anything if there is no Qt4:
// don't do anything if there is no Qt4 or Qt5Core (which contains moc):
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
if (qtMajorVersion != "4")
if (qtMajorVersion == "")
{
qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
}
if (qtMajorVersion != "4" && qtMajorVersion != "5")
{
return;
}
@@ -132,7 +136,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
targetDir += ".dir/";
cmCustomCommandLine currentLine;
currentLine.push_back(makefile->GetCMakeInstance()->GetCMakeCommand());
currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));
currentLine.push_back("-E");
currentLine.push_back("cmake_automoc");
currentLine.push_back(targetDir);
@@ -189,9 +193,15 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
}
}
std::string _moc_incs = makefile->GetProperty("INCLUDE_DIRECTORIES");
std::string _moc_defs = makefile->GetProperty("DEFINITIONS");
std::string _moc_compile_defs = makefile->GetProperty("COMPILE_DEFINITIONS");
const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES");
std::string _moc_incs = (tmp!=0 ? tmp : "");
tmp = makefile->GetProperty("DEFINITIONS");
std::string _moc_defs = (tmp!=0 ? tmp : "");
tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
std::string _moc_compile_defs = (tmp!=0 ? tmp : "");
tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
std::string _moc_options = (tmp!=0 ? tmp : "");
// forget the variables added here afterwards again:
cmMakefile::ScopePushPop varScope(makefile);
static_cast<void>(varScope);
@@ -200,11 +210,12 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
makefile->AddDefinition("_moc_incs", _moc_incs.c_str());
makefile->AddDefinition("_moc_defs", _moc_defs.c_str());
makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
makefile->AddDefinition("_moc_options", _moc_options.c_str());
makefile->AddDefinition("_moc_files", _moc_files.c_str());
makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
makefile->AddDefinition("_moc_strict_mode", strictMode ? "TRUE" : "FALSE");
const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT");
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
std::string inputFile = cmakeRoot;
inputFile += "/Modules/AutomocInfo.cmake.in";
std::string outputFile = targetDir;
@@ -236,9 +247,9 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
this->Init();
if (this->QtMajorVersion == "4")
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
{
this->RunAutomocQt4();
this->RunAutomoc();
}
this->WriteOldMocDefinitionsFile(targetDirectory);
@@ -281,6 +292,11 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
}
this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
if (this->QtMajorVersion == "")
{
this->QtMajorVersion = makefile->GetSafeDefinition(
"AM_Qt5Core_VERSION_MAJOR");
}
this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
this->IncludeProjectDirsBefore = makefile->IsOn(
@@ -292,6 +308,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
"AM_MOC_COMPILE_DEFINITIONS");
this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS");
this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES");
this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
@@ -370,6 +387,8 @@ void cmQtAutomoc::Init()
}
}
cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions);
std::vector<std::string> incPaths;
cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths);
@@ -440,7 +459,7 @@ void cmQtAutomoc::Init()
}
bool cmQtAutomoc::RunAutomocQt4()
bool cmQtAutomoc::RunAutomoc()
{
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
|| (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
@@ -970,6 +989,12 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
{
command.push_back(*it);
}
for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
it != this->MocOptions.end();
++it)
{
command.push_back(*it);
}
#ifdef _WIN32
command.push_back("-DWIN32");
#endif
+3 -1
View File
@@ -35,7 +35,7 @@ private:
const char* targetDirectory);
void WriteOldMocDefinitionsFile(const char* targetDirectory);
bool RunAutomocQt4();
bool RunAutomoc();
bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName);
void ParseCppFile(const std::string& absFilename,
@@ -69,6 +69,7 @@ private:
std::string MocCompileDefinitionsStr;
std::string MocDefinitionsStr;
std::string MocIncludesStr;
std::string MocOptionsStr;
std::string ProjectBinaryDir;
std::string ProjectSourceDir;
std::string TargetName;
@@ -78,6 +79,7 @@ private:
std::string OutMocCppFilename;
std::list<std::string> MocIncludes;
std::list<std::string> MocDefinitions;
std::vector<std::string> MocOptions;
bool Verbose;
bool ColorOutput;
+2 -1
View File
@@ -140,7 +140,8 @@ public:
"the target in an IDE like visual studio. VS_KEYWORD can be set "
"to change the visual studio keyword, for example QT integration "
"works better if this is set to Qt4VSv1.0.\n"
"VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set "
"VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and "
"VS_SCC_AUXPATH can be set "
"to add support for source control bindings in a Visual Studio "
"project file.\n"
"VS_GLOBAL_<variable> can be set to add a Visual Studio "
+5
View File
@@ -161,6 +161,11 @@ extern int putenv (char *__string) __THROW;
#define for if(false) {} else for
#endif
// Provide std::ios_base on ancient GCC 2.9x
#if defined(__GNUC__) && __GNUC__ < 3
namespace std { typedef ios ios_base; }
#endif
// check for the 720 compiler on the SGI
// which has some strange properties that I don't think are worth
// checking for in a general way in configure
+39
View File
@@ -10,6 +10,8 @@
See the License for more information.
============================================================================*/
#include "cmStringCommand.h"
#include "cmCryptoHash.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
@@ -36,6 +38,15 @@ bool cmStringCommand
{
return this->HandleReplaceCommand(args);
}
else if ( subCommand == "MD5" ||
subCommand == "SHA1" ||
subCommand == "SHA224" ||
subCommand == "SHA256" ||
subCommand == "SHA384" ||
subCommand == "SHA512" )
{
return this->HandleHashCommand(args);
}
else if(subCommand == "TOLOWER")
{
return this->HandleToUpperLowerCommand(args, false);
@@ -82,6 +93,34 @@ bool cmStringCommand
return false;
}
//----------------------------------------------------------------------------
bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
if(args.size() != 3)
{
cmOStringStream e;
e << args[0] << " requires an output variable and an input string";
this->SetError(e.str().c_str());
return false;
}
cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if(hash.get())
{
std::string out = hash->HashString(args[2].c_str());
this->Makefile->AddDefinition(args[1].c_str(), out.c_str());
return true;
}
return false;
#else
cmOStringStream e;
e << args[0] << " not available during bootstrap";
this->SetError(e.str().c_str());
return false;
#endif
}
//----------------------------------------------------------------------------
bool cmStringCommand::HandleToUpperLowerCommand(
std::vector<std::string> const& args, bool toUpper)
+5
View File
@@ -76,6 +76,8 @@ public:
" string(REPLACE <match_string>\n"
" <replace_string> <output variable>\n"
" <input> [<input>...])\n"
" string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>\n"
" <output variable> <input>)\n"
" string(COMPARE EQUAL <string1> <string2> <output variable>)\n"
" string(COMPARE NOTEQUAL <string1> <string2> <output variable>)\n"
" string(COMPARE LESS <string1> <string2> <output variable>)\n"
@@ -103,6 +105,8 @@ public:
"backslash through argument parsing.\n"
"REPLACE will replace all occurrences of match_string in the input with "
"replace_string and store the result in the output.\n"
"MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 "
"will compute a cryptographic hash of the input string.\n"
"COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and "
"store true or false in the output variable.\n"
"ASCII will convert all numbers into corresponding ASCII characters.\n"
@@ -150,6 +154,7 @@ protected:
bool RegexMatch(std::vector<std::string> const& args);
bool RegexMatchAll(std::vector<std::string> const& args);
bool RegexReplace(std::vector<std::string> const& args);
bool HandleHashCommand(std::vector<std::string> const& args);
bool HandleToUpperLowerCommand(std::vector<std::string> const& args,
bool toUpper);
bool HandleCompareCommand(std::vector<std::string> const& args);
+7 -50
View File
@@ -54,7 +54,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <memory> // auto_ptr
# include <fcntl.h>
# include <cmsys/MD5.h>
# include "cmCryptoHash.h"
#endif
#if defined(CMAKE_USE_ELF_PARSER)
@@ -1197,48 +1197,10 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname)
bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
if(!cmSystemTools::FileExists(source))
{
return false;
}
// Open files
#if defined(_WIN32) || defined(__CYGWIN__)
cmsys_ios::ifstream fin(source, cmsys_ios::ios::binary | cmsys_ios::ios::in);
#else
cmsys_ios::ifstream fin(source);
#endif
if(!fin)
{
return false;
}
cmsysMD5* md5 = cmsysMD5_New();
cmsysMD5_Initialize(md5);
// 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);
// 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()
// before using the data, but the fin.gcount() will be zero if an
// error occurred. Therefore, the loop should be safe everywhere.
while(fin)
{
fin.read(buffer, bufferSize);
if(int gcount = static_cast<int>(fin.gcount()))
{
cmsysMD5_Append(md5, buffer_uc, gcount);
}
}
cmsysMD5_FinalizeHex(md5, md5out);
cmsysMD5_Delete(md5);
fin.close();
return true;
cmCryptoHashMD5 md5;
std::string str = md5.HashFile(source);
strncpy(md5out, str.c_str(), 32);
return !str.empty();
#else
(void)source;
(void)md5out;
@@ -1250,13 +1212,8 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
std::string cmSystemTools::ComputeStringMD5(const char* input)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
char md5out[32];
cmsysMD5* md5 = cmsysMD5_New();
cmsysMD5_Initialize(md5);
cmsysMD5_Append(md5, reinterpret_cast<unsigned char const*>(input), -1);
cmsysMD5_FinalizeHex(md5, md5out);
cmsysMD5_Delete(md5);
return std::string(md5out, 32);
cmCryptoHashMD5 md5;
return md5.HashString(input);
#else
(void)input;
cmSystemTools::Message("md5sum not supported in bootstrapping mode","Error");
+83 -12
View File
@@ -17,6 +17,7 @@
#include "cmGlobalGenerator.h"
#include "cmComputeLinkInformation.h"
#include "cmDocumentCompileDefinitions.h"
#include "cmDocumentLocationUndefined.h"
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
#include <cmsys/RegularExpression.hxx>
@@ -158,10 +159,22 @@ void cmTarget::DefineProperties(cmake *cm)
"which is compiled as part of the target."
"This property is initialized by the value of the variable "
"CMAKE_AUTOMOC if it is set when a target is created.\n"
"Additional command line options for moc can be set via the "
"AUTOMOC_MOC_OPTIONS property.\n"
"By setting the CMAKE_AUTOMOC_STRICT_MODE variable to FALSE the rules "
"for searching the files which will be processed by moc can be relaxed. "
"See the documentation for this variable for more details.");
cm->DefineProperty
("AUTOMOC_MOC_OPTIONS", cmProperty::TARGET,
"Additional options for moc when using automoc (see the AUTOMOC property)",
"This property is only used if the AUTOMOC property is set to TRUE for "
"this target. In this case, it holds additional command line options "
"which will be used when moc is executed during the build, i.e. it is "
"equivalent to the optional OPTIONS argument of the qt4_wrap_cpp() "
"macro.\n"
"By default it is empty.");
cm->DefineProperty
("BUILD_WITH_INSTALL_RPATH", cmProperty::TARGET,
"Should build tree targets have install tree rpaths.",
@@ -574,15 +587,6 @@ void cmTarget::DefineProperties(cmake *cm)
"value is the default. "
"See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.");
#define CM_LOCATION_UNDEFINED_BEHAVIOR \
"\n" \
"Do not set properties that affect the location of the target after " \
"reading this property. These include properties whose names match " \
"\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?\" " \
"or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \
"Failure to follow this rule is not diagnosed and leaves the location " \
"of the target undefined."
cm->DefineProperty
("LOCATION", cmProperty::TARGET,
"Read-only location of a target on disk.",
@@ -602,7 +606,7 @@ void cmTarget::DefineProperties(cmake *cm)
"In CMake 2.8.4 and above add_custom_command recognizes generator "
"expressions to refer to target locations anywhere in the command. "
"Therefore this property is not needed for creating custom commands."
CM_LOCATION_UNDEFINED_BEHAVIOR);
CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property"));
cm->DefineProperty
("LOCATION_<CONFIG>", cmProperty::TARGET,
@@ -616,7 +620,7 @@ void cmTarget::DefineProperties(cmake *cm)
"arbitrary available configuration. "
"Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported "
"configurations explicitly."
CM_LOCATION_UNDEFINED_BEHAVIOR);
CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property"));
cm->DefineProperty
("LINK_DEPENDS", cmProperty::TARGET,
@@ -969,6 +973,23 @@ void cmTarget::DefineProperties(cmake *cm)
"If the variable CMAKE_Fortran_MODULE_DIRECTORY is set when a target "
"is created its value is used to initialize this property.");
cm->DefineProperty
("GNUtoMS", cmProperty::TARGET,
"Convert GNU import library (.dll.a) to MS format (.lib).",
"When linking a shared library or executable that exports symbols "
"using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed "
"convert the import library (.dll.a) from GNU to MS format (.lib). "
"Both import libraries will be installed by install(TARGETS) and "
"exported by install(EXPORT) and export() to be linked by applications "
"with either GNU- or MS-compatible tools."
"\n"
"If the variable CMAKE_GNUtoMS is set when a target "
"is created its value is used to initialize this property. "
"The variable must be set prior to the first command that enables "
"a language such as project() or enable_language(). "
"CMake provides the variable as an option to the user automatically "
"when configuring on Windows with GNU tools.");
cm->DefineProperty
("XCODE_ATTRIBUTE_<an-attribute>", cmProperty::TARGET,
"Set Xcode target attributes directly.",
@@ -1014,7 +1035,7 @@ void cmTarget::DefineProperties(cmake *cm)
"provider property.");
cm->DefineProperty
("VS_SCC_LOCALPATH", cmProperty::TARGET,
"Visual Studio Source Code Control Provider.",
"Visual Studio Source Code Control Local Path.",
"Can be set to change the visual studio source code control "
"local path property.");
cm->DefineProperty
@@ -1022,6 +1043,34 @@ void cmTarget::DefineProperties(cmake *cm)
"Visual Studio Source Code Control Project.",
"Can be set to change the visual studio source code control "
"project name property.");
cm->DefineProperty
("VS_SCC_AUXPATH", cmProperty::TARGET,
"Visual Studio Source Code Control Aux Path.",
"Can be set to change the visual studio source code control "
"auxpath property.");
cm->DefineProperty
("VS_GLOBAL_PROJECT_TYPES", cmProperty::TARGET,
"Visual Studio project type(s).",
"Can be set to one or more UUIDs recognized by Visual Studio "
"to indicate the type of project. This value is copied "
"verbatim into the generated project file. Example for a "
"managed C++ unit testing project: \""
"{3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are "
"semicolon-delimited.");
cm->DefineProperty
("VS_GLOBAL_KEYWORD", cmProperty::TARGET,
"Visual Studio project keyword.",
"Sets the \"keyword\" attribute for a generated Visual Studio "
"project. Defaults to \"Win32Proj\". You may wish to override "
"this value with \"ManagedCProj\", for example, in a Visual "
"Studio managed C++ unit test project.");
cm->DefineProperty
("VS_DOTNET_REFERENCES", cmProperty::TARGET,
"Visual Studio managed project .NET references",
"Adds one or more semicolon-delimited .NET references to a "
"generated Visual Studio project. For example, \"System;"
"System.Windows.Forms\".");
cm->DefineProperty
("VS_GLOBAL_<variable>", cmProperty::TARGET,
"Visual Studio project-specific global variable.",
@@ -1180,8 +1229,10 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("Fortran_FORMAT", 0);
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
this->SetPropertyDefault("GNUtoMS", 0);
this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
this->SetPropertyDefault("AUTOMOC", 0);
this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
// Collect the set of configuration types.
@@ -3440,6 +3491,26 @@ void cmTarget::GetExecutableNames(std::string& name,
pdbName = prefix+base+".pdb";
}
//----------------------------------------------------------------------------
bool cmTarget::HasImplibGNUtoMS()
{
return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
}
//----------------------------------------------------------------------------
bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
std::string& out, const char* newExt)
{
if(this->HasImplibGNUtoMS() &&
gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
{
out = gnuName.substr(0, gnuName.size()-6);
out += newExt? newExt : ".lib";
return true;
}
return false;
}
//----------------------------------------------------------------------------
void cmTarget::GenerateTargetManifest(const char* config)
{
+8
View File
@@ -369,6 +369,14 @@ public:
std::string& impName,
std::string& pdbName, const char* config);
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS();
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0);
/** Add the target output files to the global generator manifest. */
void GenerateTargetManifest(const char* config);
+41 -9
View File
@@ -95,8 +95,8 @@ bool cmTargetLinkLibrariesCommand
bool haveLLT = false;
// Start with primary linking and switch to link interface
// specification when the keyword is encountered.
this->DoingInterface = false;
// specification if the keyword is encountered as the first argument.
this->CurrentProcessingState = ProcessingLinkLibraries;
// add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
@@ -104,7 +104,7 @@ bool cmTargetLinkLibrariesCommand
{
if(args[i] == "LINK_INTERFACE_LIBRARIES")
{
this->DoingInterface = true;
this->CurrentProcessingState = ProcessingLinkInterface;
if(i != 1)
{
this->Makefile->IssueMessage(
@@ -115,6 +115,32 @@ bool cmTargetLinkLibrariesCommand
return true;
}
}
else if(args[i] == "LINK_PUBLIC")
{
if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
"argument, just after the target name."
);
return true;
}
this->CurrentProcessingState = ProcessingPublicInterface;
}
else if(args[i] == "LINK_PRIVATE")
{
if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
"argument, just after the target name."
);
return true;
}
this->CurrentProcessingState = ProcessingPrivateInterface;
}
else if(args[i] == "debug")
{
if(haveLLT)
@@ -186,10 +212,12 @@ bool cmTargetLinkLibrariesCommand
cmSystemTools::SetFatalErrorOccured();
}
// If the INTERFACE option was given, make sure the
// LINK_INTERFACE_LIBRARIES property exists. This allows the
// command to be used to specify an empty link interface.
if(this->DoingInterface &&
// If any of the LINK_ options were given, make sure the
// LINK_INTERFACE_LIBRARIES target property exists.
// Use of any of the new keywords implies awareness of
// this property. And if no libraries are named, it should
// result in an empty link interface.
if(this->CurrentProcessingState != ProcessingLinkLibraries &&
!this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
{
this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
@@ -217,11 +245,15 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
// Handle normal case first.
if(!this->DoingInterface)
if(this->CurrentProcessingState != ProcessingLinkInterface)
{
this->Makefile
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
return;
if (this->CurrentProcessingState != ProcessingPublicInterface)
{
// Not LINK_INTERFACE_LIBRARIES or LINK_PUBLIC, do not add to interface.
return;
}
}
// Get the list of configurations considered to be DEBUG.
+26 -7
View File
@@ -19,7 +19,7 @@
*
* cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
* into executable(s) or shared objects. The names of the libraries
* should be those defined by the LIBRARY(library) command(s).
* should be those defined by the LIBRARY(library) command(s).
*/
class cmTargetLinkLibrariesCommand : public cmCommand
{
@@ -27,7 +27,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
virtual cmCommand* Clone()
{
return new cmTargetLinkLibrariesCommand;
}
@@ -47,12 +47,12 @@ public:
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
virtual const char* GetTerseDocumentation()
{
return
return
"Link a target to given libraries.";
}
/**
* More documentation.
*/
@@ -107,6 +107,18 @@ public:
"Libraries specified as \"general\" (or without any keyword) are "
"treated as if specified for both \"debug\" and \"optimized\"."
"\n"
" target_link_libraries(<target>\n"
" <LINK_PRIVATE|LINK_PUBLIC>\n"
" [[debug|optimized|general] <lib>] ...\n"
" [<LINK_PRIVATE|LINK_PUBLIC>\n"
" [[debug|optimized|general] <lib>] ...])\n"
"The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both "
"the link dependencies and the link interface in one command. "
"Libraries and targets following LINK_PUBLIC are linked to, and are "
"made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
"following LINK_PRIVATE are linked to, but are not made part of the "
"LINK_INTERFACE_LIBRARIES. "
"\n"
"The library dependency graph is normally acyclic (a DAG), but in the "
"case of mutually-dependent STATIC libraries CMake allows the graph "
"to contain cycles (strongly connected components). "
@@ -130,14 +142,21 @@ public:
")"
;
}
cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
cmTarget* Target;
bool DoingInterface;
enum ProcessingState {
ProcessingLinkLibraries,
ProcessingLinkInterface,
ProcessingPublicInterface,
ProcessingPrivateInterface
};
ProcessingState CurrentProcessingState;
void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
};
+81 -10
View File
@@ -178,11 +178,20 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
const char* vsProjectTypes =
this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if(vsProjectTypes)
{
this->WriteString("<ProjectTypes>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes) <<
"</ProjectTypes>\n";
}
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
if ( vsProjectName && vsLocalPath && vsProvider)
if( vsProjectName && vsLocalPath && vsProvider )
{
this->WriteString("<SccProjectName>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) <<
@@ -193,9 +202,29 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<SccProvider>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
"</SccProvider>\n";
const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH");
if( vsAuxPath )
{
this->WriteString("<SccAuxPath>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath) <<
"</SccAuxPath>\n";
}
}
const char* vsGlobalKeyword =
this->Target->GetProperty("VS_GLOBAL_KEYWORD");
if(!vsGlobalKeyword)
{
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
}
else
{
this->WriteString("<Keyword>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) <<
"</Keyword>\n";
}
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");
@@ -225,6 +254,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteObjSources();
this->WriteCLSources();
this->WriteDotNetReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -236,6 +266,39 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteGroups();
}
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{
const char* vsDotNetReferences
= this->Target->GetProperty("VS_DOTNET_REFERENCES");
if(vsDotNetReferences)
{
std::string references(vsDotNetReferences);
std::string::size_type position = 0;
this->WriteString("<ItemGroup>\n", 1);
while(references.length() > 0)
{
if((position = references.find(";")) == std::string::npos)
{
position = references.length() + 1;
}
this->WriteString("<Reference Include=\"", 2);
(*this->BuildFileStream) <<
cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
this->WriteString("<CopyLocalSatelliteAssemblies>true"
"</CopyLocalSatelliteAssemblies>\n", 3);
this->WriteString("<ReferenceOutputAssembly>true"
"</ReferenceOutputAssembly>\n", 3);
this->WriteString("</Reference>\n", 2);
references.erase(0, position + 1);
}
this->WriteString("</ItemGroup>\n", 1);
}
}
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -290,16 +353,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
}
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
const char* mfcFlag =
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
if(mfcFlag)
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
std::string useOfMfcValue = "false";
if(mfcFlagValue == "1")
{
this->WriteString("<UseOfMfc>true</UseOfMfc>\n", 2);
useOfMfcValue = "Static";
}
else
else if(mfcFlagValue == "2")
{
this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
useOfMfcValue = "Dynamic";
}
std::string mfcLine = "<UseOfMfc>";
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
this->WriteString(mfcLine.c_str(), 2);
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
this->ClOptions[*i]->UsingUnicode())
{
@@ -897,7 +968,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
hasFlags = true;
cmVisualStudioGeneratorOptions
clOptions(this->LocalGenerator,
10, cmVisualStudioGeneratorOptions::Compiler,
cmVisualStudioGeneratorOptions::Compiler,
cmVS10CLFlagTable, 0, this);
clOptions.Parse(flags.c_str());
clOptions.AddDefines(configDefines.c_str());
@@ -1082,7 +1153,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// TODO: Integrate code below with cmLocalVisualStudio7Generator.
cmsys::auto_ptr<Options> pOptions(
new Options(this->LocalGenerator, 10, Options::Compiler,
new Options(this->LocalGenerator, Options::Compiler,
cmVS10CLFlagTable));
Options& clOptions = *pOptions;
@@ -1237,7 +1308,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{
this->WriteString("<Lib>\n", 2);
cmVisualStudioGeneratorOptions
libOptions(this->LocalGenerator, 10,
libOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Linker,
cmVS10LibFlagTable, 0, this);
libOptions.Parse(libflags?libflags:"");
@@ -1317,7 +1388,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
flags += flagsConfig;
}
cmVisualStudioGeneratorOptions
linkOptions(this->LocalGenerator, 10,
linkOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Linker,
cmVS10LinkFlagTable, 0, this);
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
+1
View File
@@ -47,6 +47,7 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteCLSources();
void WriteDotNetReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
+14 -13
View File
@@ -25,14 +25,13 @@ inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s)
//----------------------------------------------------------------------------
cmVisualStudioGeneratorOptions
::cmVisualStudioGeneratorOptions(cmLocalGenerator* lg,
int version,
::cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg,
Tool tool,
cmVS7FlagTable const* table,
cmVS7FlagTable const* extraTable,
cmVisualStudio10TargetGenerator* g):
cmIDEOptions(),
LocalGenerator(lg), Version(version), CurrentTool(tool),
LocalGenerator(lg), Version(lg->GetVersion()), CurrentTool(tool),
TargetGenerator(g)
{
// Store the given flag tables.
@@ -61,11 +60,12 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
// remove the flag we need to override the IDE default of on.
switch (this->Version)
{
case 7:
case 71:
case cmLocalVisualStudioGenerator::VS7:
case cmLocalVisualStudioGenerator::VS71:
this->FlagMap["ExceptionHandling"] = "FALSE";
break;
case 10:
case cmLocalVisualStudioGenerator::VS10:
case cmLocalVisualStudioGenerator::VS11:
// by default VS puts <ExceptionHandling></ExceptionHandling> empty
// for a project, to make our projects look the same put a new line
// and space over for the closing </ExceptionHandling> as the default
@@ -93,7 +93,8 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose)
if(verbose &&
this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end())
{
this->FlagMap["SuppressStartupBanner"] = this->Version < 10 ? "FALSE" : "";
this->FlagMap["SuppressStartupBanner"] =
this->Version < cmLocalVisualStudioGenerator::VS10 ? "FALSE" : "";
}
}
@@ -211,7 +212,7 @@ cmVisualStudioGeneratorOptions
{
return;
}
if(this->Version == 10)
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
// if there are configuration specifc flags, then
// use the configuration specific tag for PreprocessorDefinitions
@@ -239,7 +240,7 @@ cmVisualStudioGeneratorOptions
{
// Escape the definition for the compiler.
std::string define;
if(this->Version != 10)
if(this->Version < cmLocalVisualStudioGenerator::VS10)
{
define =
this->LocalGenerator->EscapeForShell(di->c_str(), true);
@@ -249,7 +250,7 @@ cmVisualStudioGeneratorOptions
define = *di;
}
// Escape this flag for the IDE.
if(this->Version == 10)
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str());
@@ -266,7 +267,7 @@ cmVisualStudioGeneratorOptions
fout << sep << define;
sep = ";";
}
if(this->Version == 10)
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
fout << ";%(PreprocessorDefinitions)</PreprocessorDefinitions>" << suffix;
}
@@ -281,7 +282,7 @@ void
cmVisualStudioGeneratorOptions
::OutputFlagMap(std::ostream& fout, const char* indent)
{
if(this->Version == 10)
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin();
m != this->FlagMap.end(); ++m)
@@ -326,7 +327,7 @@ cmVisualStudioGeneratorOptions
{
if(!this->FlagString.empty())
{
if(this->Version == 10)
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
fout << prefix;
if(this->Configuration.size())
+4 -5
View File
@@ -12,7 +12,7 @@
#ifndef cmVisualStudioGeneratorOptions_h
#define cmVisualStudioGeneratorOptions_h
#include "cmLocalGenerator.h"
#include "cmLocalVisualStudioGenerator.h"
#include "cmIDEOptions.h"
typedef cmIDEFlagTable cmVS7FlagTable;
@@ -30,8 +30,7 @@ public:
Linker,
FortranCompiler
};
cmVisualStudioGeneratorOptions(cmLocalGenerator* lg,
int version,
cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg,
Tool tool,
cmVS7FlagTable const* table,
cmVS7FlagTable const* extraTable = 0,
@@ -62,8 +61,8 @@ public:
const char* suffix);
void SetConfiguration(const char* config);
private:
cmLocalGenerator* LocalGenerator;
int Version;
cmLocalVisualStudioGenerator* LocalGenerator;
cmLocalVisualStudioGenerator::VSVersion Version;
std::string Configuration;
Tool CurrentTool;
+1613
View File
File diff suppressed because it is too large Load Diff
+140
View File
@@ -0,0 +1,140 @@
/*
* FILE: sha2.h
* AUTHOR: Aaron D. Gifford
* http://www.aarongifford.com/computers/sha.html
*
* Copyright (c) 2000-2003, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sha2.h,v 1.4 2004/01/07 19:06:18 adg Exp $
*/
#ifndef __SHA2_H__
#define __SHA2_H__
#include "cm_sha2_mangle.h"
/* CMake modification: use integer types from cmIML. */
#include "cmIML/INT.h"
typedef cmIML_INT_uint8_t cm_sha2_uint8_t;
typedef cmIML_INT_uint32_t cm_sha2_uint32_t;
typedef cmIML_INT_uint64_t cm_sha2_uint64_t;
#ifdef __cplusplus
extern "C" {
#endif
/*
* Import u_intXX_t size_t type definitions from system headers. You
* may need to change this, or define these things yourself in this
* file.
*/
#include <sys/types.h>
/*** SHA-224/256/384/512 Various Length Definitions *******************/
/* Digest lengths for SHA-1/224/256/384/512 */
#define SHA1_DIGEST_LENGTH 20
#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
#define SHA224_DIGEST_LENGTH 28
#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
#define SHA384_DIGEST_LENGTH 48
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
/*** SHA-224/256/384/512 Context Structures ***************************/
typedef union _SHA_CTX {
/* SHA-1 uses this part of the union: */
struct {
cm_sha2_uint32_t state[5];
cm_sha2_uint64_t bitcount;
cm_sha2_uint8_t buffer[64];
} s1;
/* SHA-224 and SHA-256 use this part of the union: */
struct {
cm_sha2_uint32_t state[8];
cm_sha2_uint64_t bitcount;
cm_sha2_uint8_t buffer[64];
} s256;
/* SHA-384 and SHA-512 use this part of the union: */
struct {
cm_sha2_uint64_t state[8];
cm_sha2_uint64_t bitcount[2];
cm_sha2_uint8_t buffer[128];
} s512;
} SHA_CTX;
/*** SHA-256/384/512 Function Prototypes ******************************/
void SHA1_Init(SHA_CTX*);
void SHA1_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
void SHA1_Final(cm_sha2_uint8_t[SHA1_DIGEST_LENGTH], SHA_CTX*);
char* SHA1_End(SHA_CTX*, char[SHA1_DIGEST_STRING_LENGTH]);
char* SHA1_Data(const cm_sha2_uint8_t*, size_t,
char[SHA1_DIGEST_STRING_LENGTH]);
void SHA224_Init(SHA_CTX*);
void SHA224_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
void SHA224_Final(cm_sha2_uint8_t[SHA224_DIGEST_LENGTH], SHA_CTX*);
char* SHA224_End(SHA_CTX*, char[SHA224_DIGEST_STRING_LENGTH]);
char* SHA224_Data(const cm_sha2_uint8_t*, size_t,
char[SHA224_DIGEST_STRING_LENGTH]);
void SHA256_Init(SHA_CTX*);
void SHA256_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
void SHA256_Final(cm_sha2_uint8_t[SHA256_DIGEST_LENGTH], SHA_CTX*);
char* SHA256_End(SHA_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
char* SHA256_Data(const cm_sha2_uint8_t*, size_t,
char[SHA256_DIGEST_STRING_LENGTH]);
void SHA384_Init(SHA_CTX*);
void SHA384_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
void SHA384_Final(cm_sha2_uint8_t[SHA384_DIGEST_LENGTH], SHA_CTX*);
char* SHA384_End(SHA_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
char* SHA384_Data(const cm_sha2_uint8_t*, size_t,
char[SHA384_DIGEST_STRING_LENGTH]);
void SHA512_Init(SHA_CTX*);
void SHA512_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
void SHA512_Final(cm_sha2_uint8_t[SHA512_DIGEST_LENGTH], SHA_CTX*);
char* SHA512_End(SHA_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
char* SHA512_Data(const cm_sha2_uint8_t*, size_t,
char[SHA512_DIGEST_STRING_LENGTH]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __SHA2_H__ */
+51
View File
@@ -0,0 +1,51 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cm_sha2_mangle_h
#define cm_sha2_mangle_h
/* Mangle sha2 symbol names to avoid possible conflict with
implementations in other libraries to which CMake links. */
#define SHA1_Data cmSHA1_Data
#define SHA1_End cmSHA1_End
#define SHA1_Final cmSHA1_Final
#define SHA1_Init cmSHA1_Init
#define SHA1_Internal_Transform cmSHA1_Internal_Transform
#define SHA1_Update cmSHA1_Update
#define SHA224_Data cmSHA224_Data
#define SHA224_End cmSHA224_End
#define SHA224_Final cmSHA224_Final
#define SHA224_Init cmSHA224_Init
#define SHA224_Internal_Transform cmSHA224_Internal_Transform
#define SHA224_Update cmSHA224_Update
#define SHA256_Data cmSHA256_Data
#define SHA256_End cmSHA256_End
#define SHA256_Final cmSHA256_Final
#define SHA256_Init cmSHA256_Init
#define SHA256_Internal_Init cmSHA256_Internal_Init
#define SHA256_Internal_Last cmSHA256_Internal_Last
#define SHA256_Internal_Transform cmSHA256_Internal_Transform
#define SHA256_Update cmSHA256_Update
#define SHA384_Data cmSHA384_Data
#define SHA384_End cmSHA384_End
#define SHA384_Final cmSHA384_Final
#define SHA384_Init cmSHA384_Init
#define SHA384_Update cmSHA384_Update
#define SHA512_Data cmSHA512_Data
#define SHA512_End cmSHA512_End
#define SHA512_Final cmSHA512_Final
#define SHA512_Init cmSHA512_Init
#define SHA512_Internal_Init cmSHA512_Internal_Init
#define SHA512_Internal_Last cmSHA512_Internal_Last
#define SHA512_Internal_Transform cmSHA512_Internal_Transform
#define SHA512_Update cmSHA512_Update
#endif
+129 -134
View File
@@ -128,7 +128,7 @@ public:
#include <io.h>
#include <direct.h>
#define _unlink unlink
#endif
#endif
/* The maximum length of a file name. */
#if defined(PATH_MAX)
@@ -168,9 +168,9 @@ static inline char *realpath(const char *path, char *resolved_path)
snprintf(resolved_path, maxlen, "%s", path);
BPath normalized(resolved_path, NULL, true);
const char *resolved = normalized.Path();
if (resolved != NULL) // NULL == No such file.
if (resolved != NULL) // NULL == No such file.
{
if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
{
return resolved_path;
}
@@ -179,7 +179,7 @@ static inline char *realpath(const char *path, char *resolved_path)
}
#endif
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
inline int Mkdir(const char* dir)
{
return _mkdir(dir);
@@ -300,7 +300,7 @@ double SystemTools::GetTime(void)
#endif
}
class SystemToolsTranslationMap :
class SystemToolsTranslationMap :
public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
{
};
@@ -371,7 +371,7 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
}
}
#ifdef INTEL_COMPILER
#ifdef __INTEL_COMPILER
#pragma warning disable 444
#endif
@@ -392,7 +392,7 @@ kwsysDeletingCharVector::~kwsysDeletingCharVector()
#endif
}
bool SystemTools::PutEnv(const char* value)
{
{
static kwsysDeletingCharVector localEnvironment;
char* envVar = new char[strlen(value)+1];
strcpy(envVar, value);
@@ -403,18 +403,13 @@ bool SystemTools::PutEnv(const char* value)
return ret == 0;
}
#ifdef INTEL_COMPILER
#pragma warning restore 444
#endif
const char* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
return ".exe";
#else
return "";
#endif
#endif
}
@@ -482,7 +477,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
{
const char *src = source.c_str();
char *searchPos = const_cast<char *>(strstr(src,replace));
// get out quick if string is not found
if (!searchPos)
{
@@ -499,7 +494,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
char *orig = strdup(src);
char *currentPos = orig;
searchPos = searchPos - src + orig;
// initialize the result
source.erase(source.begin(),source.end());
do
@@ -551,7 +546,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
#endif
// Read a registry value.
// Example :
// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will return the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -580,7 +575,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -602,11 +597,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
{
primaryKey = HKEY_USERS;
}
HKEY hKey;
if(RegOpenKeyEx(primaryKey,
second.c_str(),
0,
if(RegOpenKeyEx(primaryKey,
second.c_str(),
0,
SystemToolsMakeRegistryMode(KEY_READ, view),
&hKey) != ERROR_SUCCESS)
{
@@ -617,11 +612,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
DWORD dwType, dwSize;
dwSize = 1023;
char data[1024];
if(RegQueryValueEx(hKey,
(LPTSTR)valuename.c_str(),
NULL,
&dwType,
(BYTE *)data,
if(RegQueryValueEx(hKey,
(LPTSTR)valuename.c_str(),
NULL,
&dwType,
(BYTE *)data,
&dwSize) == ERROR_SUCCESS)
{
if (dwType == REG_SZ)
@@ -656,7 +651,7 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &,
// Write a registry value.
// Example :
// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will set the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -669,7 +664,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -684,7 +679,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -706,13 +701,13 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
{
primaryKey = HKEY_USERS;
}
HKEY hKey;
DWORD dwDummy;
char lpClass[] = "";
if(RegCreateKeyEx(primaryKey,
second.c_str(),
0,
if(RegCreateKeyEx(primaryKey,
second.c_str(),
0,
lpClass,
REG_OPTION_NON_VOLATILE,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
@@ -723,11 +718,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
return false;
}
if(RegSetValueEx(hKey,
(LPTSTR)valuename.c_str(),
0,
REG_SZ,
(CONST BYTE *)value,
if(RegSetValueEx(hKey,
(LPTSTR)valuename.c_str(),
0,
REG_SZ,
(CONST BYTE *)value,
(DWORD)(strlen(value) + 1)) == ERROR_SUCCESS)
{
return true;
@@ -742,7 +737,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64)
#endif
// Delete a registry value.
// Example :
// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will delete the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -754,7 +749,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -769,7 +764,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -791,11 +786,11 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
{
primaryKey = HKEY_USERS;
}
HKEY hKey;
if(RegOpenKeyEx(primaryKey,
second.c_str(),
0,
if(RegOpenKeyEx(primaryKey,
second.c_str(),
0,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
&hKey) != ERROR_SUCCESS)
{
@@ -803,7 +798,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
}
else
{
if(RegDeleteValue(hKey,
if(RegDeleteValue(hKey,
(LPTSTR)valuename.c_str()) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@@ -824,17 +819,17 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
#ifdef _WIN32
HANDLE hFile1, hFile2;
hFile1 = CreateFile( file1,
GENERIC_READ,
hFile1 = CreateFile( file1,
GENERIC_READ,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL
);
hFile2 = CreateFile( file2,
GENERIC_READ,
FILE_SHARE_READ,
hFile2 = CreateFile( file2,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
@@ -868,10 +863,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
{
// see if the files are the same file
// check the device inode and size
if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 &&
fileStat2.st_size == fileStat1.st_size
)
fileStat2.st_size == fileStat1.st_size
)
{
return true;
}
@@ -1068,11 +1063,11 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
if ((int)s[i] >= 0 && isalpha(s[i]) &&
if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
#endif
#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
}
@@ -1089,11 +1084,11 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
if ((int)s[i] >= 0 && isalpha(s[i]) &&
if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
#endif
#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
}
@@ -1171,7 +1166,7 @@ char* SystemTools::AppendStrings(
return newstr;
}
// Return a lower case string
// Return a lower case string
kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1183,7 +1178,7 @@ kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
return n;
}
// Return a lower case string
// Return a lower case string
kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1313,7 +1308,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
{
return NULL;
}
size_t len1 = strlen(str1), len2 = strlen(str2);
if (len1 >= len2)
{
@@ -1341,8 +1336,8 @@ char* SystemTools::DuplicateString(const char* str)
return NULL;
}
// Return a cropped string
kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
// Return a cropped string
kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
size_t max_len)
{
if (!s.size() || max_len == 0 || max_len >= s.size())
@@ -1386,7 +1381,7 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
if(isPath && path[0] == '/')
{
path.erase(path.begin());
paths.push_back("/");
paths.push_back("/");
}
kwsys_stl::string::size_type pos1 = 0;
kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1);
@@ -1395,9 +1390,9 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
paths.push_back(path.substr(pos1, pos2-pos1));
pos1 = pos2+1;
pos2 = path.find(sep, pos1+1);
}
}
paths.push_back(path.substr(pos1, pos2-pos1));
return paths;
}
@@ -1411,11 +1406,11 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
// Quick-hack attempt at estimating the length of the string.
// Should never under-estimate.
// Start with the length of the format string itself.
size_t length = strlen(format);
// Increase the length for every argument in the format.
const char* cur = format;
@@ -1447,7 +1442,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
// Eat the argument.
static_cast<void>(va_arg(ap, double));
} break;
@@ -1455,24 +1450,24 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
// Eat the argument.
static_cast<void>(va_arg(ap, int));
} break;
}
}
// Move past the characters just tested.
++cur;
}
}
return static_cast<int>(length);
}
kwsys_stl::string SystemTools::EscapeChars(
const char *str,
const char *chars_to_escape,
const char *str,
const char *chars_to_escape,
char escape_char)
{
kwsys_stl::string n;
@@ -1529,7 +1524,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path)
}
#endif
// convert windows slashes to unix slashes
// convert windows slashes to unix slashes
void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
{
const char* pathCString = path.c_str();
@@ -1596,7 +1591,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
}
}
#endif
// remove trailing slash if the path is more than
// remove trailing slash if the path is more than
// a single /
pathCString = path.c_str();
if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/')
@@ -1614,7 +1609,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
{
kwsys_stl::string ret = path;
// remove // except at the beginning might be a cygwin drive
kwsys_stl::string::size_type pos=1;
while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
@@ -1652,7 +1647,7 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path)
// remove double slashes not at the start
kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
{
{
kwsys_stl::string ret;
// make it big enough for all of path and double quotes
ret.reserve(strlen(path)+3);
@@ -1738,13 +1733,13 @@ bool SystemTools::FilesDiffer(const char* source,
const char* destination)
{
struct stat statSource;
if (stat(source, &statSource) != 0)
if (stat(source, &statSource) != 0)
{
return true;
}
struct stat statDestination;
if (stat(destination, &statDestination) != 0)
if (stat(destination, &statDestination) != 0)
{
return true;
}
@@ -1790,7 +1785,7 @@ bool SystemTools::FilesDiffer(const char* source,
{
return true;
}
// If this block differs the file differs.
if(memcmp(static_cast<const void*>(source_buf),
static_cast<const void*>(dest_buf),
@@ -1849,7 +1844,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
// Open files
#if defined(_WIN32) || defined(__CYGWIN__)
kwsys_ios::ifstream fin(source,
kwsys_ios::ifstream fin(source,
kwsys_ios::ios::binary | kwsys_ios::ios::in);
#else
kwsys_ios::ifstream fin(source);
@@ -1858,7 +1853,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
{
return false;
}
// try and remove the destination file so that read only destination files
// can be written to.
// If the remove fails continue so that files in read only directories
@@ -1866,17 +1861,17 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
SystemTools::RemoveFile(destination);
#if defined(_WIN32) || defined(__CYGWIN__)
kwsys_ios::ofstream fout(destination,
kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#else
kwsys_ios::ofstream fout(destination,
kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#endif
if(!fout)
{
return false;
}
// 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()
@@ -1890,12 +1885,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
fout.write(buffer, fin.gcount());
}
}
// Make sure the operating system has finished writing the file
// before closing it. This will ensure the file is finished before
// the check below.
fout.flush();
fin.close();
fout.close();
@@ -1979,7 +1974,7 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination,
unsigned long SystemTools::FileLength(const char* filename)
{
struct stat fs;
if (stat(filename, &fs) != 0)
if (stat(filename, &fs) != 0)
{
return 0;
}
@@ -2225,7 +2220,7 @@ kwsys_stl::string SystemTools
{
// Add the system search path to our path first
kwsys_stl::vector<kwsys_stl::string> path;
if (!no_system_path)
if (!no_system_path)
{
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path);
@@ -2340,7 +2335,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions if the os supports them
if(extensions.size())
{
for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
extensions.begin(); i != extensions.end(); ++i)
{
tryPath = name;
@@ -2368,7 +2363,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
// now add the additional paths
{
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
userPaths.begin(); i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -2397,7 +2392,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions
if(extensions.size())
{
for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
= extensions.begin(); ext != extensions.end(); ++ext)
{
tryPath = *p;
@@ -2962,7 +2957,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
// split up both paths into arrays of strings using / as a separator
kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here
@@ -3019,7 +3014,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
}
kwsys_stl::string relativePath; // result string
// now turn the array of directories into a unix path by puttint /
// now turn the array of directories into a unix path by puttint /
// between each entry that does not already have one
for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin();
vit1 != finalPath.end(); ++vit1)
@@ -3396,7 +3391,7 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename
{
kwsys_stl::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_stl::string::npos)
{
@@ -3515,7 +3510,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
}
bool SystemTools::FileHasSignature(const char *filename,
const char *signature,
const char *signature,
long offset)
{
if (!filename || !signature)
@@ -3547,9 +3542,9 @@ bool SystemTools::FileHasSignature(const char *filename,
return res;
}
SystemTools::FileTypeEnum
SystemTools::FileTypeEnum
SystemTools::DetectFileType(const char *filename,
unsigned long length,
unsigned long length,
double percent_bin)
{
if (!filename || percent_bin < 0)
@@ -3577,13 +3572,13 @@ SystemTools::DetectFileType(const char *filename,
// Loop over contents and count
size_t text_count = 0;
const unsigned char *ptr = buffer;
const unsigned char *buffer_end = buffer + read_length;
while (ptr != buffer_end)
{
if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
*ptr == '\n' ||
*ptr == '\r' ||
*ptr == '\t')
@@ -3595,7 +3590,7 @@ SystemTools::DetectFileType(const char *filename,
delete [] buffer;
double current_percent_bin =
double current_percent_bin =
(static_cast<double>(read_length - text_count) /
static_cast<double>(read_length));
@@ -3607,8 +3602,8 @@ SystemTools::DetectFileType(const char *filename,
return SystemTools::FileTypeText;
}
bool SystemTools::LocateFileInDir(const char *filename,
const char *dir,
bool SystemTools::LocateFileInDir(const char *filename,
const char *dir,
kwsys_stl::string& filename_found,
int try_filename_dirs)
{
@@ -3621,7 +3616,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename);
// Check if 'dir' is really a directory
// Check if 'dir' is really a directory
// If win32 and matches something like C:, accept it as a dir
kwsys_stl::string real_dir;
@@ -3645,7 +3640,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
if (filename_base.size() && dir)
{
size_t dir_len = strlen(dir);
int need_slash =
int need_slash =
(dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\');
kwsys_stl::string temp = dir;
@@ -3676,7 +3671,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
filename_dir = SystemTools::GetFilenamePath(filename_dir);
filename_dir_base = SystemTools::GetFilenameName(filename_dir);
#if defined( _WIN32 )
if (!filename_dir_base.size() ||
if (!filename_dir_base.size() ||
filename_dir_base[filename_dir_base.size() - 1] == ':')
#else
if (!filename_dir_base.size())
@@ -3700,7 +3695,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
} while (!res && filename_dir_base.size());
}
}
return res;
}
@@ -3746,12 +3741,12 @@ bool SystemTools::FileIsFullPath(const char* in_name)
bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
#if defined(WIN32) && !defined(__CYGWIN__)
#if defined(WIN32) && !defined(__CYGWIN__)
const int size = int(strlen(path)) +1; // size of return
char *buffer = new char[size]; // create a buffer
char *tempPath = new char[size]; // create a buffer
int ret;
// if the path passed in has quotes around it, first remove the quotes
if (path[0] == '"' && path[strlen(path)-1] == '"')
{
@@ -3762,7 +3757,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
strcpy(tempPath,path);
}
buffer[0] = 0;
ret = GetShortPathName(tempPath, buffer, size);
@@ -3785,7 +3780,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
#endif
}
void SystemTools::SplitProgramFromArgs(const char* path,
void SystemTools::SplitProgramFromArgs(const char* path,
kwsys_stl::string& program, kwsys_stl::string& args)
{
// see if this is a full path to a program
@@ -3797,7 +3792,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
return;
}
// Try to find the program in the path, note the program
// may have spaces in its name so we have to look for it
// may have spaces in its name so we have to look for it
kwsys_stl::vector<kwsys_stl::string> e;
kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
if(findProg.size())
@@ -3828,7 +3823,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
args = dir.substr(spacePos, dir.size()-spacePos);
return;
}
// Now try and find the the program in the path
// Now try and find the the program in the path
findProg = SystemTools::FindProgram(tryProg.c_str(), e);
if(findProg.size())
{
@@ -4203,23 +4198,23 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx((OSVERSIONINFO *)&osvi))
if (!GetVersionEx((OSVERSIONINFO *)&osvi))
{
return 0;
}
}
switch (osvi.dwPlatformId)
{
// Test for the Windows NT product family.
case VER_PLATFORM_WIN32_NT:
// Test for the specific product family.
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
{
#if (_MSC_VER >= 1300)
#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
res += "Microsoft Windows Vista";
@@ -4259,7 +4254,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
// Test for the workstation type.
#if (_MSC_VER >= 1300)
#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
if (osvi.dwMajorVersion == 4)
@@ -4278,7 +4273,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
}
// Test for the server type.
else if (osvi.wProductType == VER_NT_SERVER)
@@ -4302,7 +4297,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += " Standard Edition";
}
}
else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
{
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
@@ -4319,7 +4314,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
{
if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
{
@@ -4336,7 +4331,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Test for specific product on Windows NT 4.0 SP5 and earlier
else
else
{
HKEY hKey;
#define BUFSIZE 80
@@ -4386,7 +4381,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Display service pack (if any) and build number.
if (osvi.dwMajorVersion == 4 &&
if (osvi.dwMajorVersion == 4 &&
lstrcmpi(osvi.szCSDVersion, "Service Pack 6") == 0)
{
HKEY hKey;
@@ -4415,7 +4410,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += buffer;
res += ")";
}
RegCloseKey(hKey);
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
@@ -4455,11 +4450,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
res += "Microsoft Windows Millennium Edition";
}
}
break;
case VER_PLATFORM_WIN32s:
res += "Microsoft Win32s";
break;
}
@@ -4469,7 +4464,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
// ----------------------------------------------------------------------
bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
kwsys_stl::string& dataglom )
{
@@ -4487,12 +4482,12 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
}
// ----------------------------------------------------------------------
bool SystemTools::ParseURL( const kwsys_stl::string& URL,
bool SystemTools::ParseURL( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
kwsys_stl::string& username,
kwsys_stl::string& password,
kwsys_stl::string& hostname,
kwsys_stl::string& dataport,
kwsys_stl::string& username,
kwsys_stl::string& password,
kwsys_stl::string& hostname,
kwsys_stl::string& dataport,
kwsys_stl::string& database )
{
kwsys::RegularExpression urlRe( VTK_URL_REGEX );
@@ -4515,7 +4510,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
hostname = urlRe.match( 6 );
dataport = urlRe.match( 8 );
database = urlRe.match( 9 );
return true;
}
+1 -1
View File
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2011)
# KWSys version date month component. Format is MM.
SET(KWSYS_DATE_STAMP_MONTH 11)
SET(KWSYS_DATE_STAMP_MONTH 12)
# KWSys version date day component. Format is DD.
SET(KWSYS_DATE_STAMP_DAY 06)