summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h12
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h4
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h6
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h6
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.h6
-rw-r--r--Source/CPack/cmCPack7zGenerator.cxx13
-rw-r--r--Source/CPack/cmCPack7zGenerator.h29
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx51
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h25
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h6
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h6
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx20
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.h6
-rw-r--r--Source/CPack/cmCPackGenerator.h2
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx42
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h7
-rw-r--r--Source/CPack/cmCPackTGZGenerator.cxx13
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h29
-rw-r--r--Source/CPack/cmCPackTXZGenerator.cxx13
-rw-r--r--Source/CPack/cmCPackTXZGenerator.h29
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.cxx13
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h28
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.cxx13
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h28
-rw-r--r--Source/CPack/cmCPackZIPGenerator.cxx13
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h29
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx2
-rw-r--r--Source/CTest/cmCTestBuildHandler.h8
-rw-r--r--Source/CTest/cmCTestConfigureHandler.h2
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h10
-rw-r--r--Source/CTest/cmCTestGenericHandler.h2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h2
-rw-r--r--Source/CTest/cmCTestScriptHandler.h2
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.h11
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h2
-rw-r--r--Source/CTest/cmCTestUploadCommand.h2
-rw-r--r--Source/CTest/cmCTestUploadHandler.h2
-rw-r--r--Source/QtDialog/QCMake.h2
-rw-r--r--Source/cmAffinity.cxx2
-rw-r--r--Source/cmCLocaleEnvironmentScope.h2
-rw-r--r--Source/cmCPluginAPI.h11
-rw-r--r--Source/cmCacheManager.h2
-rw-r--r--Source/cmCommonTargetGenerator.cxx2
-rw-r--r--Source/cmCommonTargetGenerator.h2
-rw-r--r--Source/cmCustomCommand.h2
-rw-r--r--Source/cmDepends.h2
-rw-r--r--Source/cmDependsC.h2
-rw-r--r--Source/cmDependsFortran.cxx4
-rw-r--r--Source/cmDuration.h2
-rw-r--r--Source/cmELF.cxx15
-rw-r--r--Source/cmELF.h2
-rw-r--r--Source/cmExportFileGenerator.h2
-rw-r--r--Source/cmExportSetMap.h2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx2
-rw-r--r--Source/cmExtraSublimeTextGenerator.h2
-rw-r--r--Source/cmFileLockResult.h2
-rw-r--r--Source/cmGeneratorExpression.cxx5
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx4
-rw-r--r--Source/cmGeneratorTarget.h28
-rw-r--r--Source/cmGlobVerificationManager.h2
-rw-r--r--Source/cmGlobalGenerator.h12
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h11
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx11
-rw-r--r--Source/cmIDEOptions.h2
-rw-r--r--Source/cmInstalledFile.h2
-rw-r--r--Source/cmListFileLexer.h13
-rw-r--r--Source/cmLocalCommonGenerator.cxx6
-rw-r--r--Source/cmLocalGenerator.cxx114
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmLocalNinjaGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h1
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.h4
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx10
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx1
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.h2
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx1
-rw-r--r--Source/cmNinjaTypes.h2
-rw-r--r--Source/cmOrderDirectories.cxx4
-rw-r--r--Source/cmOrderDirectories.h2
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx8
-rw-r--r--Source/cmPropertyMap.cxx2
-rw-r--r--Source/cmQtAutoMocUic.cxx2
-rw-r--r--Source/cmQtAutoMocUic.h6
-rw-r--r--Source/cmSourceGroupCommand.h2
-rw-r--r--Source/cmString.hxx2
-rw-r--r--Source/cmTarget.cxx2
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmVariableWatch.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx65
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h18
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h2
-rw-r--r--Source/cmVisualStudioSlnData.h4
-rw-r--r--Source/cmVisualStudioSlnParser.cxx2
-rw-r--r--Source/cmVisualStudioSlnParser.h2
-rw-r--r--Source/cmXCodeScheme.h2
-rw-r--r--Source/cm_string_view.hxx4
-rw-r--r--Source/cm_sys_stat.h6
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h2
122 files changed, 485 insertions, 544 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 2ff6c8c..decb39a 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -978,12 +978,6 @@ set(CPACK_SRCS
CPack/cmCPackNSISGenerator.cxx
CPack/cmCPackNuGetGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
- CPack/cmCPackTGZGenerator.cxx
- CPack/cmCPackTXZGenerator.cxx
- CPack/cmCPackTarBZip2Generator.cxx
- CPack/cmCPackTarCompressGenerator.cxx
- CPack/cmCPackZIPGenerator.cxx
- CPack/cmCPack7zGenerator.cxx
)
# CPack IFW generator
set(CPACK_SRCS ${CPACK_SRCS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5f6e9bb..857e5f1 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 15)
-set(CMake_VERSION_PATCH 20190904)
+set(CMake_VERSION_PATCH 20190909)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 0430122..ee3c166 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -29,12 +29,12 @@ class cmCPackIFWGenerator
public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
- typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
- typedef std::map<std::string, cmCPackIFWRepository> RepositoriesMap;
- typedef std::map<std::string, cmCPackComponent> ComponentsMap;
- typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
- typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
- DependenceMap;
+ using PackagesMap = std::map<std::string, cmCPackIFWPackage>;
+ using RepositoriesMap = std::map<std::string, cmCPackIFWRepository>;
+ using ComponentsMap = std::map<std::string, cmCPackComponent>;
+ using ComponentGoupsMap = std::map<std::string, cmCPackComponentGroup>;
+ using DependenceMap =
+ std::map<std::string, cmCPackIFWPackage::DependenceStruct>;
using cmCPackIFWCommon::GetOption;
using cmCPackIFWCommon::IsOn;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index be51fa5..467779e 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -22,8 +22,8 @@ class cmCPackIFWInstaller : public cmCPackIFWCommon
public:
// Types
- typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
- typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
+ using PackagesMap = std::map<std::string, cmCPackIFWPackage*>;
+ using RepositoriesVector = std::vector<cmCPackIFWRepository*>;
public:
// Constructor
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index 227cfae..585334c 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -28,7 +28,7 @@ public:
Replace
};
- typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
+ using RepositoriesVector = std::vector<cmCPackIFWRepository*>;
public:
// Constructor
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index f8c7644..3b72e38 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -44,9 +44,9 @@ protected:
bool SupportsComponentInstallation() const override { return true; }
private:
- typedef std::map<std::string, std::string> id_map_t;
- typedef std::map<std::string, size_t> ambiguity_map_t;
- typedef std::set<std::string> extension_set_t;
+ using id_map_t = std::map<std::string, std::string>;
+ using ambiguity_map_t = std::map<std::string, size_t>;
+ using extension_set_t = std::set<std::string>;
enum class DefinitionType
{
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index 52c7e35..e0e3470 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -36,8 +36,8 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::vector<cmWIXPatchNode*> child_list_t;
- typedef std::map<std::string, std::string> attributes_t;
+ using child_list_t = std::vector<cmWIXPatchNode*>;
+ using attributes_t = std::map<std::string, std::string>;
std::string name;
child_list_t children;
@@ -50,7 +50,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
class cmWIXPatchParser : public cmXMLParser
{
public:
- typedef std::map<std::string, cmWIXPatchElement> fragment_map_t;
+ using fragment_map_t = std::map<std::string, cmWIXPatchElement>;
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
index 2c99a22..751f7dc 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
@@ -25,7 +25,7 @@ cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter()
void cmWIXRichTextFormatWriter::AddText(std::string const& text)
{
- typedef unsigned char rtf_byte_t;
+ using rtf_byte_t = unsigned char;
for (size_t i = 0; i < text.size(); ++i) {
rtf_byte_t c = rtf_byte_t(text[i]);
diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h
index 23ddc6a..d9eecdf 100644
--- a/Source/CPack/WiX/cmWIXShortcut.h
+++ b/Source/CPack/WiX/cmWIXShortcut.h
@@ -28,8 +28,8 @@ public:
STARTUP
};
- typedef std::vector<cmWIXShortcut> shortcut_list_t;
- typedef std::map<std::string, shortcut_list_t> shortcut_id_map_t;
+ using shortcut_list_t = std::vector<cmWIXShortcut>;
+ using shortcut_id_map_t = std::map<std::string, shortcut_list_t>;
void insert(Type type, std::string const& id, cmWIXShortcut const& shortcut);
@@ -46,7 +46,7 @@ public:
cmInstalledFile const& installedFile);
private:
- typedef std::map<Type, shortcut_id_map_t> shortcut_type_map_t;
+ using shortcut_type_map_t = std::map<Type, shortcut_id_map_t>;
void CreateFromProperty(std::string const& propertyName, Type type,
std::string const& id,
diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx
deleted file mode 100644
index 7413770..0000000
--- a/Source/CPack/cmCPack7zGenerator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPack7zGenerator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPack7zGenerator::cmCPack7zGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip")
-{
-}
-
-cmCPack7zGenerator::~cmCPack7zGenerator() = default;
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
deleted file mode 100644
index 8af4c4a..0000000
--- a/Source/CPack/cmCPack7zGenerator.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPack7zGenerator_h
-#define cmCPack7zGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPack7zGenerator
- * \brief A generator for 7z files
- */
-class cmCPack7zGenerator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPack7zGenerator, cmCPackArchiveGenerator);
-
- /**
- * Construct generator
- */
- cmCPack7zGenerator();
- ~cmCPack7zGenerator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".7z"; }
-};
-
-#endif
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 6c9c6b9..1271b08 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -16,11 +16,54 @@
#include <utility>
#include <vector>
-cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
- std::string const& format)
+cmCPackGenerator* cmCPackArchiveGenerator::Create7ZGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip",
+ ".7z");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTBZ2Generator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr",
+ ".tar.bz2");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTGZGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr",
+ ".tar.gz");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTXZGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr",
+ ".tar.xz");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTZGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr",
+ ".tar.Z");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateTZSTGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressZstd, "paxr",
+ ".tar.zst");
+}
+
+cmCPackGenerator* cmCPackArchiveGenerator::CreateZIPGenerator()
+{
+ return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip",
+ ".zip");
+}
+
+cmCPackArchiveGenerator::cmCPackArchiveGenerator(
+ cmArchiveWrite::Compress compress, std::string format, std::string extension)
+ : Compress(compress)
+ , ArchiveFormat(std::move(format))
+ , OutputExtension(std::move(extension))
{
- this->Compress = t;
- this->ArchiveFormat = format;
}
cmCPackArchiveGenerator::~cmCPackArchiveGenerator() = default;
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 9983854..461df66 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -22,12 +22,21 @@ class cmCPackComponent;
class cmCPackArchiveGenerator : public cmCPackGenerator
{
public:
- typedef cmCPackGenerator Superclass;
+ using Superclass = cmCPackGenerator;
+
+ static cmCPackGenerator* Create7ZGenerator();
+ static cmCPackGenerator* CreateTBZ2Generator();
+ static cmCPackGenerator* CreateTGZGenerator();
+ static cmCPackGenerator* CreateTXZGenerator();
+ static cmCPackGenerator* CreateTZGenerator();
+ static cmCPackGenerator* CreateTZSTGenerator();
+ static cmCPackGenerator* CreateZIPGenerator();
/**
* Construct generator
*/
- cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format);
+ cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string format,
+ std::string extension);
~cmCPackArchiveGenerator() override;
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
@@ -68,9 +77,19 @@ protected:
* components will be put in a single installer.
*/
int PackageComponentsAllInOne();
- const char* GetOutputExtension() override = 0;
+
+private:
+ const char* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
+
+ const char* GetOutputExtension() override
+ {
+ return this->OutputExtension.c_str();
+ }
+
+private:
cmArchiveWrite::Compress Compress;
std::string ArchiveFormat;
+ std::string OutputExtension;
};
#endif
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index 553a677..22385055 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmsys/SystemTools.hxx"
cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
+ : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr", ".tar.bz2")
{
}
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
index f87a134..47bd41e 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.h
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -3,15 +3,15 @@
#ifndef cmCPackCygwinBinaryGenerator_h
#define cmCPackCygwinBinaryGenerator_h
-#include "cmCPackTarBZip2Generator.h"
+#include "cmCPackArchiveGenerator.h"
/** \class cmCPackCygwinBinaryGenerator
* \brief A generator for TarBZip2 files
*/
-class cmCPackCygwinBinaryGenerator : public cmCPackTarBZip2Generator
+class cmCPackCygwinBinaryGenerator : public cmCPackArchiveGenerator
{
public:
- cmCPackTypeMacro(cmCPackCygwinBinaryGenerator, cmCPackTarBZip2Generator);
+ cmCPackTypeMacro(cmCPackCygwinBinaryGenerator, cmCPackArchiveGenerator);
/**
* Construct generator
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index 8cae9b4..5f6aab0 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -20,6 +20,7 @@
#endif
cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
+ : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr", ".tar.bz2")
{
}
@@ -40,11 +41,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".tar.bz2");
packageFileNames[0] = packageDirFileName;
std::string output;
- // skip one parent up to the cmCPackTarBZip2Generator
- // to create tar.bz2 file with the list of source
- // files
- this->Compress = cmArchiveWrite::CompressBZip2;
- if (!this->cmCPackTarBZip2Generator::PackageFiles()) {
+ // create tar.bz2 file with the list of source files
+ if (!this->cmCPackArchiveGenerator::PackageFiles()) {
return 0;
}
// Now create a tar file that contains the above .tar.bz2 file
@@ -130,7 +128,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
packageFileNames[0] = outerTarFile;
/* update the toplevel dir */
toplevel = tmpDir;
- if (!this->cmCPackTarBZip2Generator::PackageFiles()) {
+ if (!this->cmCPackArchiveGenerator::PackageFiles()) {
return 0;
}
return 1;
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
index a909b15..98d8f0a 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.h
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -3,15 +3,15 @@
#ifndef cmCPackCygwinSourceGenerator_h
#define cmCPackCygwinSourceGenerator_h
-#include "cmCPackTarBZip2Generator.h"
+#include "cmCPackArchiveGenerator.h"
/** \class cmCPackCygwinSourceGenerator
* \brief A generator for cygwin source files
*/
-class cmCPackCygwinSourceGenerator : public cmCPackTarBZip2Generator
+class cmCPackCygwinSourceGenerator : public cmCPackArchiveGenerator
{
public:
- cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTarBZip2Generator);
+ cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackArchiveGenerator);
/**
* Construct generator
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index bbba8a1..b3cb2ad 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -12,16 +12,16 @@
// Needed for ::open() and ::stat()
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <pkg.h>
#include <algorithm>
+#include <ostream>
#include <utility>
+#include <vector>
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr")
+ : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr", ".txz")
{
}
@@ -276,12 +276,6 @@ void write_manifest_files(cmGeneratedFileStream& s,
s << " },\n";
}
-static bool has_suffix(const std::string& str, const std::string& suffix)
-{
- return str.size() >= suffix.size() &&
- str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
-}
-
int cmCPackFreeBSDGenerator::PackageFiles()
{
if (!this->ReadListFile("Internal/CPack/CPackFreeBSD.cmake")) {
@@ -327,13 +321,13 @@ int cmCPackFreeBSDGenerator::PackageFiles()
pkg_create_from_manifest(output_dir.c_str(), ::TXZ, toplevel.c_str(),
manifestname.c_str(), nullptr);
- std::string broken_suffix = std::string("-") +
- var_lookup("CPACK_TOPLEVEL_TAG") + std::string(GetOutputExtension());
+ std::string broken_suffix =
+ cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), ".txz");
for (std::string& name : packageFileNames) {
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Packagefile " << name << std::endl);
- if (has_suffix(name, broken_suffix)) {
+ if (cmHasSuffix(name, broken_suffix)) {
name.replace(name.size() - broken_suffix.size(), std::string::npos,
- GetOutputExtension());
+ ".txz");
break;
}
}
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h
index 99d2e24..9c8a934 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.h
+++ b/Source/CPack/cmCPackFreeBSDGenerator.h
@@ -3,11 +3,13 @@
#ifndef cmCPackFreeBSDGenerator_h
#define cmCPackFreeBSDGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
+#include <string>
+
class cmGeneratedFileStream;
/** \class cmCPackFreeBSDGenerator
@@ -28,8 +30,6 @@ public:
int PackageFiles() override;
protected:
- const char* GetOutputExtension() override { return ".txz"; }
-
std::string var_lookup(const char* var_name);
void write_manifest_fields(cmGeneratedFileStream&);
};
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 3c06d41..fc00b09 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -326,7 +326,7 @@ protected:
};
#define cmCPackTypeMacro(klass, superclass) \
- typedef superclass Superclass; \
+ using Superclass = superclass; \
const char* GetNameOfClass() override { return #klass; } \
static cmCPackGenerator* CreateGenerator() { return new klass; } \
class cmCPackTypeMacro_UseTrailingSemicolon
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 2c5ab4d..4d41049 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -7,10 +7,10 @@
#include "IFW/cmCPackIFWGenerator.h"
#include "cmAlgorithms.h"
-#include "cmCPack7zGenerator.h"
#ifdef HAVE_FREEBSD_PKG
# include "cmCPackFreeBSDGenerator.h"
#endif
+#include "cmCPackArchiveGenerator.h"
#include "cmCPackDebGenerator.h"
#include "cmCPackExternalGenerator.h"
#include "cmCPackGenerator.h"
@@ -18,11 +18,6 @@
#include "cmCPackNSISGenerator.h"
#include "cmCPackNuGetGenerator.h"
#include "cmCPackSTGZGenerator.h"
-#include "cmCPackTGZGenerator.h"
-#include "cmCPackTXZGenerator.h"
-#include "cmCPackTarBZip2Generator.h"
-#include "cmCPackTarCompressGenerator.h"
-#include "cmCPackZIPGenerator.h"
#ifdef __APPLE__
# include "cmCPackBundleGenerator.h"
@@ -48,13 +43,21 @@
cmCPackGeneratorFactory::cmCPackGeneratorFactory()
{
- if (cmCPackTGZGenerator::CanGenerate()) {
+ if (cmCPackArchiveGenerator::CanGenerate()) {
+ this->RegisterGenerator("7Z", "7-Zip file format",
+ cmCPackArchiveGenerator::Create7ZGenerator);
+ this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
+ cmCPackArchiveGenerator::CreateTBZ2Generator);
this->RegisterGenerator("TGZ", "Tar GZip compression",
- cmCPackTGZGenerator::CreateGenerator);
- }
- if (cmCPackTXZGenerator::CanGenerate()) {
+ cmCPackArchiveGenerator::CreateTGZGenerator);
this->RegisterGenerator("TXZ", "Tar XZ compression",
- cmCPackTXZGenerator::CreateGenerator);
+ cmCPackArchiveGenerator::CreateTXZGenerator);
+ this->RegisterGenerator("TZ", "Tar Compress compression",
+ cmCPackArchiveGenerator::CreateTZGenerator);
+ this->RegisterGenerator("TZST", "Tar Zstandard compression",
+ cmCPackArchiveGenerator::CreateTZSTGenerator);
+ this->RegisterGenerator("ZIP", "ZIP file format",
+ cmCPackArchiveGenerator::CreateZIPGenerator);
}
if (cmCPackSTGZGenerator::CanGenerate()) {
this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
@@ -80,29 +83,12 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
cmCPackCygwinSourceGenerator::CreateGenerator);
}
#endif
-
- if (cmCPackZIPGenerator::CanGenerate()) {
- this->RegisterGenerator("ZIP", "ZIP file format",
- cmCPackZIPGenerator::CreateGenerator);
- }
- if (cmCPack7zGenerator::CanGenerate()) {
- this->RegisterGenerator("7Z", "7-Zip file format",
- cmCPack7zGenerator::CreateGenerator);
- }
#if defined(_WIN32) || (defined(__CYGWIN__) && defined(HAVE_LIBUUID))
if (cmCPackWIXGenerator::CanGenerate()) {
this->RegisterGenerator("WIX", "MSI file format via WiX tools",
cmCPackWIXGenerator::CreateGenerator);
}
#endif
- if (cmCPackTarBZip2Generator::CanGenerate()) {
- this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
- cmCPackTarBZip2Generator::CreateGenerator);
- }
- if (cmCPackTarCompressGenerator::CanGenerate()) {
- this->RegisterGenerator("TZ", "Tar Compress compression",
- cmCPackTarCompressGenerator::CreateGenerator);
- }
if (cmCPackDebGenerator::CanGenerate()) {
this->RegisterGenerator("DEB", "Debian packages",
cmCPackDebGenerator::CreateGenerator);
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 972f0f7..da2eb8d 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -29,7 +29,7 @@ public:
cmCPackGenerator* NewGenerator(const std::string& name);
void DeleteGenerator(cmCPackGenerator* gen);
- typedef cmCPackGenerator* CreateGeneratorCall();
+ using CreateGeneratorCall = cmCPackGenerator*();
void RegisterGenerator(const std::string& name,
const char* generatorDescription,
@@ -37,7 +37,7 @@ public:
void SetLogger(cmCPackLog* logger) { this->Logger = logger; }
- typedef std::map<std::string, std::string> DescriptionsMap;
+ using DescriptionsMap = std::map<std::string, std::string>;
const DescriptionsMap& GetGeneratorsList() const
{
return this->GeneratorDescriptions;
@@ -47,7 +47,7 @@ private:
cmCPackGenerator* NewGeneratorInternal(const std::string& name);
std::vector<cmCPackGenerator*> Generators;
- typedef std::map<std::string, CreateGeneratorCall*> t_GeneratorCreatorsMap;
+ using t_GeneratorCreatorsMap = std::map<std::string, CreateGeneratorCall*>;
t_GeneratorCreatorsMap GeneratorCreators;
DescriptionsMap GeneratorDescriptions;
cmCPackLog* Logger;
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 4666dc2..3092508 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -8,12 +8,16 @@
#include <string>
#include <vector>
+#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
#include "cm_sys_stat.h"
-cmCPackSTGZGenerator::cmCPackSTGZGenerator() = default;
+cmCPackSTGZGenerator::cmCPackSTGZGenerator()
+ : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr", ".sh")
+{
+}
cmCPackSTGZGenerator::~cmCPackSTGZGenerator() = default;
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 9cf184b..55e4779 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -5,8 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
-#include "cmCPackTGZGenerator.h"
#include <iosfwd>
@@ -14,10 +14,10 @@
* \brief A generator for Self extractable TGZ files
*
*/
-class cmCPackSTGZGenerator : public cmCPackTGZGenerator
+class cmCPackSTGZGenerator : public cmCPackArchiveGenerator
{
public:
- cmCPackTypeMacro(cmCPackSTGZGenerator, cmCPackTGZGenerator);
+ cmCPackTypeMacro(cmCPackSTGZGenerator, cmCPackArchiveGenerator);
/**
* Construct generator
@@ -29,7 +29,6 @@ protected:
int PackageFiles() override;
int InitializeInternal() override;
int GenerateHeader(std::ostream* os) override;
- const char* GetOutputExtension() override { return ".sh"; }
};
#endif
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx
deleted file mode 100644
index 6f4676e..0000000
--- a/Source/CPack/cmCPackTGZGenerator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackTGZGenerator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPackTGZGenerator::cmCPackTGZGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr")
-{
-}
-
-cmCPackTGZGenerator::~cmCPackTGZGenerator() = default;
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
deleted file mode 100644
index 7be3d9d..0000000
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackTGZGenerator_h
-#define cmCPackTGZGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackTGZGenerator
- * \brief A generator for TGZ files
- *
- */
-class cmCPackTGZGenerator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackArchiveGenerator);
- /**
- * Construct generator
- */
- cmCPackTGZGenerator();
- ~cmCPackTGZGenerator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".tar.gz"; }
-};
-
-#endif
diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx
deleted file mode 100644
index ccbccde..0000000
--- a/Source/CPack/cmCPackTXZGenerator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackTXZGenerator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPackTXZGenerator::cmCPackTXZGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr")
-{
-}
-
-cmCPackTXZGenerator::~cmCPackTXZGenerator() = default;
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
deleted file mode 100644
index 4aa5973..0000000
--- a/Source/CPack/cmCPackTXZGenerator.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackTXZGenerator_h
-#define cmCPackTXZGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackTXZGenerator
- * \brief A generator for TXZ files
- *
- */
-class cmCPackTXZGenerator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackTXZGenerator, cmCPackArchiveGenerator);
- /**
- * Construct generator
- */
- cmCPackTXZGenerator();
- ~cmCPackTXZGenerator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".tar.xz"; }
-};
-
-#endif
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
deleted file mode 100644
index 85abeb1..0000000
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackTarBZip2Generator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr")
-{
-}
-
-cmCPackTarBZip2Generator::~cmCPackTarBZip2Generator() = default;
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
deleted file mode 100644
index 7975dda..0000000
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackTarBZip2Generator_h
-#define cmCPackTarBZip2Generator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackTarBZip2Generator
- * \brief A generator for TarBZip2 files
- */
-class cmCPackTarBZip2Generator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackTarBZip2Generator, cmCPackArchiveGenerator);
- /**
- * Construct generator
- */
- cmCPackTarBZip2Generator();
- ~cmCPackTarBZip2Generator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".tar.bz2"; }
-};
-
-#endif
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx
deleted file mode 100644
index 55a6de5..0000000
--- a/Source/CPack/cmCPackTarCompressGenerator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackTarCompressGenerator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr")
-{
-}
-
-cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator() = default;
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
deleted file mode 100644
index 37c7f48..0000000
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackTarCompressGenerator_h
-#define cmCPackTarCompressGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackTarCompressGenerator
- * \brief A generator for TarCompress files
- */
-class cmCPackTarCompressGenerator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackTarCompressGenerator, cmCPackArchiveGenerator);
- /**
- * Construct generator
- */
- cmCPackTarCompressGenerator();
- ~cmCPackTarCompressGenerator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".tar.Z"; }
-};
-
-#endif
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx
deleted file mode 100644
index f06494c..0000000
--- a/Source/CPack/cmCPackZIPGenerator.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackZIPGenerator.h"
-
-#include "cmArchiveWrite.h"
-#include "cmCPackArchiveGenerator.h"
-
-cmCPackZIPGenerator::cmCPackZIPGenerator()
- : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip")
-{
-}
-
-cmCPackZIPGenerator::~cmCPackZIPGenerator() = default;
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
deleted file mode 100644
index 58ec79e..0000000
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackZIPGenerator_h
-#define cmCPackZIPGenerator_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include "cmCPackArchiveGenerator.h"
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackZIPGenerator
- * \brief A generator for ZIP files
- */
-class cmCPackZIPGenerator : public cmCPackArchiveGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackArchiveGenerator);
-
- /**
- * Construct generator
- */
- cmCPackZIPGenerator();
- ~cmCPackZIPGenerator() override;
-
-protected:
- const char* GetOutputExtension() override { return ".zip"; }
-};
-
-#endif
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index b4b320d..08681ec 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -66,7 +66,7 @@ int cpackUnknownArgument(const char* /*unused*/, void* /*unused*/)
struct cpackDefinitions
{
- typedef std::map<std::string, std::string> MapType;
+ using MapType = std::map<std::string, std::string>;
MapType Map;
cmCPackLog* Log;
};
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index 2d47b15..d5240aa 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -22,7 +22,7 @@ class cmake;
class cmCTestBuildAndTestHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 147286e..e07d7aa 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -529,7 +529,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
// Sort XML fragments in chronological order.
cmFileTimeCache ftc;
FragmentCompare fragmentCompare(&ftc);
- typedef std::set<std::string, FragmentCompare> Fragments;
+ using Fragments = std::set<std::string, FragmentCompare>;
Fragments fragments(fragmentCompare);
// only report the first 50 warnings and first 50 errors
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 87f1534..ce1d343 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -28,8 +28,8 @@ class cmXMLWriter;
class cmCTestBuildHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
- typedef cmProcessOutput::Encoding Encoding;
+ using Superclass = cmCTestGenericHandler;
+ using Encoding = cmProcessOutput::Encoding;
/*
* The main entry point for this class
@@ -111,7 +111,7 @@ private:
std::vector<cmsys::RegularExpression> WarningMatchRegex;
std::vector<cmsys::RegularExpression> WarningExceptionRegex;
- typedef std::deque<char> t_BuildProcessingQueueType;
+ using t_BuildProcessingQueueType = std::deque<char>;
void ProcessBuffer(const char* data, size_t length, size_t& tick,
size_t tick_len, std::ostream& ofs,
@@ -126,7 +126,7 @@ private:
std::string SimplifySourceDir;
std::string SimplifyBuildDir;
size_t OutputLineCounter;
- typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
+ using t_ErrorsAndWarningsVector = std::vector<cmCTestBuildErrorWarning>;
t_ErrorsAndWarningsVector ErrorsAndWarnings;
t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
size_t PostContextCount;
diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h
index 680401c..01fe801 100644
--- a/Source/CTest/cmCTestConfigureHandler.h
+++ b/Source/CTest/cmCTestConfigureHandler.h
@@ -14,7 +14,7 @@
class cmCTestConfigureHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 08f31f7..24b96c0 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -42,7 +42,7 @@ public:
*/
std::string GetName() const override { return "ctest_coverage"; }
- typedef cmCTestHandlerCommand Superclass;
+ using Superclass = cmCTestHandlerCommand;
protected:
cmCTestGenericHandler* InitializeHandler() override;
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 6492fe9..06aaef7 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -24,8 +24,8 @@ public:
int Error;
std::string SourceDir;
std::string BinaryDir;
- typedef std::vector<int> SingleFileCoverageVector;
- typedef std::map<std::string, SingleFileCoverageVector> TotalCoverageMap;
+ using SingleFileCoverageVector = std::vector<int>;
+ using TotalCoverageMap = std::map<std::string, SingleFileCoverageVector>;
TotalCoverageMap TotalCoverage;
std::ostream* OFS;
bool Quiet;
@@ -37,7 +37,7 @@ public:
class cmCTestCoverageHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/*
* The main entry point for this class
@@ -128,12 +128,12 @@ private:
class LabelSet : public std::set<int>
{
};
- typedef std::map<std::string, LabelSet> LabelMapType;
+ using LabelMapType = std::map<std::string, LabelSet>;
LabelMapType SourceLabels;
LabelMapType TargetDirs;
// Map from label name to label id.
- typedef std::map<std::string, int> LabelIdMapType;
+ using LabelIdMapType = std::map<std::string, int>;
LabelIdMapType LabelIdMap;
std::vector<std::string> Labels;
int GetLabelId(std::string const& label);
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index cf91b4f..793829e 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -71,7 +71,7 @@ public:
cmCTestGenericHandler();
virtual ~cmCTestGenericHandler();
- typedef std::map<std::string, std::string> t_StringToString;
+ using t_StringToString = std::map<std::string, std::string>;
void SetPersistentOption(const std::string& op, const char* value);
void SetOption(const std::string& op, const char* value);
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 746d72c..4bc655b 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -22,7 +22,7 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler
friend class cmCTestRunTest;
public:
- typedef cmCTestTestHandler Superclass;
+ using Superclass = cmCTestTestHandler;
void PopulateCustomVectors(cmMakefile* mf) override;
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index b2e8cbf..4a08ad9 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -58,7 +58,7 @@ class cmake;
class cmCTestScriptHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/**
* Add a script to run, and if is should run in the current process
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 5bbcd39..8562207 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -37,7 +37,7 @@ public:
*/
std::string GetName() const override { return "ctest_submit"; }
- typedef cmCTestHandlerCommand Superclass;
+ using Superclass = cmCTestHandlerCommand;
protected:
cmCTestGenericHandler* InitializeHandler() override;
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index e0fed10..31b747b 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -22,7 +22,7 @@
class cmCTestSubmitHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
cmCTestSubmitHandler();
~cmCTestSubmitHandler() override { this->LogFile = nullptr; }
@@ -59,7 +59,7 @@ private:
const std::string& remoteprefix,
const std::string& url);
- typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
+ using cmCTestSubmitHandlerVectorOfChar = std::vector<char>;
void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 2b5a406..f67b11a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -940,7 +940,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
// Prepare some maps to help us find setup and cleanup tests for
// any given fixture
using TestIterator = ListOfTests::const_iterator;
- typedef std::multimap<std::string, TestIterator> FixtureDependencies;
+ using FixtureDependencies = std::multimap<std::string, TestIterator>;
using FixtureDepsIterator = FixtureDependencies::const_iterator;
FixtureDependencies fixtureSetups;
FixtureDependencies fixtureCleanups;
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 9345185..8f1dafc 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -34,7 +34,7 @@ class cmCTestTestHandler : public cmCTestGenericHandler
friend class cmCTestMultiProcessHandler;
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/**
* The main entry point for this class
@@ -188,12 +188,11 @@ public:
std::vector<std::string>& extraPaths,
std::vector<std::string>& failed);
- typedef std::vector<cmCTestTestProperties> ListOfTests;
+ using ListOfTests = std::vector<cmCTestTestProperties>;
protected:
- typedef std::set<cmCTestTestHandler::cmCTestTestResult,
- cmCTestTestResultLess>
- SetOfTests;
+ using SetOfTests =
+ std::set<cmCTestTestHandler::cmCTestTestResult, cmCTestTestResultLess>;
// compute a final test list
virtual int PreProcessHandler();
@@ -222,7 +221,7 @@ protected:
cmDuration ElapsedTestingTime;
- typedef std::vector<cmCTestTestResult> TestResultsVector;
+ using TestResultsVector = std::vector<cmCTestTestResult>;
TestResultsVector TestResults;
std::vector<std::string> CustomTestsIgnore;
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
index 0f51d3f..57b952d 100644
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -18,7 +18,7 @@
class cmCTestUpdateHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/*
* The main entry point for this class
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index 2bb072f..9e49769 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -41,7 +41,7 @@ public:
*/
std::string GetName() const override { return "ctest_upload"; }
- typedef cmCTestHandlerCommand Superclass;
+ using Superclass = cmCTestHandlerCommand;
protected:
cmCTestGenericHandler* InitializeHandler() override;
diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h
index 4d8fab4..ff69c6e 100644
--- a/Source/CTest/cmCTestUploadHandler.h
+++ b/Source/CTest/cmCTestUploadHandler.h
@@ -19,7 +19,7 @@
class cmCTestUploadHandler : public cmCTestGenericHandler
{
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
cmCTestUploadHandler();
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index f2fd6d9..fa4451b 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -50,7 +50,7 @@ struct QCMakeProperty
};
// list of properties
-typedef QList<QCMakeProperty> QCMakePropertyList;
+using QCMakePropertyList = QList<QCMakeProperty>;
// allow QVariant to be a property or list of properties
Q_DECLARE_METATYPE(QCMakeProperty)
diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx
index fa5e4b9..a6d89aa 100644
--- a/Source/cmAffinity.cxx
+++ b/Source/cmAffinity.cxx
@@ -22,7 +22,7 @@
# if defined(__linux__)
using cm_cpuset_t = cpu_set_t;
# else
-typedef cpuset_t cm_cpuset_t;
+using cm_cpuset_t = cpuset_t;
# endif
# endif
#endif
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index 93032c1..aa2827e 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -22,7 +22,7 @@ private:
std::string GetEnv(std::string const& key);
void SetEnv(std::string const& key, std::string const& value);
- typedef std::map<std::string, std::string> backup_map_t;
+ using backup_map_t = std::map<std::string, std::string>;
backup_map_t EnvironmentBackup;
};
diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h
index adc57a2..6a95148 100644
--- a/Source/cmCPluginAPI.h
+++ b/Source/cmCPluginAPI.h
@@ -28,6 +28,7 @@ this is the structure of function entry points that a plugin may call. This
structure must be kept in sync with the static decaled at the bottom of
cmCPLuginAPI.cxx
=========================================================================*/
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef struct
{
/*=========================================================================
@@ -194,12 +195,21 @@ define the different types of custom commands for a target
/*=========================================================================
Finally we define the key data structures and function prototypes
=========================================================================*/
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef const char*(CCONV* CM_DOC_FUNCTION)();
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef int(CCONV* CM_INITIAL_PASS_FUNCTION)(void* info, void* mf, int argc,
char* []);
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef void(CCONV* CM_FINAL_PASS_FUNCTION)(void* info, void* mf);
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef void(CCONV* CM_DESTRUCTOR_FUNCTION)(void* info);
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef struct
{
unsigned long reserved1; /* Reserved for future use. DO NOT USE. */
@@ -216,6 +226,7 @@ typedef struct
void* ClientData;
} cmLoadedCommandInfo;
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef void(CCONV* CM_INIT_FUNCTION)(cmLoadedCommandInfo*);
#ifdef __cplusplus
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 65f22f7..a988bd8 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -212,7 +212,7 @@ protected:
unsigned int CacheMinorVersion;
private:
- typedef std::map<std::string, CacheEntry> CacheEntryMap;
+ using CacheEntryMap = std::map<std::string, CacheEntry>;
static void OutputHelpString(std::ostream& fout,
const std::string& helpString);
static void OutputWarningComment(std::ostream& fout,
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 49db505..54443f2 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -90,7 +90,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
if (var) {
this->LocalCommonGenerator->AppendFlags(
- flags, this->Makefile->GetDefinition(var));
+ flags, this->Makefile->GetSafeDefinition(var));
}
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 6b0f74e..17792d6 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -50,7 +50,7 @@ protected:
void AppendOSXVerFlag(std::string& flags, const std::string& lang,
const char* name, bool so);
- typedef std::map<std::string, std::string> ByLanguageMap;
+ using ByLanguageMap = std::map<std::string, std::string>;
std::string GetFlags(const std::string& l);
ByLanguageMap FlagsByLanguage;
std::string GetDefines(const std::string& l);
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 9a6f239..102b178 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -68,7 +68,7 @@ public:
/** Backtrace of the command that created this custom command. */
cmListFileBacktrace const& GetBacktrace() const;
- typedef std::pair<std::string, std::string> ImplicitDependsPair;
+ using ImplicitDependsPair = std::pair<std::string, std::string>;
class ImplicitDependsList : public std::vector<ImplicitDependsPair>
{
};
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index b7475f0..d938775 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -24,7 +24,7 @@ class cmLocalGenerator;
class cmDepends
{
public:
- typedef std::map<std::string, std::vector<std::string>> DependencyMap;
+ using DependencyMap = std::map<std::string, std::vector<std::string>>;
public:
/** Instances need to know the build directory name and the relative
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 3fc839e..cbdc276 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -59,7 +59,7 @@ protected:
// Regex to transform #include lines.
std::string IncludeRegexTransformString;
cmsys::RegularExpression IncludeRegexTransform;
- typedef std::map<std::string, std::string> TransformRulesType;
+ using TransformRulesType = std::map<std::string, std::string>;
TransformRulesType TransformRules;
void SetupTransforms();
void ParseTransform(std::string const& xform);
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 8df9938..c30e0bf 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -46,11 +46,11 @@ public:
std::set<std::string> TargetProvides;
// Map modules required by this target to locations.
- typedef std::map<std::string, std::string> TargetRequiresMap;
+ using TargetRequiresMap = std::map<std::string, std::string>;
TargetRequiresMap TargetRequires;
// Information about each object file.
- typedef std::map<std::string, cmFortranSourceInfo> ObjectInfoMap;
+ using ObjectInfoMap = std::map<std::string, cmFortranSourceInfo>;
ObjectInfoMap ObjectInfo;
cmFortranSourceInfo& CreateObjectInfo(const std::string& obj,
diff --git a/Source/cmDuration.h b/Source/cmDuration.h
index 6df1455..ccd1cc1 100644
--- a/Source/cmDuration.h
+++ b/Source/cmDuration.h
@@ -5,7 +5,7 @@
#include <chrono>
#include <ratio>
-typedef std::chrono::duration<double, std::ratio<1>> cmDuration;
+using cmDuration = std::chrono::duration<double, std::ratio<1>>;
/*
* This function will return number of seconds in the requested type T.
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 425f1a8..648a900 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -20,11 +20,11 @@
#elif defined(__HAIKU__)
# include <elf32.h>
# include <elf64.h>
-typedef struct Elf32_Ehdr Elf32_Ehdr;
-typedef struct Elf32_Shdr Elf32_Shdr;
-typedef struct Elf32_Sym Elf32_Sym;
-typedef struct Elf32_Rel Elf32_Rel;
-typedef struct Elf32_Rela Elf32_Rela;
+using Elf32_Ehdr = struct Elf32_Ehdr;
+using Elf32_Shdr = struct Elf32_Shdr;
+using Elf32_Sym = struct Elf32_Sym;
+using Elf32_Rel = struct Elf32_Rel;
+using Elf32_Rela = struct Elf32_Rela;
# define ELFMAG0 0x7F
# define ELFMAG1 'E'
# define ELFMAG2 'L'
@@ -289,9 +289,8 @@ public:
}
private:
- // ByteSwap(ELF_Dyn) assumes d_val and d_ptr are the same size
- typedef char dyn_size_assert
- [sizeof(ELF_Dyn().d_un.d_val) == sizeof(ELF_Dyn().d_un.d_ptr) ? 1 : -1];
+ static_assert(sizeof(ELF_Dyn().d_un.d_val) == sizeof(ELF_Dyn().d_un.d_ptr),
+ "ByteSwap(ELF_Dyn) assumes d_val and d_ptr are the same size");
void ByteSwap(ELF_Ehdr& elf_header)
{
diff --git a/Source/cmELF.h b/Source/cmELF.h
index afef654..123bf9b 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -68,7 +68,7 @@ public:
};
/** Represent entire dynamic section header */
- typedef std::vector<std::pair<long, unsigned long>> DynamicEntryList;
+ using DynamicEntryList = std::vector<std::pair<long, unsigned long>>;
/** Get the type of the file opened. */
FileType GetFileType() const;
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 747503e..6fa86ab 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -62,7 +62,7 @@ public:
bool GenerateImportFile();
protected:
- typedef std::map<std::string, std::string> ImportPropertyMap;
+ using ImportPropertyMap = std::map<std::string, std::string>;
// Generate per-configuration target information to the given output
// stream.
diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h
index 3853732..0ef07ef 100644
--- a/Source/cmExportSetMap.h
+++ b/Source/cmExportSetMap.h
@@ -13,7 +13,7 @@ class cmExportSet;
/// A name -> cmExportSet map with overloaded operator[].
class cmExportSetMap : public std::map<std::string, cmExportSet*>
{
- typedef std::map<std::string, cmExportSet*> derived;
+ using derived = std::map<std::string, cmExportSet*>;
public:
/** \brief Overloaded operator[].
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 6b16b93..5a9c54c 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -333,7 +333,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// Collect all used source files in the project.
// Keep a list of C/C++ source files which might have an accompanying header
// that should be looked for.
- typedef std::map<std::string, CbpUnit> all_files_map_t;
+ using all_files_map_t = std::map<std::string, CbpUnit>;
all_files_map_t allFiles;
std::vector<std::string> cFiles;
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index bc158f6..d9ef1d1 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -24,7 +24,7 @@ class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
{
public:
static cmExternalMakefileProjectGeneratorFactory* GetFactory();
- typedef std::map<std::string, std::vector<std::string>> MapSourceFileFlags;
+ using MapSourceFileFlags = std::map<std::string, std::vector<std::string>>;
cmExtraSublimeTextGenerator();
void Generate() override;
diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h
index c452814..81c1906 100644
--- a/Source/cmFileLockResult.h
+++ b/Source/cmFileLockResult.h
@@ -19,7 +19,7 @@ class cmFileLockResult
{
public:
#if defined(_WIN32)
- typedef DWORD Error;
+ using Error = DWORD;
#else
using Error = int;
#endif
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 133a72b..32eb3cd 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -370,9 +370,8 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
{
- typedef std::map<cmGeneratorTarget const*,
- std::map<std::string, std::string>>
- MapType;
+ using MapType =
+ std::map<cmGeneratorTarget const*, std::map<std::string, std::string>>;
MapType::const_iterator it = this->MaxLanguageStandard.find(tgt);
if (it != this->MaxLanguageStandard.end()) {
mapping = it->second;
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 667f4a0..89b6c1c 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1473,7 +1473,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
}
context->HadHeadSensitiveCondition = true;
- typedef std::map<std::string, std::vector<std::string>> LangMap;
+ using LangMap = std::map<std::string, std::vector<std::string>>;
static LangMap availableFeatures;
LangMap testedFeatures;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 48ffcec..b4706a3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1107,7 +1107,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
config_upper = cmSystemTools::UpperCase(config);
}
- typedef std::map<std::string, std::vector<std::string>> IncludeCacheType;
+ using IncludeCacheType = std::map<std::string, std::vector<std::string>>;
IncludeCacheType::const_iterator iter =
this->SystemIncludesCache.find(config_upper);
@@ -2606,7 +2606,7 @@ private:
SourceEntry* CurrentEntry;
std::queue<cmSourceFile*> SourceQueue;
std::set<cmSourceFile*> SourcesQueued;
- typedef std::map<std::string, cmSourceFile*> NameMapType;
+ using NameMapType = std::map<std::string, cmSourceFile*>;
NameMapType NameMap;
std::vector<std::string> NewSources;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 4701071..9eb2ecf 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -531,7 +531,7 @@ public:
CompileInfo const* GetCompileInfo(const std::string& config) const;
- typedef std::map<std::string, CompileInfo> CompileInfoMapType;
+ using CompileInfoMapType = std::map<std::string, CompileInfo>;
mutable CompileInfoMapType CompileInfoMap;
bool IsNullImpliedByLinkLibraries(const std::string& p) const;
@@ -745,7 +745,7 @@ private:
{
std::vector<cmSourceFile*> Depends;
};
- typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
+ using SourceEntriesType = std::map<cmSourceFile const*, SourceEntry>;
SourceEntriesType SourceDepends;
mutable std::map<cmSourceFile const*, std::string> Objects;
std::set<cmSourceFile const*> ExplicitObjectName;
@@ -775,7 +775,7 @@ private:
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
- typedef std::map<std::string, LinkClosure> LinkClosureMapType;
+ using LinkClosureMapType = std::map<std::string, LinkClosure>;
mutable LinkClosureMapType LinkClosureMap;
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
@@ -802,8 +802,8 @@ private:
};
mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
- typedef std::map<std::string, cmComputeLinkInformation*>
- cmTargetLinkInformationMap;
+ using cmTargetLinkInformationMap =
+ std::map<std::string, cmComputeLinkInformation*>;
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation* info,
@@ -815,7 +815,7 @@ private:
};
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
- typedef std::map<std::string, cmHeadToLinkInterfaceMap> LinkInterfaceMapType;
+ using LinkInterfaceMapType = std::map<std::string, cmHeadToLinkInterfaceMap>;
mutable LinkInterfaceMapType LinkInterfaceMap;
mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
@@ -843,7 +843,7 @@ private:
std::string SharedDeps;
};
- typedef std::map<std::string, ImportInfo> ImportInfoMapType;
+ using ImportInfoMapType = std::map<std::string, ImportInfo>;
mutable ImportInfoMapType ImportInfoMap;
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
@@ -857,7 +857,7 @@ private:
const std::string& config, const cmGeneratorTarget* head,
bool usage_requirements_only) const;
- typedef std::map<std::string, KindedSources> KindedSourcesMapType;
+ using KindedSourcesMapType = std::map<std::string, KindedSources>;
mutable KindedSourcesMapType KindedSourcesMap;
void ComputeKindedSources(KindedSources& files,
std::string const& config) const;
@@ -902,7 +902,7 @@ private:
: public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation>
{
};
- typedef std::map<std::string, HeadToLinkImplementationMap> LinkImplMapType;
+ using LinkImplMapType = std::map<std::string, HeadToLinkImplementationMap>;
mutable LinkImplMapType LinkImplMap;
cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
@@ -911,17 +911,17 @@ private:
cmStateEnums::ArtifactType artifact,
std::string& out) const;
- typedef std::map<std::string, OutputInfo> OutputInfoMapType;
+ using OutputInfoMapType = std::map<std::string, OutputInfo>;
mutable OutputInfoMapType OutputInfoMap;
- typedef std::map<std::string, ModuleDefinitionInfo>
- ModuleDefinitionInfoMapType;
+ using ModuleDefinitionInfoMapType =
+ std::map<std::string, ModuleDefinitionInfo>;
mutable ModuleDefinitionInfoMapType ModuleDefinitionInfoMap;
void ComputeModuleDefinitionInfo(std::string const& config,
ModuleDefinitionInfo& info) const;
- typedef std::pair<std::string, cmStateEnums::ArtifactType> OutputNameKey;
- typedef std::map<OutputNameKey, std::string> OutputNameMapType;
+ using OutputNameKey = std::pair<std::string, cmStateEnums::ArtifactType>;
+ using OutputNameMapType = std::map<OutputNameKey, std::string>;
mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
cmPolicies::PolicyMap PolicyMap;
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index 48606d3..e03d939 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -72,7 +72,7 @@ private:
std::vector<std::pair<std::string, cmListFileBacktrace>> Backtraces;
};
- typedef std::map<CacheEntryKey, CacheEntryValue> CacheEntryMap;
+ using CacheEntryMap = std::map<CacheEntryKey, CacheEntryValue>;
CacheEntryMap Cache;
std::string VerifyScript;
std::string VerifyStamp;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 36e5d0e..d67c725 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -561,11 +561,11 @@ protected:
const char* GetPredefinedTargetsFolder();
private:
- typedef std::unordered_map<std::string, cmTarget*> TargetMap;
- typedef std::unordered_map<std::string, cmGeneratorTarget*>
- GeneratorTargetMap;
- typedef std::unordered_map<std::string, cmMakefile*> MakefileMap;
- typedef std::unordered_map<std::string, cmLocalGenerator*> LocalGeneratorMap;
+ using TargetMap = std::unordered_map<std::string, cmTarget*>;
+ using GeneratorTargetMap =
+ std::unordered_map<std::string, cmGeneratorTarget*>;
+ using MakefileMap = std::unordered_map<std::string, cmMakefile*>;
+ using LocalGeneratorMap = std::unordered_map<std::string, cmLocalGenerator*>;
// Map efficiently from target name to cmTarget instance.
// Do not use this structure for looping over all targets.
// It contains both normal and globally visible imported targets.
@@ -626,7 +626,7 @@ private:
std::vector<std::string> FilesReplacedDuringGenerate;
// Store computed inter-target dependencies.
- typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
+ using TargetDependMap = std::map<cmGeneratorTarget const*, TargetDependSet>;
TargetDependMap TargetDependencies;
friend class cmake;
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 9b5bf63..e58e65e 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -148,9 +148,8 @@ class cmGlobalGhsMultiGenerator::OrderedTargetDependSet
: public std::multiset<cmTargetDepend,
cmGlobalGhsMultiGenerator::TargetCompare>
{
- typedef std::multiset<cmTargetDepend,
- cmGlobalGhsMultiGenerator::TargetCompare>
- derived;
+ using derived =
+ std::multiset<cmTargetDepend, cmGlobalGhsMultiGenerator::TargetCompare>;
public:
using TargetDependSet = cmGlobalGenerator::TargetDependSet;
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index db64031..f6d5998 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -426,7 +426,7 @@ private:
/// The mapping from source file to assumed dependencies.
std::map<std::string, std::set<std::string>> AssumedSourceDependencies;
- typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
+ using TargetAliasMap = std::map<std::string, cmGeneratorTarget*>;
TargetAliasMap TargetAliases;
std::map<cmGeneratorTarget const*, cmNinjaOuts> TargetDependsClosures;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 287472c..264de54 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -220,9 +220,8 @@ protected:
std::vector<unsigned long> Marks;
void WriteProgressVariables(unsigned long total, unsigned long& current);
};
- typedef std::map<cmGeneratorTarget const*, TargetProgress,
- cmGeneratorTarget::StrictTargetComparison>
- ProgressMapType;
+ using ProgressMapType = std::map<cmGeneratorTarget const*, TargetProgress,
+ cmGeneratorTarget::StrictTargetComparison>;
ProgressMapType ProgressMap;
size_t CountProgressMarksInTarget(
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index e4cd73f..bd615ec 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -180,7 +180,7 @@ protected:
const std::string&);
virtual std::string WriteUtilityDepend(cmGeneratorTarget const*) = 0;
std::string GetUtilityDepend(const cmGeneratorTarget* target);
- typedef std::map<cmGeneratorTarget const*, std::string> UtilityDependsMap;
+ using UtilityDependsMap = std::map<cmGeneratorTarget const*, std::string>;
UtilityDependsMap UtilityDepends;
protected:
@@ -213,13 +213,12 @@ class cmGlobalVisualStudioGenerator::OrderedTargetDependSet
: public std::multiset<cmTargetDepend,
cmGlobalVisualStudioGenerator::TargetCompare>
{
- typedef std::multiset<cmTargetDepend,
- cmGlobalVisualStudioGenerator::TargetCompare>
- derived;
+ using derived = std::multiset<cmTargetDepend,
+ cmGlobalVisualStudioGenerator::TargetCompare>;
public:
- typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
- typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
+ using TargetDependSet = cmGlobalGenerator::TargetDependSet;
+ using TargetSet = cmGlobalVisualStudioGenerator::TargetSet;
OrderedTargetDependSet(TargetDependSet const&, std::string const& first);
OrderedTargetDependSet(TargetSet const&, std::string const& first);
};
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 427ab44..10f822f 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1244,8 +1244,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
// framework or bundle targets
std::vector<cmXCodeObject*> contentBuildPhases;
if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
- typedef std::map<std::string, std::vector<cmSourceFile*>>
- mapOfVectorOfSourceFiles;
+ using mapOfVectorOfSourceFiles =
+ std::map<std::string, std::vector<cmSourceFile*>>;
mapOfVectorOfSourceFiles bundleFiles;
for (auto sourceFile : classes) {
cmGeneratorTarget::SourceFileFlags tsFlags =
@@ -1292,8 +1292,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
// create vector of "resource content file" build phases - only for
// framework or bundle targets
if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
- typedef std::map<std::string, std::vector<cmSourceFile*>>
- mapOfVectorOfSourceFiles;
+ using mapOfVectorOfSourceFiles =
+ std::map<std::string, std::vector<cmSourceFile*>>;
mapOfVectorOfSourceFiles bundleFiles;
for (auto sourceFile : classes) {
cmGeneratorTarget::SourceFileFlags tsFlags =
@@ -2839,6 +2839,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(
continue;
}
+ generator->AddUnityBuild(gtgt, "");
generator->AddPchDependencies(gtgt, "");
auto addSourceToGroup = [this, mf, gtgt,
@@ -3048,7 +3049,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateObject(cmXCodeObject::XCConfigurationList);
cmXCodeObject* buildConfigurations =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
- typedef std::vector<std::pair<std::string, cmXCodeObject*>> Configs;
+ using Configs = std::vector<std::pair<std::string, cmXCodeObject*>>;
Configs configs;
std::string defaultConfigName;
for (const auto& name : this->CurrentConfigurationTypes) {
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index 4a43073..f949ae3 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -51,7 +51,7 @@ protected:
// and overwrite or add new values to this map
class FlagValue : public std::vector<std::string>
{
- typedef std::vector<std::string> derived;
+ using derived = std::vector<std::string>;
public:
FlagValue& operator=(std::string const& r)
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index e00e666..ee809ee 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -37,7 +37,7 @@ public:
ExpressionVectorType ValueExpressions;
};
- typedef std::map<std::string, Property> PropertyMapType;
+ using PropertyMapType = std::map<std::string, Property>;
cmInstalledFile();
diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h
index 8962396..ec6b3cd 100644
--- a/Source/cmListFileLexer.h
+++ b/Source/cmListFileLexer.h
@@ -3,6 +3,11 @@
#ifndef cmListFileLexer_h
#define cmListFileLexer_h
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef enum cmListFileLexer_Type_e
{
cmListFileLexer_Token_None,
@@ -20,6 +25,7 @@ typedef enum cmListFileLexer_Type_e
cmListFileLexer_Token_BadString
} cmListFileLexer_Type;
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef struct cmListFileLexer_Token_s cmListFileLexer_Token;
struct cmListFileLexer_Token_s
{
@@ -40,14 +46,13 @@ enum cmListFileLexer_BOM_e
cmListFileLexer_BOM_UTF32BE,
cmListFileLexer_BOM_UTF32LE
};
+
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef enum cmListFileLexer_BOM_e cmListFileLexer_BOM;
+/* NOLINTNEXTLINE(modernize-use-using) */
typedef struct cmListFileLexer_s cmListFileLexer;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
cmListFileLexer* cmListFileLexer_New(void);
int cmListFileLexer_SetFileName(cmListFileLexer*, const char*,
cmListFileLexer_BOM* bom);
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 7c36bdc..f86955d 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -35,10 +35,8 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
std::string flags;
// Enable module output if necessary.
- if (const char* modout_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
- this->AppendFlags(flags, modout_flag);
- }
+ this->AppendFlags(
+ flags, this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODOUT_FLAG"));
// Add a module output directory flag if necessary.
std::string mod_dir =
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ee0d4da..25e4d01 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -39,6 +39,7 @@
#include <algorithm>
#include <assert.h>
+#include <cstdlib>
#include <functional>
#include <initializer_list>
#include <iterator>
@@ -1125,10 +1126,10 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
}
}
- this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
+ this->AppendFlags(flags, target->GetSafeProperty("STATIC_LIBRARY_FLAGS"));
if (!config.empty()) {
std::string name = "STATIC_LIBRARY_FLAGS_" + config;
- this->AppendFlags(flags, target->GetProperty(name));
+ this->AppendFlags(flags, target->GetSafeProperty(name));
}
std::vector<std::string> options;
@@ -1750,7 +1751,7 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
// Add flags for dealing with shared libraries for this language.
if (shared) {
this->AppendFlags(flags,
- this->Makefile->GetDefinition(
+ this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
}
}
@@ -2096,12 +2097,12 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
{
// Add the flags from the variable itself.
std::string flagsVar = var;
- this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
+ this->AppendFlags(flags, this->Makefile->GetSafeDefinition(flagsVar));
// Add the flags from the build-type specific variable.
if (!config.empty()) {
flagsVar += "_";
flagsVar += cmSystemTools::UpperCase(config);
- this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
+ this->AppendFlags(flags, this->Makefile->GetSafeDefinition(flagsVar));
}
}
@@ -2116,14 +2117,6 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
}
}
-void cmLocalGenerator::AppendFlags(std::string& flags,
- const char* newFlags) const
-{
- if (newFlags && *newFlags) {
- this->AppendFlags(flags, std::string(newFlags));
- }
-}
-
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const
{
@@ -2206,6 +2199,101 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
}
}
+void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target,
+ const std::string& config)
+{
+ if (!target->GetPropertyAsBool("UNITY_BUILD")) {
+ return;
+ }
+
+ const std::string buildType = cmSystemTools::UpperCase(config);
+
+ std::string filename_base =
+ cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/",
+ target->GetName(), ".dir/Unity/");
+
+ std::vector<cmSourceFile*> sources;
+ target->GetSourceFiles(sources, buildType);
+
+ auto batchSizeString = target->GetProperty("UNITY_BUILD_BATCH_SIZE");
+ const size_t unityBatchSize =
+ static_cast<size_t>(std::atoi(batchSizeString));
+
+ auto beforeInclude = target->GetProperty("UNITY_BUILD_CODE_BEFORE_INCLUDE");
+ auto afterInclude = target->GetProperty("UNITY_BUILD_CODE_AFTER_INCLUDE");
+
+ for (std::string lang : { "C", "CXX" }) {
+ std::vector<cmSourceFile*> filtered_sources;
+ std::copy_if(sources.begin(), sources.end(),
+ std::back_inserter(filtered_sources), [&](cmSourceFile* sf) {
+ return sf->GetLanguage() == lang &&
+ !sf->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION") &&
+ !sf->GetPropertyAsBool("GENERATED") &&
+ !sf->GetProperty("COMPILE_OPTIONS") &&
+ !sf->GetProperty("COMPILE_DEFINITIONS") &&
+ !sf->GetProperty("COMPILE_FLAGS") &&
+ !sf->GetProperty("INCLUDE_DIRECTORIES");
+ });
+
+ size_t batchSize = unityBatchSize;
+ if (unityBatchSize == 0) {
+ batchSize = filtered_sources.size();
+ }
+
+ for (size_t itemsLeft = filtered_sources.size(), chunk = batchSize,
+ batch = 0;
+ itemsLeft > 0; itemsLeft -= chunk, ++batch) {
+
+ chunk = std::min(itemsLeft, batchSize);
+
+ std::string filename = cmStrCat(filename_base, "unity_", batch,
+ (lang == "C") ? ".c" : ".cxx");
+
+ const std::string filename_tmp = cmStrCat(filename, ".tmp");
+ {
+ size_t begin = batch * batchSize;
+ size_t end = begin + chunk;
+
+ cmGeneratedFileStream file(
+ filename_tmp, false,
+ this->GetGlobalGenerator()->GetMakefileEncoding());
+ file << "/* generated by CMake */\n\n";
+
+ for (; begin != end; ++begin) {
+ cmSourceFile* sf = filtered_sources[begin];
+
+ // Only in Visual Studio generator we keep the source files
+ // for explicit processing. For the rest the source files will
+ // not be included in the project.
+ if (!this->GetGlobalGenerator()->IsMultiConfig() ||
+ this->GetGlobalGenerator()->IsXcode()) {
+ sf->SetProperty("HEADER_FILE_ONLY", "ON");
+ }
+ sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
+
+ if (beforeInclude) {
+ file << beforeInclude << "\n";
+ }
+
+ file << "#include \"" << sf->GetFullPath() << "\"\n";
+
+ if (afterInclude) {
+ file << afterInclude << "\n";
+ }
+ }
+ }
+ cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
+ cmSystemTools::RemoveFile(filename_tmp);
+
+ target->AddSource(filename, true);
+
+ auto unity = this->Makefile->GetOrCreateSource(filename);
+ unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON");
+ unity->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
+ }
+ }
+}
+
void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
const std::string& config,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f63fe0f..e6ba333 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -121,11 +121,11 @@ public:
//! Append flags to a string.
virtual void AppendFlags(std::string& flags,
const std::string& newFlags) const;
- virtual void AppendFlags(std::string& flags, const char* newFlags) const;
virtual void AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const;
void AddPchDependencies(cmGeneratorTarget* target,
const std::string& config);
+ void AddUnityBuild(cmGeneratorTarget* target, const std::string& config);
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
@@ -433,8 +433,8 @@ protected:
std::set<std::string> EnvCPATH;
- typedef std::unordered_map<std::string, cmGeneratorTarget*>
- GeneratorTargetMap;
+ using GeneratorTargetMap =
+ std::unordered_map<std::string, cmGeneratorTarget*>;
GeneratorTargetMap GeneratorTargetSearchIndex;
std::vector<cmGeneratorTarget*> GeneratorTargets;
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 3a30bbb..08bec70 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -109,8 +109,8 @@ private:
std::string HomeRelativeOutputPath;
- typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*>>
- CustomCommandTargetMap;
+ using CustomCommandTargetMap =
+ std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*>>;
CustomCommandTargetMap CustomCommandTargets;
std::vector<cmCustomCommand const*> CustomCommands;
};
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 106e506..320a58b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -831,12 +831,6 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(
this->cmLocalGenerator::AppendFlags(flags, newFlags);
}
-void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
- const char* newFlags) const
-{
- this->cmLocalGenerator::AppendFlags(flags, newFlags);
-}
-
void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
std::vector<std::string>& depends, const char* ruleFileName)
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index c8e4b0e..745e251 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -90,7 +90,6 @@ public:
// append flags to a string
void AppendFlags(std::string& flags,
const std::string& newFlags) const override;
- void AppendFlags(std::string& flags, const char* newFlags) const override;
// append an echo command
enum EchoColor
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 357ccc8..6c7fb2b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -30,7 +30,7 @@ public:
: LocalGenerator(e)
{
}
- typedef cmComputeLinkInformation::ItemVector ItemVector;
+ using ItemVector = cmComputeLinkInformation::ItemVector;
void OutputLibraries(std::ostream& fout, ItemVector const& libs);
void OutputObjects(std::ostream& fout, cmGeneratorTarget* t,
std::string const& config, const char* isep = 0);
@@ -1321,6 +1321,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
const std::string& libName,
cmGeneratorTarget* target)
{
+ this->AddUnityBuild(target, "");
this->AddPchDependencies(target, "");
std::vector<std::string> configs;
@@ -1509,8 +1510,11 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
const std::string& linkLanguage = gt->GetLinkerLanguage(config.c_str());
// If HEADER_FILE_ONLY is set, we must suppress this generation in
// the project file
- fc.ExcludedFromBuild =
- sf.GetPropertyAsBool("HEADER_FILE_ONLY") || !cmContains(acs.Configs, ci);
+ fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") ||
+ !cmContains(acs.Configs, ci) ||
+ (gt->GetPropertyAsBool("UNITY_BUILD") &&
+ sf.GetProperty("UNITY_SOURCE_FILE") &&
+ !sf.GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION"));
if (fc.ExcludedFromBuild) {
needfc = true;
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index ce8eceb..671783f 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -83,8 +83,8 @@ protected:
void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
private:
- typedef cmVS7GeneratorOptions Options;
- typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
+ using Options = cmVS7GeneratorOptions;
+ using FCInfo = cmLocalVisualStudio7GeneratorFCInfo;
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const std::string& configName);
void FixGlobalTargets();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index dfe0086..411add3 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2744,12 +2744,13 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
return mtype;
}
-typedef enum
+enum t_domain
{
NORMAL,
ENVIRONMENT,
CACHE
-} t_domain;
+};
+
struct t_lookup
{
t_domain domain = NORMAL;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index bebd5c4..e44ca7b 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -41,6 +41,7 @@ cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
+ this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
}
@@ -134,7 +135,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
std::string export_flag_var =
cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG");
this->LocalGenerator->AppendFlags(
- linkFlags, this->Makefile->GetDefinition(export_flag_var));
+ linkFlags, this->Makefile->GetSafeDefinition(export_flag_var));
}
this->LocalGenerator->AppendFlags(linkFlags,
@@ -386,10 +387,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) {
this->LocalGenerator->AppendFlags(
- linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE"));
+ linkFlags, this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"));
} else {
this->LocalGenerator->AppendFlags(
- linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_CONSOLE_EXE"));
+ linkFlags,
+ this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"));
}
// Add symbol export flags if necessary.
@@ -397,7 +399,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string export_flag_var =
cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG");
this->LocalGenerator->AppendFlags(
- linkFlags, this->Makefile->GetDefinition(export_flag_var));
+ linkFlags, this->Makefile->GetSafeDefinition(export_flag_var));
}
this->LocalGenerator->AppendFlags(linkFlags,
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index d51bba4..36f6809 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -43,6 +43,7 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
+ this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4a60aa9..1f6986b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -89,12 +89,12 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
std::string& flags, const std::string& linkLanguage)
{
this->LocalGenerator->AppendFlags(
- flags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+ flags, this->GeneratorTarget->GetSafeProperty("LINK_FLAGS"));
std::string linkFlagsConfig =
cmStrCat("LINK_FLAGS_", cmSystemTools::UpperCase(this->ConfigName));
this->LocalGenerator->AppendFlags(
- flags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+ flags, this->GeneratorTarget->GetSafeProperty(linkFlagsConfig));
std::vector<std::string> opts;
this->GeneratorTarget->GetLinkOptions(opts, this->ConfigName, linkLanguage);
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 9eeeed0..f464128 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -223,7 +223,7 @@ protected:
// Set of extra output files to be driven by the build.
std::set<std::string> ExtraFiles;
- typedef std::map<std::string, std::string> MultipleOutputPairsType;
+ using MultipleOutputPairsType = std::map<std::string, std::string>;
MultipleOutputPairsType MultipleOutputPairs;
bool WriteMakeRule(std::ostream& os, const char* comment,
const std::vector<std::string>& outputs,
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 556191f..d4045b3 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -26,6 +26,7 @@ cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
+ this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6c23846..bc2506e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -61,6 +61,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
cm::make_unique<cmOSXBundleGenerator>(target, this->GetConfigName());
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
+ GetLocalGenerator()->AddUnityBuild(target, this->GetConfigName());
GetLocalGenerator()->AddPchDependencies(target, this->GetConfigName());
}
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index 89afbbd..bd0e83f 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -19,7 +19,7 @@ enum cmNinjaTargetDepends
using cmNinjaDeps = std::vector<std::string>;
using cmNinjaOuts = std::set<std::string>;
-typedef std::map<std::string, std::string> cmNinjaVars;
+using cmNinjaVars = std::map<std::string, std::string>;
class cmNinjaRule
{
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 21a17e8..35ec33e 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -412,7 +412,7 @@ void cmOrderDirectories::AddOriginalDirectories(
struct cmOrderDirectoriesCompare
{
- typedef std::pair<int, int> ConflictPair;
+ using ConflictPair = std::pair<int, int>;
// The conflict pair is unique based on just the directory
// (first). The second element is only used for displaying
@@ -557,7 +557,7 @@ std::string const& cmOrderDirectories::GetRealPath(std::string const& dir)
this->RealPaths.lower_bound(dir);
if (i == this->RealPaths.end() ||
this->RealPaths.key_comp()(dir, i->first)) {
- typedef std::map<std::string, std::string>::value_type value_type;
+ using value_type = std::map<std::string, std::string>::value_type;
i = this->RealPaths.insert(
i, value_type(dir, cmSystemTools::GetRealPath(dir)));
}
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 23e61d6..2dfc4d1 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -75,7 +75,7 @@ private:
// the index of the directory that must come first. The second
// element is the index of the runtime library that added the
// constraint.
- typedef std::pair<int, int> ConflictPair;
+ using ConflictPair = std::pair<int, int>;
struct ConflictList : public std::vector<ConflictPair>
{
};
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 1a854dc..c034fdd 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -446,10 +446,10 @@ protected:
cmsys::RegularExpression IncludeFileRegularExpression;
cmsys::RegularExpression ComplainFileRegularExpression;
std::vector<std::string> IncludeDirectories;
- typedef std::map<std::string, std::string> FileToPathMapType;
- typedef std::map<std::string, FileToPathMapType>
- DirectoryToFileToPathMapType;
- typedef std::map<std::string, cmDependInformation*> DependInformationMapType;
+ using FileToPathMapType = std::map<std::string, std::string>;
+ using DirectoryToFileToPathMapType =
+ std::map<std::string, FileToPathMapType>;
+ using DependInformationMapType = std::map<std::string, cmDependInformation*>;
DependInformationMapType DependInformationMap;
DirectoryToFileToPathMapType DirectoryToFileToPathMap;
};
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 3ed4c05..a3d4946 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -66,7 +66,7 @@ std::vector<std::string> cmPropertyMap::GetKeys() const
std::vector<std::pair<std::string, std::string>> cmPropertyMap::GetList() const
{
- typedef std::pair<std::string, std::string> StringPair;
+ using StringPair = std::pair<std::string, std::string>;
std::vector<StringPair> kvList;
kvList.reserve(Map_.size());
for (auto const& item : Map_) {
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 84359f2..14329c0 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1237,7 +1237,7 @@ std::pair<std::string, cmFileTime>
cmQtAutoMocUic::JobGenerateT::MocFindDependency(
std::string const& sourceDir, std::string const& includeString) const
{
- typedef std::pair<std::string, cmFileTime> ResPair;
+ using ResPair = std::pair<std::string, cmFileTime>;
// Search in vicinity of the source
{
ResPair res{ sourceDir + includeString, {} };
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 076e460..549b088 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -107,7 +107,7 @@ public:
} Uic;
};
using FileHandleT = std::shared_ptr<FileT>;
- typedef std::pair<FileHandleT, bool> GetOrInsertT;
+ using GetOrInsertT = std::pair<FileHandleT, bool>;
public:
ParseCacheT();
@@ -147,7 +147,7 @@ public:
bool Uic = false;
};
using SourceFileHandleT = std::shared_ptr<SourceFileT>;
- typedef std::map<std::string, SourceFileHandleT> SourceFileMapT;
+ using SourceFileMapT = std::map<std::string, SourceFileHandleT>;
/**
* Meta compiler file mapping information
@@ -160,7 +160,7 @@ public:
std::vector<SourceFileHandleT> IncluderFiles;
};
using MappingHandleT = std::shared_ptr<MappingT>;
- typedef std::map<std::string, MappingHandleT> MappingMapT;
+ using MappingMapT = std::map<std::string, MappingHandleT>;
/**
* Common settings
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 45438a9..87a6114 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -40,7 +40,7 @@ public:
cmExecutionStatus& status) override;
private:
- typedef std::map<std::string, std::vector<std::string>> ParsedArguments;
+ using ParsedArguments = std::map<std::string, std::vector<std::string>>;
using ExpectedOptions = std::vector<std::string>;
ExpectedOptions getExpectedOptions() const;
diff --git a/Source/cmString.hxx b/Source/cmString.hxx
index 050a2fd..a401ad1 100644
--- a/Source/cmString.hxx
+++ b/Source/cmString.hxx
@@ -725,7 +725,7 @@ struct StringAdd
template <typename L, typename R>
struct StringAdd<StringOpPlus<L, R>> : std::true_type
{
- typedef StringOpPlus<L, R> const& temp_type;
+ using temp_type = StringOpPlus<L, R> const&;
static temp_type temp(temp_type s) { return s; }
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 2a09b43..10ea7dd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -352,6 +352,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");
initProp("DISABLE_PRECOMPILE_HEADERS");
+ initProp("UNITY_BUILD");
+ initPropValue("UNITY_BUILD_BATCH_SIZE", "8");
#ifdef __APPLE__
if (this->GetGlobalGenerator()->IsXcode()) {
initProp("XCODE_GENERATE_SCHEME");
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index fa420af..e9bcffe 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -107,7 +107,7 @@ public:
cmSourceFile* AddSource(const std::string& src, bool before = false);
//! how we identify a library, by name and type
- typedef std::pair<std::string, cmTargetLinkLibraryType> LibraryID;
+ using LibraryID = std::pair<std::string, cmTargetLinkLibraryType>;
using LinkLibraryVectorType = std::vector<LibraryID>;
LinkLibraryVectorType const& GetOriginalLinkLibraries() const;
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 32445d5..e4b3b7c 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -77,7 +77,7 @@ protected:
};
using VectorOfPairs = std::vector<std::shared_ptr<Pair>>;
- typedef std::map<std::string, VectorOfPairs> StringToVectorOfPairs;
+ using StringToVectorOfPairs = std::map<std::string, VectorOfPairs>;
StringToVectorOfPairs WatchMap;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 209ebb1..ba72294 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -121,7 +121,7 @@ struct cmVisualStudio10TargetGenerator::Elem
class cmVS10GeneratorOptions : public cmVisualStudioGeneratorOptions
{
public:
- typedef cmVisualStudio10TargetGenerator::Elem Elem;
+ using Elem = cmVisualStudio10TargetGenerator::Elem;
cmVS10GeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
cmVS7FlagTable const* table,
cmVisualStudio10TargetGenerator* g = nullptr)
@@ -250,6 +250,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
this->Makefile->GetCurrentBinaryDirectory());
+ this->LocalGenerator->AddUnityBuild(target, "");
this->LocalGenerator->AddPchDependencies(target, "");
}
@@ -894,7 +895,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_";
static const std::string refpropInfix = "_TAG_";
const std::string refPropFullPrefix = refpropPrefix + ref + refpropInfix;
- typedef std::map<std::string, std::string> CustomTags;
+ using CustomTags = std::map<std::string, std::string>;
CustomTags tags;
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
for (const auto& i : props.GetList()) {
@@ -2070,6 +2071,17 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) {
return;
}
+
+ const bool haveUnityBuild =
+ this->GeneratorTarget->GetPropertyAsBool("UNITY_BUILD");
+
+ if (haveUnityBuild &&
+ this->GlobalGenerator->GetVersion() >=
+ cmGlobalVisualStudioGenerator::VS15) {
+ Elem e1(e0, "PropertyGroup");
+ e1.Element("EnableUnitySupport", "true");
+ }
+
Elem e1(e0, "ItemGroup");
e1.SetHasElements();
@@ -2168,6 +2180,45 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
Elem e2(e1, tool);
this->WriteSource(e2, si.Source);
+
+ bool useNativeUnityBuild = false;
+ if (haveUnityBuild &&
+ this->GlobalGenerator->GetVersion() >=
+ cmGlobalVisualStudioGenerator::VS15) {
+ // Magic value taken from cmGlobalVisualStudioVersionedGenerator.cxx
+ static const std::string vs15 = "141";
+ std::string toolset =
+ this->GlobalGenerator->GetPlatformToolsetString();
+ cmSystemTools::ReplaceString(toolset, "v", "");
+
+ if (toolset.empty() ||
+ cmSystemTools::VersionCompareGreaterEq(toolset, vs15)) {
+ useNativeUnityBuild = true;
+ }
+ }
+
+ if (haveUnityBuild && strcmp(tool, "ClCompile") == 0 &&
+ si.Source->GetProperty("UNITY_SOURCE_FILE")) {
+ if (useNativeUnityBuild) {
+ e2.Attribute(
+ "IncludeInUnityFile",
+ si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")
+ ? "false"
+ : "true");
+ e2.Attribute("CustomUnityFile", "true");
+
+ std::string unityDir = cmSystemTools::GetFilenamePath(
+ si.Source->GetProperty("UNITY_SOURCE_FILE"));
+ e2.Attribute("UnityFilesDirectory", unityDir);
+ } else {
+ // Visual Studio versions prior to 2017 do not know about unity
+ // builds, thus we exclude the files alredy part of unity sources.
+ if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) {
+ exclude_configs = si.Configs;
+ }
+ }
+ }
+
if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) {
this->OutputSourceSpecificFlags(e2, si.Source);
}
@@ -2349,7 +2400,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
if (this->ProjectType == csproj) {
std::string f = source->GetFullPath();
- typedef std::map<std::string, std::string> CsPropMap;
+ using CsPropMap = std::map<std::string, std::string>;
CsPropMap sourceFileTags;
// set <Link> tag if necessary
std::string link;
@@ -3739,7 +3790,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
}
cmComputeLinkInformation& cli = *pcli;
- typedef cmComputeLinkInformation::ItemVector ItemVector;
+ using ItemVector = cmComputeLinkInformation::ItemVector;
const ItemVector& libs = cli.GetItems();
std::string currentBinDir =
this->LocalGenerator->GetCurrentBinaryDirectory();
@@ -3784,7 +3835,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
const cmComputeLinkInformation& cli, std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec, const std::string& config)
{
- typedef cmComputeLinkInformation::ItemVector ItemVector;
+ using ItemVector = cmComputeLinkInformation::ItemVector;
ItemVector const& libs = cli.GetItems();
std::string currentBinDir =
this->LocalGenerator->GetCurrentBinaryDirectory();
@@ -4010,8 +4061,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
{
cmGlobalGenerator::TargetDependSet const& unordered =
this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
- typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
- OrderedTargetDependSet;
+ using OrderedTargetDependSet =
+ cmGlobalVisualStudioGenerator::OrderedTargetDependSet;
OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET);
Elem e1(e0, "ItemGroup");
e1.SetHasElements();
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 6607e77..4dd92eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -186,8 +186,8 @@ private:
private:
friend class cmVS10GeneratorOptions;
- typedef cmVS10GeneratorOptions Options;
- typedef std::map<std::string, std::unique_ptr<Options>> OptionsMap;
+ using Options = cmVS10GeneratorOptions;
+ using OptionsMap = std::map<std::string, std::unique_ptr<Options>>;
OptionsMap ClOptions;
OptionsMap RcOptions;
OptionsMap CudaOptions;
@@ -224,16 +224,16 @@ private:
std::string DefaultArtifactDir;
bool AddedDefaultCertificate = false;
// managed C++/C# relevant members
- typedef std::pair<std::string, std::string> DotNetHintReference;
- typedef std::vector<DotNetHintReference> DotNetHintReferenceList;
- typedef std::map<std::string, DotNetHintReferenceList>
- DotNetHintReferenceMap;
+ using DotNetHintReference = std::pair<std::string, std::string>;
+ using DotNetHintReferenceList = std::vector<DotNetHintReference>;
+ using DotNetHintReferenceMap =
+ std::map<std::string, DotNetHintReferenceList>;
DotNetHintReferenceMap DotNetHintReferences;
- typedef std::set<std::string> UsingDirectories;
- typedef std::map<std::string, UsingDirectories> UsingDirectoriesMap;
+ using UsingDirectories = std::set<std::string>;
+ using UsingDirectoriesMap = std::map<std::string, UsingDirectories>;
UsingDirectoriesMap AdditionalUsingDirectories;
- typedef std::map<std::string, ToolSources> ToolSourceMap;
+ using ToolSourceMap = std::map<std::string, ToolSources>;
ToolSourceMap Tools;
std::string GetCMakeFilePath(const char* name) const;
};
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index a30a67f..560593e 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -14,7 +14,7 @@
class cmLocalVisualStudioGenerator;
-typedef cmIDEFlagTable cmVS7FlagTable;
+using cmVS7FlagTable = cmIDEFlagTable;
class cmVisualStudioGeneratorOptions : public cmIDEOptions
{
diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h
index 9c1dffc..5ce7d74 100644
--- a/Source/cmVisualStudioSlnData.h
+++ b/Source/cmVisualStudioSlnData.h
@@ -45,9 +45,9 @@ public:
const std::string& projectRelativePath);
private:
- typedef std::map<std::string, cmSlnProjectEntry> ProjectStorage;
+ using ProjectStorage = std::map<std::string, cmSlnProjectEntry>;
ProjectStorage ProjectsByGUID;
- typedef std::map<std::string, ProjectStorage::iterator> ProjectStringIndex;
+ using ProjectStringIndex = std::map<std::string, ProjectStorage::iterator>;
ProjectStringIndex ProjectNameIndex;
};
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index 9eaee11..05ef517 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -51,7 +51,7 @@ public:
void CopyVerbatim(const std::string& line) { this->Tag = line; }
private:
- typedef std::pair<std::string, bool> StringData;
+ using StringData = std::pair<std::string, bool>;
std::string Tag;
StringData Arg;
std::vector<StringData> Values;
diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h
index d6345a8..166f788 100644
--- a/Source/cmVisualStudioSlnParser.h
+++ b/Source/cmVisualStudioSlnParser.h
@@ -42,7 +42,7 @@ public:
DataGroupCount
};
- typedef std::bitset<DataGroupCount> DataGroupSet;
+ using DataGroupSet = std::bitset<DataGroupCount>;
static const DataGroupSet DataGroupProjects;
static const DataGroupSet DataGroupProjectDependencies;
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index 8c47123..1cc5324 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -18,7 +18,7 @@
class cmXCodeScheme
{
public:
- typedef std::vector<const cmXCodeObject*> TestObjects;
+ using TestObjects = std::vector<const cmXCodeObject*>;
cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
const std::vector<std::string>& configList,
diff --git a/Source/cm_string_view.hxx b/Source/cm_string_view.hxx
index d368ed8..04de797 100644
--- a/Source/cm_string_view.hxx
+++ b/Source/cm_string_view.hxx
@@ -207,8 +207,8 @@ namespace std {
template <>
struct hash<cm::string_view>
{
- typedef cm::string_view argument_type;
- typedef size_t result_type;
+ using argument_type = cm::string_view;
+ using result_type = size_t;
result_type operator()(argument_type const& s) const noexcept;
};
}
diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h
index 796f027..d3b9ef2 100644
--- a/Source/cm_sys_stat.h
+++ b/Source/cm_sys_stat.h
@@ -4,12 +4,12 @@
#define cm_sys_stat_h
#if defined(_MSC_VER)
-typedef unsigned short mode_t;
+using mode_t = unsigned short;
#endif
#if defined(WIN32)
-typedef unsigned short uid_t;
-typedef unsigned short gid_t;
+using uid_t = unsigned short;
+using gid_t = unsigned short;
#endif
#include <sys/types.h>
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1746082..ace9198 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -116,7 +116,7 @@
namespace {
#if !defined(CMAKE_BOOTSTRAP)
-typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
+using JsonValueMapType = std::unordered_map<std::string, Json::Value>;
#endif
} // namespace
diff --git a/Source/cmake.h b/Source/cmake.h
index cc44b92..687c105 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -133,7 +133,7 @@ public:
std::unordered_set<std::string> unordered;
};
- typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
+ using InstalledFilesMap = std::map<std::string, cmInstalledFile>;
static const int NO_BUILD_PARALLEL_LEVEL = -1;
static const int DEFAULT_BUILD_PARALLEL_LEVEL = 0;