summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx10
-rw-r--r--Source/cmFileCommand.cxx32
-rw-r--r--Source/cmFileCommand.h1
-rw-r--r--Source/cmLocalNinjaGenerator.cxx17
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmQtAutoGenInitializer.cxx241
7 files changed, 140 insertions, 168 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 85cbbca43e..7abab01c6f 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 13)
-set(CMake_VERSION_PATCH 20181207)
+set(CMake_VERSION_PATCH 20181212)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 7cf69fcef4..4e497278d8 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -89,6 +89,15 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
+static void cpackProgressCallback(const char* message, float progress,
+ void* clientdata)
+{
+ (void)progress;
+ (void)clientdata;
+
+ std::cout << "-- " << message << std::endl;
+}
+
// this is CPack.
int main(int argc, char const* const* argv)
{
@@ -202,6 +211,7 @@ int main(int argc, char const* const* argv)
cmake cminst(cmake::RoleScript);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
+ cminst.SetProgressCallback(cpackProgressCallback, nullptr);
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator cmgg(&cminst);
cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot());
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 73ff5a1cf8..fb8e8d353e 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -180,6 +180,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
if (subCommand == "SIZE") {
return this->HandleSizeCommand(args);
}
+ if (subCommand == "READ_SYMLINK") {
+ return this->HandleReadSymlinkCommand(args);
+ }
std::string e = "does not recognize sub-command " + subCommand;
this->SetError(e);
@@ -3627,7 +3630,7 @@ bool cmFileCommand::HandleSizeCommand(std::vector<std::string> const& args)
if (!cmSystemTools::FileExists(filename, true)) {
std::ostringstream e;
- e << "SIZE requested of path that is not readable " << filename;
+ e << "SIZE requested of path that is not readable:\n " << filename;
this->SetError(e.str());
return false;
}
@@ -3638,3 +3641,30 @@ bool cmFileCommand::HandleSizeCommand(std::vector<std::string> const& args)
return true;
}
+
+bool cmFileCommand::HandleReadSymlinkCommand(
+ std::vector<std::string> const& args)
+{
+ if (args.size() != 3) {
+ std::ostringstream e;
+ e << args[0] << " requires a file name and output variable";
+ this->SetError(e.str());
+ return false;
+ }
+
+ const std::string& filename = args[1];
+ const std::string& outputVariable = args[2];
+
+ std::string result;
+ if (!cmSystemTools::ReadSymlink(filename, result)) {
+ std::ostringstream e;
+ e << "READ_SYMLINK requested of path that is not a symlink:\n "
+ << filename;
+ this->SetError(e.str());
+ return false;
+ }
+
+ this->Makefile->AddDefinition(outputVariable, result.c_str());
+
+ return true;
+}
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 01e007deba..fe05c98499 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -60,6 +60,7 @@ protected:
bool HandleGenerateCommand(std::vector<std::string> const& args);
bool HandleLockCommand(std::vector<std::string> const& args);
bool HandleSizeCommand(std::vector<std::string> const& args);
+ bool HandleReadSymlinkCommand(std::vector<std::string> const& args);
private:
void AddEvaluationFile(const std::string& inputName,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 8a075161f4..a8647b189b 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -318,7 +318,10 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
cmsys::ofstream script(scriptPath.c_str());
-#ifndef _WIN32
+#ifdef _WIN32
+ script << "@echo off\n";
+ int line = 1;
+#else
script << "set -e\n\n";
#endif
@@ -329,12 +332,22 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
// for the raw shell script.
cmSystemTools::ReplaceString(cmd, "$$", "$");
#ifdef _WIN32
- script << cmd << " || exit /b" << '\n';
+ script << cmd << " || (set FAIL_LINE=" << ++line << "& goto :ABORT)"
+ << '\n';
#else
script << cmd << '\n';
#endif
}
+#ifdef _WIN32
+ script << "goto :EOF\n\n"
+ ":ABORT\n"
+ "set ERROR_CODE=%ERRORLEVEL%\n"
+ "echo Batch file failed at line %FAIL_LINE% "
+ "with errorcode %ERRORLEVEL%\n"
+ "exit /b %ERROR_CODE%";
+#endif
+
return scriptPath;
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 9985d6395e..7674877362 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -251,7 +251,10 @@ class cmMakefile;
"The FindQt module does not exist for find_package().", 3, 14, 0, \
cmPolicies::WARN) \
SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14, \
- 0, cmPolicies::WARN)
+ 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0086, \
+ "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, \
+ cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index d4819a307d..6a2a9519e9 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -35,9 +35,22 @@
#include <set>
#include <sstream>
#include <string>
+#include <type_traits>
#include <utility>
#include <vector>
+std::string GetQtExecutableTargetName(
+ const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable)
+{
+ if (qtVersion.Major == 5) {
+ return ("Qt5::" + executable);
+ }
+ if (qtVersion.Major == 4) {
+ return ("Qt4::" + executable);
+ }
+ return ("");
+}
+
static std::size_t GetParallelCPUCount()
{
static std::size_t count = 0;
@@ -489,10 +502,13 @@ bool cmQtAutoGenInitializer::InitMoc()
// Moc includes
{
- bool const appendImplicit = (this->QtVersion.Major == 5);
+ // We need to disable this until we have all implicit includes available.
+ // See issue #18669.
+ // bool const appendImplicit = (this->QtVersion.Major == 5);
+
auto GetIncludeDirs =
- [this, localGen,
- appendImplicit](std::string const& cfg) -> std::vector<std::string> {
+ [this, localGen](std::string const& cfg) -> std::vector<std::string> {
+ bool const appendImplicit = false;
// Get the include dirs for this target, without stripping the implicit
// include dirs off, see
// https://gitlab.kitware.com/cmake/cmake/issues/13667
@@ -544,11 +560,7 @@ bool cmQtAutoGenInitializer::InitMoc()
}
// Moc executable
- if (!GetMocExecutable()) {
- return false;
- }
-
- return true;
+ return GetMocExecutable();
}
bool cmQtAutoGenInitializer::InitUic()
@@ -625,19 +637,12 @@ bool cmQtAutoGenInitializer::InitUic()
}
// Uic executable
- if (!GetUicExecutable()) {
- return false;
- }
-
- return true;
+ return GetUicExecutable();
}
bool cmQtAutoGenInitializer::InitRcc()
{
- if (!GetRccExecutable()) {
- return false;
- }
- return true;
+ return GetRccExecutable();
}
bool cmQtAutoGenInitializer::InitScanFiles()
@@ -1409,199 +1414,109 @@ cmQtAutoGenInitializer::IntegerVersion cmQtAutoGenInitializer::GetQtVersion(
return cmQtAutoGenInitializer::IntegerVersion();
}
-bool cmQtAutoGenInitializer::GetMocExecutable()
+std::pair<bool, std::string> GetQtExecutable(
+ const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target,
+ const std::string& executable, bool ignoreMissingTarget, std::string* output)
{
std::string err;
+ std::string result;
- // Find moc executable
+ // Find executable
{
- std::string targetName;
- if (this->QtVersion.Major == 5) {
- targetName = "Qt5::moc";
- } else if (this->QtVersion.Major == 4) {
- targetName = "Qt4::moc";
+ const std::string targetName =
+ GetQtExecutableTargetName(qtVersion, executable);
+ if (targetName.empty()) {
+ err = "The AUTOMOC, AUTOUIC and AUTORCC feature ";
+ err += "supports only Qt 4 and Qt 5";
} else {
- err = "The AUTOMOC feature supports only Qt 4 and Qt 5";
- }
- if (!targetName.empty()) {
- cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmLocalGenerator* localGen = target->GetLocalGenerator();
cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
if (tgt != nullptr) {
- this->Moc.Executable = tgt->ImportedGetLocation("");
+ result = tgt->ImportedGetLocation("");
} else {
+ if (ignoreMissingTarget) {
+ return std::make_pair(true, "");
+ }
+
err = "Could not find target " + targetName;
}
}
}
- // Test moc command
+ // Test executable
if (err.empty()) {
- if (cmSystemTools::FileExists(this->Moc.Executable, true)) {
+ if (cmSystemTools::FileExists(result, true)) {
std::vector<std::string> command;
- command.push_back(this->Moc.Executable);
+ command.push_back(result);
command.push_back("-h");
std::string stdOut;
std::string stdErr;
int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
+ const bool runResult = cmSystemTools::RunSingleCommand(
command, &stdOut, &stdErr, &retVal, nullptr,
cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- if (!result) {
- err = "The moc test command failed: ";
- err += QuotedCommand(command);
+ if (!runResult) {
+ err = "Test of \"" + executable + "\" binary ";
+ err += cmQtAutoGen::Quoted(result) + " failed: ";
+ err += cmQtAutoGen::QuotedCommand(command);
+ } else {
+ if (output != nullptr) {
+ *output = stdOut;
+ }
}
} else {
- err = "The moc executable ";
- err += Quoted(this->Moc.Executable);
+ err = "The \"" + executable + "\" binary ";
+ err += cmQtAutoGen::Quoted(result);
err += " does not exist";
}
}
// Print error
if (!err.empty()) {
- std::string msg = "AutoMoc (";
- msg += this->Target->GetName();
+ std::string msg = "AutoGen (";
+ msg += target->GetName();
msg += "): ";
msg += err;
cmSystemTools::Error(msg.c_str());
- return false;
+ return std::make_pair(false, "");
}
- return true;
+ return std::make_pair(true, result);
}
-bool cmQtAutoGenInitializer::GetUicExecutable()
+bool cmQtAutoGenInitializer::GetMocExecutable()
{
- std::string err;
-
- // Find uic executable
- {
- std::string targetName;
- if (this->QtVersion.Major == 5) {
- targetName = "Qt5::uic";
- } else if (this->QtVersion.Major == 4) {
- targetName = "Qt4::uic";
- } else {
- err = "The AUTOUIC feature supports only Qt 4 and Qt 5";
- }
- if (!targetName.empty()) {
- cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
- if (tgt != nullptr) {
- this->Uic.Executable = tgt->ImportedGetLocation("");
- } else {
- if (this->QtVersion.Major == 5) {
- // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
- } else {
- err = "Could not find target " + targetName;
- }
- }
- }
- }
-
- // Test uic command
- if (err.empty() && !this->Uic.Executable.empty()) {
- if (cmSystemTools::FileExists(this->Uic.Executable, true)) {
- std::vector<std::string> command;
- command.push_back(this->Uic.Executable);
- command.push_back("-h");
- std::string stdOut;
- std::string stdErr;
- int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
- command, &stdOut, &stdErr, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- if (!result) {
- err = "The uic test command failed: ";
- err += QuotedCommand(command);
- }
- } else {
- err = "The uic executable ";
- err += Quoted(this->Uic.Executable);
- err += " does not exist";
- }
- }
-
- // Print error
- if (!err.empty()) {
- std::string msg = "AutoUic (";
- msg += this->Target->GetName();
- msg += "): ";
- msg += err;
- cmSystemTools::Error(msg.c_str());
- return false;
- }
+ const auto result =
+ GetQtExecutable(this->QtVersion, this->Target, "moc", false, nullptr);
+ this->Moc.Executable = result.second;
+ return result.first;
+}
- return true;
+bool cmQtAutoGenInitializer::GetUicExecutable()
+{
+ const auto result =
+ GetQtExecutable(this->QtVersion, this->Target, "uic", true, nullptr);
+ this->Uic.Executable = result.second;
+ return result.first;
}
bool cmQtAutoGenInitializer::GetRccExecutable()
{
- std::string err;
-
- // Find rcc executable
- {
- std::string targetName;
- if (this->QtVersion.Major == 5) {
- targetName = "Qt5::rcc";
- } else if (this->QtVersion.Major == 4) {
- targetName = "Qt4::rcc";
- } else {
- err = "The AUTORCC feature supports only Qt 4 and Qt 5";
- }
- if (!targetName.empty()) {
- cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
- if (tgt != nullptr) {
- this->Rcc.Executable = tgt->ImportedGetLocation("");
- } else {
- err = "Could not find target " + targetName;
- }
- }
+ std::string stdOut;
+ const auto result =
+ GetQtExecutable(this->QtVersion, this->Target, "rcc", false, &stdOut);
+ this->Rcc.Executable = result.second;
+ if (!result.first) {
+ return false;
}
- // Test rcc command
- if (err.empty()) {
- if (cmSystemTools::FileExists(this->Rcc.Executable, true)) {
- std::vector<std::string> command;
- command.push_back(this->Rcc.Executable);
- command.push_back("-h");
- std::string stdOut;
- std::string stdErr;
- int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
- command, &stdOut, &stdErr, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- if (result) {
- // Detect if rcc supports (-)-list
- if (this->QtVersion.Major == 5) {
- if (stdOut.find("--list") != std::string::npos) {
- this->Rcc.ListOptions.push_back("--list");
- } else {
- this->Rcc.ListOptions.push_back("-list");
- }
- }
- } else {
- err = "The rcc test command failed: ";
- err += QuotedCommand(command);
- }
+ if (this->QtVersion.Major == 5) {
+ if (stdOut.find("--list") != std::string::npos) {
+ this->Rcc.ListOptions.push_back("--list");
} else {
- err = "The rcc executable ";
- err += Quoted(this->Rcc.Executable);
- err += " does not exist";
+ this->Rcc.ListOptions.push_back("-list");
}
}
-
- // Print error
- if (!err.empty()) {
- std::string msg = "AutoRcc (";
- msg += this->Target->GetName();
- msg += "): ";
- msg += err;
- cmSystemTools::Error(msg.c_str());
- return false;
- }
-
return true;
}