Merge branch 'FindMatlab-2017a' into release
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index e905bc6..866c61e 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -887,6 +887,19 @@
#
# * Mandatory : YES
# * Default : "/"
+#
+# .. VARIABLE:: CPACK_RPM_BUILDREQUIRES
+#
+# List of source rpm build dependencies.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set source RPM build dependencies (BuildRequires). Note that
+# you must enclose the complete build requirements string between quotes, for
+# example::
+#
+# set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")
# Author: Eric Noulard with the help of Alexander Neundorf.
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 2dd08e1..093d8c9 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -127,7 +127,10 @@
# ('n' tag). Default is OFF.
# Boost_COMPILER - Set to the compiler-specific library suffix
# (e.g. "-gcc43"). Default is auto-computed
-# for the C++ compiler in use.
+# for the C++ compiler in use. A list may be
+# used if multiple compatible suffixes should
+# be tested for, in decreasing order of
+# preference.
# Boost_THREADAPI - Suffix for "thread" component library name,
# such as "pthread" or "win32". Names with
# and without this suffix will both be tried.
@@ -428,7 +431,7 @@
set(_boost_COMPILER "-ghs")
elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
- set(_boost_COMPILER "-vc141")
+ set(_boost_COMPILER "-vc141;-vc140")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
set(_boost_COMPILER "-vc140")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
@@ -893,7 +896,7 @@
# This function would append corresponding directories if MSVC is a current compiler,
# so having `BOOST_ROOT` would be enough to specify to find everything.
#
-macro(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
+function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_arch_suffix 64)
@@ -901,7 +904,8 @@
set(_arch_suffix 32)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
- list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-15.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
@@ -915,8 +919,9 @@
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0)
endif()
+ set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE)
endif()
-endmacro()
+endfunction()
#
# End functions/macros
@@ -1119,6 +1124,12 @@
if( Boost_NO_SYSTEM_PATHS)
list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
+ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ foreach(ver ${_Boost_KNOWN_VERSIONS})
+ string(REPLACE "." "_" ver "${ver}")
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}")
+ endforeach()
+ endif()
list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
C:/boost/include
C:/boost
@@ -1392,12 +1403,16 @@
if( Boost_NO_SYSTEM_PATHS )
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
+ foreach(ver ${_Boost_KNOWN_VERSIONS})
+ string(REPLACE "." "_" ver "${ver}")
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}")
+ endforeach()
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost")
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
C:/boost/lib
C:/boost
/sw/local/lib
)
- _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost")
endif()
endif()
endforeach()
@@ -1524,17 +1539,24 @@
#
# Find RELEASE libraries
#
- set(_boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ unset(_boost_RELEASE_NAMES)
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
+ endforeach()
+ list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
if(_boost_STATIC_RUNTIME_WORKAROUND)
set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ endforeach()
list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endif()
@@ -1565,18 +1587,25 @@
#
# Find DEBUG libraries
#
- set(_boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ unset(_boost_DEBUG_NAMES)
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
+ endforeach()
+ list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
if(_boost_STATIC_RUNTIME_WORKAROUND)
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ endforeach()
list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endif()
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 6259ce1..609bc17 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -145,6 +145,7 @@
find_library(LIB_EAY_DEBUG
NAMES
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
+ libcrypto${_OPENSSL_MSVC_RT_MODE}d
libcryptod
libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
@@ -157,6 +158,7 @@
find_library(LIB_EAY_RELEASE
NAMES
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
+ libcrypto${_OPENSSL_MSVC_RT_MODE}
libcrypto
libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
@@ -169,6 +171,7 @@
find_library(SSL_EAY_DEBUG
NAMES
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
+ libssl${_OPENSSL_MSVC_RT_MODE}d
libssld
ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
@@ -181,6 +184,7 @@
find_library(SSL_EAY_RELEASE
NAMES
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
+ libssl${_OPENSSL_MSVC_RT_MODE}
libssl
ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 58497b3..65e7b5d 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,4 +2,4 @@
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 4)
+#set(CMake_VERSION_RC 0)
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index 2312bc0..da2bf8c 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -164,7 +164,7 @@
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return true;
+ return cmSystemTools::FileExists(win81Root + "/um/windows.h", true);
}
return false;
}
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 5555199..23048bf 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
+#include <algorithm>
+#include <iterator>
+#include <set>
#include <sstream>
#include "cmMakefile.h"
@@ -34,21 +37,31 @@
}
std::set<std::string> getSourceGroupFilesPaths(
- const std::string& currentPath, const std::string& root,
- const std::vector<std::string>& files)
+ const std::string& root, const std::vector<std::string>& files)
{
std::set<std::string> ret;
const std::string::size_type rootLength = root.length();
for (size_t i = 0; i < files.size(); ++i) {
- const std::string fullPath = getFullFilePath(currentPath, files[i]);
-
- ret.insert(fullPath.substr(rootLength + 1)); // +1 to also omnit last '/'
+ ret.insert(files[i].substr(rootLength + 1)); // +1 to also omnit last '/'
}
return ret;
}
+bool rootIsPrefix(const std::string& root,
+ const std::vector<std::string>& files, std::string& error)
+{
+ for (size_t i = 0; i < files.size(); ++i) {
+ if (!cmSystemTools::StringStartsWith(files[i], root.c_str())) {
+ error = "ROOT: " + root + " is not a prefix of file: " + files[i];
+ return false;
+ }
+ }
+
+ return true;
+}
+
cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath,
cmMakefile& makefile)
{
@@ -66,7 +79,22 @@
return sg;
}
-bool addFilesToItsSourceGroups(const std::set<std::string>& sgFilesPaths,
+std::string prepareFilePathForTree(const std::string& path)
+{
+ return cmSystemTools::CollapseFullPath(path);
+}
+
+std::vector<std::string> prepareFilesPathsForTree(
+ std::vector<std::string>::const_iterator begin,
+ std::vector<std::string>::const_iterator end)
+{
+ std::vector<std::string> prepared(std::distance(begin, end));
+ std::transform(begin, end, prepared.begin(), prepareFilePathForTree);
+ return prepared;
+}
+
+bool addFilesToItsSourceGroups(const std::string& root,
+ const std::set<std::string>& sgFilesPaths,
const std::string& prefix, cmMakefile& makefile,
std::string& errorMsg)
{
@@ -91,8 +119,7 @@
errorMsg = "Could not create source group for file: " + *it;
return false;
}
- const std::string fullPath =
- getFullFilePath(makefile.GetCurrentSourceDirectory(), *it);
+ const std::string fullPath = getFullFilePath(root, *it);
sg->AddGroupFile(fullPath);
}
}
@@ -231,17 +258,18 @@
filesBegin = FilesWithPrefixKeywordIndex + 1;
}
- const std::vector<std::string> filesVector(args.begin() + filesBegin,
- args.end());
+ const std::vector<std::string> filesVector =
+ prepareFilesPathsForTree(args.begin() + filesBegin, args.end());
- std::set<std::string> sourceGroupPaths = getSourceGroupFilesPaths(
- this->Makefile->GetCurrentSourceDirectory(), root, filesVector);
+ if (!rootIsPrefix(root, filesVector, errorMsg)) {
+ return false;
+ }
- addFilesToItsSourceGroups(sourceGroupPaths, prefix, *(this->Makefile),
- errorMsg);
+ std::set<std::string> sourceGroupPaths =
+ getSourceGroupFilesPaths(root, filesVector);
- if (!errorMsg.empty()) {
- this->SetError(errorMsg);
+ if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix,
+ *(this->Makefile), errorMsg)) {
return false;
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 902fe03..cb6afe1 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3194,13 +3194,8 @@
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
this->WriteString("<Project>", 3);
- if (csproj == this->ProjectType) {
- (*this->BuildFileStream) << "{";
- }
- (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str());
- if (csproj == this->ProjectType) {
- (*this->BuildFileStream) << "}";
- }
+ (*this->BuildFileStream)
+ << "{" << this->GlobalGenerator->GetGUID(name.c_str()) << "}";
(*this->BuildFileStream) << "</Project>\n";
this->WriteString("<Name>", 3);
(*this->BuildFileStream) << name << "</Name>\n";
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 8f842d6..e6c5270 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -1,10 +1,6 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017
project(AllFindModules)
-if (POLICY CMP0017)
- cmake_policy(SET CMP0017 NEW)
-endif ()
-
# Avoid ctest truncation of output
message(STATUS "CTEST_FULL_OUTPUT")
diff --git a/Tests/FindModulesExecuteAll/CMakeLists.txt b/Tests/FindModulesExecuteAll/CMakeLists.txt
index 21b9d38..4893bb3 100644
--- a/Tests/FindModulesExecuteAll/CMakeLists.txt
+++ b/Tests/FindModulesExecuteAll/CMakeLists.txt
@@ -6,8 +6,8 @@
#
# I guess more things could be added, like checking whether variables are
# defined after running the modules (e.g. FOO_FOUND etc.).
+cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017
project(FindModulesExecuteAll)
-cmake_minimum_required(VERSION 2.7)
file(GLOB all_modules "${CMAKE_CURRENT_SOURCE_DIR}/../../Modules/Find*cmake")