summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJiri Malak <malak.jiri@gmail.com>2023-01-24 22:12:28 +0100
committerJiri Malak <malak.jiri@gmail.com>2023-01-24 22:12:28 +0100
commita1d065e5c7f2b0bb33dc8aea6d10947e46a43abb (patch)
tree4f7dfaaa52b2b0b2f0d49d4200431500fc148025 /Source
parent62483b9b99647bcec8275d7b139a64e879623fcc (diff)
downloadcmake-a1d065e5c7f2b0bb33dc8aea6d10947e46a43abb.tar.gz
Watcom: Replace WATCOMQUOTE format by UseWatcomQuote attribute
Replace WATCOMQUOTE output format by UseWatcomQuote attribute to properly handle single quote This attribute is used globaly only for Watcom linker to handle single-quote separator instead of double-quote it doesn't mean different output format only change of quoting separator It is now applied to any output form SHELL/RESPONSE/NINJAMULTI if Watcom linker is used otherwise double-quote is used
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLinkLineComputer.cxx10
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx5
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx5
-rw-r--r--Source/cmOutputConverter.cxx20
-rw-r--r--Source/cmOutputConverter.h7
5 files changed, 21 insertions, 26 deletions
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index b1e9e568e2..ba0c138ab9 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -87,13 +87,12 @@ std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
cmOutputConverter::OutputFormat shellFormat = cmOutputConverter::SHELL;
if (this->ForResponse) {
shellFormat = cmOutputConverter::RESPONSE;
- } else if (this->UseWatcomQuote) {
- shellFormat = cmOutputConverter::WATCOMQUOTE;
} else if (this->UseNinjaMulti) {
shellFormat = cmOutputConverter::NINJAMULTI;
}
- return this->OutputConverter->ConvertToOutputFormat(input, shellFormat);
+ return this->OutputConverter->ConvertToOutputFormat(input, shellFormat,
+ this->UseWatcomQuote);
}
std::string cmLinkLineComputer::ConvertToOutputForExisting(
@@ -102,13 +101,12 @@ std::string cmLinkLineComputer::ConvertToOutputForExisting(
cmOutputConverter::OutputFormat shellFormat = cmOutputConverter::SHELL;
if (this->ForResponse) {
shellFormat = cmOutputConverter::RESPONSE;
- } else if (this->UseWatcomQuote) {
- shellFormat = cmOutputConverter::WATCOMQUOTE;
} else if (this->UseNinjaMulti) {
shellFormat = cmOutputConverter::NINJAMULTI;
}
- return this->OutputConverter->ConvertToOutputForExisting(input, shellFormat);
+ return this->OutputConverter->ConvertToOutputForExisting(
+ input, shellFormat, this->UseWatcomQuote);
}
std::string cmLinkLineComputer::ComputeLinkPath(
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 54f03b9ddf..e53d28cec3 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -537,12 +537,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
- cmOutputConverter::OutputFormat output = (useWatcomQuote)
- ? cmOutputConverter::WATCOMQUOTE
- : cmOutputConverter::SHELL;
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetFullPathReal),
- output);
+ cmOutputConverter::SHELL, useWatcomQuote);
vars.Target = target.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 45ef8c888b..09c9c7e439 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -756,12 +756,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
- cmOutputConverter::OutputFormat output = (useWatcomQuote)
- ? cmOutputConverter::WATCOMQUOTE
- : cmOutputConverter::SHELL;
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetFullPathReal),
- output);
+ cmOutputConverter::SHELL, useWatcomQuote);
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 299ab3a437..6c54e01e3d 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -154,7 +154,7 @@ std::string cmOutputConverter::MaybeRelativeToCurBinDir(
}
std::string cmOutputConverter::ConvertToOutputForExisting(
- const std::string& remote, OutputFormat format) const
+ const std::string& remote, OutputFormat format, bool useWatcomQuote) const
{
#ifdef _WIN32
// Cache the Short Paths since we only convert the same few paths anyway and
@@ -181,25 +181,27 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
return tmp;
}();
- return this->ConvertToOutputFormat(shortPath, format);
+ return this->ConvertToOutputFormat(shortPath, format, useWatcomQuote);
}
#endif
// Otherwise, perform standard conversion.
- return this->ConvertToOutputFormat(remote, format);
+ return this->ConvertToOutputFormat(remote, format, useWatcomQuote);
}
std::string cmOutputConverter::ConvertToOutputFormat(cm::string_view source,
- OutputFormat output) const
+ OutputFormat format,
+ bool useWatcomQuote) const
{
std::string result(source);
// Convert it to an output path.
- if (output == SHELL || output == WATCOMQUOTE || output == NINJAMULTI) {
+ if (format == SHELL || format == NINJAMULTI) {
result = this->ConvertDirectorySeparatorsForShell(source);
- result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE,
- output == NINJAMULTI);
- } else if (output == RESPONSE) {
- result = this->EscapeForShell(result, false, false, false, false, true);
+ result = this->EscapeForShell(result, true, false, useWatcomQuote,
+ format == NINJAMULTI);
+ } else if (format == RESPONSE) {
+ result =
+ this->EscapeForShell(result, false, false, useWatcomQuote, false, true);
}
return result;
}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 6e1bfe3653..2717bdd1c2 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -35,17 +35,18 @@ public:
enum OutputFormat
{
SHELL,
- WATCOMQUOTE,
NINJAMULTI,
RESPONSE
};
std::string ConvertToOutputFormat(cm::string_view source,
- OutputFormat output) const;
+ OutputFormat output,
+ bool useWatcomQuote = false) const;
std::string ConvertDirectorySeparatorsForShell(cm::string_view source) const;
//! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const std::string& remote,
- OutputFormat format = SHELL) const;
+ OutputFormat format = SHELL,
+ bool useWatcomQuote = false) const;
void SetLinkScriptShell(bool linkScriptShell);