summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-08-16 22:41:18 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-08-26 05:46:57 (GMT)
commit4614a3b287456fad12bcb91ad2936214da3237bf (patch)
tree73b988b53642367f65a43795b9cba783f04a0fe0 /Source
parentebe436eb97bf81704a1d0b074b3da4ac817f37d3 (diff)
downloadCMake-4614a3b287456fad12bcb91ad2936214da3237bf.zip
CMake-4614a3b287456fad12bcb91ad2936214da3237bf.tar.gz
CMake-4614a3b287456fad12bcb91ad2936214da3237bf.tar.bz2
server: backport to C++11
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAlgorithms.h19
-rw-r--r--Source/cmServer.cxx3
-rw-r--r--Source/cmServerProtocol.cxx2
3 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 4adfe23..a4f66a9 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -9,6 +9,7 @@
#include <algorithm>
#include <functional>
#include <iterator>
+#include <memory>
#include <sstream>
#include <string.h>
#include <string>
@@ -402,4 +403,22 @@ inline void cmStripSuffixIfExists(std::string& str, const std::string& suffix)
}
}
+namespace cm {
+
+#if defined(CMake_HAVE_CXX_MAKE_UNIQUE)
+
+using std::make_unique;
+
+#else
+
+template <typename T, typename... Args>
+std::unique_ptr<T> make_unique(Args&&... args)
+{
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+#endif
+
+} // namespace cm
+
#endif
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 04810c6..d3aeb0b 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServer.h"
+#include "cmAlgorithms.h"
#include "cmConnection.h"
#include "cmFileMonitor.h"
#include "cmServerDictionary.h"
@@ -78,7 +79,7 @@ void cmServer::ProcessRequest(cmConnection* connection,
std::unique_ptr<DebugInfo> debug;
Json::Value debugValue = value["debug"];
if (!debugValue.isNull()) {
- debug = std::make_unique<DebugInfo>();
+ debug = cm::make_unique<DebugInfo>();
debug->OutputFile = debugValue["dumpToFile"].asString();
debug->PrintStatistics = debugValue["showStats"].asBool();
}
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index cb5e6ae..0b50deb 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -220,7 +220,7 @@ bool cmServerProtocol::Activate(cmServer* server,
{
assert(server);
this->m_Server = server;
- this->m_CMakeInstance = std::make_unique<cmake>(cmake::RoleProject);
+ this->m_CMakeInstance = cm::make_unique<cmake>(cmake::RoleProject);
const bool result = this->DoActivate(request, errorMessage);
if (!result) {
this->m_CMakeInstance = nullptr;