diff options
Diffstat (limited to 'Source')
65 files changed, 610 insertions, 150 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6c3ebf5..f5c2e52 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -492,6 +492,8 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio14Generator.h cmGlobalVisualStudio14Generator.cxx + cmGlobalVisualStudio15Generator.h + cmGlobalVisualStudio15Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmIDEFlagTable.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fb13b21..74f34b2 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 20160906) +set(CMake_VERSION_PATCH 20160908) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 4a5eb90..a6f1585 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -12,21 +12,20 @@ #include "cmCPackIFWGenerator.h" -#include <CPack/cmCPackComponentGroup.h> -#include <CPack/cmCPackLog.h> - -#include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> -#include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> - -#include <cmGeneratedFileStream.h> -#include <cmGlobalGenerator.h> -#include <cmMakefile.h> -#include <cmSystemTools.h> -#include <cmTimestamp.h> -#include <cmVersionConfig.h> -#include <cmXMLWriter.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" +#include "cmCPackIFWInstaller.h" +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmVersionConfig.h" +#include "cmXMLWriter.h" + +#include <sstream> +#include <utility> cmCPackIFWGenerator::cmCPackIFWGenerator() { diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 12f2ca6..17d61bf 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,11 +13,19 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h -#include <CPack/cmCPackGenerator.h> +#include <cmConfigure.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWInstaller.h" #include "cmCPackIFWPackage.h" #include "cmCPackIFWRepository.h" +#include "cmTypeMacro.h" + +#include <map> +#include <set> +#include <string> +#include <vector> class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 13a3613..5a3efc9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -12,12 +12,16 @@ #include "cmCPackIFWInstaller.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <utility> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 3170116..f72d379 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,10 +13,14 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> +#include <vector> -class cmCPackIFWPackage; class cmCPackIFWGenerator; +class cmCPackIFWPackage; class cmCPackIFWRepository; class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5db06e6..bc503fc 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -12,13 +12,20 @@ #include "cmCPackIFWPackage.h" +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmTimestamp.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWInstaller.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <map> +#include <sstream> +#include <stddef.h> //----------------------------------------------------------------- Logger --- #ifdef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 55b07ec..579eeb8 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,12 +13,16 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <set> +#include <string> +#include <vector> class cmCPackComponent; class cmCPackComponentGroup; -class cmCPackIFWInstaller; class cmCPackIFWGenerator; +class cmCPackIFWInstaller; class cmXMLWriter; /** \class cmCPackIFWPackage diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index fcb1c77..947e420 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -12,13 +12,15 @@ #include "cmCPackIFWRepository.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLParser.h" +#include "cmXMLWriter.h" -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLParser.h> -#include <cmXMLWriter.h> +#include <cmConfigure.h> +#include <stddef.h> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index 5ffb775..a0c535b 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -13,7 +13,10 @@ #ifndef cmCPackIFWRepository_h #define cmCPackIFWRepository_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> +#include <vector> class cmCPackIFWGenerator; class cmXMLWriter; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d7f69a1..85e0ae3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -35,6 +35,7 @@ cmCPackWIXGenerator::cmCPackWIXGenerator() : Patch(0) + , ComponentGuidType(cmWIXSourceWriter::WIX_GENERATED_GUID) { } @@ -234,6 +235,12 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() } } + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used + if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { + this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID; + } + return true; } @@ -317,7 +324,9 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); @@ -338,7 +347,9 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/properties.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); std::string prefix = "CPACK_WIX_PROPERTY_"; std::vector<std::string> options = GetOptions(); @@ -386,7 +397,9 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); this->Patch->ApplyFragment("#PRODUCT", includeFile); } @@ -413,13 +426,15 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, bool cmCPackWIXGenerator::CreateWiXSourceFiles() { + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used std::string directoryDefinitionsFilename = this->CPackTopLevel + "/directories.wxs"; this->WixSources.push_back(directoryDefinitionsFilename); cmWIXDirectoriesSourceWriter directoryDefinitions( - this->Logger, directoryDefinitionsFilename); + this->Logger, directoryDefinitionsFilename, this->ComponentGuidType); directoryDefinitions.BeginElement("Fragment"); std::string installRoot; @@ -439,13 +454,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(fileDefinitionsFilename); - cmWIXFilesSourceWriter fileDefinitions(this->Logger, - fileDefinitionsFilename); - - // if install folder is supposed to be set absolutely, the default - // component guid "*" cannot be used - fileDefinitions.GenerateComponentGuids = - cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER")); + cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename, + this->ComponentGuidType); fileDefinitions.BeginElement("Fragment"); @@ -454,8 +464,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(featureDefinitionsFilename); - cmWIXFeaturesSourceWriter featureDefinitions(this->Logger, - featureDefinitionsFilename); + cmWIXFeaturesSourceWriter featureDefinitions( + this->Logger, featureDefinitionsFilename, this->ComponentGuidType); featureDefinitions.BeginElement("Fragment"); @@ -764,7 +774,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); + fileDefinitions.AddAttribute( + "Guid", fileDefinitions.CreateGuidFromComponentId(componentId)); this->Patch->ApplyFragment(componentId, fileDefinitions); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 9d3a522..883df9a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -162,6 +162,8 @@ private: std::string CPackTopLevel; cmWIXPatch* Patch; + + cmWIXSourceWriter::GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 97e3a51..9704195 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXDirectoriesSourceWriter.h" cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index 023f4b8..6ebe281 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -25,8 +25,8 @@ class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter { public: - cmWIXDirectoriesSourceWriter(cmCPackLog* logger, - std::string const& filename); + cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitStartMenuFolder(std::string const& startMenuFolder); diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 1747b62..7794935 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXFeaturesSourceWriter.h" cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -24,7 +24,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( BeginElement("Component"); AddAttribute("Id", "CM_PACKAGE_REGISTRY"); AddAttribute("Directory", "TARGETDIR"); - AddAttribute("Guid", "*"); + AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = std::string("Software\\Kitware\\CMake\\Packages\\") + package; diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index ee9c17a..9974b63 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -23,7 +23,8 @@ class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dde9635..846edde 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -24,9 +24,9 @@ #include <sys/stat.h> cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, - std::string const& filename) - : cmWIXSourceWriter(logger, filename) - , GenerateComponentGuids(false) + std::string const& filename, + GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -130,13 +130,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; - std::string guid = "*"; - if (this->GenerateComponentGuids) { - std::string md5 = cmSystemTools::ComputeStringMD5(componentId); - cmUuid uuid; - std::vector<unsigned char> ns; - guid = uuid.FromMd5(ns, md5); - } + std::string guid = CreateGuidFromComponentId(componentId); BeginElement("DirectoryRef"); AddAttribute("Id", directoryId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index eeb84cb..c1952af 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -26,7 +26,8 @@ class cmWIXFilesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut, std::string const& shortcutPrefix, size_t shortcutIndex); @@ -47,8 +48,6 @@ public: std::string const& id, std::string const& filePath, cmWIXPatch& patch, cmInstalledFile const* installedFile); - - bool GenerateComponentGuids; }; #endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 2c0384e..a287424 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -14,19 +14,23 @@ #include <CPack/cmCPackGenerator.h> +#include <cmUuid.h> + #include <windows.h> cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile) + GuidType componentGuidType, + RootElementType rootElementType) : Logger(logger) , File(filename.c_str()) , State(DEFAULT) , SourceFilename(filename) + , ComponentGuidType(componentGuidType) { WriteXMLDeclaration(); - if (isIncludeFile) { + if (rootElementType == INCLUDE_ELEMENT_ROOT) { BeginElement("Include"); } else { BeginElement("Wix"); @@ -173,6 +177,19 @@ std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) #endif } +std::string cmWIXSourceWriter::CreateGuidFromComponentId( + std::string const& componentId) +{ + std::string guid = "*"; + if (this->ComponentGuidType == CMAKE_GENERATED_GUID) { + std::string md5 = cmSystemTools::ComputeStringMD5(componentId); + cmUuid uuid; + std::vector<unsigned char> ns; + guid = uuid.FromMd5(ns, md5); + } + return guid; +} + void cmWIXSourceWriter::WriteXMLDeclaration() { File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 4efc026..c29ffa7 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -26,8 +26,21 @@ class cmWIXSourceWriter { public: + enum GuidType + { + WIX_GENERATED_GUID, + CMAKE_GENERATED_GUID + }; + + enum RootElementType + { + WIX_ELEMENT_ROOT, + INCLUDE_ELEMENT_ROOT + }; + cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile = false); + GuidType componentGuidType, + RootElementType rootElementType = WIX_ELEMENT_ROOT); ~cmWIXSourceWriter(); @@ -45,6 +58,8 @@ public: void AddAttributeUnlessEmpty(std::string const& key, std::string const& value); + std::string CreateGuidFromComponentId(std::string const& componentId); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: @@ -70,6 +85,8 @@ private: std::vector<std::string> Elements; std::string SourceFilename; + + GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index b01c216..39d2e54 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPack7zGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPack7zGenerator::cmCPack7zGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip") { diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index ddbcc34..94add69 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPack7zGenerator_h #define cmCPack7zGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPack7zGenerator * \brief A generator for 7z files diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 377fee1..ddf2ccb 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -12,17 +12,16 @@ #include "cmCPackArchiveGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" -#include <errno.h> -#include <cm_libarchive.h> -#include <cmsys/Directory.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <ostream> +#include <utility> +#include <vector> cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string const& format) diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index a018ebd..6db6fb0 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -13,9 +13,16 @@ #ifndef cmCPackArchiveGenerator_h #define cmCPackArchiveGenerator_h -#include "cmCPackGenerator.h" +#include <cmConfigure.h> #include "cmArchiveWrite.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> +#include <string> + +class cmCPackComponent; /** \class cmCPackArchiveGenerator * \brief A generator base for libarchive generation. diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 78b81b3..8e9218e 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -15,7 +15,8 @@ #include <cmConfigure.h> -#include "cmStandardIncludes.h" +#include <string> +#include <vector> class cmCPackComponentGroup; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index b909598..2e18265 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -13,16 +13,21 @@ #include "cmCPackDebGenerator.h" #include "cmArchiveWrite.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmMakefile.h" #include "cmSystemTools.h" #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> - -#include <limits.h> // USHRT_MAX +#include <limits.h> +#include <map> +#include <ostream> +#include <set> +#include <stdio.h> +#include <string.h> #include <sys/stat.h> +#include <utility> // NOTE: // A debian package .deb is simply an 'ar' archive. The only subtle difference @@ -743,14 +748,6 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( * SUCH DAMAGE. */ -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #define ARMAG "!<arch>\n" /* ar "magic number" */ #define SARMAG 8 /* strlen(ARMAG); */ diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index bcdc509..c76bf99 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackDebGenerator_h #define cmCPackDebGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> +#include <vector> /** \class cmCPackDebGenerator * \brief A generator for Debian packages diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96c218c..d6b58f2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -17,14 +17,17 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmXMLSafe.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" #include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> +#include <cmsys/RegularExpression.hxx> #include <list> +#include <utility> #if defined(__HAIKU__) #include <FindDirectory.h> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 23e4bb7..f89f349 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -13,15 +13,21 @@ #ifndef cmCPackGenerator_h #define cmCPackGenerator_h -#include "cmObject.h" +#include <cmConfigure.h> +#include "cmCPackComponentGroup.h" +#include "cmObject.h" #include "cmSystemTools.h" +#include "cmTypeMacro.h" + #include <map> +#include <sstream> +#include <string> #include <vector> -#include "cmCPackComponentGroup.h" // cmCPackComponent and friends -// Forward declarations are insufficient since we use them in -// std::map data members below... +class cmCPackLog; +class cmInstalledFile; +class cmMakefile; #define cmCPackTypeMacro(klass, superclass) \ cmTypeMacro(klass, superclass); \ @@ -46,10 +52,6 @@ #endif #define cout no_cout_use_cmCPack_Log -class cmMakefile; -class cmCPackLog; -class cmInstalledFile; - /** \class cmCPackGenerator * \brief A superclass of all CPack Generators * diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 0f0268f..fb84739 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -49,6 +49,9 @@ #include "cmAlgorithms.h" #include "cmCPackLog.h" +#include <ostream> +#include <utility> + cmCPackGeneratorFactory::cmCPackGeneratorFactory() { if (cmCPackTGZGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index f0ed57a..4c07ea3 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -13,10 +13,17 @@ #ifndef cmCPackGeneratorFactory_h #define cmCPackGeneratorFactory_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <map> +#include <string> +#include <vector> -class cmCPackLog; class cmCPackGenerator; +class cmCPackLog; /** \class cmCPackGeneratorFactory * \brief A container for CPack generators diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 339323e..8439de1 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -15,6 +15,8 @@ #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include <iostream> + cmCPackLog::cmCPackLog() { this->Verbose = false; diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 77f0f0b..c1bf82c 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -13,7 +13,14 @@ #ifndef cmCPackLog_h #define cmCPackLog_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <ostream> +#include <string.h> +#include <string> #define cmCPack_Log(ctSelf, logType, msg) \ do { \ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d8ff907..2db94f1 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,16 +13,19 @@ #include "cmCPackNSISGenerator.h" #include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" +#include <algorithm> #include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <sstream> +#include <stdlib.h> +#include <string.h> +#include <utility> /* NSIS uses different command line syntax on Windows and others */ #ifdef _WIN32 diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 4923cf0..ae03e6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -13,9 +13,18 @@ #ifndef cmCPackNSISGenerator_h #define cmCPackNSISGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" +#include <iosfwd> #include <set> +#include <string> +#include <vector> + +class cmCPackComponent; +class cmCPackComponentGroup; /** \class cmCPackNSISGenerator * \brief A generator for NSIS files diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 5d81a49..0f2e9b9 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -11,9 +11,17 @@ ============================================================================*/ #include "cmCPackRPMGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" +#include <algorithm> +#include <map> +#include <ostream> +#include <utility> +#include <vector> + cmCPackRPMGenerator::cmCPackRPMGenerator() { } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 4baef08..10c5572 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -13,7 +13,12 @@ #ifndef cmCPackRPMGenerator_h #define cmCPackRPMGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> /** \class cmCPackRPMGenerator * \brief A generator for RPM packages diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 4d07a7e..4c33a08 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -12,13 +12,15 @@ #include "cmCPackSTGZGenerator.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" #include <cmsys/FStream.hxx> +#include <sstream> +#include <stdio.h> +#include <string> +#include <vector> #include <sys/types.h> // include sys/stat.h after sys/types.h diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 94cc8aa..2a68f2c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackSTGZGenerator_h #define cmCPackSTGZGenerator_h +#include <cmConfigure.h> + +#include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> /** \class cmCPackSTGZGenerator * \brief A generator for Self extractable TGZ files diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 7c5c245..8df53a8 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTGZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTGZGenerator::cmCPackTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr") { diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index cb7620c..78cd109 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTGZGenerator * \brief A generator for TGZ files diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index d17a164..c708022 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTXZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTXZGenerator::cmCPackTXZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") { diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index 87c92ef..6d6db74 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTXZGenerator_h #define cmCPackTXZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTXZGenerator * \brief A generator for TXZ files diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 694d392..09bda8c 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarBZip2Generator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr") { diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 6fec882..d7b7277 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarBZip2Generator * \brief A generator for TarBZip2 files diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index aec6893..a2b0b66 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarCompressGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr") { diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 02926a2..9213d81 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarCompressGenerator_h #define cmCPackTarCompressGenerator_h -#include "cmCPackTGZGenerator.h" +#include <cmConfigure.h> + +#include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarCompressGenerator * \brief A generator for TarCompress files diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 9b42e6d..f2a2547 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackZIPGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackZIPGenerator::cmCPackZIPGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip") { diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 1130826..fdb10a9 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackZIPGenerator * \brief A generator for ZIP files diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index de572c0..be524b3 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,22 +9,30 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmSystemTools.h" +#include <cmConfigure.h> -// Need these for documentation support. #include "cmCPackGenerator.h" #include "cmCPackGeneratorFactory.h" +#include "cmCPackLog.h" #include "cmDocumentation.h" +#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" +#include "cmSystemTools.h" +#include "cmTypeMacro.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" -#include "cmake.h" - -#include "cmCPackLog.h" #include <cmsys/CommandLineArguments.hxx> #include <cmsys/Encoding.hxx> -#include <cmsys/SystemTools.hxx> +#include <iostream> +#include <map> +#include <sstream> +#include <stddef.h> +#include <string> +#include <utility> +#include <vector> static const char* cmDocumentationName[][2] = { { CM_NULLPTR, " cpack - Packaging driver provided by CMake." }, diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 14e1454..7302837 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -40,12 +40,16 @@ public: this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; + this->NestedError = false; } + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; + bool NestedError; }; #endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ceba69a..bcadaa0 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -122,7 +122,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) "PATH)\n"; dest = cmSystemTools::GetFilenamePath(dest); } - os << "\n"; + os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" + << " set(_IMPORT_PREFIX \"\")\n" + << "endif()\n" + << "\n"; } std::vector<std::string> missingTargets; diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index f0e4854..40c54db 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -76,7 +76,7 @@ public: }; bool cmFunctionHelperCommand::InvokeInitialPass( - const std::vector<cmListFileArgument>& args, cmExecutionStatus&) + const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus) { // Expand the argument list to the function. std::vector<std::string> expandedArgs; @@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass( for (unsigned int c = 0; c < this->Functions.size(); ++c) { cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(this->Functions[c], status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 819feb1..8bb43ee 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -350,16 +350,36 @@ std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand() std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() { std::string msbuild; - std::string mskey = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; + std::string mskey; + + // Search in standard location. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; mskey += this->GetToolsVersion(); mskey += ";MSBuildToolsPath"; if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(msbuild); - msbuild += "/"; + msbuild += "/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } } - msbuild += "MSBuild.exe"; + + // Search where VS15Preview places it. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + mskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(msbuild); + msbuild += "/MSBuild/"; + msbuild += this->GetIDEVersion(); + msbuild += "/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } + } + + msbuild = "MSBuild.exe"; return msbuild; } diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx new file mode 100644 index 0000000..98076c3 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -0,0 +1,151 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#include "cmGlobalVisualStudio15Generator.h" + +#include "cmAlgorithms.h" +#include "cmLocalVisualStudio10Generator.h" +#include "cmMakefile.h" + +static const char vs15generatorName[] = "Visual Studio 15"; + +// Map generator name without year to name with year. +static const char* cmVS15GenName(const std::string& name, std::string& genName) +{ + if (strncmp(name.c_str(), vs15generatorName, + sizeof(vs15generatorName) - 1) != 0) { + return 0; + } + const char* p = name.c_str() + sizeof(vs15generatorName) - 1; + genName = std::string(vs15generatorName) + p; + return p; +} + +class cmGlobalVisualStudio15Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const + { + std::string genName; + const char* p = cmVS15GenName(name, genName); + if (!p) { + return 0; + } + if (!*p) { + return new cmGlobalVisualStudio15Generator(cm, genName, ""); + } + if (*p++ != ' ') { + return 0; + } + if (strcmp(p, "Win64") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "x64"); + } + if (strcmp(p, "ARM") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "ARM"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = std::string(vs15generatorName) + " [arch]"; + entry.Brief = "Generates Visual Studio 15 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs15generatorName); + names.push_back(vs15generatorName + std::string(" ARM")); + names.push_back(vs15generatorName + std::string(" Win64")); + } + + bool SupportsToolset() const CM_OVERRIDE { return true; } + bool SupportsPlatform() const CM_OVERRIDE { return true; } +}; + +cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() +{ + return new Factory; +} + +cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( + cmake* cm, const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio14Generator(cm, name, platformName) +{ + std::string vc15Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;" + "ProductDir", + vc15Express, cmSystemTools::KeyWOW64_32); + this->DefaultPlatformToolset = "v140"; + this->Version = VS15; +} + +bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( + const std::string& name) const +{ + std::string genName; + if (cmVS15GenName(name, genName)) { + return genName == this->GetName(); + } + return false; +} + +void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout) +{ + // Visual Studio 15 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 15 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 15\n"; + } +} + +bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( + std::string& toolset) const +{ + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { + if (this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) { + toolset = "v140"; // VS 15 uses v140 toolset + return true; + } else { + return false; + } + } + return this->cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( + toolset); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const +{ + const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\VC\\Runtimes"; + + std::vector<std::string> vc15; + return cmSystemTools::GetRegistrySubKeys(desktop10Key, vc15, + cmSystemTools::KeyWOW64_32); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const +{ + const char universal10Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\Setup\\Build Tools for Windows 10;SrcPath"; + + std::string win10SDK; + return cmSystemTools::ReadRegistryValue(universal10Key, win10SDK, + cmSystemTools::KeyWOW64_32); +} diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h new file mode 100644 index 0000000..f673883 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#ifndef cmGlobalVisualStudio15Generator_h +#define cmGlobalVisualStudio15Generator_h + +#include "cmGlobalVisualStudio14Generator.h" + +/** \class cmGlobalVisualStudio15Generator */ +class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator +{ +public: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + const std::string& platformName); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool MatchesGeneratorName(const std::string& name) const; + + virtual void WriteSLNHeader(std::ostream& fout); + + virtual const char* GetToolsVersion() { return "15.0"; } +protected: + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + virtual const char* GetIDEVersion() { return "15.0"; } + + // Used to verify that the Desktop toolset for the current generator is + // installed on the machine. + virtual bool IsWindowsDesktopToolsetInstalled() const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsStoreToolsetInstalled() const; + +private: + class Factory; +}; +#endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 08be304..0dc4497 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -150,13 +150,32 @@ std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand() std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() { std::string vscmd; - std::string vskey = this->GetRegistryBase() + ";InstallDir"; + std::string vskey; + + // Search in standard location. + vskey = this->GetRegistryBase() + ";InstallDir"; if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(vscmd); - vscmd += "/"; + vscmd += "/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } } - vscmd += "devenv.com"; + + // Search where VS15Preview places it. + vskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + vskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(vscmd); + vscmd += "/Common7/IDE/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } + } + + vscmd = "devenv.com"; return vscmd; } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 1d456ff..3312ed6 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -34,7 +34,8 @@ public: VS11 = 110, VS12 = 120, /* VS13 = 130 was skipped */ - VS14 = 140 + VS14 = 140, + VS15 = 150 }; cmGlobalVisualStudioGenerator(cmake* cm); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d312ee..ee9dc8a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass( } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11ccca1..e5a5e6e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -117,6 +117,11 @@ cmMakefile::~cmMakefile() void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { + if (!this->ExecutionStatusStack.empty()) { + if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { + this->ExecutionStatusStack.back()->SetNestedError(true); + } + } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -277,19 +282,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); } - - bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - cmSystemTools::ResetErrorOccuredFlag(); - + // Try invoking the command. bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); - bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - if (hadPreviousNonFatalError) { - cmSystemTools::SetErrorOccured(); - } + bool hadNestedError = status.GetNestedError(); if (!invokeSucceeded || hadNestedError) { - if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) { + if (!hadNestedError) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); } diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h index 5812e79..c48db68 100644 --- a/Source/cmVS14CLFlagTable.h +++ b/Source/cmVS14CLFlagTable.h @@ -60,6 +60,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "BufferSecurityCheck", "GS-", "Disable Security Check", "false", 0 }, { "BufferSecurityCheck", "GS", "Enable Security Check", "true", 0 }, + { "ControlFlowGuard", "guard:cf", "Yes", "Guard", 0 }, + { "ControlFlowGuard", "", "No", "false", 0 }, + { "EnableEnhancedInstructionSet", "arch:SSE", "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0 }, { "EnableEnhancedInstructionSet", "arch:SSE2", "Streaming SIMD Extensions 2", @@ -76,6 +79,10 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "FloatingPointModel", "fp:strict", "Strict", "Strict", 0 }, { "FloatingPointModel", "fp:fast", "Fast", "Fast", 0 }, + { "LanguageStandard", "std:c++14", "ISO C++14 Standard", "stdcpp14", 0 }, + { "LanguageStandard", "std:c++latest", "ISO C++ Latest Draft Standard", + "stdcpplatest", 0 }, + { "PrecompiledHeader", "Yc", "Create", "Create", cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue }, { "PrecompiledHeader", "Yu", "Use", "Use", @@ -164,6 +171,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0 }, + { "RemoveUnreferencedCodeData", "Zc:inline", "", "true", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast-", "", "false", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast", "", "true", 0 }, { "RuntimeTypeInfo", "GR-", "", "false", 0 }, { "RuntimeTypeInfo", "GR", "", "true", 0 }, { "OpenMPSupport", "openmp-", "", "false", 0 }, @@ -215,6 +225,8 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // String Properties + { "WarningVersion", "Wv:", "Warning Version", "", + cmVS7FlagTable::UserValue }, // Skip [TrackerLogDirectory] - no command line Switch. { "PreprocessOutputPath", "Fi", "Preprocess Output Path", "", cmVS7FlagTable::UserValue }, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6e56422..596f880 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -35,6 +35,12 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACExecutionLevel", "level='requireAdministrator'", "requireAdministrator", "RequireAdministrator", 0 }, + { "GenerateDebugInformation", "DEBUG:FASTLINK", + "Optimize for faster linking", "DebugFastLink", + cmVS7FlagTable::CaseInsensitive }, + { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "Debug", + cmVS7FlagTable::CaseInsensitive }, + { "SubSystem", "", "Not Set", "NotSet", 0 }, { "SubSystem", "SUBSYSTEM:CONSOLE", "Console", "Console", 0 }, { "SubSystem", "SUBSYSTEM:WINDOWS", "Windows", "Windows", 0 }, @@ -54,6 +60,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "Driver", "DRIVER:WDM", "WDM", "WDM", 0 }, { "LinkTimeCodeGeneration", "", "Default", "Default", 0 }, + { "LinkTimeCodeGeneration", "LTCG:incremental", + "Use Fast Link Time Code Generation", "UseFastLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG", "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG:PGInstrument", @@ -121,6 +129,9 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", "System Dlls Only", "SystemDlls", 0 }, + { "LinkControlFlowGuard", "guard:cf", "Enable Security Check with Guard", + "Guard", 0 }, + // Bool Properties { "LinkIncremental", "INCREMENTAL:NO", "", "false", 0 }, { "LinkIncremental", "INCREMENTAL", "", "true", 0 }, @@ -138,10 +149,6 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACUIAccess", "uiAccess='false'", "", "false", 0 }, { "UACUIAccess", "uiAccess='true'", "", "true", 0 }, { "ManifestEmbed", "manifest:embed", "", "true", 0 }, - { "GenerateDebugInformation", "DEBUG:FASTLINK", "", "DebugFastLink", - cmVS7FlagTable::CaseInsensitive }, - { "GenerateDebugInformation", "DEBUG", "", "Debug", - cmVS7FlagTable::CaseInsensitive }, { "MapExports", "MAPINFO:EXPORTS", "", "true", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0 }, @@ -195,6 +202,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "AdditionalLibraryDirectories", "LIBPATH:", "Additional Library Directories", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "Natvis", "NATVIS:", "Natvis files", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // Skip [AdditionalDependencies] - no command line Switch. { "IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", "Ignore Specific Default Libraries", "", diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 3b31d7b..9badda6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -96,6 +96,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmGlobalVisualStudioGenerator::VS11: case cmGlobalVisualStudioGenerator::VS12: case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VS15: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 25f9e3a..d6bea3d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -66,6 +66,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmGlobalVisualStudio12Generator.h" #include "cmGlobalVisualStudio14Generator.h" +#include "cmGlobalVisualStudio15Generator.h" #include "cmGlobalVisualStudio71Generator.h" #include "cmGlobalVisualStudio8Generator.h" #include "cmGlobalVisualStudio9Generator.h" @@ -1317,6 +1318,7 @@ int cmake::ActualConfigure() { "11.0", "Visual Studio 11 2012" }, { "12.0", "Visual Studio 12 2013" }, { "14.0", "Visual Studio 14 2015" }, + { "15.0", "Visual Studio 15" }, { 0, 0 } }; for (int i = 0; version[i].MSVersion != 0; i++) { @@ -1634,6 +1636,7 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) #if !defined(CMAKE_BOOT_MINGW) + this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index 056a0db..1b38d15 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -15,6 +15,9 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/cl.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/lib.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/link.xml" # # BoolProperty <Name>true|false</Name> # simple example: |