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
This commit is contained in:
Brad King
2021-11-01 13:06:51 +00:00
committed by Kitware Robot
10 changed files with 63 additions and 49 deletions
+9 -8
View File
@@ -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()
+1 -1
View File
@@ -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);
+8 -8
View File
@@ -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."));
}
}
}
+2
View File
@@ -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.
+4 -1
View File
@@ -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) {
+4 -20
View File
@@ -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,
+4
View File
@@ -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
+9 -7
View File
@@ -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);
@@ -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.$
@@ -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.$