summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/string.rst7
-rw-r--r--Help/generator/Visual Studio 14 2015.rst (renamed from Help/generator/Visual Studio 14.rst)10
-rw-r--r--Help/manual/cmake-generators.7.rst2
-rw-r--r--Help/release/3.1.0.rst2
-rw-r--r--Modules/CPackRPM.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCallVisualStudioMacro.cxx13
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx40
-rw-r--r--Source/cmStringCommand.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Tests/CMakeTests/StringTest.cmake.in4
-rw-r--r--Tests/CMakeTests/StringTestScript.cmake11
13 files changed, 66 insertions, 41 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 07d0ff3..351385b 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -73,8 +73,13 @@ TOUPPER/TOLOWER will convert string to upper/lower characters.
LENGTH will return a given string's length.
-SUBSTRING will return a substring of a given string. If length is -1
+SUBSTRING will return a substring of a given string. If length is -1
the remainder of the string starting at begin will be returned.
+If string is shorter than length then end of string is used instead.
+
+.. note::
+ CMake 3.1 and below reported an error if length pointed past
+ the end of string.
STRIP will return a substring of a given string with leading and
trailing spaces removed.
diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14 2015.rst
index d621b7e..b35997a 100644
--- a/Help/generator/Visual Studio 14.rst
+++ b/Help/generator/Visual Studio 14 2015.rst
@@ -1,7 +1,7 @@
-Visual Studio 14
-----------------
+Visual Studio 14 2015
+---------------------
-Generates Visual Studio 14 project files.
+Generates Visual Studio 14 (VS 2015) project files.
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
to specify a target platform name.
@@ -9,8 +9,8 @@ to specify a target platform name.
For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
-``Visual Studio 14 Win64``
+``Visual Studio 14 2015 Win64``
Specify target platform ``x64``.
-``Visual Studio 14 ARM``
+``Visual Studio 14 2015 ARM``
Specify target platform ``ARM``.
diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst
index 4bc8c5f..bda7eef 100644
--- a/Help/manual/cmake-generators.7.rst
+++ b/Help/manual/cmake-generators.7.rst
@@ -64,7 +64,7 @@ one may launch CMake from any environment.
/generator/Visual Studio 10 2010
/generator/Visual Studio 11 2012
/generator/Visual Studio 12 2013
- /generator/Visual Studio 14
+ /generator/Visual Studio 14 2015
/generator/Xcode
Extra Generators
diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst
index 65aae00..101c29d 100644
--- a/Help/release/3.1.0.rst
+++ b/Help/release/3.1.0.rst
@@ -18,7 +18,7 @@ New Features
Generators
----------
-* A :generator:`Visual Studio 14` generator was added.
+* The :generator:`Visual Studio 14 2015` generator was added.
Windows Phone and Windows Store
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 56d9b66..66717ef 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -683,9 +683,7 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC
# Transform NAME --> Name e.g. PROVIDES --> Provides
# The Upper-case first letter and lowercase tail is the
# appropriate value required in the final RPM spec file.
- string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
- math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
- string(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL)
+ string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL)
string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 730f068..ab05c2a 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 1)
-set(CMake_VERSION_PATCH 20141114)
+set(CMake_VERSION_PATCH 20141117)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index 0c15477..8f22f80 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -63,12 +63,13 @@ static bool LogErrorsAsMessages;
{ \
if (LogErrorsAsMessages) \
{ \
- std::ostringstream oss; \
- oss.flags(std::ios::hex); \
- oss << context << " failed HRESULT, hr = 0x" << hr << std::endl; \
- oss.flags(std::ios::dec); \
- oss << __FILE__ << "(" << __LINE__ << ")"; \
- cmSystemTools::Message(oss.str().c_str()); \
+ std::ostringstream _hresult_oss; \
+ _hresult_oss.flags(std::ios::hex); \
+ _hresult_oss << context << " failed HRESULT, hr = 0x" \
+ << hr << std::endl; \
+ _hresult_oss.flags(std::ios::dec); \
+ _hresult_oss << __FILE__ << "(" << __LINE__ << ")"; \
+ cmSystemTools::Message(_hresult_oss.str().c_str()); \
} \
}
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index d001f93..fe702c0 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -13,21 +13,36 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
-static const char vs14generatorName[] = "Visual Studio 14";
+static const char vs14generatorName[] = "Visual Studio 14 2015";
+
+// Map generator name without year to name with year.
+static const char* cmVS14GenName(const std::string& name, std::string& genName)
+{
+ if(strncmp(name.c_str(), vs14generatorName,
+ sizeof(vs14generatorName)-6) != 0)
+ {
+ return 0;
+ }
+ const char* p = name.c_str() + sizeof(vs14generatorName) - 6;
+ if(cmHasLiteralPrefix(p, " 2015"))
+ {
+ p += 5;
+ }
+ genName = std::string(vs14generatorName) + p;
+ return p;
+}
class cmGlobalVisualStudio14Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
virtual cmGlobalGenerator* CreateGlobalGenerator(
- const std::string& genName) const
+ const std::string& name) const
{
- if(strncmp(genName.c_str(), vs14generatorName,
- sizeof(vs14generatorName) - 1) != 0)
- {
- return 0;
- }
- const char* p = genName.c_str() + sizeof(vs14generatorName) - 1;
+ std::string genName;
+ const char* p = cmVS14GenName(name, genName);
+ if(!p)
+ { return 0; }
if(!*p)
{
return new cmGlobalVisualStudio14Generator(
@@ -51,7 +66,7 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
entry.Name = vs14generatorName;
- entry.Brief = "Generates Visual Studio 14 project files.";
+ entry.Brief = "Generates Visual Studio 14 (VS 2015) project files.";
}
virtual void GetGenerators(std::vector<std::string>& names) const
@@ -85,7 +100,12 @@ bool
cmGlobalVisualStudio14Generator::MatchesGeneratorName(
const std::string& name) const
{
- return name == this->GetName();
+ std::string genName;
+ if(cmVS14GenName(name, genName))
+ {
+ return genName == this->GetName();
+ }
+ return false;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 90a8f85..ce7c854 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -711,12 +711,10 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
this->SetError(ostr.str());
return false;
}
- int leftOverLength = intStringLength - begin;
- if ( end < -1 || end > leftOverLength )
+ if ( end < -1 )
{
cmOStringStream ostr;
- ostr << "end index: " << end << " is out of range -1 - "
- << leftOverLength;
+ ostr << "end index: " << end << " should be -1 or greater";
this->SetError(ostr.str());
return false;
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8109b16..2b5d162 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -307,7 +307,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->BuildFileStream->SetCopyIfDifferent(true);
// Write the encoding header into the file
- char magic[] = {0xEF,0xBB, 0xBF};
+ char magic[] = {char(0xEF), char(0xBB), char(0xBF)};
this->BuildFileStream->write(magic, 3);
//get the tools version to use
@@ -937,7 +937,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
path += ".vcxproj.filters";
cmGeneratedFileStream fout(path.c_str());
fout.SetCopyIfDifferent(true);
- char magic[] = {0xEF,0xBB, 0xBF};
+ char magic[] = {char(0xEF), char(0xBB), char(0xBF)};
fout.write(magic, 3);
cmGeneratedFileStream* save = this->BuildFileStream;
this->BuildFileStream = & fout;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index dc1b113..fb04376 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1401,7 +1401,7 @@ int cmake::ActualConfigure()
{"10.0", "Visual Studio 10 2010"},
{"11.0", "Visual Studio 11 2012"},
{"12.0", "Visual Studio 12 2013"},
- {"14.0", "Visual Studio 14"},
+ {"14.0", "Visual Studio 14 2015"},
{0, 0}};
for(int i=0; version[i].MSVersion != 0; i++)
{
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index a9fe428..92e70c3 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -63,7 +63,7 @@ check_cmake_test(String
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
-set(number_of_tests_expected 69)
+set(number_of_tests_expected 70)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
@@ -75,6 +75,6 @@ message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
-if(number_of_tests_executed LESS number_of_tests_expected)
+if(NOT number_of_tests_executed EQUAL number_of_tests_expected)
message(FATAL_ERROR "error: some test cases were skipped")
endif()
diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake
index a562e71..44d5653 100644
--- a/Tests/CMakeTests/StringTestScript.cmake
+++ b/Tests/CMakeTests/StringTestScript.cmake
@@ -122,14 +122,17 @@ elseif(testname STREQUAL substring_not_enough_args) # fail
elseif(testname STREQUAL substring_begin_too_large) # fail
string(SUBSTRING "abcdefg" 25 100 v)
-elseif(testname STREQUAL substring_end_too_large) # fail
+elseif(testname STREQUAL substring_end_larger_than_strlen) # pass
string(SUBSTRING "abcdefg" 1 100 v)
elseif(testname STREQUAL substring_begin_less_than_zero) # fail
- string(SUBSTRING "abcdefg" -2 4 v)
+ string(SUBSTRING "abcdefg" -1 4 v)
-elseif(testname STREQUAL substring_end_less_than_begin) # fail
- string(SUBSTRING "abcdefg" 6 3 v)
+elseif(testname STREQUAL substring_end_less_than_zero) # pass
+ string(SUBSTRING "abcdefg" 0 -1 v)
+
+elseif(testname STREQUAL substring_end_less_than_begin) # pass
+ string(SUBSTRING "abcdefg" 6 0 v)
elseif(testname STREQUAL length_not_enough_args) # fail
string(LENGTH)