summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx43
-rw-r--r--Source/cmCTest.cxx11
-rw-r--r--Source/cmExportBuildFileGenerator.cxx3
-rw-r--r--Source/cmExportInstallFileGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalNinjaGenerator.h5
-rw-r--r--Source/cmInstallCommand.cxx19
-rw-r--r--Source/cmLocalGenerator.cxx6
-rw-r--r--Source/cmTargetExport.h2
-rw-r--r--Source/cmake.cxx22
11 files changed, 85 insertions, 39 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 63dde11..464e138 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 19)
-set(CMake_VERSION_PATCH 20201201)
+set(CMake_VERSION_PATCH 20201202)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 1cc267e..4151fde 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -54,22 +54,21 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
//
cmProp ctestBuildConfiguration =
this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
- const std::string* cmakeBuildConfiguration = !this->Configuration.empty()
- ? &this->Configuration
- : (cmNonempty(ctestBuildConfiguration) ? ctestBuildConfiguration
- : &this->CTest->GetConfigType());
-
- const std::string* cmakeBuildAdditionalFlags = !this->Flags.empty()
- ? &this->Flags
- : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS");
- const std::string* cmakeBuildTarget = !this->Target.empty()
- ? &this->Target
- : this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
+ std::string cmakeBuildConfiguration = cmNonempty(this->Configuration)
+ ? this->Configuration
+ : cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration
+ : this->CTest->GetConfigType();
+
+ const std::string& cmakeBuildAdditionalFlags = cmNonempty(this->Flags)
+ ? this->Flags
+ : this->Makefile->GetSafeDefinition("CTEST_BUILD_FLAGS");
+ const std::string& cmakeBuildTarget = cmNonempty(this->Target)
+ ? this->Target
+ : this->Makefile->GetSafeDefinition("CTEST_BUILD_TARGET");
if (cmNonempty(cmakeGeneratorName)) {
- if (!cmakeBuildConfiguration) {
- static const std::string sRelease = "Release";
- cmakeBuildConfiguration = &sRelease;
+ if (cmakeBuildConfiguration.empty()) {
+ cmakeBuildConfiguration = "Release";
}
if (this->GlobalGenerator) {
if (this->GlobalGenerator->GetName() != *cmakeGeneratorName) {
@@ -88,24 +87,18 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
return nullptr;
}
}
- if (cmakeBuildConfiguration->empty()) {
- const std::string* config = nullptr;
+ if (cmakeBuildConfiguration.empty()) {
#ifdef CMAKE_INTDIR
- static const std::string sIntDir = CMAKE_INTDIR;
- config = &sIntDir;
+ cmakeBuildConfiguration = CMAKE_INTDIR;
+#else
+ cmakeBuildConfiguration = "Debug";
#endif
- if (!config) {
- static const std::string sDebug = "Debug";
- config = &sDebug;
- }
- cmakeBuildConfiguration = config;
}
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand =
this->GlobalGenerator->GenerateCMakeBuildCommand(
- cmakeBuildTarget ? *cmakeBuildTarget : "", *cmakeBuildConfiguration,
- cmakeBuildAdditionalFlags ? *cmakeBuildAdditionalFlags : "",
+ cmakeBuildTarget, cmakeBuildConfiguration, cmakeBuildAdditionalFlags,
this->Makefile->IgnoreErrorsCMP0061());
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 8cf5ae9..8479458 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1017,6 +1017,17 @@ int cmCTest::ProcessSteps()
}
if (res != 0) {
cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest" << std::endl);
+ if (!this->Impl->OutputTestOutputOnTestFailure) {
+ const std::string lastTestLog =
+ this->GetBinaryDir() + "/Testing/Temporary/LastTest.log";
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Output from these tests are in: " << lastTestLog
+ << std::endl);
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Use \"--rerun-failed --output-on-failure\" to re-run the "
+ "failed cases verbosely."
+ << std::endl);
+ }
}
return res;
}
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index dd700c5..1a31ae4 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -288,6 +288,9 @@ void cmExportBuildFileGenerator::GetTargets(
if (this->ExportSet) {
for (std::unique_ptr<cmTargetExport> const& te :
this->ExportSet->GetTargetExports()) {
+ if (te->NamelinkOnly) {
+ continue;
+ }
targets.push_back(te->TargetName);
}
return;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 987ec9e..0b9b183 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -42,6 +42,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::string sep;
for (std::unique_ptr<cmTargetExport> const& te :
this->IEGen->GetExportSet()->GetTargetExports()) {
+ if (te->NamelinkOnly) {
+ continue;
+ }
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
sep = " ";
if (this->ExportedTargets.insert(te->Target).second) {
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7ef69f4..4147ba8 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -540,10 +540,11 @@ void cmGlobalNinjaGenerator::Generate()
this->CloseBuildFileStreams();
#ifdef _WIN32
- // The ninja tools will not be able to update metadata on Windows
+ // Older ninja tools will not be able to update metadata on Windows
// when we are re-generating inside an existing 'ninja' invocation
// because the outer tool has the files open for write.
- if (!this->GetCMakeInstance()->GetRegenerateDuringBuild())
+ if (this->NinjaSupportsMetadataOnRegeneration ||
+ !this->GetCMakeInstance()->GetRegenerateDuringBuild())
#endif
{
this->CleanMetaData();
@@ -692,6 +693,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaSupportsMultipleOutputs = !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForMultipleOutputs().c_str());
+ this->NinjaSupportsMetadataOnRegeneration = !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForMetadataOnRegeneration().c_str());
}
bool cmGlobalNinjaGenerator::CheckLanguages(
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 40d3cfc..8df0372 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -377,6 +377,10 @@ public:
{
return "1.10";
}
+ static std::string RequiredNinjaVersionForMetadataOnRegeneration()
+ {
+ return "1.10.2";
+ }
bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
bool SupportsManifestRestat() const;
@@ -542,6 +546,7 @@ private:
bool NinjaSupportsUnconditionalRecompactTool = false;
bool NinjaSupportsCleanDeadTool = false;
bool NinjaSupportsMultipleOutputs = false;
+ bool NinjaSupportsMetadataOnRegeneration = false;
private:
void InitOutputPathPrefix();
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index b99e6a3..ff08ee4 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -461,6 +461,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> resourceGenerator;
+ // Avoid selecting default destinations for PUBLIC_HEADER and
+ // PRIVATE_HEADER if any artifacts are specified.
+ bool artifactsSpecified = false;
+
+ // Track whether this is a namelink-only rule.
+ bool namelinkOnly = false;
+
auto addTargetExport = [&]() {
// Add this install rule to an export if one was specified.
if (!exports.empty()) {
@@ -475,20 +482,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
te->ObjectsGenerator = objectGenerator.get();
te->InterfaceIncludeDirectories =
cmJoin(includesArgs.GetIncludeDirs(), ";");
-
+ te->NamelinkOnly = namelinkOnly;
helper.Makefile->GetGlobalGenerator()
->GetExportSets()[exports]
.AddTargetExport(std::move(te));
}
};
- // Avoid selecting default destinations for PUBLIC_HEADER and
- // PRIVATE_HEADER if any artifacts are specified.
- bool artifactsSpecified = false;
-
- // Track whether this is a namelink-only rule.
- bool namelinkOnly = false;
-
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY: {
// Shared libraries are handled differently on DLL and non-DLL
@@ -497,6 +497,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsDLLPlatform()) {
// When in namelink only mode skip all libraries on Windows.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
@@ -529,6 +530,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
@@ -574,6 +576,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8a3f285..f582701 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2503,8 +2503,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
if (!useMultiArchPch.empty()) {
- target->Target->SetProperty(
- cmStrCat(lang, "_COMPILE_OPTIONS_USE_PCH"), useMultiArchPch);
+
+ target->Target->AppendProperty(
+ cmStrCat(lang, "_COMPILE_OPTIONS_USE_PCH"),
+ cmStrCat("$<$<CONFIG:", config, ">:", useMultiArchPch, ">"));
}
}
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index cb4d8da..1e38d84 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -31,4 +31,6 @@ public:
cmInstallFilesGenerator* HeaderGenerator;
std::string InterfaceIncludeDirectories;
///@}
+
+ bool NamelinkOnly = false;
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5524d4e..cfd724b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -846,6 +846,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
bool haveToolset = false;
bool havePlatform = false;
bool haveBArg = false;
+ bool scriptMode = false;
+ std::string possibleUnknownArg;
#if !defined(CMAKE_BOOTSTRAP)
std::string profilingFormat;
std::string profilingOutput;
@@ -898,7 +900,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument{ "-B", "No build directory specified for -B",
CommandArgument::Values::One, BuildArgLambda },
CommandArgument{ "-P", "-P must be followed by a file name.",
- CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument::Values::One,
+ [&](std::string const&, cmake*) -> bool {
+ scriptMode = true;
+ return true;
+ } },
CommandArgument{ "-D", "-D must be followed with VAR=VALUE.",
CommandArgument::Values::One, IgnoreAndTrueLambda },
CommandArgument{ "-C", "-C must be followed by a file name.",
@@ -1145,14 +1151,28 @@ void cmake::SetArgs(const std::vector<std::string>& args)
break;
}
}
+
+ // We have an issue where arguments to a "-P" script mode
+ // can be provided before the "-P" argument. This means
+ // that we need to lazily check this argument after checking
+ // all args.
+ // Additionally it can't be the source/binary tree location
if (!parsedCorrectly) {
cmSystemTools::Error("Run 'cmake --help' for all supported options.");
exit(1);
+ } else if (!matched && cmHasLiteralPrefix(arg, "-")) {
+ possibleUnknownArg = arg;
} else if (!matched) {
this->SetDirectoriesFromFile(arg);
}
}
+ if (!possibleUnknownArg.empty() && !scriptMode) {
+ cmSystemTools::Error(cmStrCat("Unknown argument ", possibleUnknownArg));
+ cmSystemTools::Error("Run 'cmake --help' for all supported options.");
+ exit(1);
+ }
+
// Empty instance, platform and toolset if only a generator is specified
if (this->GlobalGenerator) {
this->GeneratorInstance = "";