summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-01 13:06:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-11-01 13:07:13 (GMT)
commit562ee8a50bf291300007ad8d14fdc977ef3a3371 (patch)
tree557965f25c866d86ccea06d120d27d5033672e8b
parentf13b8a52ee48baba3631eba789e07d09f3c33827 (diff)
parentdbe33b20bde8fd9a2196409a0df91245c082f653 (diff)
downloadCMake-562ee8a50bf291300007ad8d14fdc977ef3a3371.zip
CMake-562ee8a50bf291300007ad8d14fdc977ef3a3371.tar.gz
CMake-562ee8a50bf291300007ad8d14fdc977ef3a3371.tar.bz2
Merge topic 'misc-messages'
dbe33b20bd install: Add context to {PUBLIC,PRIVATE}_HEADER/RESOURCE DESTINATION warnings 1a25f057da cmComputeLinkInformation: Add context to warning about linking a directory 4862f3b2c8 cmcmd: Write progress and tar errors directly to stderr efc6c23a47 bootstrap: Do not declare cmSystemTools functions that are not implemented Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6680
-rw-r--r--Source/cmComputeLinkInformation.cxx17
-rw-r--r--Source/cmComputeLinkInformation.h2
-rw-r--r--Source/cmInstallCommand.cxx16
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx5
-rw-r--r--Source/cmSystemTools.cxx24
-rw-r--r--Source/cmSystemTools.h4
-rw-r--r--Source/cmcmd.cxx16
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt13
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-stderr.txt13
10 files changed, 63 insertions, 49 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 831a81f..2ff91fe 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -722,7 +722,7 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
this->AddFrameworkItem(item.Value);
} else if (cmSystemTools::FileIsDirectory(item.Value)) {
// This is a directory.
- this->DropDirectoryItem(item.Value);
+ this->DropDirectoryItem(item);
} else {
// Use the full path given to the library file.
this->Depends.push_back(item.Value);
@@ -1349,16 +1349,17 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
}
}
-void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
+void cmComputeLinkInformation::DropDirectoryItem(BT<std::string> const& item)
{
// A full path to a directory was found as a link item. Warn the
// user.
- std::ostringstream e;
- e << "WARNING: Target \"" << this->Target->GetName()
- << "\" requests linking to directory \"" << item << "\". "
- << "Targets may link only to libraries. "
- << "CMake is dropping the item.";
- cmSystemTools::Message(e.str());
+ this->CMakeInstance->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat(
+ "Target \"", this->Target->GetName(),
+ "\" requests linking to directory \"", item.Value,
+ "\". Targets may link only to libraries. CMake is dropping the item."),
+ item.Backtrace);
}
void cmComputeLinkInformation::ComputeFrameworkInfo()
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 90a699e..0315540 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -187,7 +187,7 @@ private:
bool CheckImplicitDirItem(std::string const& item);
void AddUserItem(BT<std::string> const& item, bool pathNotKnown);
void AddFrameworkItem(std::string const& item);
- void DropDirectoryItem(std::string const& item);
+ void DropDirectoryItem(BT<std::string> const& item);
bool CheckSharedLibNoSOName(std::string const& item);
void AddSharedLibNoSOName(std::string const& item);
void HandleBadFullItem(std::string const& item, std::string const& file);
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 18f2f7f..52a411b 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1026,9 +1026,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.GetIncludeDestination(&privateHeaderArgs));
} else {
std::ostringstream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ e << "Target " << target.GetName() << " has "
<< "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
- cmSystemTools::Message(e.str(), "Warning");
+ helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
}
@@ -1048,9 +1048,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.GetIncludeDestination(&publicHeaderArgs));
} else {
std::ostringstream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ e << "Target " << target.GetName() << " has "
<< "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
- cmSystemTools::Message(e.str(), "Warning");
+ helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
}
@@ -1067,10 +1067,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
resourceGenerator = CreateInstallFilesGenerator(
helper.Makefile, absFiles, resourceArgs, false);
} else if (!target.IsAppBundleOnApple()) {
- cmSystemTools::Message(
- cmStrCat("INSTALL TARGETS - target ", target.GetName(),
- " has RESOURCE files but no RESOURCE DESTINATION."),
- "Warning");
+ helper.Makefile->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat("Target ", target.GetName(),
+ " has RESOURCE files but no RESOURCE DESTINATION."));
}
}
}
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index d932fd9..820f24a 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -85,7 +85,9 @@ void cmInstallExportGenerator::ComputeTempDir()
}
if (useMD5) {
// Replace the destination path with a hash to keep it short.
+#ifndef CMAKE_BOOTSTRAP
this->TempDir += cmSystemTools::ComputeStringMD5(this->Destination);
+#endif
} else {
std::string dest = this->Destination;
// Avoid unix full paths.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 95c9eea..3a4c386 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2831,7 +2831,10 @@ void cmLocalGenerator::IncludeFileInUnitySources(
unity_file << "/* " << pathToHash << " */\n"
<< "#undef " << *uniqueIdName << "\n"
<< "#define " << *uniqueIdName << " unity_"
- << cmSystemTools::ComputeStringMD5(pathToHash) << "\n";
+#ifndef CMAKE_BOOTSTRAP
+ << cmSystemTools::ComputeStringMD5(pathToHash) << "\n"
+#endif
+ ;
}
if (beforeInclude) {
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7d878b2..1b07358 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1158,39 +1158,26 @@ void cmSystemTools::MoveFileIfDifferent(const std::string& source,
RemoveFile(source);
}
+#ifndef CMAKE_BOOTSTRAP
std::string cmSystemTools::ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo)
{
-#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash hash(algo);
return hash.HashFile(source);
-#else
- (void)source;
- cmSystemTools::Message("hashsum not supported in bootstrapping mode",
- "Error");
- return std::string();
-#endif
}
std::string cmSystemTools::ComputeStringMD5(const std::string& input)
{
-#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
return md5.HashString(input);
-#else
- (void)input;
- cmSystemTools::Message("md5sum not supported in bootstrapping mode",
- "Error");
- return "";
-#endif
}
+# ifdef _WIN32
std::string cmSystemTools::ComputeCertificateThumbprint(
const std::string& source)
{
std::string thumbprint;
-#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
CRYPT_INTEGER_BLOB cryptBlob;
HCERTSTORE certStore = NULL;
PCCERT_CONTEXT certContext = NULL;
@@ -1247,14 +1234,11 @@ std::string cmSystemTools::ComputeCertificateThumbprint(
}
CloseHandle(certFile);
}
-#else
- (void)source;
- cmSystemTools::Message("ComputeCertificateThumbprint is not implemented",
- "Error");
-#endif
return thumbprint;
}
+# endif
+#endif
void cmSystemTools::Glob(const std::string& directory,
const std::string& regexp,
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 715724c..19dabe8 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -179,6 +179,7 @@ public:
static void MoveFileIfDifferent(const std::string& source,
const std::string& destination);
+#ifndef CMAKE_BOOTSTRAP
//! Compute the hash of a file
static std::string ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo);
@@ -186,8 +187,11 @@ public:
/** Compute the md5sum of a string. */
static std::string ComputeStringMD5(const std::string& input);
+# ifdef _WIN32
//! Get the SHA thumbprint for a certificate file
static std::string ComputeCertificateThumbprint(const std::string& source);
+# endif
+#endif
/**
* Run a single executable command
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f742ace..8376d4d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1112,7 +1112,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
int count;
if (countFile) {
if (1 != fscanf(countFile, "%i", &count)) {
- cmSystemTools::Message("Could not read from count file.");
+ std::cerr << "Could not read from count file.\n";
}
fclose(countFile);
} else {
@@ -1426,8 +1426,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
action = cmSystemTools::TarActionExtract;
} break;
default: {
- cmSystemTools::Message(
- std::string("tar: Unknown argument: ") + flag, "Warning");
+ std::cerr << "tar: Unknown argument: " << flag << "\n";
}
}
}
@@ -1448,8 +1447,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
}
} else if (action == cmSystemTools::TarActionCreate) {
if (files.empty()) {
- cmSystemTools::Message("tar: No files or directories specified",
- "Warning");
+ std::cerr << "tar: No files or directories specified\n";
}
if (!cmSystemTools::CreateTar(outFile, files, compress, verbose, mtime,
format)) {
@@ -1588,7 +1586,11 @@ int cmcmd::HashSumFile(std::vector<std::string> const& args,
std::cerr << "Error: " << filename << " is a directory" << std::endl;
retval++;
} else {
- std::string value = cmSystemTools::ComputeFileHash(filename, algo);
+ std::string value
+#ifndef CMAKE_BOOTSTRAP
+ = cmSystemTools::ComputeFileHash(filename, algo)
+#endif
+ ;
if (value.empty()) {
// To mimic "md5sum/shasum" behavior in a shell:
std::cerr << filename << ": No such file or directory" << std::endl;
@@ -1684,7 +1686,7 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num)
return;
}
if (1 != fscanf(progFile, "%i", &count)) {
- cmSystemTools::Message("Could not read from progress file.");
+ std::cerr << "Could not read from progress file.\n";
}
fclose(progFile);
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
index 1939097..138a69d 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
@@ -1,2 +1,11 @@
-^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
-INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
+^CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\):
+ Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\):
+ Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
index 1939097..5f56986 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
+++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
@@ -1,2 +1,11 @@
-^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
-INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
+^CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\):
+ Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\):
+ Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$