summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx8
-rw-r--r--Source/CursesDialog/ccmake.cxx8
-rw-r--r--Source/QtDialog/CMakeSetup.cxx16
-rw-r--r--Source/cmAddDependenciesCommand.cxx9
-rw-r--r--Source/cmAddLibraryCommand.cxx88
-rw-r--r--Source/cmExportCommand.cxx10
-rw-r--r--Source/cmExportFileGenerator.cxx18
-rw-r--r--Source/cmExportFileGenerator.h2
-rw-r--r--Source/cmExportInstallFileGenerator.cxx27
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h1
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx4
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h4
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx131
-rw-r--r--Source/cmGeneratorTarget.cxx113
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx32
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmTarget.cxx285
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmakemain.cxx18
-rw-r--r--Source/ctest.cxx8
-rw-r--r--Source/kwsys/Terminal.c1
28 files changed, 539 insertions, 267 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 937a5fe..90d311c 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20140104)
+set(CMake_VERSION_TWEAK 20140107)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 438b16d..a19b778 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -25,6 +25,7 @@
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -97,8 +98,13 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
//----------------------------------------------------------------------------
// this is CPack.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = args.argc();
+ argv = args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index ce50845..2d1ef5c 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -19,6 +19,7 @@
#include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.h"
+#include <cmsys/Encoding.hxx>
#include <form.h>
@@ -78,8 +79,13 @@ void CMakeErrorHandler(const char* message, const char* title, bool&, void* clie
self->AddError(message, title);
}
-int main(int argc, char** argv)
+int main(int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmDocumentation doc;
doc.addCMakeStandardDocSections();
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 408bb4c..821121e 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -21,6 +21,7 @@
#include "cmVersion.h"
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -48,12 +49,17 @@ static const char * cmDocumentationOptions[][2] =
int main(int argc, char** argv)
{
- cmSystemTools::FindCMakeResources(argv[0]);
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ int argc2 = encoding_args.argc();
+ char const* const* argv2 = encoding_args.argv();
+
+ cmSystemTools::FindCMakeResources(argv2[0]);
// check docs first so that X is not need to get docs
// do docs, if args were given
cmDocumentation doc;
doc.addCMakeStandardDocSections();
- if(argc >1 && doc.CheckOptions(argc, argv))
+ if(argc2 >1 && doc.CheckOptions(argc2, argv2))
{
// Construct and print requested documentation.
cmake hcm;
@@ -80,9 +86,9 @@ int main(int argc, char** argv)
}
// if arg for install
- for(int i =0; i < argc; i++)
+ for(int i =0; i < argc2; i++)
{
- if(strcmp(argv[i], "--mac-install") == 0)
+ if(strcmp(argv2[i], "--mac-install") == 0)
{
QMacInstallDialog setupdialog(0);
setupdialog.exec();
@@ -116,7 +122,7 @@ int main(int argc, char** argv)
dialog.show();
cmsys::CommandLineArguments arg;
- arg.Initialize(argc, argv);
+ arg.Initialize(argc2, argv2);
std::string binaryDirectory;
std::string sourceDirectory;
typedef cmsys::CommandLineArguments argT;
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index e4d7f7f..87bfb3c 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -33,6 +33,15 @@ bool cmAddDependenciesCommand
}
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
{
+ if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "Cannot add target-level dependencies to INTERFACE library "
+ "target \"" << target_name << "\".\n";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
std::vector<std::string>::const_iterator s = args.begin();
++s; // skip over target_name
for (; s != args.end(); ++s)
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 0f98f35..2627445 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -49,47 +49,117 @@ bool cmAddLibraryCommand
std::string libType = *s;
if(libType == "STATIC")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting STATIC type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::STATIC_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "SHARED")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting SHARED type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::SHARED_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "MODULE")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting MODULE type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::MODULE_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "OBJECT")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting OBJECT type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::OBJECT_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "UNKNOWN")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting UNKNOWN type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::UNKNOWN_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "ALIAS")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting ALIAS type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
isAlias = true;
}
else if(libType == "INTERFACE")
{
+ if (haveSpecifiedType)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting/multiple types.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (isAlias)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting ALIAS type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (excludeFromAll)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::INTERFACE_LIBRARY;
haveSpecifiedType = true;
}
else if(*s == "EXCLUDE_FROM_ALL")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
excludeFromAll = true;
}
@@ -109,6 +179,24 @@ bool cmAddLibraryCommand
}
}
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (s != args.end())
+ {
+ cmOStringStream e;
+ e << "INTERFACE library requires no source arguments.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (importGlobal && !importTarget)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+
bool nameOk = cmGeneratorExpression::IsValidTargetName(libName) &&
!cmGlobalGenerator::IsReservedTarget(libName);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index b6bf870..7c97d8d 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -236,8 +236,14 @@ bool cmExportCommand
{
ebfg->AddConfiguration("");
}
-
- gg->AddBuildExportSet(ebfg);
+ if (this->ExportSet)
+ {
+ gg->AddBuildExportExportSet(ebfg);
+ }
+ else
+ {
+ gg->AddBuildExportSet(ebfg);
+ }
return true;
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index d5f81ce..13bff19 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -826,36 +826,36 @@ cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix,
cmTarget* target,
const char* propName,
- std::vector<std::string> const& libs,
+ std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
{
- // Skip the property if there are no libraries.
- if(libs.empty())
+ // Skip the property if there are no entries.
+ if(entries.empty())
{
return;
}
// Construct the property value.
- std::string link_libs;
+ std::string link_entries;
const char* sep = "";
- for(std::vector<std::string>::const_iterator li = libs.begin();
- li != libs.end(); ++li)
+ for(std::vector<std::string>::const_iterator li = entries.begin();
+ li != entries.end(); ++li)
{
// Separate this from the previous entry.
- link_libs += sep;
+ link_entries += sep;
sep = ";";
std::string temp = *li;
this->AddTargetNamespace(temp, target, missingTargets);
- link_libs += temp;
+ link_entries += temp;
}
// Store the property.
std::string prop = propName;
prop += suffix;
- properties[prop] = link_libs;
+ properties[prop] = link_entries;
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 6fd23b0..1438f4d 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -82,7 +82,7 @@ protected:
std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const char* propName,
- std::vector<std::string> const& libs,
+ std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 1025dc0..73e9b31 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -114,13 +114,18 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
bool require2_8_12 = false;
- bool require2_8_13 = false;
+ bool require3_0_0 = false;
+ bool requiresConfigFiles = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = (*tei)->Target;
+
+ requiresConfigFiles = requiresConfigFiles
+ || te->GetType() != cmTarget::INTERFACE_LIBRARY;
+
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
@@ -160,7 +165,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
{
- require2_8_13 = true;
+ require3_0_0 = true;
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
@@ -169,7 +174,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
- if (require2_8_13)
+ if (require3_0_0)
{
this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007");
}
@@ -197,15 +202,19 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this->GenerateImportedFileCheckLoop(os);
- // Generate an import file for each configuration.
bool result = true;
- for(std::vector<std::string>::const_iterator
- ci = this->Configurations.begin();
- ci != this->Configurations.end(); ++ci)
+ // Generate an import file for each configuration.
+ // Don't do this if we only export INTERFACE_LIBRARY targets.
+ if (requiresConfigFiles)
{
- if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ for(std::vector<std::string>::const_iterator
+ ci = this->Configurations.begin();
+ ci != this->Configurations.end(); ++ci)
{
- result = false;
+ if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ {
+ result = false;
+ }
}
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index d9bc04c..8d37b62 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -36,6 +36,8 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS)
+#undef FIND_TARGETS
+
this->PopulateProperties(te, properties, emittedDeps);
this->GenerateInterfaceProperties(te, os, properties);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 755b445..c93187e 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -40,6 +40,7 @@ cmExtraEclipseCDT4Generator
this->SupportsVirtualFolders = true;
this->GenerateLinkedResources = true;
this->SupportsGmakeErrorParser = true;
+ this->SupportsMachO64Parser = true;
}
//----------------------------------------------------------------------------
@@ -93,6 +94,7 @@ void cmExtraEclipseCDT4Generator::Generate()
if (version < 3006) // 3.6 is Helios
{
this->SupportsVirtualFolders = false;
+ this->SupportsMachO64Parser = false;
}
if (version < 3007) // 3.7 is Indigo
{
@@ -754,7 +756,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
else if (systemName == "Darwin")
{
- fout << "<extension id=\"org.eclipse.cdt.core.MachO\""
+ fout << "<extension id=\"" <<
+ (this->SupportsMachO64Parser ? "org.eclipse.cdt.core.MachO64"
+ : "org.eclipse.cdt.core.MachO") << "\""
" point=\"org.eclipse.cdt.core.BinaryParser\">\n"
"<attribute key=\"c++filt\" value=\"c++filt\"/>\n"
"</extension>\n"
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 9c89f85..d88b247 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -115,6 +115,7 @@ private:
bool GenerateLinkedResources;
bool SupportsVirtualFolders;
bool SupportsGmakeErrorParser;
+ bool SupportsMachO64Parser;
};
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 92f74f3..c2c4e20 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -40,6 +40,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(TEST_TRANSITIVE_PROPERTY_METHOD)
false)
)
+#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
std::map<cmStdString, std::set<cmStdString> >::const_iterator it
= top->Seen.find(target);
@@ -191,7 +192,8 @@ bool
cmGeneratorExpressionDAGChecker::EvaluatingSystemIncludeDirectories() const
{
const char *prop = this->Property.c_str();
- return strcmp(prop, "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES") == 0;
+ return (strcmp(prop, "SYSTEM_INCLUDE_DIRECTORIES") == 0
+ || strcmp(prop, "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES") == 0);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index fd47ad7..98ffd36 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -56,7 +56,9 @@ struct cmGeneratorExpressionDAGChecker
#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) \
bool METHOD () const;
-CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+
+#undef DECLARE_TRANSITIVE_PROPERTY_METHOD
bool GetTransitivePropertiesOnly();
void SetTransitivePropertiesOnly()
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index c8010d0..f0e40ea 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -19,6 +19,7 @@
#include <cmsys/String.h>
#include <assert.h>
+#include <errno.h>
//----------------------------------------------------------------------------
#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
@@ -48,7 +49,7 @@ struct cmGeneratorExpressionNode
enum {
DynamicParameters = 0,
OneOrMoreParameters = -1,
- ZeroOrMoreParameters = -2
+ OneOrZeroParameters = -2
};
virtual ~cmGeneratorExpressionNode() {}
@@ -197,6 +198,92 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
} strEqualNode;
//----------------------------------------------------------------------------
+static const struct EqualNode : public cmGeneratorExpressionNode
+{
+ EqualNode() {}
+
+ virtual int NumExpectedParameters() const { return 2; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *content,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ char *pEnd;
+
+ int base = 0;
+ bool flipSign = false;
+
+ const char *lhs = parameters[0].c_str();
+ if (cmHasLiteralPrefix(lhs, "0b"))
+ {
+ base = 2;
+ lhs += 2;
+ }
+ if (cmHasLiteralPrefix(lhs, "-0b"))
+ {
+ base = 2;
+ lhs += 3;
+ flipSign = true;
+ }
+ if (cmHasLiteralPrefix(lhs, "+0b"))
+ {
+ base = 2;
+ lhs += 3;
+ }
+
+ long lnum = strtol(lhs, &pEnd, base);
+ if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<EQUAL> parameter " + parameters[0] + " is not a valid integer.");
+ return std::string();
+ }
+
+ if (flipSign)
+ {
+ lnum = -lnum;
+ }
+
+ base = 0;
+ flipSign = false;
+
+ const char *rhs = parameters[1].c_str();
+ if (cmHasLiteralPrefix(rhs, "0b"))
+ {
+ base = 2;
+ rhs += 2;
+ }
+ if (cmHasLiteralPrefix(rhs, "-0b"))
+ {
+ base = 2;
+ rhs += 3;
+ flipSign = true;
+ }
+ if (cmHasLiteralPrefix(rhs, "+0b"))
+ {
+ base = 2;
+ rhs += 3;
+ }
+
+ long rnum = strtol(rhs, &pEnd, base);
+ if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<EQUAL> parameter " + parameters[1] + " is not a valid integer.");
+ return std::string();
+ }
+
+ if (flipSign)
+ {
+ rnum = -rnum;
+ }
+
+ return lnum == rnum ? "1" : "0";
+ }
+} equalNode;
+
+//----------------------------------------------------------------------------
static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
@@ -297,7 +384,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
CompilerIdNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -343,12 +430,6 @@ static const struct CCompilerIdNode : public CompilerIdNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<C_COMPILER_ID> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
@@ -371,12 +452,6 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<CXX_COMPILER_ID> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
@@ -394,7 +469,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
{
CompilerVersionNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -439,12 +514,6 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<C_COMPILER_VERSION> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
@@ -467,13 +536,6 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<CXX_COMPILER_VERSION> expression requires one or two "
- "parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
@@ -492,7 +554,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{
PlatformIdNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -710,6 +772,8 @@ static const char* targetPropertyTransitiveWhitelist[] = {
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
};
+#undef TRANSITIVE_PROPERTY_NAME
+
std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
cmTarget const* target,
cmTarget const* headTarget,
@@ -937,6 +1001,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
ASSERT_TRANSITIVE_PROPERTY_METHOD)
false);
}
+#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
}
std::string linkedTargetsContent;
@@ -1492,6 +1557,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &targetSoNameFileDirNode;
else if (identifier == "STREQUAL")
return &strEqualNode;
+ else if (identifier == "EQUAL")
+ return &equalNode;
else if (identifier == "LOWER_CASE")
return &lowerCaseNode;
else if (identifier == "UPPER_CASE")
@@ -1733,6 +1800,12 @@ std::string GeneratorExpressionContent::EvaluateParameters(
reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ "> expression requires at least one parameter.");
}
+ if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters
+ && parameters.size() > 2)
+ {
+ reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ + "> expression requires one or zero parameters.");
+ }
return std::string();
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index fdd4e6d..6894cfc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -18,9 +18,12 @@
#include "cmSourceFile.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmComputeLinkInformation.h"
#include <queue>
+#include "assert.h"
+
//----------------------------------------------------------------------------
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
{
@@ -59,10 +62,50 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
return 0;
}
+static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name,
+ const char *config, cmTarget *headTarget,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ std::vector<std::string>& result)
+{
+ cmTarget* depTgt = mf->FindTargetToUse(name.c_str());
+
+ if (!depTgt)
+ {
+ return;
+ }
+
+ cmListFileBacktrace lfbt;
+
+ if (const char* dirs =
+ depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"))
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(dirs)
+ ->Evaluate(mf,
+ config, false, headTarget,
+ depTgt, dagChecker), result);
+ }
+ if (!depTgt->IsImported())
+ {
+ return;
+ }
+
+ if (const char* dirs =
+ depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES"))
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(dirs)
+ ->Evaluate(mf,
+ config, false, headTarget,
+ depTgt, dagChecker), result);
+ }
+}
+
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
const char *config) const
{
+ assert(this->GetType() != cmTarget::INTERFACE_LIBRARY);
std::string config_upper;
if(config && *config)
{
@@ -75,39 +118,81 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
if (iter == this->SystemIncludesCache.end())
{
+ cmTarget::LinkImplementation const* impl
+ = this->Target->GetLinkImplementation(config, this->Target);
+ if(!impl)
+ {
+ return false;
+ }
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+
std::vector<std::string> result;
for (std::set<cmStdString>::const_iterator
it = this->Target->GetSystemIncludeDirectories().begin();
it != this->Target->GetSystemIncludeDirectories().end(); ++it)
{
- cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(*it)
+ ->Evaluate(this->Makefile,
+ config, false, this->Target,
+ &dagChecker), result);
+ }
+
+ std::set<cmStdString> uniqueDeps;
+ for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
+ li != impl->Libraries.end(); ++li)
+ {
+ if (uniqueDeps.insert(*li).second)
+ {
+ cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str());
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+ if (!tgt)
+ {
+ continue;
+ }
- cmSystemTools::ExpandListArgument(ge.Parse(*it)
- ->Evaluate(this->Makefile,
- config, false, this->Target,
- &dagChecker), result);
+ handleSystemIncludesDep(this->Makefile, *li, config, this->Target,
+ &dagChecker, result);
+
+ std::vector<std::string> deps;
+ tgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps);
+
+ for(std::vector<std::string>::const_iterator di = deps.begin();
+ di != deps.end(); ++di)
+ {
+ if (uniqueDeps.insert(*di).second)
+ {
+ handleSystemIncludesDep(this->Makefile, *di, config, this->Target,
+ &dagChecker, result);
+ }
+ }
+ }
}
+ std::set<cmStdString> unique;
for(std::vector<std::string>::iterator li = result.begin();
li != result.end(); ++li)
{
cmSystemTools::ConvertToUnixSlashes(*li);
+ unique.insert(*li);
+ }
+ result.clear();
+ for(std::set<cmStdString>::iterator li = unique.begin();
+ li != unique.end(); ++li)
+ {
+ result.push_back(*li);
}
IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first;
}
- if (std::find(iter->second.begin(),
- iter->second.end(), dir) != iter->second.end())
- {
- return true;
- }
- return false;
+ std::string dirString = dir;
+ return std::binary_search(iter->second.begin(), iter->second.end(),
+ dirString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index faba7cd..a1454a3 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -298,7 +298,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
return this->StoreResult(target->GetName());
}
}
- return false;
+ return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
}
if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name.c_str()))
{
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 780b072..82c9155 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -188,6 +188,13 @@ void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)
this->BuildExportSets[gen->GetMainExportFileName()] = gen;
}
+void
+cmGlobalGenerator::AddBuildExportExportSet(cmExportBuildFileGenerator* gen)
+{
+ this->BuildExportSets[gen->GetMainExportFileName()] = gen;
+ this->BuildExportExportSets[gen->GetMainExportFileName()] = gen;
+}
+
bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
{
std::map<std::string, cmExportBuildFileGenerator*>::iterator it
@@ -208,7 +215,12 @@ cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
{
const std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it
= this->BuildExportSets.find(filename);
- return it != this->BuildExportSets.end();
+ if (it == this->BuildExportSets.end())
+ {
+ return false;
+ }
+ return this->BuildExportExportSets.find(filename)
+ == this->BuildExportExportSets.end();
}
// Find the make program for the generator, required for try compiles
@@ -1165,17 +1177,6 @@ void cmGlobalGenerator::Generate()
// it builds by default.
this->FillLocalGeneratorToTargetMap();
- for (i = 0; i < this->LocalGenerators.size(); ++i)
- {
- cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
- cmTargets* targets = &(mf->GetTargets());
- for ( cmTargets::iterator it = targets->begin();
- it != targets->end(); ++ it )
- {
- it->second.FinalizeSystemIncludeDirectories();
- }
- }
-
// Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1338,13 +1339,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
cmTarget* t = &ti->second;
+ t->AppendBuildInterfaceIncludes();
+
if (t->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
- t->AppendBuildInterfaceIncludes();
-
for (std::vector<cmValueWithOrigin>::const_iterator it
= noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it)
@@ -1909,7 +1910,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
cmTarget& target)
{
- if(target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(target.GetType() == cmTarget::INTERFACE_LIBRARY
+ || target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
// This target is excluded from its directory.
return true;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 049b0e6..fc5cab9 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -311,6 +311,7 @@ public:
std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
{return this->BuildExportSets;}
void AddBuildExportSet(cmExportBuildFileGenerator*);
+ void AddBuildExportExportSet(cmExportBuildFileGenerator*);
bool IsExportedTargetsFile(const std::string &filename) const;
bool GenerateImportFile(const std::string &file);
cmExportBuildFileGenerator*
@@ -375,6 +376,7 @@ protected:
// Sets of named target exports
cmExportSetMap ExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
+ std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets;
// Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b5a46d0..381c1f5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -488,7 +488,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
dir.c_str());
}
- if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(target.GetType() != cmTarget::INTERFACE_LIBRARY
+ && !target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
allbuild->AddUtility(target.GetName());
}
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 30c1743..e20fe02 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -55,7 +55,7 @@ bool cmIncludeDirectoryCommand
std::vector<std::string> includes;
- GetIncludes(*i, includes);
+ this->GetIncludes(*i, includes);
if (before)
{
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 401ea5b..35b65b4 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4045,8 +4045,8 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
// Create the target.
cmsys::auto_ptr<cmTarget> target(new cmTarget);
target->SetType(type, name);
- target->SetMakefile(this);
target->MarkAsImported();
+ target->SetMakefile(this);
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9faf0d9..b06480b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -24,6 +24,7 @@
#include <set>
#include <stdlib.h> // required for atof
#include <assert.h>
+#include <errno.h>
const char* cmTarget::GetTargetTypeName(TargetType targetType)
{
@@ -136,7 +137,7 @@ public:
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
- std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
+ std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
@@ -330,34 +331,36 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Save the backtrace of target construction.
this->Makefile->GetBacktrace(this->Internal->Backtrace);
- // Initialize the INCLUDE_DIRECTORIES property based on the current value
- // of the same directory property:
- const std::vector<cmValueWithOrigin> parentIncludes =
- this->Makefile->GetIncludeDirectoriesEntries();
-
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentIncludes.begin(); it != parentIncludes.end(); ++it)
+ if (!this->IsImported())
{
- this->InsertInclude(*it);
- }
+ // Initialize the INCLUDE_DIRECTORIES property based on the current value
+ // of the same directory property:
+ const std::vector<cmValueWithOrigin> parentIncludes =
+ this->Makefile->GetIncludeDirectoriesEntries();
- const std::set<cmStdString> parentSystemIncludes =
- this->Makefile->GetSystemIncludeDirectories();
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = parentIncludes.begin(); it != parentIncludes.end(); ++it)
+ {
+ this->InsertInclude(*it);
+ }
+ const std::set<cmStdString> parentSystemIncludes =
+ this->Makefile->GetSystemIncludeDirectories();
- for (std::set<cmStdString>::const_iterator it
- = parentSystemIncludes.begin();
- it != parentSystemIncludes.end(); ++it)
- {
- this->SystemIncludeDirectories.insert(*it);
- }
+ for (std::set<cmStdString>::const_iterator it
+ = parentSystemIncludes.begin();
+ it != parentSystemIncludes.end(); ++it)
+ {
+ this->SystemIncludeDirectories.insert(*it);
+ }
- const std::vector<cmValueWithOrigin> parentOptions =
- this->Makefile->GetCompileOptionsEntries();
+ const std::vector<cmValueWithOrigin> parentOptions =
+ this->Makefile->GetCompileOptionsEntries();
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentOptions.begin(); it != parentOptions.end(); ++it)
- {
- this->InsertCompileOption(*it);
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = parentOptions.begin(); it != parentOptions.end(); ++it)
+ {
+ this->InsertCompileOption(*it);
+ }
}
if (this->GetType() != INTERFACE_LIBRARY)
@@ -1039,62 +1042,6 @@ cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
}
//----------------------------------------------------------------------------
-void cmTarget::FinalizeSystemIncludeDirectories()
-{
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
- it != end; ++it)
- {
- if (!cmGeneratorExpression::IsValidTargetName(it->Value)
- && cmGeneratorExpression::Find(it->Value) == std::string::npos)
- {
- continue;
- }
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(it->Value);
- std::string targetName = cge->Evaluate(this->Makefile, 0,
- false, this, 0, 0);
- cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str());
- if (!tgt || tgt == this)
- {
- continue;
- }
- if (tgt->IsImported()
- && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")
- && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"))
- {
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- this->SystemIncludeDirectories.insert(includeGenex);
- return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset
- // of the INTERFACE_INCLUDE_DIRECTORIES
- }
- }
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- this->SystemIncludeDirectories.insert(includeGenex);
- }
-}
-
-//----------------------------------------------------------------------------
void
cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
{
@@ -1400,14 +1347,10 @@ static bool whiteListedInterfaceProperty(const char *prop)
"COMPATIBLE_INTERFACE_NUMBER_MAX",
"COMPATIBLE_INTERFACE_NUMBER_MIN",
"COMPATIBLE_INTERFACE_STRING",
- "EXCLUDE_FROM_ALL",
- "EXCLUDE_FROM_DEFAULT_BUILD",
"EXPORT_NAME",
- "IMPORTED_LINK_INTERFACE_LANGUAGES",
"IMPORTED",
"NAME",
- "TYPE",
- "VERSION"
+ "TYPE"
};
if (std::binary_search(cmArrayBegin(builtIns),
@@ -1418,9 +1361,7 @@ static bool whiteListedInterfaceProperty(const char *prop)
return true;
}
- if (cmHasLiteralPrefix(prop, "EXCLUDE_FROM_DEFAULT_BUILD_")
- || cmHasLiteralPrefix(prop, "IMPORTED_LINK_INTERFACE_LANGUAGES_")
- || cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_"))
+ if (cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_"))
{
return true;
}
@@ -1495,11 +1436,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
- this->Internal->LinkInterfacePropertyEntries.clear();
+ this->Internal->LinkImplementationPropertyEntries.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return;
}
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
@@ -1570,7 +1511,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return;
}
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
@@ -1603,6 +1544,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
if(this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::STATIC_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY &&
+ this->GetType() != cmTarget::INTERFACE_LIBRARY &&
!this->IsExecutableWithExports())
{
return;
@@ -1882,8 +1824,8 @@ cmTarget::GetIncludeDirectories(const char *config) const
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2111,8 +2053,8 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2224,8 +2166,8 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2572,6 +2514,8 @@ void cmTarget::GetTargetVersion(bool soversion,
minor = 0;
patch = 0;
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
// Look for a VERSION or SOVERSION property.
const char* prop = soversion? "SOVERSION" : "VERSION";
if(const char* version = this->GetProperty(prop))
@@ -2685,7 +2629,6 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
- this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
if(strcmp(prop,"LOCATION") == 0)
@@ -2720,25 +2663,6 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetLocation(configName.c_str()),
cmProperty::TARGET);
}
- else
- {
- // Support "<CONFIG>_LOCATION" for compatibility.
- int len = static_cast<int>(strlen(prop));
- if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
- {
- std::string configName(prop, len-9);
- if(configName != "IMPORTED")
- {
- if (!this->HandleLocationPropertyPolicy())
- {
- return 0;
- }
- this->Properties.SetProperty(prop,
- this->GetLocation(configName.c_str()),
- cmProperty::TARGET);
- }
- }
- }
}
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
@@ -2800,8 +2724,8 @@ const char *cmTarget::GetProperty(const char* prop,
output = "";
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
output += sep;
@@ -3604,6 +3528,8 @@ void cmTarget::GetLibraryNames(std::string& name,
return;
}
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
@@ -4179,6 +4105,8 @@ std::string cmTarget::GetOutputName(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion() const
{
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
{
return fversion;
@@ -4257,20 +4185,23 @@ enum CompatibleType
//----------------------------------------------------------------------------
template<typename PropertyType>
-PropertyType consistentProperty(PropertyType lhs, PropertyType rhs,
- CompatibleType t);
+std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
+ PropertyType rhs,
+ CompatibleType t);
//----------------------------------------------------------------------------
template<>
-bool consistentProperty(bool lhs, bool rhs, CompatibleType)
+std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
{
- return lhs == rhs;
+ return std::make_pair(lhs == rhs, lhs);
}
//----------------------------------------------------------------------------
-const char * consistentStringProperty(const char *lhs, const char *rhs)
+std::pair<bool, const char*> consistentStringProperty(const char *lhs,
+ const char *rhs)
{
- return strcmp(lhs, rhs) == 0 ? lhs : 0;
+ const bool b = strcmp(lhs, rhs) == 0;
+ return std::make_pair(b, b ? lhs : 0);
}
#if defined(_MSC_VER) && _MSC_VER <= 1200
@@ -4284,49 +4215,74 @@ cmMinimum(const T& l, const T& r) {return l < r ? l : r;}
#endif
//----------------------------------------------------------------------------
-const char * consistentNumberProperty(const char *lhs, const char *rhs,
- CompatibleType t)
+std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
{
- double lnum;
- double rnum;
- if(sscanf(lhs, "%lg", &lnum) != 1 ||
- sscanf(rhs, "%lg", &rnum) != 1)
+ char *pEnd;
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
+ long lnum = strtol(lhs, &pEnd, 0);
+ if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
{
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
+ }
+
+ long rnum = strtol(rhs, &pEnd, 0);
+ if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ return std::pair<bool, const char*>(false, null_ptr);
}
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
if (t == NumberMaxType)
{
- return cmMaximum(lnum, rnum) == lnum ? lhs : rhs;
+ return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
}
else
{
- return cmMinimum(lnum, rnum) == lnum ? lhs : rhs;
+ return std::make_pair(true, cmMinimum(lnum, rnum) == lnum ? lhs : rhs);
}
}
//----------------------------------------------------------------------------
template<>
-const char* consistentProperty(const char *lhs, const char *rhs,
- CompatibleType t)
+std::pair<bool, const char*> consistentProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
{
if (!lhs && !rhs)
{
- return "";
+ return std::make_pair(true, lhs);
}
if (!lhs)
{
- return rhs ? rhs : "";
+ return std::make_pair(true, rhs);
}
if (!rhs)
{
- return lhs ? lhs : "";
+ return std::make_pair(true, lhs);
}
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
switch(t)
{
case BoolType:
assert(!"consistentProperty for strings called with BoolType");
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
case StringType:
return consistentStringProperty(lhs, rhs);
case NumberMinType:
@@ -4334,7 +4290,12 @@ const char* consistentProperty(const char *lhs, const char *rhs,
return consistentNumberProperty(lhs, rhs, t);
}
assert(!"Unreachable!");
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
+
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
}
template<typename PropertyType>
@@ -4506,7 +4467,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
("INTERFACE_" + p).c_str(), 0);
std::string reportEntry;
- if (ifacePropContent)
+ if (ifaceIsSet)
{
reportEntry += " * Target \"";
reportEntry += li->Target->GetName();
@@ -4519,11 +4480,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
if (ifaceIsSet)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "Property " << p << " on target \""
@@ -4535,7 +4497,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -4549,19 +4511,14 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
propContent = impliedValue<PropertyType>(propContent);
- reportEntry += " * Target \"";
- reportEntry += li->Target->GetName();
- reportEntry += "\" property value \"";
- reportEntry += valueAsString<PropertyType>(propContent);
- reportEntry += "\" ";
-
if (ifaceIsSet)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "Property " << p << " on target \""
@@ -4574,7 +4531,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -4590,11 +4547,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
if (propInitialized)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "The INTERFACE_" << p << " property of \""
@@ -4606,7 +4564,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -5578,9 +5536,6 @@ void cmTarget::ComputeLinkImplementation(const char* config,
LinkImplementation& impl,
cmTarget const* head) const
{
- // Compute which library configuration to link.
- cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
-
// Collect libraries directly linked in this configuration.
std::vector<std::string> llibs;
this->GetDirectLinkLibraries(config, llibs, head);
@@ -5673,6 +5628,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
impl.Libraries.push_back(item);
}
+ cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
li != oldllibs.end(); ++li)
@@ -6003,7 +5959,8 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
<< propsString <<
" property in the dependencies of target \"" << this->GetName() <<
"\". This is not allowed. A property may only require compatibility "
- "in a boolean interpretation or a string interpretation, but not both.";
+ "in a boolean interpretation, a numeric minimum, a numeric maximum or a "
+ "string interpretation, but not a mixture.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index e026c59..4916648 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -568,8 +568,6 @@ public:
std::set<cmStdString> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; }
- void FinalizeSystemIncludeDirectories();
-
bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == STATIC_LIBRARY; }
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 882b072..fcaa127 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -24,6 +24,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include <cmsys/Encoding.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
//----------------------------------------------------------------------------
@@ -79,7 +80,7 @@ static const char * cmDocumentationOptions[][2] =
#endif
-static int do_command(int ac, char** av)
+static int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
args.push_back(av[0]);
@@ -90,8 +91,8 @@ static int do_command(int ac, char** av)
return cmcmd::ExecuteCMakeCommand(args);
}
-int do_cmake(int ac, char** av);
-static int do_build(int ac, char** av);
+int do_cmake(int ac, char const* const* av);
+static int do_build(int ac, char const* const* av);
static cmMakefile* cmakemainGetMakefile(void *clientdata)
{
@@ -159,8 +160,13 @@ static void cmakemainProgressCallback(const char *m, float prog,
}
-int main(int ac, char** av)
+int main(int ac, char const* const* av)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(ac, av);
+ ac = args.argc();
+ av = args.argv();
+
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(av[0]);
if(ac > 1)
@@ -181,7 +187,7 @@ int main(int ac, char** av)
return ret;
}
-int do_cmake(int ac, char** av)
+int do_cmake(int ac, char const* const* av)
{
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
{
@@ -352,7 +358,7 @@ int do_cmake(int ac, char** av)
}
//----------------------------------------------------------------------------
-static int do_build(int ac, char** av)
+static int do_build(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --build\n";
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index de07458..3eb5551 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -18,6 +18,7 @@
#include "CTest/cmCTestScriptHandler.h"
#include "CTest/cmCTestLaunch.h"
+#include "cmsys/Encoding.hxx"
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -111,8 +112,13 @@ static const char * cmDocumentationOptions[][2] =
};
// this is a test driver program for cmCTest.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::DoNotInheritStdPipes();
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(argv[0]);
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index 25832c2..6d7ec41 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -155,6 +155,7 @@ static const char* kwsysTerminalVT100Names[] =
"mach-color",
"mlterm",
"putty",
+ "putty-256color",
"rxvt",
"rxvt-256color",
"rxvt-cygwin",