diff options
-rw-r--r-- | Help/manual/cmake-server.7.rst | 8 | ||||
-rw-r--r-- | Help/release/dev/CheckFortranSourceCompiles-custom-ext.rst | 6 | ||||
-rw-r--r-- | Modules/CheckFortranSourceCompiles.cmake | 17 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 12 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 2 | ||||
-rw-r--r-- | Source/cmServer.cxx | 79 | ||||
-rw-r--r-- | Source/cmServer.h | 4 | ||||
-rw-r--r-- | Source/cmServerConnection.cxx | 5 | ||||
-rw-r--r-- | Source/cmServerDictionary.h | 49 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 24 | ||||
-rw-r--r-- | Source/cmServerProtocol.h | 6 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 3 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CheckFortran.cmake | 3 | ||||
-rw-r--r-- | Tests/Fortran/CMakeLists.txt | 89 | ||||
-rw-r--r-- | Tests/FortranModules/CMakeLists.txt | 78 | ||||
-rw-r--r-- | Tests/FortranModules/Executable/CMakeLists.txt (renamed from Tests/Fortran/Executable/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Executable/main.f90 (renamed from Tests/Fortran/Executable/main.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/External/CMakeLists.txt (renamed from Tests/Fortran/External/CMakeLists.txt) | 1 | ||||
-rw-r--r-- | Tests/FortranModules/External/a.f90 (renamed from Tests/Fortran/External/a.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Library/CMakeLists.txt (renamed from Tests/Fortran/Library/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Library/a.f90 (renamed from Tests/Fortran/Library/a.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Library/b.f90 (renamed from Tests/Fortran/Library/b.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Library/main.f90 (renamed from Tests/Fortran/Library/main.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Subdir/CMakeLists.txt (renamed from Tests/Fortran/Subdir/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/Subdir/subdir.f90 (renamed from Tests/Fortran/Subdir/subdir.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/in_interface/main.f90 (renamed from Tests/Fortran/in_interface/main.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/in_interface/module.f90 (renamed from Tests/Fortran/in_interface/module.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/include/test_preprocess.h (renamed from Tests/Fortran/include/test_preprocess.h) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_module_implementation.f90 (renamed from Tests/Fortran/test_module_implementation.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_module_interface.f90 (renamed from Tests/Fortran/test_module_interface.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_module_main.f90 (renamed from Tests/Fortran/test_module_main.f90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_preprocess.F90 (renamed from Tests/Fortran/test_preprocess.F90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_preprocess_module.F90 (renamed from Tests/Fortran/test_preprocess_module.F90) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_use_in_comment_fixedform.f (renamed from Tests/Fortran/test_use_in_comment_fixedform.f) | 0 | ||||
-rw-r--r-- | Tests/FortranModules/test_use_in_comment_freeform.f90 (renamed from Tests/Fortran/test_use_in_comment_freeform.f90) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeAttributeLocation-check.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeAttributeLocation.cmake | 3 |
40 files changed, 260 insertions, 153 deletions
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 00ffcd1..61d6896 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -186,6 +186,14 @@ Example:: ]== CMake Server ==] +Type "signal" +^^^^^^^^^^^^^ + +The server can send signals when it detects changes in the system state. Signals +are of type "signal", have an empty "cookie" and "inReplyTo" field and always +have a "name" set to show which signal was sent. + + Specific Message Types ---------------------- diff --git a/Help/release/dev/CheckFortranSourceCompiles-custom-ext.rst b/Help/release/dev/CheckFortranSourceCompiles-custom-ext.rst new file mode 100644 index 0000000..bf62812 --- /dev/null +++ b/Help/release/dev/CheckFortranSourceCompiles-custom-ext.rst @@ -0,0 +1,6 @@ +CheckFortranSourceCompiles-custom-ext +------------------------------------- + +* The :module:`CheckFortranSourceCompiles` module macro + ``CHECK_Fortran_SOURCE_COMPILES`` gained a ``SRC_EXT`` option + to specify a custom test Fortran source file extension. diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 0bdcffa..967b830 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -4,7 +4,8 @@ # # Check if given Fortran source compiles and links into an executable:: # -# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]) +# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>] +# [SRC_EXT <ext>]) # # The arguments are: # @@ -13,8 +14,10 @@ # ``<var>`` # Variable to store whether the source code compiled. # Will be created as an internal cache variable. -# ``<fail-regex>`` +# ``FAIL_REGEX <fail-regex>`` # Fail if test output matches this regex. +# ``SRC_EXT <ext>`` +# Use source extension ``.<ext>`` instead of the default ``.F``. # # The following variables may be set before calling this macro to modify # the way the check is run:: @@ -43,9 +46,10 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) if(NOT DEFINED "${VAR}") set(_FAIL_REGEX) + set(_SRC_EXT) set(_key) foreach(arg ${ARGN}) - if("${arg}" MATCHES "^(FAIL_REGEX)$") + if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$") set(_key "${arg}") elseif(_key) list(APPEND _${_key} "${arg}") @@ -53,6 +57,9 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) message(FATAL_ERROR "Unknown argument:\n ${arg}\n") endif() endforeach() + if(NOT _SRC_EXT) + set(_SRC_EXT F) + endif() set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) @@ -67,7 +74,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) else() set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES) endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F" + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}" "${SOURCE}\n") if(NOT CMAKE_REQUIRED_QUIET) @@ -75,7 +82,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 7ddd783..034b0e6 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -142,15 +142,15 @@ if(WIN32 AND NOT CYGWIN) if(OPENSSL_USE_STATIC_LIBS) set(_OPENSSL_PATH_SUFFIXES - "lib" - "VC/static" "lib/VC/static" + "VC/static" + "lib" ) else() set(_OPENSSL_PATH_SUFFIXES - "lib" - "VC" "lib/VC" + "VC" + "lib" ) endif () @@ -227,8 +227,8 @@ if(WIN32 AND NOT CYGWIN) NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" "lib/MinGW" + "lib" ) find_library(SSL_EAY @@ -237,8 +237,8 @@ if(WIN32 AND NOT CYGWIN) NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" "lib/MinGW" + "lib" ) mark_as_advanced(SSL_EAY LIB_EAY) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 68c9a6d..27ca0ca 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160922) +set(CMake_VERSION_PATCH 20160923) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 4de4bef..52809b0 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -109,11 +109,13 @@ int main(int argc, char** argv) QTextCodec::setCodecForLocale(utf8_codec); #endif +#if QT_VERSION < 0x050000 // clean out standard Qt paths for plugins, which we don't use anyway // when creating Mac bundles, it potentially causes problems foreach (QString p, QApplication::libraryPaths()) { QApplication::removeLibraryPath(p); } +#endif // tell the cmake library where cmake is QDir cmExecDir(QApplication::applicationDirPath()); diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index 56cd7ba..d5dac4e 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -14,6 +14,7 @@ #include "cmServer.h" #include "cmServerConnection.h" +#include "cmServerDictionary.h" #include "cmServerProtocol.h" #include "cmSystemTools.h" #include "cmVersionMacros.h" @@ -28,19 +29,6 @@ #include <iostream> #include <memory> -static const std::string kTYPE_KEY = "type"; -static const std::string kCOOKIE_KEY = "cookie"; -static const std::string kREPLY_TO_KEY = "inReplyTo"; -static const std::string kERROR_MESSAGE_KEY = "errorMessage"; - -static const std::string kERROR_TYPE = "error"; -static const std::string kREPLY_TYPE = "reply"; -static const std::string kPROGRESS_TYPE = "progress"; -static const std::string kMESSAGE_TYPE = "message"; - -static const std::string kSTART_MAGIC = "[== CMake Server ==["; -static const std::string kEND_MAGIC = "]== CMake Server ==]"; - class cmServer::DebugInfo { public: @@ -144,16 +132,16 @@ void cmServer::PrintHello() const Json::Value hello = Json::objectValue; hello[kTYPE_KEY] = "hello"; - Json::Value& protocolVersions = hello["supportedProtocolVersions"] = + Json::Value& protocolVersions = hello[kSUPPORTED_PROTOCOL_VERSIONS] = Json::arrayValue; for (auto const& proto : this->SupportedProtocols) { auto version = proto->ProtocolVersion(); Json::Value tmp = Json::objectValue; - tmp["major"] = version.first; - tmp["minor"] = version.second; + tmp[kMAJOR_KEY] = version.first; + tmp[kMINOR_KEY] = version.second; if (proto->IsExperimental()) { - tmp["experimental"] = true; + tmp[kIS_EXPERIMENTAL_KEY] = true; } protocolVersions.append(tmp); } @@ -193,31 +181,37 @@ void cmServer::reportMessage(const char* msg, const char* title, cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) { - if (request.Type != "handshake") - return request.ReportError("Waiting for type \"handshake\"."); + if (request.Type != kHANDSHAKE_TYPE) + return request.ReportError("Waiting for type \"" + kHANDSHAKE_TYPE + + "\"."); - Json::Value requestedProtocolVersion = request.Data["protocolVersion"]; + Json::Value requestedProtocolVersion = request.Data[kPROTOCOL_VERSION_KEY]; if (requestedProtocolVersion.isNull()) - return request.ReportError( - "\"protocolVersion\" is required for \"handshake\"."); + return request.ReportError("\"" + kPROTOCOL_VERSION_KEY + + "\" is required for \"" + kHANDSHAKE_TYPE + + "\"."); if (!requestedProtocolVersion.isObject()) - return request.ReportError("\"protocolVersion\" must be a JSON object."); + return request.ReportError("\"" + kPROTOCOL_VERSION_KEY + + "\" must be a JSON object."); - Json::Value majorValue = requestedProtocolVersion["major"]; + Json::Value majorValue = requestedProtocolVersion[kMAJOR_KEY]; if (!majorValue.isInt()) - return request.ReportError("\"major\" must be set and an integer."); + return request.ReportError("\"" + kMAJOR_KEY + + "\" must be set and an integer."); - Json::Value minorValue = requestedProtocolVersion["minor"]; + Json::Value minorValue = requestedProtocolVersion[kMINOR_KEY]; if (!minorValue.isNull() && !minorValue.isInt()) - return request.ReportError("\"minor\" must be unset or an integer."); + return request.ReportError("\"" + kMINOR_KEY + + "\" must be unset or an integer."); const int major = majorValue.asInt(); const int minor = minorValue.isNull() ? -1 : minorValue.asInt(); if (major < 0) - return request.ReportError("\"major\" must be >= 0."); + return request.ReportError("\"" + kMAJOR_KEY + "\" must be >= 0."); if (!minorValue.isNull() && minor < 0) - return request.ReportError("\"minor\" must be >= 0 when set."); + return request.ReportError("\"" + kMINOR_KEY + + "\" must be >= 0 when set."); this->Protocol = this->FindMatchingProtocol(this->SupportedProtocols, major, minor); @@ -226,7 +220,7 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) } std::string errorMessage; - if (!this->Protocol->Activate(request, &errorMessage)) { + if (!this->Protocol->Activate(this, request, &errorMessage)) { this->Protocol = CM_NULLPTR; return request.ReportError("Failed to activate protocol version: " + errorMessage); @@ -311,10 +305,10 @@ void cmServer::WriteProgress(const cmServerRequest& request, int min, obj[kTYPE_KEY] = kPROGRESS_TYPE; obj[kREPLY_TO_KEY] = request.Type; obj[kCOOKIE_KEY] = request.Cookie; - obj["progressMessage"] = message; - obj["progressMinimum"] = min; - obj["progressMaximum"] = max; - obj["progressCurrent"] = current; + obj[kPROGRESS_MESSAGE_KEY] = message; + obj[kPROGRESS_MINIMUM_KEY] = min; + obj[kPROGRESS_MAXIMUM_KEY] = max; + obj[kPROGRESS_CURRENT_KEY] = current; this->WriteJsonObject(obj, nullptr); } @@ -330,9 +324,9 @@ void cmServer::WriteMessage(const cmServerRequest& request, obj[kTYPE_KEY] = kMESSAGE_TYPE; obj[kREPLY_TO_KEY] = request.Type; obj[kCOOKIE_KEY] = request.Cookie; - obj["message"] = message; + obj[kMESSAGE_KEY] = message; if (!title.empty()) { - obj["title"] = title; + obj[kTITLE_KEY] = title; } WriteJsonObject(obj, nullptr); @@ -349,6 +343,19 @@ void cmServer::WriteParseError(const std::string& message) const this->WriteJsonObject(obj, nullptr); } +void cmServer::WriteSignal(const std::string& name, + const Json::Value& data) const +{ + assert(data.isObject()); + Json::Value obj = data; + obj[kTYPE_KEY] = kSIGNAL_TYPE; + obj[kREPLY_TO_KEY] = ""; + obj[kCOOKIE_KEY] = ""; + obj[kNAME_KEY] = name; + + WriteJsonObject(obj, nullptr); +} + void cmServer::WriteResponse(const cmServerResponse& response, const DebugInfo* debug) const { diff --git a/Source/cmServer.h b/Source/cmServer.h index dde5333..849e5c5 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -63,6 +63,7 @@ private: void WriteResponse(const cmServerResponse& response, const DebugInfo* debug) const; void WriteParseError(const std::string& message) const; + void WriteSignal(const std::string& name, const Json::Value& obj) const; void WriteJsonObject(Json::Value const& jsonValue, const DebugInfo* debug) const; @@ -95,6 +96,7 @@ private: mutable bool Writing = false; - friend class cmServerRequest; friend class cmServerConnection; + friend class cmServerProtocol; + friend class cmServerRequest; }; diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index 398e250..112cafd 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -13,15 +13,14 @@ #include "cmServerConnection.h" +#include "cmServerDictionary.h" + #include <cmServer.h> #include <assert.h> namespace { -static const std::string kSTART_MAGIC = "[== CMake Server ==["; -static const std::string kEND_MAGIC = "]== CMake Server ==]"; - struct write_req_t { uv_write_t req; diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h new file mode 100644 index 0000000..156ade2 --- /dev/null +++ b/Source/cmServerDictionary.h @@ -0,0 +1,49 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2016 Tobias Hunger <tobias.hunger@qt.io> + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#pragma once + +#include <string> + +// Vocabulary: + +static const std::string kERROR_TYPE = "error"; +static const std::string kHANDSHAKE_TYPE = "handshake"; +static const std::string kMESSAGE_TYPE = "message"; +static const std::string kPROGRESS_TYPE = "progress"; +static const std::string kREPLY_TYPE = "reply"; +static const std::string kSIGNAL_TYPE = "signal"; + +static const std::string kBUILD_DIRECTORY_KEY = "buildDirectory"; +static const std::string kCOOKIE_KEY = "cookie"; +static const std::string kERROR_MESSAGE_KEY = "errorMessage"; +static const std::string kEXTRA_GENERATOR_KEY = "extraGenerator"; +static const std::string kGENERATOR_KEY = "generator"; +static const std::string kIS_EXPERIMENTAL_KEY = "isExperimental"; +static const std::string kMAJOR_KEY = "major"; +static const std::string kMESSAGE_KEY = "message"; +static const std::string kMINOR_KEY = "minor"; +static const std::string kNAME_KEY = "name"; +static const std::string kPROGRESS_CURRENT_KEY = "progressCurrent"; +static const std::string kPROGRESS_MAXIMUM_KEY = "progressMaximum"; +static const std::string kPROGRESS_MESSAGE_KEY = "progressMessage"; +static const std::string kPROGRESS_MINIMUM_KEY = "progressMinimum"; +static const std::string kPROTOCOL_VERSION_KEY = "protocolVersion"; +static const std::string kREPLY_TO_KEY = "inReplyTo"; +static const std::string kSOURCE_DIRECTORY_KEY = "sourceDirectory"; +static const std::string kSUPPORTED_PROTOCOL_VERSIONS = + "supportedProtocolVersions"; +static const std::string kTITLE_KEY = "title"; +static const std::string kTYPE_KEY = "type"; + +static const std::string kSTART_MAGIC = "[== CMake Server ==["; +static const std::string kEND_MAGIC = "]== CMake Server ==]"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 26942d3..e42b18a 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -14,23 +14,17 @@ #include "cmExternalMakefileProjectGenerator.h" #include "cmServer.h" +#include "cmServerDictionary.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmServerDictionary.h" + #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cm_jsoncpp_reader.h" #include "cm_jsoncpp_value.h" #endif -// Vocabulary: - -static const std::string kBUILD_DIRECTORY_KEY = "buildDirectory"; -static const std::string kCOOKIE_KEY = "cookie"; -static const std::string kEXTRA_GENERATOR_KEY = "extraGenerator"; -static const std::string kGENERATOR_KEY = "generator"; -static const std::string kSOURCE_DIRECTORY_KEY = "sourceDirectory"; -static const std::string kTYPE_KEY = "type"; - cmServerRequest::cmServerRequest(cmServer* server, const std::string& t, const std::string& c, const Json::Value& d) : Type(t) @@ -115,9 +109,12 @@ Json::Value cmServerResponse::Data() const return this->m_Data; } -bool cmServerProtocol::Activate(const cmServerRequest& request, +bool cmServerProtocol::Activate(cmServer* server, + const cmServerRequest& request, std::string* errorMessage) { + assert(server); + this->m_Server = server; this->m_CMakeInstance = std::make_unique<cmake>(); const bool result = this->DoActivate(request, errorMessage); if (!result) @@ -125,6 +122,13 @@ bool cmServerProtocol::Activate(const cmServerRequest& request, return result; } +void cmServerProtocol::SendSignal(const std::string& name, + const Json::Value& data) const +{ + if (this->m_Server) + this->m_Server->WriteSignal(name, data); +} + cmake* cmServerProtocol::CMakeInstance() const { return this->m_CMakeInstance.get(); diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h index bab949b..0383dfe 100644 --- a/Source/cmServerProtocol.h +++ b/Source/cmServerProtocol.h @@ -87,7 +87,10 @@ public: virtual bool IsExperimental() const = 0; virtual const cmServerResponse Process(const cmServerRequest& request) = 0; - bool Activate(const cmServerRequest& request, std::string* errorMessage); + bool Activate(cmServer* server, const cmServerRequest& request, + std::string* errorMessage); + + void SendSignal(const std::string& name, const Json::Value& data) const; protected: cmake* CMakeInstance() const; @@ -97,6 +100,7 @@ protected: private: std::unique_ptr<cmake> m_CMakeInstance; + cmServer* m_Server = nullptr; // not owned! friend class cmServer; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1dad742..eb17561 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1164,7 +1164,8 @@ const char* cmTarget::GetProperty(const std::string& prop, } } // Support "<CONFIG>_LOCATION". - else if (cmHasLiteralSuffix(prop, "_LOCATION")) { + else if (cmHasLiteralSuffix(prop, "_LOCATION") && + !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) { std::string configName(prop.c_str(), prop.size() - 9); if (configName != "IMPORTED") { if (!this->HandleLocationPropertyPolicy(context)) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8cf1faa..235e38a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3097,10 +3097,22 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-project testf --build-two-config --build-options ${build_options} - -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} --test-command testf) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + add_test(FortranModules ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FortranModules" + "${CMake_BINARY_DIR}/Tests/FortranModules" + ${build_generator_args} + --build-project FortranModules + --build-options ${build_options} + -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranModules") + endif() + # FortranCInterface tests. if(UNIX) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in diff --git a/Tests/CheckFortran.cmake b/Tests/CheckFortran.cmake index ebbb426..678bb82 100644 --- a/Tests/CheckFortran.cmake +++ b/Tests/CheckFortran.cmake @@ -22,6 +22,7 @@ project(CheckFortran Fortran) file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" \"set(CMAKE_Fortran_COMPILER \\\"\${CMAKE_Fortran_COMPILER}\\\")\\n\" \"set(CMAKE_Fortran_FLAGS \\\"\${CMAKE_Fortran_FLAGS}\\\")\\n\" + \"set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 \\\"\${CMAKE_Fortran_COMPILER_SUPPORTS_F90}\\\")\\n\" ) ") execute_process( @@ -47,4 +48,6 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" mark_as_advanced(CMAKE_Fortran_COMPILER) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" CACHE STRING "Fortran flags") mark_as_advanced(CMAKE_Fortran_FLAGS) + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 "${CMAKE_Fortran_COMPILER_SUPPORTS_F90}" CACHE BOOL "Fortran compiler supports F90") + mark_as_advanced(CMAKE_Fortran_COMPILER_SUPPORTS_F90) endif() diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 99fcc0a..740e6f5 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required (VERSION 3.1) project(testf C CXX Fortran) -if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") -endif() message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) @@ -67,7 +64,7 @@ function(test_fortran_c_interface_module) SYMBOL_NAMESPACE "F_" SYMBOLS ${FORTRAN_FUNCTIONS} ) - include_directories("${testf_BINARY_DIR}") + include_directories("${CMAKE_CURRENT_BINARY_DIR}") # if the name mangling is not found for a F90 compiler # print out some diagnostic stuff for the dashboard @@ -111,7 +108,7 @@ function(test_fortran_c_interface_module) target_link_libraries(maincxx mycxx) # print out some stuff to help debug on machines via cdash - file(READ "${testf_BINARY_DIR}/foo.h" fooh) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/foo.h" fooh) message("foo.h contents:\n${fooh}") endfunction() @@ -144,85 +141,3 @@ else() endif() endif() - - - - -set(TEST_MODULE_DEPENDS 0) -if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - add_executable(test_module - test_module_main.f90 - test_module_implementation.f90 - test_module_interface.f90) - - add_executable(test_use_in_comment_fixedform - test_use_in_comment_fixedform.f) - set_property(SOURCE test_use_in_comment_fixedform.f PROPERTY Fortran_FORMAT FIXED) - add_executable(test_use_in_comment_freeform - test_use_in_comment_freeform.f90) - set_property(SOURCE test_use_in_comment_freeform.f90 PROPERTY Fortran_FORMAT FREE) - - add_executable(test_in_interface - in_interface/main.f90 - in_interface/module.f90) - - add_definitions(-DFOO -DBAR=1) - include_directories(${testf_SOURCE_DIR}/include) - add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90) - - set(TEST_MODULE_DEPENDS 1) -endif() - -if(TEST_MODULE_DEPENDS) - # Build the external project separately using a custom target. - # Make sure it uses the same build configuration as this test. - if(CMAKE_CONFIGURATION_TYPES) - set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") - set(External_BUILD_TYPE) - else() - set(External_CONFIG_TYPE) - set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - endif() - set(External_SOURCE_DIR "${testf_SOURCE_DIR}/External") - set(External_BINARY_DIR "${testf_BINARY_DIR}/External") - if("${testf_BINARY_DIR}" MATCHES " ") - # Our build tree has a space, so the build tool supports spaces. - # Test using modules from a path with spaces. - string(APPEND External_BINARY_DIR " Build") - endif() - add_custom_command( - OUTPUT ${testf_BINARY_DIR}/ExternalProject - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS ${External_CONFIG_TYPE} - --build-and-test - ${External_SOURCE_DIR} - ${External_BINARY_DIR} - --build-noclean - --build-two-config - --build-project ExtFort - --build-generator ${CMAKE_GENERATOR} - --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" - --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} - -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} - -DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG} - -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} - -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} - -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} - -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_NESTED_MAKE_PROGRAM} - ${External_BUILD_TYPE} - VERBATIM - ) - add_custom_target(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject) - - # Test module output directory if available. - if(CMAKE_Fortran_MODDIR_FLAG) - set(Library_MODDIR "${testf_BINARY_DIR}/Library/modules") - else() - set(Library_MODDIR "${testf_BINARY_DIR}/Library") - endif() - - add_subdirectory(Library) - add_subdirectory(Subdir) - add_subdirectory(Executable) -endif() diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt new file mode 100644 index 0000000..b406df3 --- /dev/null +++ b/Tests/FortranModules/CMakeLists.txt @@ -0,0 +1,78 @@ +cmake_minimum_required (VERSION 3.1) +project(FortranModules Fortran) + +if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") +endif() + +add_executable(test_module + test_module_main.f90 + test_module_implementation.f90 + test_module_interface.f90) + +add_executable(test_use_in_comment_fixedform + test_use_in_comment_fixedform.f) +set_property(SOURCE test_use_in_comment_fixedform.f PROPERTY Fortran_FORMAT FIXED) +add_executable(test_use_in_comment_freeform + test_use_in_comment_freeform.f90) +set_property(SOURCE test_use_in_comment_freeform.f90 PROPERTY Fortran_FORMAT FREE) + +add_executable(test_in_interface + in_interface/main.f90 + in_interface/module.f90) + +add_definitions(-DFOO -DBAR=1) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90) + +# Build the external project separately using a custom target. +# Make sure it uses the same build configuration as this test. +if(CMAKE_CONFIGURATION_TYPES) + set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") + set(External_BUILD_TYPE) +else() + set(External_CONFIG_TYPE) + set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) +endif() +set(External_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External") +set(External_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/External") +if("${CMAKE_CURRENT_BINARY_DIR}" MATCHES " ") + # Our build tree has a space, so the build tool supports spaces. + # Test using modules from a path with spaces. + string(APPEND External_BINARY_DIR " Build") +endif() +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ExternalProject + COMMAND ${CMAKE_CTEST_COMMAND} + ARGS ${External_CONFIG_TYPE} + --build-and-test + ${External_SOURCE_DIR} + ${External_BINARY_DIR} + --build-noclean + --build-two-config + --build-project ExtFort + --build-generator ${CMAKE_GENERATOR} + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} + -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} + -DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG} + -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} + -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} + -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} + -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_NESTED_MAKE_PROGRAM} + ${External_BUILD_TYPE} + VERBATIM + ) +add_custom_target(ExternalTarget ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ExternalProject) + +# Test module output directory if available. +if(CMAKE_Fortran_MODDIR_FLAG) + set(Library_MODDIR "${CMAKE_CURRENT_BINARY_DIR}/Library/modules") +else() + set(Library_MODDIR "${CMAKE_CURRENT_BINARY_DIR}/Library") +endif() + +add_subdirectory(Library) +add_subdirectory(Subdir) +add_subdirectory(Executable) diff --git a/Tests/Fortran/Executable/CMakeLists.txt b/Tests/FortranModules/Executable/CMakeLists.txt index de08d86..de08d86 100644 --- a/Tests/Fortran/Executable/CMakeLists.txt +++ b/Tests/FortranModules/Executable/CMakeLists.txt diff --git a/Tests/Fortran/Executable/main.f90 b/Tests/FortranModules/Executable/main.f90 index 640259c..640259c 100644 --- a/Tests/Fortran/Executable/main.f90 +++ b/Tests/FortranModules/Executable/main.f90 diff --git a/Tests/Fortran/External/CMakeLists.txt b/Tests/FortranModules/External/CMakeLists.txt index 0eb1cfe..c90a0ffb 100644 --- a/Tests/Fortran/External/CMakeLists.txt +++ b/Tests/FortranModules/External/CMakeLists.txt @@ -1,4 +1,3 @@ project(ExtFort Fortran) add_library(myext a.f90) - diff --git a/Tests/Fortran/External/a.f90 b/Tests/FortranModules/External/a.f90 index 2be73c5..2be73c5 100644 --- a/Tests/Fortran/External/a.f90 +++ b/Tests/FortranModules/External/a.f90 diff --git a/Tests/Fortran/Library/CMakeLists.txt b/Tests/FortranModules/Library/CMakeLists.txt index 17438ca..17438ca 100644 --- a/Tests/Fortran/Library/CMakeLists.txt +++ b/Tests/FortranModules/Library/CMakeLists.txt diff --git a/Tests/Fortran/Library/a.f90 b/Tests/FortranModules/Library/a.f90 index 3031c07..3031c07 100644 --- a/Tests/Fortran/Library/a.f90 +++ b/Tests/FortranModules/Library/a.f90 diff --git a/Tests/Fortran/Library/b.f90 b/Tests/FortranModules/Library/b.f90 index ae1edcb..ae1edcb 100644 --- a/Tests/Fortran/Library/b.f90 +++ b/Tests/FortranModules/Library/b.f90 diff --git a/Tests/Fortran/Library/main.f90 b/Tests/FortranModules/Library/main.f90 index 2385408..2385408 100644 --- a/Tests/Fortran/Library/main.f90 +++ b/Tests/FortranModules/Library/main.f90 diff --git a/Tests/Fortran/Subdir/CMakeLists.txt b/Tests/FortranModules/Subdir/CMakeLists.txt index 52683e5..52683e5 100644 --- a/Tests/Fortran/Subdir/CMakeLists.txt +++ b/Tests/FortranModules/Subdir/CMakeLists.txt diff --git a/Tests/Fortran/Subdir/subdir.f90 b/Tests/FortranModules/Subdir/subdir.f90 index 68955f6..68955f6 100644 --- a/Tests/Fortran/Subdir/subdir.f90 +++ b/Tests/FortranModules/Subdir/subdir.f90 diff --git a/Tests/Fortran/in_interface/main.f90 b/Tests/FortranModules/in_interface/main.f90 index 28bcf36..28bcf36 100644 --- a/Tests/Fortran/in_interface/main.f90 +++ b/Tests/FortranModules/in_interface/main.f90 diff --git a/Tests/Fortran/in_interface/module.f90 b/Tests/FortranModules/in_interface/module.f90 index 1064d74..1064d74 100644 --- a/Tests/Fortran/in_interface/module.f90 +++ b/Tests/FortranModules/in_interface/module.f90 diff --git a/Tests/Fortran/include/test_preprocess.h b/Tests/FortranModules/include/test_preprocess.h index f4a00a9..f4a00a9 100644 --- a/Tests/Fortran/include/test_preprocess.h +++ b/Tests/FortranModules/include/test_preprocess.h diff --git a/Tests/Fortran/test_module_implementation.f90 b/Tests/FortranModules/test_module_implementation.f90 index de3cb57..de3cb57 100644 --- a/Tests/Fortran/test_module_implementation.f90 +++ b/Tests/FortranModules/test_module_implementation.f90 diff --git a/Tests/Fortran/test_module_interface.f90 b/Tests/FortranModules/test_module_interface.f90 index dd0f35c..dd0f35c 100644 --- a/Tests/Fortran/test_module_interface.f90 +++ b/Tests/FortranModules/test_module_interface.f90 diff --git a/Tests/Fortran/test_module_main.f90 b/Tests/FortranModules/test_module_main.f90 index 6ac97fa..6ac97fa 100644 --- a/Tests/Fortran/test_module_main.f90 +++ b/Tests/FortranModules/test_module_main.f90 diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/FortranModules/test_preprocess.F90 index 3a09976..3a09976 100644 --- a/Tests/Fortran/test_preprocess.F90 +++ b/Tests/FortranModules/test_preprocess.F90 diff --git a/Tests/Fortran/test_preprocess_module.F90 b/Tests/FortranModules/test_preprocess_module.F90 index 5849b62..5849b62 100644 --- a/Tests/Fortran/test_preprocess_module.F90 +++ b/Tests/FortranModules/test_preprocess_module.F90 diff --git a/Tests/Fortran/test_use_in_comment_fixedform.f b/Tests/FortranModules/test_use_in_comment_fixedform.f index 39f486b..39f486b 100644 --- a/Tests/Fortran/test_use_in_comment_fixedform.f +++ b/Tests/FortranModules/test_use_in_comment_fixedform.f diff --git a/Tests/Fortran/test_use_in_comment_freeform.f90 b/Tests/FortranModules/test_use_in_comment_freeform.f90 index 48bcd5a..48bcd5a 100644 --- a/Tests/Fortran/test_use_in_comment_freeform.f90 +++ b/Tests/FortranModules/test_use_in_comment_freeform.f90 diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 0684d57..d43c80d 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(XcodeFileType) +run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeObjectNeedsEscape) diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeLocation-check.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeLocation-check.cmake new file mode 100644 index 0000000..2f55131 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeLocation-check.cmake @@ -0,0 +1,7 @@ +set(expect "DEPLOYMENT_LOCATION = YES") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeLocation.xcodeproj/project.pbxproj actual + REGEX "DEPLOYMENT_LOCATION = .*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeLocation.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeLocation.cmake new file mode 100644 index 0000000..5ab5528 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeLocation.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(some main.c) +set_property(TARGET some PROPERTY XCODE_ATTRIBUTE_DEPLOYMENT_LOCATION YES) |