diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-08-27 08:02:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-08-27 08:02:24 (GMT) |
commit | e710d6953dae27f73452095df6d7b2d7ec698fd1 (patch) | |
tree | 2f5b4c46d89fadcb3560436cf9aa743582d1f09c /Source | |
parent | 19f2a706a3d0ca72f0c6151bbfcd3b944c14e72b (diff) | |
parent | 27d87fbd04839e868ae7ef3c27ddfcb9379e80a0 (diff) | |
download | CMake-e710d6953dae27f73452095df6d7b2d7ec698fd1.zip CMake-e710d6953dae27f73452095df6d7b2d7ec698fd1.tar.gz CMake-e710d6953dae27f73452095df6d7b2d7ec698fd1.tar.bz2 |
Merge topic 'server-cxx11'
27d87fbd CTestCustom: Suppress exception loosening warning
7f29bbe6 server: always enable server
4614a3b2 server: backport to C++11
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1149
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 24 | ||||
-rw-r--r-- | Source/cmAlgorithms.h | 19 | ||||
-rw-r--r-- | Source/cmServer.cxx | 3 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 2 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 11 |
5 files changed, 36 insertions, 23 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d35b7fb..bcc3437 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1010,20 +1010,16 @@ add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE}) list(APPEND _tools cmake) target_link_libraries(cmake CMakeLib) -if(CMake_ENABLE_SERVER_MODE) - add_library(CMakeServerLib - cmConnection.h cmConnection.cxx - cmFileMonitor.cxx cmFileMonitor.h - cmPipeConnection.cxx cmPipeConnection.h - cmServer.cxx cmServer.h - cmServerConnection.cxx cmServerConnection.h - cmServerProtocol.cxx cmServerProtocol.h - ) - target_link_libraries(CMakeServerLib CMakeLib) - set_property(SOURCE cmcmd.cxx APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SERVER_MODE=1) - - target_link_libraries(cmake CMakeServerLib) -endif() +add_library(CMakeServerLib + cmConnection.h cmConnection.cxx + cmFileMonitor.cxx cmFileMonitor.h + cmPipeConnection.cxx cmPipeConnection.h + cmServer.cxx cmServer.h + cmServerConnection.cxx cmServerConnection.h + cmServerProtocol.cxx cmServerProtocol.h + ) +target_link_libraries(CMakeServerLib CMakeLib) +target_link_libraries(cmake CMakeServerLib) # Build CTest executable add_executable(ctest ctest.cxx ${MANIFEST_FILE}) 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; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7ec3e6d..bf5479c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -15,13 +15,10 @@ #include "cm_auto_ptr.hxx" #include "cmake.h" -#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE -#include "cmServer.h" -#include "cmServerConnection.h" -#endif - #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. +#include "cmServer.h" +#include "cmServerConnection.h" #endif #if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) @@ -590,7 +587,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } cmake cm(cmake::RoleInternal); -#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE +#if defined(CMAKE_BUILD_WITH_CMAKE) std::cout << cm.ReportCapabilities(true); #else std::cout << cm.ReportCapabilities(false); @@ -1022,7 +1019,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } } -#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE +#if defined(CMAKE_BUILD_WITH_CMAKE) cmConnection* conn; if (isDebug) { conn = new cmServerStdIoConnection; |