diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-12-23 10:38:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-12-23 10:39:10 (GMT) |
commit | 179c036b5dcf74c46c91164850704876443658ed (patch) | |
tree | c66924307656b09cf7abe8d34838df4df11f7730 /Source | |
parent | 6d578ab5f8abe27cffca4f62fdb346b258803d81 (diff) | |
parent | 255c2e14309a4861b929f65698b7326cff6c63ad (diff) | |
download | CMake-179c036b5dcf74c46c91164850704876443658ed.zip CMake-179c036b5dcf74c46c91164850704876443658ed.tar.gz CMake-179c036b5dcf74c46c91164850704876443658ed.tar.bz2 |
Merge topic 'Ninja-LINK_OPTIONS-with-newlines'
255c2e1430 Ninja: LINK_OPTIONS property should support newlines
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9096
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmOutputConverter.cxx | 9 | ||||
-rw-r--r-- | Source/cmOutputConverter.h | 5 | ||||
-rw-r--r-- | Source/cmState.cxx | 10 | ||||
-rw-r--r-- | Source/cmState.h | 3 |
5 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index af2fa82..55eb9b5 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -579,6 +579,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) this->Comspec = "cmd.exe"; } #endif + cm->GetState()->SetNinja(true); this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake"; } diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 9c30d74..f4a8d0c 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -275,6 +275,9 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str, if (this->GetState()->UseNMake()) { flags |= Shell_Flag_NMake; } + if (this->GetState()->UseNinja()) { + flags |= Shell_Flag_Ninja; + } if (!this->GetState()->UseWindowsShell()) { flags |= Shell_Flag_IsUnix; } @@ -677,6 +680,12 @@ std::string cmOutputConverter::Shell_GetArgument(cm::string_view in, int flags) /* Otherwise a semicolon is written just ;. */ out += ';'; } + } else if (*cit == '\n') { + if (flags & Shell_Flag_Ninja) { + out += "$\n"; + } else { + out += '\n'; + } } else { /* Store this character. */ out += *cit; diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 0ee7afb..424f004 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -100,7 +100,10 @@ public: Shell_Flag_UnescapeNinjaConfiguration = (1 << 9), - Shell_Flag_IsResponse = (1 << 10) + Shell_Flag_IsResponse = (1 << 10), + + /** The target shell is in a Ninja build file. */ + Shell_Flag_Ninja = (1 << 11) }; std::string EscapeForShell(cm::string_view str, bool makeVars = false, diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 8ae2166..d104268 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -752,6 +752,16 @@ bool cmState::UseMSYSShell() const return this->MSYSShell; } +void cmState::SetNinja(bool ninja) +{ + this->Ninja = ninja; +} + +bool cmState::UseNinja() const +{ + return this->Ninja; +} + void cmState::SetNinjaMulti(bool ninjaMulti) { this->NinjaMulti = ninjaMulti; diff --git a/Source/cmState.h b/Source/cmState.h index 702b06f..ae0d52b 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -220,6 +220,8 @@ public: bool UseNMake() const; void SetMSYSShell(bool mSYSShell); bool UseMSYSShell() const; + void SetNinja(bool ninja); + bool UseNinja() const; void SetNinjaMulti(bool ninjaMulti); bool UseNinjaMulti() const; @@ -297,6 +299,7 @@ private: bool MinGWMake = false; bool NMake = false; bool MSYSShell = false; + bool Ninja = false; bool NinjaMulti = false; Mode StateMode = Unknown; ProjectKind StateProjectKind = ProjectKind::Normal; |