summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx31
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx65
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
-rw-r--r--Source/Modules/FindLibUV.cmake2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx13
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
-rw-r--r--Source/cmCommonTargetGenerator.h1
-rw-r--r--Source/cmFileCommand.cxx6
-rw-r--r--Source/cmFortranParser.h3
-rw-r--r--Source/cmFortranParserImpl.cxx1
-rw-r--r--Source/cmGeneratorTarget.cxx85
-rw-r--r--Source/cmGeneratorTarget.h8
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx9
-rw-r--r--Source/cmIDEOptions.cxx5
-rw-r--r--Source/cmIDEOptions.h2
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx13
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx21
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx22
-rw-r--r--Source/cmPolicies.h6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx15
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx5
-rw-r--r--Source/kwsys/FStream.hxx.in4
29 files changed, 267 insertions, 74 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8d56b82..58c9390 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170328)
+set(CMake_VERSION_PATCH 20170331)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ff465ab..2d4726c 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -163,7 +163,9 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
this->TestRunningMap[test] = false;
this->RunningCount -= GetProcessorsUsed(test);
testRun->EndTest(this->Completed, this->Total, false);
- this->Failed->push_back(this->Properties[test]->Name);
+ if (!this->Properties[test]->Disabled) {
+ this->Failed->push_back(this->Properties[test]->Name);
+ }
delete testRun;
}
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index f148f30..94aa4bd 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -215,6 +215,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
if (this->TestProperties->SkipReturnCode >= 0 &&
this->TestProperties->SkipReturnCode == retVal) {
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
+ std::ostringstream s;
+ s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
+ this->TestResult.CompletionStatus = s.str();
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
} else if ((success && !this->TestProperties->WillFail) ||
(!success && this->TestProperties->WillFail)) {
@@ -253,6 +256,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other");
this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
}
+ } else if ("Disabled" == this->TestResult.CompletionStatus) {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run (Disabled) ");
} else // cmsysProcess_State_Error
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run ");
@@ -413,6 +418,24 @@ bool cmCTestRunTest::StartTest(size_t total)
<< this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl);
this->ProcessOutput.clear();
+
+ // Return immediately if test is disabled
+ if (this->TestProperties->Disabled) {
+ this->TestResult.Properties = this->TestProperties;
+ this->TestResult.ExecutionTime = 0;
+ this->TestResult.CompressOutput = false;
+ this->TestResult.ReturnValue = -1;
+ this->TestResult.CompletionStatus = "Disabled";
+ this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
+ this->TestResult.TestCount = this->TestProperties->Index;
+ this->TestResult.Name = this->TestProperties->Name;
+ this->TestResult.Path = this->TestProperties->Directory;
+ this->TestProcess = new cmProcess;
+ this->TestResult.Output = "Disabled";
+ this->TestResult.FullCommandLine = "";
+ return false;
+ }
+
this->ComputeArguments();
std::vector<std::string>& args = this->TestProperties->Args;
this->TestResult.Properties = this->TestProperties;
@@ -437,7 +460,7 @@ bool cmCTestRunTest::StartTest(size_t total)
cmCTestLog(this->CTest, HANDLER_OUTPUT, msg << std::endl);
this->TestResult.Output = msg;
this->TestResult.FullCommandLine = "";
- this->TestResult.CompletionStatus = "Not Run";
+ this->TestResult.CompletionStatus = "Fixture dependency failed";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
@@ -457,7 +480,7 @@ bool cmCTestRunTest::StartTest(size_t total)
cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl);
this->TestResult.Output = msg;
this->TestResult.FullCommandLine = "";
- this->TestResult.CompletionStatus = "Not Run";
+ this->TestResult.CompletionStatus = "Missing Configuration";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
@@ -477,7 +500,7 @@ bool cmCTestRunTest::StartTest(size_t total)
"Unable to find required file: " << file << std::endl);
this->TestResult.Output = "Unable to find required file: " + file;
this->TestResult.FullCommandLine = "";
- this->TestResult.CompletionStatus = "Not Run";
+ this->TestResult.CompletionStatus = "Required Files Missing";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
@@ -493,7 +516,7 @@ bool cmCTestRunTest::StartTest(size_t total)
"Unable to find executable: " << args[1] << std::endl);
this->TestResult.Output = "Unable to find executable: " + args[1];
this->TestResult.FullCommandLine = "";
- this->TestResult.CompletionStatus = "Not Run";
+ this->TestResult.CompletionStatus = "Unable to find executable";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 9d22065..814b310 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -487,6 +487,19 @@ int cmCTestTestHandler::ProcessHandler()
}
}
+ typedef std::set<cmCTestTestHandler::cmCTestTestResult,
+ cmCTestTestResultLess>
+ SetOfTests;
+ SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end());
+ std::vector<cmCTestTestHandler::cmCTestTestResult> disabledTests;
+
+ for (SetOfTests::iterator ftit = resultsSet.begin();
+ ftit != resultsSet.end(); ++ftit) {
+ if (ftit->CompletionStatus == "Disabled") {
+ disabledTests.push_back(*ftit);
+ }
+ }
+
float percent = float(passed.size()) * 100.0f / float(total);
if (!failed.empty() && percent > 99) {
percent = 99;
@@ -505,21 +518,33 @@ int cmCTestTestHandler::ProcessHandler()
"\nTotal Test time (real) = " << realBuf << "\n",
this->Quiet);
+ if (!disabledTests.empty()) {
+ cmGeneratedFileStream ofs;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
+ << "The following tests are disabled and did not run:"
+ << std::endl);
+ this->StartLogFile("TestsDisabled", ofs);
+
+ for (std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator dtit =
+ disabledTests.begin();
+ dtit != disabledTests.end(); ++dtit) {
+ ofs << dtit->TestCount << ":" << dtit->Name << std::endl;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t"
+ << std::setw(3) << dtit->TestCount << " - " << dtit->Name
+ << std::endl);
+ }
+ }
+
if (!failed.empty()) {
cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
<< "The following tests FAILED:" << std::endl);
this->StartLogFile("TestsFailed", ofs);
- typedef std::set<cmCTestTestHandler::cmCTestTestResult,
- cmCTestTestResultLess>
- SetOfTests;
- SetOfTests resultsSet(this->TestResults.begin(),
- this->TestResults.end());
-
for (SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit) {
- if (ftit->Status != cmCTestTestHandler::COMPLETED) {
+ if (ftit->Status != cmCTestTestHandler::COMPLETED &&
+ ftit->CompletionStatus != "Disabled") {
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
cmCTestLog(
this->CTest, HANDLER_OUTPUT, "\t"
@@ -841,6 +866,11 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
size_t fixtureTestsAdded = 0;
std::set<std::string> addedFixtures;
for (size_t i = 0; i < tests.size(); ++i) {
+ // Skip disabled tests
+ if (tests[i].Disabled) {
+ continue;
+ }
+
// There are two things to do for each test:
// 1. For every fixture required by this test, record that fixture as
// being required and create dependencies on that fixture's setup
@@ -1200,6 +1230,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
cmCTestTestResult* result = &this->TestResults[cc];
this->WriteTestResultHeader(xml, result);
xml.StartElement("Results");
+
if (result->Status != cmCTestTestHandler::NOT_RUN) {
if (result->Status != cmCTestTestHandler::COMPLETED ||
result->ReturnValue) {
@@ -1208,6 +1239,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.Attribute("name", "Exit Code");
xml.Element("Value", this->GetTestStatus(result->Status));
xml.EndElement(); // NamedMeasurement
+
xml.StartElement("NamedMeasurement");
xml.Attribute("type", "text/string");
xml.Attribute("name", "Exit Value");
@@ -1222,8 +1254,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.EndElement(); // NamedMeasurement
if (!result->Reason.empty()) {
const char* reasonType = "Pass Reason";
- if (result->Status != cmCTestTestHandler::COMPLETED &&
- result->Status != cmCTestTestHandler::NOT_RUN) {
+ if (result->Status != cmCTestTestHandler::COMPLETED) {
reasonType = "Fail Reason";
}
xml.StartElement("NamedMeasurement");
@@ -1232,12 +1263,14 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.Element("Value", result->Reason);
xml.EndElement(); // NamedMeasurement
}
- xml.StartElement("NamedMeasurement");
- xml.Attribute("type", "text/string");
- xml.Attribute("name", "Completion Status");
- xml.Element("Value", result->CompletionStatus);
- xml.EndElement(); // NamedMeasurement
}
+
+ xml.StartElement("NamedMeasurement");
+ xml.Attribute("type", "text/string");
+ xml.Attribute("name", "Completion Status");
+ xml.Element("Value", result->CompletionStatus);
+ xml.EndElement(); // NamedMeasurement
+
xml.StartElement("NamedMeasurement");
xml.Attribute("type", "text/string");
xml.Attribute("name", "Command Line");
@@ -2000,6 +2033,9 @@ bool cmCTestTestHandler::SetTestsProperties(
if (key == "WILL_FAIL") {
rtit->WillFail = cmSystemTools::IsOn(val.c_str());
}
+ if (key == "DISABLED") {
+ rtit->Disabled = cmSystemTools::IsOn(val.c_str());
+ }
if (key == "ATTACHED_FILES") {
cmSystemTools::ExpandListArgument(val, rtit->AttachedFiles);
}
@@ -2178,6 +2214,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.IsInBasedOnREOptions = true;
test.WillFail = false;
+ test.Disabled = false;
test.RunSerial = false;
test.Timeout = 0;
test.ExplicitTimeout = false;
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 5b07e98..a95f088 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -114,6 +114,7 @@ public:
std::map<std::string, std::string> Measurements;
bool IsInBasedOnREOptions;
bool WillFail;
+ bool Disabled;
float Cost;
int PreviousRuns;
bool RunSerial;
diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake
index b8cb365..ba13d75 100644
--- a/Source/Modules/FindLibUV.cmake
+++ b/Source/Modules/FindLibUV.cmake
@@ -49,7 +49,7 @@ They may be set by end users to point at libuv components.
#-----------------------------------------------------------------------------
find_library(LibUV_LIBRARY
- NAMES uv
+ NAMES uv libuv
)
mark_as_advanced(LibUV_LIBRARY)
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 7da93ac..e135ac6 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -7,6 +7,12 @@
#include "cmMakefile.h"
#include "cmsys/SystemInformation.hxx"
+#if defined(_WIN32)
+#include "cmSystemTools.h"
+#include "cmVSSetupHelper.h"
+#define HAVE_VS_SETUP_HELPER
+#endif
+
class cmExecutionStatus;
// cmCMakeHostSystemInformation
@@ -70,6 +76,13 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
value = this->ValueToString(info.GetTotalPhysicalMemory());
} else if (key == "AVAILABLE_PHYSICAL_MEMORY") {
value = this->ValueToString(info.GetAvailablePhysicalMemory());
+#ifdef HAVE_VS_SETUP_HELPER
+ } else if (key == "VS_15_DIR") {
+ cmVSSetupAPIHelper vsSetupAPIHelper;
+ if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
+ cmSystemTools::ConvertToUnixSlashes(value);
+ }
+#endif
} else {
std::string e = "does not recognize <key> " + key;
this->SetError(e);
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 2d66344..1222d5a 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCommandArgumentParserHelper.h"
-#include <cm_kwiml.h>
-
#include "cmCommandArgumentLexer.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index fd1ad36..fe2c0fe 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -43,18 +43,13 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
}
-bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature)
-{
- return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName);
-}
-
void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
const std::string& lang)
{
// Add language-specific flags.
this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
- if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) {
+ if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) {
this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
}
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 8d68123..425ff91 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -32,7 +32,6 @@ protected:
// Feature query methods.
const char* GetFeature(const std::string& feature);
- bool GetFeatureAsBool(const std::string& feature);
// Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 97292f9..63012a5 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -37,6 +37,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmCurl.h"
#include "cmFileLockResult.h"
+#include <cm_curl.h>
#endif
#if defined(CMAKE_USE_ELF_PARSER)
@@ -1028,8 +1029,6 @@ protected:
{
}
};
- struct MatchRule;
- friend struct MatchRule;
struct MatchRule
{
cmsys::RegularExpression Regex;
@@ -1486,6 +1485,9 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
// Remove the destination file so we can always create the symlink.
cmSystemTools::RemoveFile(toFile);
+ // Create destination directory if it doesn't exist
+ cmSystemTools::MakeDirectory(cmSystemTools::GetFilenamePath(toFile));
+
// Create the symlink.
if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
std::ostringstream e;
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index e8273fb..024b00a 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -54,8 +54,7 @@ void cmFortranParser_RuleElse(cmFortranParser* parser);
void cmFortranParser_RuleEndif(cmFortranParser* parser);
/* Define the parser stack element type. */
-typedef union cmFortran_yystype_u cmFortran_yystype;
-union cmFortran_yystype_u
+struct cmFortran_yystype
{
char* string;
};
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 1a5e6c5..1abe673 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFortranParser.h"
-#include "cmFortranLexer.h"
#include "cmSystemTools.h"
#include <assert.h>
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f78a933..73d2009 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -286,6 +286,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
, FortranModuleDirectoryCreated(false)
, SourceFileFlagsConstructed(false)
, PolicyWarnedCMP0022(false)
+ , PolicyReportedCMP0069(false)
, DebugIncludesDone(false)
, DebugCompileOptionsDone(false)
, DebugCompileFeaturesDone(false)
@@ -656,10 +657,65 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature,
return this->LocalGenerator->GetFeature(feature, config);
}
-bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature,
- const std::string& config) const
+bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
{
- return cmSystemTools::IsOn(this->GetFeature(feature, config));
+ const char* feature = "INTERPROCEDURAL_OPTIMIZATION";
+ const bool result = cmSystemTools::IsOn(this->GetFeature(feature, config));
+
+ if (!result) {
+ // 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
+ return false;
+ }
+
+ cmPolicies::PolicyStatus cmp0069 = this->GetPolicyStatusCMP0069();
+
+ if (cmp0069 == cmPolicies::OLD || cmp0069 == cmPolicies::WARN) {
+ if (this->Makefile->IsOn("_CMAKE_IPO_LEGACY_BEHAVIOR")) {
+ return true;
+ }
+ if (this->PolicyReportedCMP0069) {
+ // problem is already reported, no need to issue a message
+ return false;
+ }
+ if (cmp0069 == cmPolicies::WARN) {
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0069) << "\n";
+ w << "INTERPROCEDURAL_OPTIMIZATION property will be ignored for target "
+ << "'" << this->GetName() << "'.";
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
+ cmake::AUTHOR_WARNING, w.str(), this->GetBacktrace());
+
+ this->PolicyReportedCMP0069 = true;
+ }
+ return false;
+ }
+
+ // Note: check consistency with messages from CheckIPOSupported
+ const char* message = CM_NULLPTR;
+ if (!this->Makefile->IsOn("_CMAKE_IPO_SUPPORTED_BY_CMAKE")) {
+ message = "CMake doesn't support IPO for current compiler";
+ } else if (!this->Makefile->IsOn(
+ "_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER")) {
+ message = "Compiler doesn't support IPO";
+ } else if (!this->GlobalGenerator->IsIPOSupported()) {
+ message = "CMake doesn't support IPO for current generator";
+ }
+
+ if (!message) {
+ // No error/warning messages
+ return true;
+ }
+
+ if (this->PolicyReportedCMP0069) {
+ // problem is already reported, no need to issue a message
+ return false;
+ }
+
+ this->PolicyReportedCMP0069 = true;
+
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR, message, this->GetBacktrace());
+ return false;
}
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
@@ -2410,19 +2466,28 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
}
}
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable(
+ std::string const& var, std::string const& config) const
+{
+ if (this->IsIPOEnabled(config)) {
+ std::string varIPO = var + "_IPO";
+ if (this->Makefile->IsDefinitionSet(varIPO)) {
+ return varIPO;
+ }
+ }
+
+ return var;
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetCreateRuleVariable(
std::string const& lang, std::string const& config) const
{
switch (this->GetType()) {
case cmStateEnums::STATIC_LIBRARY: {
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
- if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
- std::string varIPO = var + "_IPO";
- if (this->Makefile->GetDefinition(varIPO)) {
- return varIPO;
- }
- }
- return var;
+ return this->GetFeatureSpecificLinkRuleVariable(var, config);
}
case cmStateEnums::SHARED_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d60ad24..fcab4aa 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -112,8 +112,8 @@ public:
const char* GetFeature(const std::string& feature,
const std::string& config) const;
- bool GetFeatureAsBool(const std::string& feature,
- const std::string& config) const;
+
+ bool IsIPOEnabled(const std::string& config) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
const std::string& config) const;
@@ -309,6 +309,9 @@ public:
void GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const;
+ std::string GetFeatureSpecificLinkRuleVariable(
+ std::string const& var, std::string const& config) const;
+
/** Return the rule variable used to create this type of target. */
std::string GetCreateRuleVariable(std::string const& lang,
std::string const& config) const;
@@ -745,6 +748,7 @@ private:
mutable std::set<cmLinkItem> UtilityItems;
cmPolicies::PolicyMap PolicyMap;
mutable bool PolicyWarnedCMP0022;
+ mutable bool PolicyReportedCMP0069;
mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileFeaturesDone;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 2558fee..b228d41 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -333,6 +333,8 @@ public:
virtual bool UseFolderProperty() const;
+ virtual bool IsIPOSupported() const { return false; }
+
/** Return whether the generator should use EFFECTIVE_PLATFORM_NAME. This is
relevant for mixed macOS and iOS builds. */
virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; }
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index a51e919..956af51 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -99,6 +99,8 @@ public:
*/
static bool SupportsPlatform() { return false; }
+ bool IsIPOSupported() const CM_OVERRIDE { return true; }
+
/**
* Write a build statement to @a os with the @a comment using
* the @a rule the list of @a outputs files and inputs.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 67d7bc9..bbf9f0f 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -149,6 +149,8 @@ public:
/** Does the make tool tolerate .DELETE_ON_ERROR? */
virtual bool AllowDeleteOnError() const { return true; }
+ bool IsIPOSupported() const CM_OVERRIDE { return true; }
+
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE;
std::string IncludeDirective;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 39f7b8f..416af14 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1707,6 +1707,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
return;
}
+ // Check IPO related warning/error.
+ gtgt->IsIPOEnabled(configName);
+
// Add define flags
this->CurrentLocalGenerator->AppendFlags(
defFlags, this->CurrentMakefile->GetDefineFlags());
@@ -3117,10 +3120,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateString(this->GeneratorToolset));
}
if (this->GetLanguageEnabled("Swift")) {
- std::string swiftVersion = "2.3";
+ std::string swiftVersion;
if (const char* vers = this->CurrentMakefile->GetDefinition(
"CMAKE_Swift_LANGUAGE_VERSION")) {
swiftVersion = vers;
+ } else if (this->XcodeVersion >= 83) {
+ swiftVersion = "3.0";
+ } else {
+ swiftVersion = "2.3";
}
buildSettings->AddAttribute("SWIFT_VERSION",
this->CreateString(swiftVersion));
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 1c0a99e..bda6b75 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -150,6 +150,11 @@ void cmIDEOptions::AddDefines(const std::vector<std::string>& defines)
this->Defines.insert(this->Defines.end(), defines.begin(), defines.end());
}
+std::vector<std::string> const& cmIDEOptions::GetDefines() const
+{
+ return this->Defines;
+}
+
void cmIDEOptions::AddFlag(const char* flag, const char* value)
{
this->FlagMap[flag] = value;
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index 465cf2c..11f8aba 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -24,6 +24,8 @@ public:
void AddDefine(const std::string& define);
void AddDefines(const char* defines);
void AddDefines(const std::vector<std::string>& defines);
+ std::vector<std::string> const& GetDefines() const;
+
void AddFlag(const char* flag, const char* value);
void AddFlag(const char* flag, std::vector<std::string> const& value);
void AppendFlag(std::string const& flag, std::string const& value);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 82bf0b9..9333ed7 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1052,7 +1052,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
// Add language-specific flags.
this->AddLanguageFlags(flags, lang, config);
- if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
+ if (target->IsIPOEnabled(config)) {
this->AppendFeatureOptions(flags, lang, "IPO");
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7c33821..260a84b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -670,6 +670,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
// Add the target-specific flags.
this->AddCompileOptions(flags, target, linkLanguage, configName);
+
+ // Check IPO related warning/error.
+ target->IsIPOEnabled(configName);
}
if (this->FortranProject) {
@@ -746,11 +749,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
if (this->FortranProject) {
// Intel Fortran >= 15.0 uses TargetName property.
- std::string targetNameFull = target->GetFullName(configName);
- std::string targetName =
+ std::string const targetNameFull = target->GetFullName(configName);
+ std::string const targetName =
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
- std::string targetExt =
- cmSystemTools::GetFilenameLastExtension(targetNameFull);
+ std::string const targetExt =
+ target->GetType() == cmStateEnums::OBJECT_LIBRARY
+ ? ".lib"
+ : cmSystemTools::GetFilenameLastExtension(targetNameFull);
/* clang-format off */
fout <<
"\t\t\tTargetName=\"" << this->EscapeForXML(targetName) << "\"\n"
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index e5fae13..cc8a6b3 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -129,14 +129,9 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
std::string linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
- std::string linkRuleVar = "CMAKE_";
- linkRuleVar += linkLanguage;
- linkRuleVar += "_CREATE_STATIC_LIBRARY";
- if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") &&
- this->Makefile->GetDefinition(linkRuleVar + "_IPO")) {
- linkRuleVar += "_IPO";
- }
+ std::string linkRuleVar = this->GeneratorTarget->GetCreateRuleVariable(
+ linkLanguage, this->ConfigName);
std::string extraFlags;
this->LocalGenerator->GetStaticLibraryFlags(
@@ -676,18 +671,30 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
+
+ arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
+ arCreateVar, this->ConfigName);
+
if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
cmSystemTools::ExpandListArgument(rule, archiveCreateCommands);
}
std::string arAppendVar = "CMAKE_";
arAppendVar += linkLanguage;
arAppendVar += "_ARCHIVE_APPEND";
+
+ arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
+ arAppendVar, this->ConfigName);
+
if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
cmSystemTools::ExpandListArgument(rule, archiveAppendCommands);
}
std::string arFinishVar = "CMAKE_";
arFinishVar += linkLanguage;
arFinishVar += "_ARCHIVE_FINISH";
+
+ arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
+ arFinishVar, this->ConfigName);
+
if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
cmSystemTools::ExpandListArgument(rule, archiveFinishCommands);
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 5552fa9..aaeb659 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -516,6 +516,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
std::string linkCmdVar = "CMAKE_";
linkCmdVar += this->TargetLinkLanguage;
linkCmdVar += "_ARCHIVE_CREATE";
+
+ linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
+ linkCmdVar, this->GetConfigName());
+
const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
}
@@ -523,6 +527,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
std::string linkCmdVar = "CMAKE_";
linkCmdVar += this->TargetLinkLanguage;
linkCmdVar += "_ARCHIVE_FINISH";
+
+ linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
+ linkCmdVar, this->GetConfigName());
+
const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
}
@@ -544,10 +552,6 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
#ifdef _WIN32
8000,
#endif
-#if defined(_SC_ARG_MAX)
- // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
- ((int)sysconf(_SC_ARG_MAX)) - 1000,
-#endif
#if defined(__linux)
// #define MAX_ARG_STRLEN (PAGE_SIZE * 32) in Linux's binfmts.h
((int)sysconf(_SC_PAGESIZE) * 32) - 1000,
@@ -556,7 +560,15 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
};
size_t const arrSz = cmArraySize(limits);
- int const sz = *std::min_element(limits, limits + arrSz);
+ int sz = *std::min_element(limits, limits + arrSz);
+#if defined(_SC_ARG_MAX)
+ // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
+ int const szArgMax = static_cast<int>(sysconf(_SC_ARG_MAX));
+ // a return value of -1 signifies an unrestricted value
+ if (szArgMax != -1) {
+ sz = std::min(sz, szArgMax - 1000);
+ }
+#endif
if (sz == std::numeric_limits<int>::max()) {
return 0;
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ecf06b3..72dcc4f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -203,6 +203,9 @@ class cmMakefile;
3, 8, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0068, \
"RPATH settings on macOS do not affect install_name.", 3, 9, 0, \
+ cmPolicies::WARN) \
+ SELECT(POLICY, CMP0069, \
+ "INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0, \
cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
@@ -225,7 +228,8 @@ class cmMakefile;
F(CMP0060) \
F(CMP0063) \
F(CMP0065) \
- F(CMP0068)
+ F(CMP0068) \
+ F(CMP0069)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 84767a8..a9ccc68 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2239,6 +2239,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
linkLanguage, configName.c_str());
}
+ // Check IPO related warning/error.
+ this->GeneratorTarget->IsIPOEnabled(configName);
+
// Get preprocessor definitions for this directory.
std::string defineFlags =
this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
@@ -2402,6 +2405,11 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar));
rcOptions.Parse(flags.c_str());
+
+ // For historical reasons, add the C preprocessor defines to RC.
+ Options& clOptions = *(this->ClOptions[configName]);
+ rcOptions.AddDefines(clOptions.GetDefines());
+
this->RcOptions[configName] = pOptions.release();
return true;
}
@@ -2414,12 +2422,9 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions(
}
this->WriteString("<ResourceCompile>\n", 2);
- // Preprocessor definitions and includes are shared with clOptions.
- Options& clOptions = *(this->ClOptions[configName]);
- clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "RC");
-
Options& rcOptions = *(this->RcOptions[configName]);
+ rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
+ "\n", "RC");
rcOptions.AppendFlag("AdditionalIncludeDirectories", includes);
rcOptions.AppendFlag("AdditionalIncludeDirectories",
"%(AdditionalIncludeDirectories)");
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 1ca6b9c..abc4924 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -1,5 +1,6 @@
#include "cmVisualStudioGeneratorOptions.h"
+#include "cmAlgorithms.h"
#include "cmLocalVisualStudioGenerator.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
@@ -403,8 +404,10 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
fout << prefix << tag << "=\"";
}
const char* sep = "";
+ std::vector<std::string>::const_iterator de =
+ cmRemoveDuplicates(this->Defines);
for (std::vector<std::string>::const_iterator di = this->Defines.begin();
- di != this->Defines.end(); ++di) {
+ di != de; ++di) {
// Escape the definition for the compiler.
std::string define;
if (this->Version < cmGlobalVisualStudioGenerator::VS10) {
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index cf331a5..d4bc6c9 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -170,8 +170,6 @@ template <typename CharType, typename Traits = std::char_traits<CharType> >
class basic_ifstream : public std::basic_istream<CharType, Traits>,
public basic_efilebuf<CharType, Traits>
{
- using basic_efilebuf<CharType, Traits>::is_open;
-
public:
typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type
internal_buffer_type;
@@ -201,6 +199,8 @@ public:
void close() { this->_set_state(this->_close(), this, this); }
+ using basic_efilebuf<CharType, Traits>::is_open;
+
internal_buffer_type* rdbuf() const { return this->buf_; }
~basic_ifstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT { close(); }