Merge topic 'update-kwsys'
ec13bd5230 Tests: Disable test that builds KWSys if not also building CMake
ded4bc136e Merge branch 'upstream-KWSys' into update-kwsys
f3999a21c8 KWSys 2019-02-12 (44676809)
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2953
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a4eb53f..8330dc8 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 14)
-set(CMake_VERSION_PATCH 20190212)
+set(CMake_VERSION_PATCH 20190214)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 2917763..fc34ef8 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -388,8 +388,7 @@
}
/* If it is not a symlink then do a plain copy */
else if (!(cmSystemTools::CopyFileIfDifferent(inFile, filePath) &&
- cmSystemTools::CopyFileTime(inFile.c_str(),
- filePath.c_str()))) {
+ cmSystemTools::CopyFileTime(inFile, filePath))) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem copying file: " << inFile << " -> "
<< filePath << std::endl);
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 3b93422..10928e0 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -223,7 +223,7 @@
checkDir = fBinDir;
}
std::string ndc = cmSystemTools::FileExistsInParentDirectories(
- ".NoDartCoverage", fFile.c_str(), checkDir.c_str());
+ ".NoDartCoverage", fFile, checkDir);
if (!ndc.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found: " << ndc << " so skip coverage of " << file
@@ -254,8 +254,8 @@
return true;
}
- ndc = cmSystemTools::FileExistsInParentDirectories(
- ".NoDartCoverage", fFile.c_str(), checkDir.c_str());
+ ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile,
+ checkDir);
if (!ndc.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found: " << ndc << " so skip coverage of: " << file
@@ -1058,8 +1058,7 @@
this->Quiet);
std::vector<std::string> lines;
-
- cmSystemTools::Split(output.c_str(), lines);
+ cmsys::SystemTools::Split(output, lines);
for (std::string const& line : lines) {
std::string sourceFile;
@@ -1435,8 +1434,7 @@
this->Quiet);
std::vector<std::string> lines;
-
- cmSystemTools::Split(output.c_str(), lines);
+ cmsys::SystemTools::Split(output, lines);
for (std::string const& line : lines) {
std::string sourceFile;
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 8ba59d3..954f5bb 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -725,7 +725,7 @@
cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*");
int defects = 0;
std::vector<std::string> lines;
- cmSystemTools::Split(str.c_str(), lines);
+ cmsys::SystemTools::Split(str, lines);
std::ostringstream ostr;
log.clear();
for (std::string const& l : lines) {
@@ -755,7 +755,7 @@
const std::string& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
- cmSystemTools::Split(str.c_str(), lines);
+ cmsys::SystemTools::Split(str, lines);
std::ostringstream ostr;
log.clear();
@@ -798,7 +798,7 @@
const std::string& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
- cmSystemTools::Split(str.c_str(), lines);
+ cmsys::SystemTools::Split(str, lines);
bool unlimitedOutput = false;
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
this->CustomMaximumFailedTestOutputSize == 0) {
@@ -937,7 +937,7 @@
log.clear();
auto sttime = std::chrono::steady_clock::now();
std::vector<std::string> lines;
- cmSystemTools::Split(str.c_str(), lines);
+ cmsys::SystemTools::Split(str, lines);
cmCTestOptionalLog(this->CTest, DEBUG,
"Start test: " << lines.size() << std::endl, this->Quiet);
std::vector<std::string>::size_type cc;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 3fe1834..906dd02 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -647,11 +647,12 @@
return;
}
- auto removeIt = std::find_if(this->Entries->begin(), this->Entries->end(),
- [value](cmCursesCacheEntryComposite* entry) {
- const char* val = entry->GetValue();
- return val && !strcmp(value, val);
- });
+ auto removeIt =
+ std::find_if(this->Entries->begin(), this->Entries->end(),
+ [value](cmCursesCacheEntryComposite* entry) -> bool {
+ const char* val = entry->GetValue();
+ return val != nullptr && !strcmp(value, val);
+ });
if (removeIt != this->Entries->end()) {
this->CMakeInstance->UnwatchUnusedCli(value);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4d9f657..aa75a8c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -223,7 +223,7 @@
bool writable = false;
// Set permissions to writable
- if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) {
+ if (cmSystemTools::GetPermissions(fileName, mode)) {
#if defined(_MSC_VER) || defined(__MINGW32__)
writable = (mode & S_IWRITE) != 0;
mode_t newMode = mode | S_IWRITE;
@@ -232,7 +232,7 @@
mode_t newMode = mode | S_IWUSR | S_IWGRP;
#endif
if (!writable) {
- cmSystemTools::SetPermissions(fileName.c_str(), newMode);
+ cmSystemTools::SetPermissions(fileName, newMode);
}
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
@@ -259,7 +259,7 @@
}
file.close();
if (mode && !writable) {
- cmSystemTools::SetPermissions(fileName.c_str(), mode);
+ cmSystemTools::SetPermissions(fileName, mode);
}
return true;
}
@@ -393,7 +393,7 @@
#else
std::ostringstream e;
e << args[0] << " not available during bootstrap";
- this->SetError(e.str().c_str());
+ this->SetError(e.str());
return false;
#endif
}
@@ -523,7 +523,7 @@
maxlen = len;
arg_mode = arg_none;
} else if (arg_mode == arg_regex) {
- if (!regex.compile(args[i].c_str())) {
+ if (!regex.compile(args[i])) {
std::ostringstream e;
e << "STRINGS option REGEX value \"" << args[i]
<< "\" could not be compiled.";
@@ -1105,7 +1105,7 @@
MatchProperties Properties;
std::string RegexString;
MatchRule(std::string const& regex)
- : Regex(regex.c_str())
+ : Regex(regex)
, RegexString(regex)
{
}
@@ -1113,14 +1113,13 @@
std::vector<MatchRule> MatchRules;
// Get the properties from rules matching this input file.
- MatchProperties CollectMatchProperties(const char* file)
+ MatchProperties CollectMatchProperties(const std::string& file)
{
// Match rules are case-insensitive on some platforms.
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
- std::string lower = cmSystemTools::LowerCase(file);
- const char* file_to_match = lower.c_str();
+ const std::string file_to_match = cmSystemTools::LowerCase(file);
#else
- const char* file_to_match = file;
+ const std::string& file_to_match = file;
#endif
// Collect properties from all matching rules.
@@ -1139,14 +1138,13 @@
return result;
}
- bool SetPermissions(const char* toFile, mode_t permissions)
+ bool SetPermissions(const std::string& toFile, mode_t permissions)
{
if (permissions) {
#ifdef WIN32
if (Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
// Store the mode in an NTFS alternate stream.
- std::string mode_t_adt_filename =
- std::string(toFile) + ":cmake_mode_t";
+ std::string mode_t_adt_filename = toFile + ":cmake_mode_t";
// Writing to an NTFS alternate stream changes the modification
// time, so we need to save and restore its original value.
@@ -1189,12 +1187,13 @@
return true;
}
- bool InstallSymlink(const char* fromFile, const char* toFile);
- bool InstallFile(const char* fromFile, const char* toFile,
+ bool InstallSymlink(const std::string& fromFile, const std::string& toFile);
+ bool InstallFile(const std::string& fromFile, const std::string& toFile,
MatchProperties match_properties);
- bool InstallDirectory(const char* source, const char* destination,
+ bool InstallDirectory(const std::string& source,
+ const std::string& destination,
MatchProperties match_properties);
- virtual bool Install(const char* fromFile, const char* toFile);
+ virtual bool Install(const std::string& fromFile, const std::string& toFile);
virtual std::string const& ToName(std::string const& fromName)
{
return fromName;
@@ -1206,8 +1205,8 @@
TypeDir,
TypeLink
};
- virtual void ReportCopy(const char*, Type, bool) {}
- virtual bool ReportMissing(const char* fromFile)
+ virtual void ReportCopy(const std::string&, Type, bool) {}
+ virtual bool ReportMissing(const std::string& fromFile)
{
// The input file does not exist and installation is not optional.
std::ostringstream e;
@@ -1551,16 +1550,17 @@
fromFile += fromName;
}
- if (!this->Install(fromFile.c_str(), toFile.c_str())) {
+ if (!this->Install(fromFile, toFile)) {
return false;
}
}
return true;
}
-bool cmFileCopier::Install(const char* fromFile, const char* toFile)
+bool cmFileCopier::Install(const std::string& fromFile,
+ const std::string& toFile)
{
- if (!*fromFile) {
+ if (fromFile.empty()) {
std::ostringstream e;
e << "INSTALL encountered an empty string input file name.";
this->FileCommand->SetError(e.str());
@@ -1590,7 +1590,8 @@
return this->ReportMissing(fromFile);
}
-bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
+bool cmFileCopier::InstallSymlink(const std::string& fromFile,
+ const std::string& toFile)
{
// Read the original symlink.
std::string symlinkTarget;
@@ -1637,7 +1638,8 @@
return true;
}
-bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
+bool cmFileCopier::InstallFile(const std::string& fromFile,
+ const std::string& toFile,
MatchProperties match_properties)
{
// Determine whether we will copy the file.
@@ -1690,8 +1692,8 @@
return this->SetPermissions(toFile, permissions);
}
-bool cmFileCopier::InstallDirectory(const char* source,
- const char* destination,
+bool cmFileCopier::InstallDirectory(const std::string& source,
+ const std::string& destination,
MatchProperties match_properties)
{
// Inform the user about this directory installation.
@@ -1748,7 +1750,7 @@
// Load the directory contents to traverse it recursively.
cmsys::Directory dir;
- if (source && *source) {
+ if (!source.empty()) {
dir.Load(source);
}
unsigned long numFiles = static_cast<unsigned long>(dir.GetNumberOfFiles());
@@ -1761,7 +1763,7 @@
std::string toPath = destination;
toPath += "/";
toPath += dir.GetFile(fileNum);
- if (!this->Install(fromPath.c_str(), toPath.c_str())) {
+ if (!this->Install(fromPath, toPath)) {
return false;
}
}
@@ -1829,7 +1831,7 @@
return this->Rename.empty() ? fromName : this->Rename;
}
- void ReportCopy(const char* toFile, Type type, bool copy) override
+ void ReportCopy(const std::string& toFile, Type type, bool copy) override
{
if (!this->MessageNever && (copy || !this->MessageLazy)) {
std::string message = (copy ? "Installing: " : "Up-to-date: ");
@@ -1841,14 +1843,14 @@
this->ManifestAppend(toFile);
}
}
- bool ReportMissing(const char* fromFile) override
+ bool ReportMissing(const std::string& fromFile) override
{
return (this->Optional || this->cmFileCopier::ReportMissing(fromFile));
}
- bool Install(const char* fromFile, const char* toFile) override
+ bool Install(const std::string& fromFile, const std::string& toFile) override
{
// Support installing from empty source to make a directory.
- if (this->InstallType == cmInstallType_DIRECTORY && !*fromFile) {
+ if (this->InstallType == cmInstallType_DIRECTORY && fromFile.empty()) {
return this->InstallDirectory(fromFile, toFile, MatchProperties());
}
return this->cmFileCopier::Install(fromFile, toFile);
@@ -2138,7 +2140,7 @@
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = nullptr;
+ std::string file;
const char* oldRPath = nullptr;
const char* newRPath = nullptr;
enum Doing
@@ -2157,7 +2159,7 @@
} else if (args[i] == "FILE") {
doing = DoingFile;
} else if (doing == DoingFile) {
- file = args[i].c_str();
+ file = args[i];
doing = DoingNone;
} else if (doing == DoingOld) {
oldRPath = args[i].c_str();
@@ -2172,7 +2174,7 @@
return false;
}
}
- if (!file) {
+ if (file.empty()) {
this->SetError("RPATH_CHANGE not given FILE option.");
return false;
}
@@ -2228,7 +2230,7 @@
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = nullptr;
+ std::string file;
enum Doing
{
DoingNone,
@@ -2239,7 +2241,7 @@
if (args[i] == "FILE") {
doing = DoingFile;
} else if (doing == DoingFile) {
- file = args[i].c_str();
+ file = args[i];
doing = DoingNone;
} else {
std::ostringstream e;
@@ -2248,7 +2250,7 @@
return false;
}
}
- if (!file) {
+ if (file.empty()) {
this->SetError("RPATH_REMOVE not given FILE option.");
return false;
}
@@ -2292,7 +2294,7 @@
std::vector<std::string> const& args)
{
// Evaluate arguments.
- const char* file = nullptr;
+ std::string file;
const char* rpath = nullptr;
enum Doing
{
@@ -2307,7 +2309,7 @@
} else if (args[i] == "FILE") {
doing = DoingFile;
} else if (doing == DoingFile) {
- file = args[i].c_str();
+ file = args[i];
doing = DoingNone;
} else if (doing == DoingRPath) {
rpath = args[i].c_str();
@@ -2319,7 +2321,7 @@
return false;
}
}
- if (!file) {
+ if (file.empty()) {
this->SetError("RPATH_CHECK not given FILE option.");
return false;
}
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 0f26e70..728f2a4 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -157,14 +157,8 @@
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression()
{
- const cmGeneratorExpressionDAGChecker* top = this;
- const cmGeneratorExpressionDAGChecker* parent = this->Parent;
- while (parent) {
- top = parent;
- parent = parent->Parent;
- }
-
- return top->Property == "TARGET_GENEX_EVAL" || top->Property == "GENEX_EVAL";
+ return this->Property.find("TARGET_GENEX_EVAL:") == 0 ||
+ this->Property.find("GENEX_EVAL:", 0) == 0;
}
bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression()
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index dcec0a4..49a5fcd 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -402,8 +402,8 @@
{
if (context->HeadTarget) {
cmGeneratorExpressionDAGChecker dagChecker(
- context->Backtrace, context->HeadTarget, genexOperator, content,
- dagCheckerParent);
+ context->Backtrace, context->HeadTarget,
+ genexOperator + ":" + expression, content, dagCheckerParent);
switch (dagChecker.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 54cfd3a..6f5e9bd 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1617,13 +1617,7 @@
return "";
}
// Compute the soname that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return soName;
+ return this->GetLibraryNames(config).SharedObject;
}
static bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level)
@@ -3394,17 +3388,13 @@
cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
// Get the names.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
+ cmGeneratorTarget::Names targetNames;
if (this->GetType() == cmStateEnums::EXECUTABLE) {
- this->GetExecutableNames(name, realName, impName, pdbName, config);
+ targetNames = this->GetExecutableNames(config);
} else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY) {
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
+ targetNames = this->GetLibraryNames(config);
} else {
return;
}
@@ -3415,34 +3405,34 @@
// Add each name.
std::string f;
- if (!name.empty()) {
+ if (!targetNames.Output.empty()) {
f = dir;
f += "/";
- f += name;
+ f += targetNames.Output;
gg->AddToManifest(f);
}
- if (!soName.empty()) {
+ if (!targetNames.SharedObject.empty()) {
f = dir;
f += "/";
- f += soName;
+ f += targetNames.SharedObject;
gg->AddToManifest(f);
}
- if (!realName.empty()) {
+ if (!targetNames.Real.empty()) {
f = dir;
f += "/";
- f += realName;
+ f += targetNames.Real;
gg->AddToManifest(f);
}
- if (!pdbName.empty()) {
+ if (!targetNames.PDB.empty()) {
f = dir;
f += "/";
- f += pdbName;
+ f += targetNames.PDB;
gg->AddToManifest(f);
}
- if (!impName.empty()) {
+ if (!targetNames.ImportLibrary.empty()) {
f = this->GetDirectory(config, cmStateEnums::ImportLibraryArtifact);
f += "/";
- f += impName;
+ f += targetNames.ImportLibrary;
gg->AddToManifest(f);
}
}
@@ -3520,29 +3510,17 @@
if (this->GetType() == cmStateEnums::EXECUTABLE) {
// Compute the real name that will be built.
- std::string name;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetExecutableNames(name, realName, impName, pdbName, config);
- return realName;
+ return this->GetExecutableNames(config).Real;
}
// Compute the real name that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return realName;
+ return this->GetLibraryNames(config).Real;
}
-void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
- std::string& realName,
- std::string& impName,
- std::string& pdbName,
- const std::string& config) const
+cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames(
+ const std::string& config) const
{
+ cmGeneratorTarget::Names targetNames;
+
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
// enforcement of the limited imported target API.
@@ -3550,7 +3528,6 @@
std::string msg = "GetLibraryNames called on imported target: ";
msg += this->GetName();
this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg);
- return;
}
// Check for library version properties.
@@ -3576,50 +3553,51 @@
// Get the components of the library name.
std::string prefix;
- std::string base;
std::string suffix;
this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact,
- prefix, base, suffix);
+ prefix, targetNames.Base, suffix);
// The library name.
- name = prefix + base + suffix;
+ targetNames.Output = prefix + targetNames.Base + suffix;
if (this->IsFrameworkOnApple()) {
- realName = prefix;
+ targetNames.Real = prefix;
if (!this->Makefile->PlatformIsAppleEmbedded()) {
- realName += "Versions/";
- realName += this->GetFrameworkVersion();
- realName += "/";
+ targetNames.Real += "Versions/";
+ targetNames.Real += this->GetFrameworkVersion();
+ targetNames.Real += "/";
}
- realName += base;
- soName = realName;
+ targetNames.Real += targetNames.Base;
+ targetNames.SharedObject = targetNames.Real;
} else {
// The library's soname.
- this->ComputeVersionedName(soName, prefix, base, suffix, name, soversion);
+ this->ComputeVersionedName(targetNames.SharedObject, prefix,
+ targetNames.Base, suffix, targetNames.Output,
+ soversion);
// The library's real name on disk.
- this->ComputeVersionedName(realName, prefix, base, suffix, name, version);
+ this->ComputeVersionedName(targetNames.Real, prefix, targetNames.Base,
+ suffix, targetNames.Output, version);
}
// The import library name.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY) {
- impName =
+ targetNames.ImportLibrary =
this->GetFullNameInternal(config, cmStateEnums::ImportLibraryArtifact);
- } else {
- impName.clear();
}
// The program database file name.
- pdbName = this->GetPDBName(config);
+ targetNames.PDB = this->GetPDBName(config);
+
+ return targetNames;
}
-void cmGeneratorTarget::GetExecutableNames(std::string& name,
- std::string& realName,
- std::string& impName,
- std::string& pdbName,
- const std::string& config) const
+cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
+ const std::string& config) const
{
+ cmGeneratorTarget::Names targetNames;
+
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
// enforcement of the limited imported target API.
@@ -3644,34 +3622,35 @@
// Get the components of the executable name.
std::string prefix;
- std::string base;
std::string suffix;
this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact,
- prefix, base, suffix);
+ prefix, targetNames.Base, suffix);
// The executable name.
- name = prefix + base + suffix;
+ targetNames.Output = prefix + targetNames.Base + suffix;
// The executable's real name on disk.
#if defined(__CYGWIN__)
- realName = prefix + base;
+ targetNames.Real = prefix + targetNames.Base;
#else
- realName = name;
+ targetNames.Real = targetNames.Output;
#endif
if (version) {
- realName += "-";
- realName += version;
+ targetNames.Real += "-";
+ targetNames.Real += version;
}
#if defined(__CYGWIN__)
- realName += suffix;
+ targetNames.Real += suffix;
#endif
// The import library name.
- impName =
+ targetNames.ImportLibrary =
this->GetFullNameInternal(config, cmStateEnums::ImportLibraryArtifact);
// The program database file name.
- pdbName = this->GetPDBName(config);
+ targetNames.PDB = this->GetPDBName(config);
+
+ return targetNames;
}
std::string cmGeneratorTarget::GetFullNameInternal(
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 59d38af..bc966e1 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -568,19 +568,25 @@
void GetAutoUicOptions(std::vector<std::string>& result,
const std::string& config) const;
+ struct Names
+ {
+ std::string Base;
+ std::string Output;
+ std::string Real;
+ std::string ImportLibrary;
+ std::string PDB;
+ std::string SharedObject;
+ };
+
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
- void GetExecutableNames(std::string& name, std::string& realName,
- std::string& impName, std::string& pdbName,
- const std::string& config) const;
+ Names GetExecutableNames(const std::string& config) const;
/** Get the names of the library needed to generate a build rule
that takes into account shared library version numbers. This
should be called only on a library target. */
- void GetLibraryNames(std::string& name, std::string& soName,
- std::string& realName, std::string& impName,
- std::string& pdbName, const std::string& config) const;
+ Names GetLibraryNames(const std::string& config) const;
/**
* Compute whether this target must be relinked before installing.
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 08441a8..c63e01a 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -40,12 +40,8 @@
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::EXECUTABLE: {
// Get the name of the executable to generate.
- std::string targetName;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->GeneratorTarget->GetExecutableNames(
- targetName, this->TargetNameReal, targetNameImport, targetNamePDB,
- this->ConfigName);
+ this->TargetNameReal =
+ this->GeneratorTarget->GetExecutableNames(this->ConfigName).Real;
if (cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()) {
this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION;
} else {
@@ -54,13 +50,8 @@
break;
}
case cmStateEnums::STATIC_LIBRARY: {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->GeneratorTarget->GetLibraryNames(
- targetName, targetNameSO, this->TargetNameReal, targetNameImport,
- targetNamePDB, this->ConfigName);
+ this->TargetNameReal =
+ this->GeneratorTarget->GetLibraryNames(this->ConfigName).Real;
this->TagType = GhsMultiGpj::LIBRARY;
break;
}
@@ -71,13 +62,8 @@
return;
}
case cmStateEnums::OBJECT_LIBRARY: {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->GeneratorTarget->GetLibraryNames(
- targetName, targetNameSO, this->TargetNameReal, targetNameImport,
- targetNamePDB, this->ConfigName);
+ this->TargetNameReal =
+ this->GeneratorTarget->GetLibraryNames(this->ConfigName).Real;
this->TagType = GhsMultiGpj::SUBPROJECT;
break;
}
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 5cee9d3..7053e99 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -123,19 +123,15 @@
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);
- std::string targetName;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->Target->GetExecutableNames(targetName, targetNameReal,
- targetNameImport, targetNamePDB, config);
+ cmGeneratorTarget::Names targetNames =
+ this->Target->GetExecutableNames(config);
if (this->ImportLibrary) {
- std::string from1 = fromDirConfig + targetNameImport;
- std::string to1 = toDir + targetNameImport;
+ std::string from1 = fromDirConfig + targetNames.ImportLibrary;
+ std::string to1 = toDir + targetNames.ImportLibrary;
filesFrom.push_back(std::move(from1));
filesTo.push_back(std::move(to1));
std::string targetNameImportLib;
- if (this->Target->GetImplibGNUtoMS(config, targetNameImport,
+ if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary,
targetNameImportLib)) {
filesFrom.push_back(fromDirConfig + targetNameImportLib);
filesTo.push_back(toDir + targetNameImportLib);
@@ -144,8 +140,8 @@
// An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY;
} else {
- std::string from1 = fromDirConfig + targetName;
- std::string to1 = toDir + targetName;
+ std::string from1 = fromDirConfig + targetNames.Output;
+ std::string to1 = toDir + targetNames.Output;
// Handle OSX Bundles.
if (this->Target->IsAppBundleOnApple()) {
@@ -170,12 +166,12 @@
if (!mf->PlatformIsAppleEmbedded()) {
to1 += "Contents/MacOS/";
}
- to1 += targetName;
+ to1 += targetNames.Output;
} else {
// Tweaks apply to the real file, so list it first.
- if (targetNameReal != targetName) {
- std::string from2 = fromDirConfig + targetNameReal;
- std::string to2 = toDir += targetNameReal;
+ if (targetNames.Real != targetNames.Output) {
+ std::string from2 = fromDirConfig + targetNames.Real;
+ std::string to2 = toDir += targetNames.Real;
filesFrom.push_back(std::move(from2));
filesTo.push_back(std::move(to2));
}
@@ -185,23 +181,18 @@
filesTo.push_back(std::move(to1));
}
} else {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, targetNamePDB, config);
+ cmGeneratorTarget::Names targetNames =
+ this->Target->GetLibraryNames(config);
if (this->ImportLibrary) {
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);
- std::string from1 = fromDirConfig + targetNameImport;
- std::string to1 = toDir + targetNameImport;
+ std::string from1 = fromDirConfig + targetNames.ImportLibrary;
+ std::string to1 = toDir + targetNames.ImportLibrary;
filesFrom.push_back(std::move(from1));
filesTo.push_back(std::move(to1));
std::string targetNameImportLib;
- if (this->Target->GetImplibGNUtoMS(config, targetNameImport,
+ if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary,
targetNameImportLib)) {
filesFrom.push_back(fromDirConfig + targetNameImportLib);
filesTo.push_back(toDir + targetNameImportLib);
@@ -243,11 +234,11 @@
type = cmInstallType_DIRECTORY;
literal_args += " USE_SOURCE_PERMISSIONS";
- std::string from1 = fromDirConfig + targetName;
+ std::string from1 = fromDirConfig + targetNames.Output;
from1 = cmSystemTools::GetFilenamePath(from1);
// Tweaks apply to the binary inside the bundle.
- std::string to1 = toDir + targetNameReal;
+ std::string to1 = toDir + targetNames.Real;
filesFrom.push_back(std::move(from1));
filesTo.push_back(std::move(to1));
@@ -256,10 +247,11 @@
type = cmInstallType_DIRECTORY;
literal_args += " USE_SOURCE_PERMISSIONS";
- std::string targetNameBase = targetName.substr(0, targetName.find('/'));
+ std::string targetNameBase =
+ targetNames.Output.substr(0, targetNames.Output.find('/'));
std::string from1 = fromDirConfig + targetNameBase;
- std::string to1 = toDir + targetName;
+ std::string to1 = toDir + targetNames.Output;
filesFrom.push_back(std::move(from1));
filesTo.push_back(std::move(to1));
@@ -267,25 +259,26 @@
bool haveNamelink = false;
// Library link name.
- std::string fromName = fromDirConfig + targetName;
- std::string toName = toDir + targetName;
+ std::string fromName = fromDirConfig + targetNames.Output;
+ std::string toName = toDir + targetNames.Output;
// Library interface name.
std::string fromSOName;
std::string toSOName;
- if (targetNameSO != targetName) {
+ if (targetNames.SharedObject != targetNames.Output) {
haveNamelink = true;
- fromSOName = fromDirConfig + targetNameSO;
- toSOName = toDir + targetNameSO;
+ fromSOName = fromDirConfig + targetNames.SharedObject;
+ toSOName = toDir + targetNames.SharedObject;
}
// Library implementation name.
std::string fromRealName;
std::string toRealName;
- if (targetNameReal != targetName && targetNameReal != targetNameSO) {
+ if (targetNames.Real != targetNames.Output &&
+ targetNames.Real != targetNames.SharedObject) {
haveNamelink = true;
- fromRealName = fromDirConfig + targetNameReal;
- toRealName = toDir + targetNameReal;
+ fromRealName = fromDirConfig + targetNames.Real;
+ toRealName = toDir + targetNames.Real;
}
// Add the names based on the current namelink mode.
@@ -416,48 +409,37 @@
std::string fname;
// Compute the name of the library.
if (target->GetType() == cmStateEnums::EXECUTABLE) {
- std::string targetName;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameReal, targetNameImport,
- targetNamePDB, config);
+ cmGeneratorTarget::Names targetNames = target->GetExecutableNames(config);
if (nameType == NameImplib) {
// Use the import library name.
- if (!target->GetImplibGNUtoMS(config, targetNameImport, fname,
+ if (!target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) {
- fname = targetNameImport;
+ fname = targetNames.ImportLibrary;
}
} else if (nameType == NameReal) {
// Use the canonical name.
- fname = targetNameReal;
+ fname = targetNames.Real;
} else {
// Use the canonical name.
- fname = targetName;
+ fname = targetNames.Output;
}
} else {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, targetNamePDB, config);
+ cmGeneratorTarget::Names targetNames = target->GetLibraryNames(config);
if (nameType == NameImplib) {
// Use the import library name.
- if (!target->GetImplibGNUtoMS(config, targetNameImport, fname,
+ if (!target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) {
- fname = targetNameImport;
+ fname = targetNames.ImportLibrary;
}
} else if (nameType == NameSO) {
// Use the soname.
- fname = targetNameSO;
+ fname = targetNames.SharedObject;
} else if (nameType == NameReal) {
// Use the real name.
- fname = targetNameReal;
+ fname = targetNames.Real;
} else {
// Use the canonical name.
- fname = targetName;
+ fname = targetNames.Output;
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index b809be4..9f18e8f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1043,13 +1043,8 @@
}
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameFull;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetLibraryNames(targetName, targetNameSO, targetNameFull,
- targetNameImport, targetNamePDB, configName);
+ cmGeneratorTarget::Names targetNames =
+ target->GetLibraryNames(configName);
// Compute the link library and directory information.
cmComputeLinkInformation* pcli = target->GetLinkInformation(configName);
@@ -1085,7 +1080,7 @@
fout << "\"\n";
temp = target->GetDirectory(configName);
temp += "/";
- temp += targetNameFull;
+ temp += targetNames.Output;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
@@ -1095,7 +1090,7 @@
fout << "\"\n";
temp = target->GetPDBDirectory(configName);
temp += "/";
- temp += targetNamePDB;
+ temp += targetNames.PDB;
fout << "\t\t\t\tProgramDatabaseFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
if (targetOptions.IsDebug()) {
@@ -1118,7 +1113,7 @@
temp =
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact);
temp += "/";
- temp += targetNameImport;
+ temp += targetNames.ImportLibrary;
fout << "\t\t\t\tImportLibrary=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"";
if (this->FortranProject) {
@@ -1127,12 +1122,8 @@
fout << "/>\n";
} break;
case cmStateEnums::EXECUTABLE: {
- std::string targetName;
- std::string targetNameFull;
- std::string targetNameImport;
- std::string targetNamePDB;
- target->GetExecutableNames(targetName, targetNameFull, targetNameImport,
- targetNamePDB, configName);
+ cmGeneratorTarget::Names targetNames =
+ target->GetExecutableNames(configName);
// Compute the link library and directory information.
cmComputeLinkInformation* pcli = target->GetLinkInformation(configName);
@@ -1170,7 +1161,7 @@
fout << "\"\n";
temp = target->GetDirectory(configName);
temp += "/";
- temp += targetNameFull;
+ temp += targetNames.Output;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
@@ -1180,8 +1171,8 @@
fout << "\"\n";
std::string path = this->ConvertToXMLOutputPathSingle(
target->GetPDBDirectory(configName).c_str());
- fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/" << targetNamePDB
- << "\"\n";
+ fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/"
+ << targetNames.PDB << "\"\n";
if (targetOptions.IsDebug()) {
fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n";
}
@@ -1216,7 +1207,7 @@
temp =
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact);
temp += "/";
- temp += targetNameImport;
+ temp += targetNames.ImportLibrary;
fout << "\t\t\t\tImportLibrary=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
break;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index e8ae5ae..572270a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -31,9 +31,8 @@
: cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnDepends;
- this->GeneratorTarget->GetExecutableNames(
- this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
- this->TargetNamePDB, this->ConfigName);
+ this->TargetNames =
+ this->GeneratorTarget->GetExecutableNames(this->ConfigName);
this->OSXBundleGenerator =
new cmOSXBundleGenerator(target, this->ConfigName);
@@ -305,18 +304,13 @@
std::vector<std::string> commands;
// Get the name of the executable to generate.
- std::string targetName;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->GeneratorTarget->GetExecutableNames(targetName, targetNameReal,
- targetNameImport, targetNamePDB,
- this->ConfigName);
+ cmGeneratorTarget::Names targetNames =
+ this->GeneratorTarget->GetExecutableNames(this->ConfigName);
// Construct the full path version of the names.
std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
if (this->GeneratorTarget->IsAppBundleOnApple()) {
- this->OSXBundleGenerator->CreateAppBundle(targetName, outpath);
+ this->OSXBundleGenerator->CreateAppBundle(targetNames.Output, outpath);
}
outpath += "/";
std::string outpathImp;
@@ -326,12 +320,12 @@
outpath += "/CMakeRelink.dir";
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
- if (!targetNameImport.empty()) {
+ if (!targetNames.ImportLibrary.empty()) {
outpathImp = outpath;
}
} else {
cmSystemTools::MakeDirectory(outpath);
- if (!targetNameImport.empty()) {
+ if (!targetNames.ImportLibrary.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
cmSystemTools::MakeDirectory(outpathImp);
@@ -348,10 +342,10 @@
cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
- std::string targetFullPath = outpath + targetName;
- std::string targetFullPathReal = outpath + targetNameReal;
- std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
- std::string targetFullPathImport = outpathImp + targetNameImport;
+ std::string targetFullPath = outpath + targetNames.Output;
+ std::string targetFullPathReal = outpath + targetNames.Real;
+ std::string targetFullPathPDB = pdbOutputPath + targetNames.PDB;
+ std::string targetFullPathImport = outpathImp + targetNames.ImportLibrary;
std::string targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
targetFullPathPDB, cmOutputConverter::SHELL);
// Convert to the output path to use in constructing commands.
@@ -468,11 +462,11 @@
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPath + ".manifest"));
#endif
- if (targetNameReal != targetName) {
+ if (this->TargetNames.Real != this->TargetNames.Output) {
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
}
- if (!targetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport));
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 5a1ef4e..ed2fd68 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -32,9 +32,8 @@
{
this->CustomCommandDriver = OnDepends;
if (this->GeneratorTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- this->GeneratorTarget->GetLibraryNames(
- this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
- this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
+ this->TargetNames =
+ this->GeneratorTarget->GetLibraryNames(this->ConfigName);
}
this->OSXBundleGenerator =
@@ -489,25 +488,20 @@
}
// Construct the name of the library.
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameReal;
- std::string targetNameImport;
- std::string targetNamePDB;
- this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
- targetNameReal, targetNameImport,
- targetNamePDB, this->ConfigName);
+ this->GeneratorTarget->GetLibraryNames(this->ConfigName);
// Construct the full path version of the names.
std::string outpath;
std::string outpathImp;
if (this->GeneratorTarget->IsFrameworkOnApple()) {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
- this->OSXBundleGenerator->CreateFramework(targetName, outpath);
+ this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output,
+ outpath);
outpath += "/";
} else if (this->GeneratorTarget->IsCFBundleOnApple()) {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
- this->OSXBundleGenerator->CreateCFBundle(targetName, outpath);
+ this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output,
+ outpath);
outpath += "/";
} else if (relink) {
outpath = this->Makefile->GetCurrentBinaryDirectory();
@@ -515,14 +509,14 @@
outpath += "/CMakeRelink.dir";
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
- if (!targetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
outpathImp = outpath;
}
} else {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
- if (!targetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
cmSystemTools::MakeDirectory(outpathImp);
@@ -539,11 +533,12 @@
cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
- std::string targetFullPath = outpath + targetName;
- std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
- std::string targetFullPathSO = outpath + targetNameSO;
- std::string targetFullPathReal = outpath + targetNameReal;
- std::string targetFullPathImport = outpathImp + targetNameImport;
+ std::string targetFullPath = outpath + this->TargetNames.Output;
+ std::string targetFullPathPDB = pdbOutputPath + this->TargetNames.PDB;
+ std::string targetFullPathSO = outpath + this->TargetNames.SharedObject;
+ std::string targetFullPathReal = outpath + this->TargetNames.Real;
+ std::string targetFullPathImport =
+ outpathImp + this->TargetNames.ImportLibrary;
// Construct the output path version of the names for use in command
// arguments.
@@ -616,15 +611,16 @@
commands1.clear();
}
- if (targetName != targetNameReal) {
+ if (this->TargetNames.Output != this->TargetNames.Real) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
}
- if (targetNameSO != targetNameReal && targetNameSO != targetName) {
+ if (this->TargetNames.SharedObject != this->TargetNames.Real &&
+ this->TargetNames.SharedObject != this->TargetNames.Output) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO));
}
- if (!targetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
targetFullPathImport));
@@ -820,7 +816,7 @@
vars.ObjectsQuoted = buildObjs.c_str();
if (this->GeneratorTarget->HasSOName(this->ConfigName)) {
vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
- vars.TargetSOName = targetNameSO.c_str();
+ vars.TargetSOName = this->TargetNames.SharedObject.c_str();
}
vars.LinkFlags = linkFlags.c_str();
@@ -981,10 +977,11 @@
// Compute the list of outputs.
std::vector<std::string> outputs(1, targetFullPathReal);
- if (targetNameSO != targetNameReal) {
+ if (this->TargetNames.SharedObject != this->TargetNames.Real) {
outputs.push_back(targetFullPathSO);
}
- if (targetName != targetNameSO && targetName != targetNameReal) {
+ if (this->TargetNames.Output != this->TargetNames.SharedObject &&
+ this->TargetNames.Output != this->TargetNames.Real) {
outputs.push_back(targetFullPath);
}
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 529b4db..c053d5b 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -12,12 +12,12 @@
#include <vector>
#include "cmCommonTargetGenerator.h"
+#include "cmGeneratorTarget.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmOSXBundleGenerator.h"
class cmCustomCommandGenerator;
class cmGeneratedFileStream;
-class cmGeneratorTarget;
class cmGlobalUnixMakefileGenerator3;
class cmLinkLineComputer;
class cmOutputConverter;
@@ -231,11 +231,7 @@
bool in_help = false);
// Target name info.
- std::string TargetNameOut;
- std::string TargetNameSO;
- std::string TargetNameReal;
- std::string TargetNameImport;
- std::string TargetNamePDB;
+ cmGeneratorTarget::Names TargetNames;
// macOS content info.
std::set<std::string> MacContentFolders;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index cbc0103..3874f48 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -41,13 +41,10 @@
{
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmStateEnums::EXECUTABLE) {
- this->GetGeneratorTarget()->GetExecutableNames(
- this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
- this->TargetNamePDB, GetLocalGenerator()->GetConfigName());
+ this->TargetNames = this->GetGeneratorTarget()->GetExecutableNames(
+ GetLocalGenerator()->GetConfigName());
} else {
- this->GetGeneratorTarget()->GetLibraryNames(
- this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
- this->TargetNameImport, this->TargetNamePDB,
+ this->TargetNames = this->GetGeneratorTarget()->GetLibraryNames(
GetLocalGenerator()->GetConfigName());
}
@@ -395,7 +392,7 @@
/*generator*/ false);
}
- if (this->TargetNameOut != this->TargetNameReal &&
+ if (this->TargetNames.Output != this->TargetNames.Real &&
!this->GetGeneratorTarget()->IsFrameworkOnApple()) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
@@ -676,7 +673,7 @@
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
vars["SONAME_FLAG"] =
this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage);
- vars["SONAME"] = this->TargetNameSO;
+ vars["SONAME"] = this->TargetNames.SharedObject;
if (targetType == cmStateEnums::SHARED_LIBRARY) {
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
@@ -687,7 +684,7 @@
}
}
- if (!this->TargetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
const std::string impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
@@ -749,24 +746,25 @@
if (gt.IsAppBundleOnApple()) {
// Create the app bundle
std::string outpath = gt.GetDirectory(cfgName);
- this->OSXBundleGenerator->CreateAppBundle(this->TargetNameOut, outpath);
+ this->OSXBundleGenerator->CreateAppBundle(this->TargetNames.Output,
+ outpath);
// Calculate the output path
targetOutput = outpath;
targetOutput += "/";
- targetOutput += this->TargetNameOut;
+ targetOutput += this->TargetNames.Output;
targetOutput = this->ConvertToNinjaPath(targetOutput);
targetOutputReal = outpath;
targetOutputReal += "/";
- targetOutputReal += this->TargetNameReal;
+ targetOutputReal += this->TargetNames.Real;
targetOutputReal = this->ConvertToNinjaPath(targetOutputReal);
} else if (gt.IsFrameworkOnApple()) {
// Create the library framework.
- this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
+ this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output,
gt.GetDirectory(cfgName));
} else if (gt.IsCFBundleOnApple()) {
// Create the core foundation bundle.
- this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut,
+ this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output,
gt.GetDirectory(cfgName));
}
@@ -864,7 +862,7 @@
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
- vars["SONAME"] = this->TargetNameSO;
+ vars["SONAME"] = this->TargetNames.SharedObject;
if (targetType == cmStateEnums::SHARED_LIBRARY) {
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
@@ -877,7 +875,7 @@
cmNinjaDeps byproducts;
- if (!this->TargetNameImport.empty()) {
+ if (!this->TargetNames.ImportLibrary.empty()) {
const std::string impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
@@ -1037,8 +1035,8 @@
emptyDeps, emptyDeps, symlinkVars);
} else {
cmNinjaDeps symlinks;
- std::string const soName =
- this->ConvertToNinjaPath(this->GetTargetFilePath(this->TargetNameSO));
+ std::string const soName = this->ConvertToNinjaPath(
+ this->GetTargetFilePath(this->TargetNames.SharedObject));
// If one link has to be created.
if (targetOutputReal == soName || targetOutput == soName) {
symlinkVars["SONAME"] = soName;
@@ -1056,7 +1054,7 @@
}
// Add aliases for the file name and the target name.
- globalGen.AddTargetAlias(this->TargetNameOut, >);
+ globalGen.AddTargetAlias(this->TargetNames.Output, >);
globalGen.AddTargetAlias(this->GetTargetName(), >);
}
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 01cc881..14991a2 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -5,13 +5,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmGeneratorTarget.h"
#include "cmNinjaTargetGenerator.h"
#include <string>
#include <vector>
-class cmGeneratorTarget;
-
class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator
{
public:
@@ -40,11 +39,7 @@
private:
// Target name info.
- std::string TargetNameOut;
- std::string TargetNameSO;
- std::string TargetNameReal;
- std::string TargetNameImport;
- std::string TargetNamePDB;
+ cmGeneratorTarget::Names TargetNames;
std::string TargetLinkLanguage;
std::string DeviceLinkObject;
};
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2d7bce4..a5d191d 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -897,7 +897,7 @@
}
bool cmSystemTools::DoesFileExistWithExtensions(
- const char* name, const std::vector<std::string>& headerExts)
+ const std::string& name, const std::vector<std::string>& headerExts)
{
std::string hname;
@@ -912,9 +912,9 @@
return false;
}
-std::string cmSystemTools::FileExistsInParentDirectories(const char* fname,
- const char* directory,
- const char* toplevel)
+std::string cmSystemTools::FileExistsInParentDirectories(
+ const std::string& fname, const std::string& directory,
+ const std::string& toplevel)
{
std::string file = fname;
cmSystemTools::ConvertToUnixSlashes(file);
@@ -926,7 +926,7 @@
if (cmSystemTools::FileExists(path)) {
return path;
}
- if (dir.size() < strlen(toplevel)) {
+ if (dir.size() < toplevel.size()) {
break;
}
prevDir = dir;
@@ -2081,7 +2081,8 @@
#endif
}
-bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
+bool cmSystemTools::CopyFileTime(const std::string& fromFile,
+ const std::string& toFile)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
cmSystemToolsWindowsHandle hFrom = CreateFileW(
@@ -2102,14 +2103,14 @@
return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0;
#else
struct stat fromStat;
- if (stat(fromFile, &fromStat) < 0) {
+ if (stat(fromFile.c_str(), &fromStat) < 0) {
return false;
}
struct utimbuf buf;
buf.actime = fromStat.st_atime;
buf.modtime = fromStat.st_mtime;
- return utime(toFile, &buf) >= 0;
+ return utime(toFile.c_str(), &buf) >= 0;
#endif
}
@@ -2123,7 +2124,8 @@
delete t;
}
-bool cmSystemTools::FileTimeGet(const char* fname, cmSystemToolsFileTime* t)
+bool cmSystemTools::FileTimeGet(const std::string& fname,
+ cmSystemToolsFileTime* t)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
cmSystemToolsWindowsHandle h = CreateFileW(
@@ -2138,7 +2140,7 @@
}
#else
struct stat st;
- if (stat(fname, &st) < 0) {
+ if (stat(fname.c_str(), &st) < 0) {
return false;
}
t->timeBuf.actime = st.st_atime;
@@ -2147,7 +2149,8 @@
return true;
}
-bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t)
+bool cmSystemTools::FileTimeSet(const std::string& fname,
+ const cmSystemToolsFileTime* t)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
cmSystemToolsWindowsHandle h = CreateFileW(
@@ -2159,7 +2162,7 @@
return SetFileTime(h, &t->timeCreation, &t->timeLastAccess,
&t->timeLastWrite) != 0;
#else
- return utime(fname, &t->timeBuf) >= 0;
+ return utime(fname.c_str(), &t->timeBuf) >= 0;
#endif
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 88758a6..ba6de51 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -144,16 +144,16 @@
static bool IsPathToFramework(const char* value);
static bool DoesFileExistWithExtensions(
- const char* name, const std::vector<std::string>& sourceExts);
+ const std::string& name, const std::vector<std::string>& sourceExts);
/**
* Check if the given file exists in one of the parent directory of the
* given file or directory and if it does, return the name of the file.
* Toplevel specifies the top-most directory to where it will look.
*/
- static std::string FileExistsInParentDirectories(const char* fname,
- const char* directory,
- const char* toplevel);
+ static std::string FileExistsInParentDirectories(
+ const std::string& fname, const std::string& directory,
+ const std::string& toplevel);
static void Glob(const std::string& directory, const std::string& regexp,
std::vector<std::string>& files);
@@ -443,13 +443,15 @@
/** Copy the file create/access/modify times from the file named by
the first argument to that named by the second. */
- static bool CopyFileTime(const char* fromFile, const char* toFile);
+ static bool CopyFileTime(const std::string& fromFile,
+ const std::string& toFile);
/** Save and restore file times. */
static cmSystemToolsFileTime* FileTimeNew();
static void FileTimeDelete(cmSystemToolsFileTime*);
- static bool FileTimeGet(const char* fname, cmSystemToolsFileTime* t);
- static bool FileTimeSet(const char* fname, cmSystemToolsFileTime* t);
+ static bool FileTimeGet(const std::string& fname, cmSystemToolsFileTime* t);
+ static bool FileTimeSet(const std::string& fname,
+ const cmSystemToolsFileTime* t);
/** Random seed generation. */
static unsigned int RandomSeed();
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8e08417..00a2d74 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3439,18 +3439,11 @@
linkDirs.push_back("%(AdditionalLibraryDirectories)");
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
- std::string targetName;
- std::string targetNameSO;
- std::string targetNameFull;
- std::string targetNameImport;
- std::string targetNamePDB;
+ cmGeneratorTarget::Names targetNames;
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
- this->GeneratorTarget->GetExecutableNames(
- targetName, targetNameFull, targetNameImport, targetNamePDB, config);
+ targetNames = this->GeneratorTarget->GetExecutableNames(config);
} else {
- this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
- targetNameFull, targetNameImport,
- targetNamePDB, config);
+ targetNames = this->GeneratorTarget->GetLibraryNames(config);
}
if (this->MSTools) {
@@ -3491,11 +3484,11 @@
std::string pdb = this->GeneratorTarget->GetPDBDirectory(config);
pdb += "/";
- pdb += targetNamePDB;
+ pdb += targetNames.PDB;
std::string imLib = this->GeneratorTarget->GetDirectory(
config, cmStateEnums::ImportLibraryArtifact);
imLib += "/";
- imLib += targetNameImport;
+ imLib += targetNames.ImportLibrary;
linkOptions.AddFlag("ImportLibrary", imLib);
linkOptions.AddFlag("ProgramDataBaseFile", pdb);
@@ -3519,7 +3512,7 @@
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib");
}
} else if (this->NsightTegra) {
- linkOptions.AddFlag("SoName", targetNameSO);
+ linkOptions.AddFlag("SoName", targetNames.SharedObject);
}
linkOptions.Parse(flags);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d507484..ff6b04b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1105,7 +1105,7 @@
if (cmSystemTools::FileExists(cmakeFiles)) {
std::string cachePathFound =
cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt",
- cachePath.c_str(), "/");
+ cachePath, "/");
if (!cachePathFound.empty()) {
cachePath = cmSystemTools::GetFilenamePath(cachePathFound);
}
diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt
index fd954e6..ed68400 100644
--- a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt
@@ -1,7 +1,7 @@
^CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\):
Error evaluating generator expression:
- \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY1>>
+ \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>>
Dependency loop found.
Call Stack \(most recent call first\):
@@ -11,7 +11,7 @@
CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\):
Loop step 1
- \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>>
+ \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY1>>
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
@@ -20,7 +20,7 @@
CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\):
Loop step 2
- \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY1>>
+ \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>>
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake
index ab8988b..153cd17 100644
--- a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake
+++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake
@@ -7,5 +7,6 @@
set_property (TARGET example PROPERTY CUSTOM_PROPERTY1 "PROPERTY1")
set_property (TARGET example PROPERTY CUSTOM_PROPERTY2 "$<TARGET_PROPERTY:CUSTOM_PROPERTY1>")
set_property (TARGET example PROPERTY CUSTOM_PROPERTY3 "$<GENEX_EVAL:BEFORE_$<TARGET_PROPERTY:CUSTOM_PROPERTY2>_AFTER>")
+set_property (TARGET example PROPERTY CUSTOM_PROPERTY4 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY3>>")
-file(GENERATE OUTPUT "GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY3>>")
+file(GENERATE OUTPUT "GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY4>>")