server: backport to C++11
This commit is contained in:
parent
ebe436eb97
commit
4614a3b287
@ -723,10 +723,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|||||||
if(NOT DEFINED CMake_ENABLE_SERVER_MODE)
|
if(NOT DEFINED CMake_ENABLE_SERVER_MODE)
|
||||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_auto_type CMake_HAVE_CXX_AUTO_TYPE)
|
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_auto_type CMake_HAVE_CXX_AUTO_TYPE)
|
||||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_range_for CMake_HAVE_CXX_RANGE_FOR)
|
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_range_for CMake_HAVE_CXX_RANGE_FOR)
|
||||||
if(CMake_HAVE_CXX_AUTO_TYPE
|
if(CMake_HAVE_CXX_AUTO_TYPE AND CMake_HAVE_CXX_RANGE_FOR)
|
||||||
AND CMake_HAVE_CXX_MAKE_UNIQUE
|
|
||||||
AND CMake_HAVE_CXX_RANGE_FOR
|
|
||||||
)
|
|
||||||
set(CMake_ENABLE_SERVER_MODE 1)
|
set(CMake_ENABLE_SERVER_MODE 1)
|
||||||
else()
|
else()
|
||||||
set(CMake_ENABLE_SERVER_MODE 0)
|
set(CMake_ENABLE_SERVER_MODE 0)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#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
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmServer.h"
|
#include "cmServer.h"
|
||||||
|
|
||||||
|
#include "cmAlgorithms.h"
|
||||||
#include "cmConnection.h"
|
#include "cmConnection.h"
|
||||||
#include "cmFileMonitor.h"
|
#include "cmFileMonitor.h"
|
||||||
#include "cmServerDictionary.h"
|
#include "cmServerDictionary.h"
|
||||||
@ -78,7 +79,7 @@ void cmServer::ProcessRequest(cmConnection* connection,
|
|||||||
std::unique_ptr<DebugInfo> debug;
|
std::unique_ptr<DebugInfo> debug;
|
||||||
Json::Value debugValue = value["debug"];
|
Json::Value debugValue = value["debug"];
|
||||||
if (!debugValue.isNull()) {
|
if (!debugValue.isNull()) {
|
||||||
debug = std::make_unique<DebugInfo>();
|
debug = cm::make_unique<DebugInfo>();
|
||||||
debug->OutputFile = debugValue["dumpToFile"].asString();
|
debug->OutputFile = debugValue["dumpToFile"].asString();
|
||||||
debug->PrintStatistics = debugValue["showStats"].asBool();
|
debug->PrintStatistics = debugValue["showStats"].asBool();
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ bool cmServerProtocol::Activate(cmServer* server,
|
|||||||
{
|
{
|
||||||
assert(server);
|
assert(server);
|
||||||
this->m_Server = 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);
|
const bool result = this->DoActivate(request, errorMessage);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
this->m_CMakeInstance = nullptr;
|
this->m_CMakeInstance = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user