summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/.gitattributes18
-rw-r--r--Source/CMakeLists.txt112
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx86
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.h65
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx113
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h30
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx103
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h17
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx109
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h20
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx48
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h16
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx14
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx6
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx26
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h6
-rw-r--r--Source/CPack/cmCPackGenerator.cxx6
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx3
-rw-r--r--Source/CTest/cmCTestLaunch.cxx3
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx8
-rw-r--r--Source/CTest/cmCTestSVN.cxx12
-rw-r--r--Source/CTest/cmCTestSVN.h3
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx18
-rw-r--r--Source/CTest/cmCTestTestCommand.h3
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx154
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx3
-rw-r--r--Source/Checks/cm_cxx_eq_delete.cxx14
-rw-r--r--Source/Checks/cm_cxx_features.cmake1
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h7
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.h8
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx2
-rw-r--r--Source/CursesDialog/cmCursesForm.h7
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h6
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx3
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h4
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesWidget.h7
-rw-r--r--Source/LexerParser/.clang-tidy6
-rw-r--r--Source/LexerParser/.gitattributes17
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.cxx (renamed from Source/cmCommandArgumentLexer.cxx)0
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.h (renamed from Source/cmCommandArgumentLexer.h)0
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.in.l (renamed from Source/cmCommandArgumentLexer.in.l)0
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.cxx (renamed from Source/cmCommandArgumentParser.cxx)0
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.y (renamed from Source/cmCommandArgumentParser.y)1
-rw-r--r--Source/LexerParser/cmCommandArgumentParserTokens.h (renamed from Source/cmCommandArgumentParserTokens.h)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.cxx (renamed from Source/cmDependsJavaLexer.cxx)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.h (renamed from Source/cmDependsJavaLexer.h)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.in.l (renamed from Source/cmDependsJavaLexer.in.l)0
-rw-r--r--Source/LexerParser/cmDependsJavaParser.cxx (renamed from Source/cmDependsJavaParser.cxx)0
-rw-r--r--Source/LexerParser/cmDependsJavaParser.y (renamed from Source/cmDependsJavaParser.y)3
-rw-r--r--Source/LexerParser/cmDependsJavaParserTokens.h (renamed from Source/cmDependsJavaParserTokens.h)0
-rw-r--r--Source/LexerParser/cmExprLexer.cxx (renamed from Source/cmExprLexer.cxx)0
-rw-r--r--Source/LexerParser/cmExprLexer.h (renamed from Source/cmExprLexer.h)0
-rw-r--r--Source/LexerParser/cmExprLexer.in.l (renamed from Source/cmExprLexer.in.l)0
-rw-r--r--Source/LexerParser/cmExprParser.cxx (renamed from Source/cmExprParser.cxx)1
-rw-r--r--Source/LexerParser/cmExprParser.y (renamed from Source/cmExprParser.y)1
-rw-r--r--Source/LexerParser/cmExprParserTokens.h (renamed from Source/cmExprParserTokens.h)0
-rw-r--r--Source/LexerParser/cmFortranLexer.cxx (renamed from Source/cmFortranLexer.cxx)0
-rw-r--r--Source/LexerParser/cmFortranLexer.h (renamed from Source/cmFortranLexer.h)0
-rw-r--r--Source/LexerParser/cmFortranLexer.in.l (renamed from Source/cmFortranLexer.in.l)0
-rw-r--r--Source/LexerParser/cmFortranParser.cxx (renamed from Source/cmFortranParser.cxx)0
-rw-r--r--Source/LexerParser/cmFortranParser.y (renamed from Source/cmFortranParser.y)0
-rw-r--r--Source/LexerParser/cmFortranParserTokens.h (renamed from Source/cmFortranParserTokens.h)0
-rw-r--r--Source/LexerParser/cmListFileLexer.c (renamed from Source/cmListFileLexer.c)0
-rw-r--r--Source/LexerParser/cmListFileLexer.in.l (renamed from Source/cmListFileLexer.in.l)0
-rw-r--r--Source/QtDialog/CMakeLists.txt13
-rw-r--r--Source/bindexplib.cxx32
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx3
-rw-r--r--Source/cmAlgorithms.h3
-rw-r--r--Source/cmCLocaleEnvironmentScope.h4
-rw-r--r--Source/cmCPackPropertiesGenerator.cxx2
-rw-r--r--Source/cmCPackPropertiesGenerator.h6
-rw-r--r--Source/cmCTest.cxx28
-rw-r--r--Source/cmCommand.h6
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx1
-rw-r--r--Source/cmCommandArgumentParserHelper.h4
-rw-r--r--Source/cmCommonTargetGenerator.cxx11
-rw-r--r--Source/cmCommonTargetGenerator.h3
-rw-r--r--Source/cmComputeLinkInformation.h6
-rw-r--r--Source/cmConfigure.cmake.h.in11
-rw-r--r--Source/cmCryptoHash.h4
-rw-r--r--Source/cmDefinitions.h6
-rw-r--r--Source/cmDepends.h6
-rw-r--r--Source/cmDependsC.h6
-rw-r--r--Source/cmDependsFortran.h5
-rw-r--r--Source/cmDependsJava.h6
-rw-r--r--Source/cmDocumentation.cxx17
-rw-r--r--Source/cmDynamicLoader.cxx2
-rw-r--r--Source/cmDynamicLoader.h8
-rw-r--r--Source/cmELF.cxx7
-rw-r--r--Source/cmFileCommand.cxx14
-rw-r--r--Source/cmFileLock.h7
-rw-r--r--Source/cmFileLockPool.h18
-rw-r--r--Source/cmFileMonitor.cxx2
-rw-r--r--Source/cmGeneratorExpression.h10
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h3
-rw-r--r--Source/cmGeneratorTarget.cxx79
-rw-r--r--Source/cmGeneratorTarget.h12
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx8
-rw-r--r--Source/cmGlobalGenerator.cxx12
-rw-r--r--Source/cmGlobalGenerator.h6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx35
-rw-r--r--Source/cmGlobalNinjaGenerator.h10
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx498
-rw-r--r--Source/cmGlobalXCodeGenerator.h7
-rw-r--r--Source/cmGraphAdjacencyList.h17
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx6
-rw-r--r--Source/cmInstallDirectoryGenerator.h7
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallExportGenerator.h6
-rw-r--r--Source/cmInstallFilesGenerator.cxx6
-rw-r--r--Source/cmInstallFilesGenerator.h7
-rw-r--r--Source/cmInstallGenerator.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx26
-rw-r--r--Source/cmInstallTargetGenerator.h31
-rw-r--r--Source/cmLinkItem.h11
-rw-r--r--Source/cmLinkLineComputer.h4
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx21
-rw-r--r--Source/cmLinkLineDeviceComputer.h4
-rw-r--r--Source/cmListFileCache.cxx5
-rw-r--r--Source/cmListFileCache.h6
-rw-r--r--Source/cmLocalGenerator.cxx108
-rw-r--r--Source/cmLocalGenerator.h13
-rw-r--r--Source/cmLocalNinjaGenerator.cxx6
-rw-r--r--Source/cmLocalNinjaGenerator.h4
-rw-r--r--Source/cmLocale.h5
-rw-r--r--Source/cmMSVC60LinkLineComputer.h2
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx15
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx48
-rw-r--r--Source/cmNinjaLinkLineComputer.h2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx13
-rw-r--r--Source/cmNinjaTargetGenerator.cxx50
-rw-r--r--Source/cmNinjaTargetGenerator.h3
-rw-r--r--Source/cmNinjaTypes.h6
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx3
-rw-r--r--Source/cmPolicies.cxx16
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmQtAutoGenerators.cxx478
-rw-r--r--Source/cmQtAutoGenerators.h93
-rw-r--r--Source/cmRST.cxx10
-rw-r--r--Source/cmScriptGenerator.cxx14
-rw-r--r--Source/cmScriptGenerator.h18
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx7
-rw-r--r--Source/cmServerProtocol.cxx29
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx3
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx3
-rw-r--r--Source/cmSourceGroupCommand.cxx59
-rw-r--r--Source/cmStatePrivate.h5
-rw-r--r--Source/cmSystemTools.cxx82
-rw-r--r--Source/cmSystemTools.h12
-rw-r--r--Source/cmTargetDepend.h2
-rw-r--r--Source/cmTestGenerator.cxx14
-rw-r--r--Source/cmTestGenerator.h17
-rw-r--r--Source/cmVS10MASMFlagTable.h76
-rw-r--r--Source/cmVS11MASMFlagTable.h76
-rw-r--r--Source/cmVS12MASMFlagTable.h76
-rw-r--r--Source/cmVS14MASMFlagTable.h76
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx89
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h6
-rw-r--r--Source/cmXMLWriter.h7
-rw-r--r--Source/cm_auto_ptr.hxx10
-rw-r--r--Source/cmake.h6
-rw-r--r--Source/cmcmd.cxx3
-rw-r--r--Source/ctest.cxx12
-rw-r--r--Source/kwsys/CMakeLists.txt12
184 files changed, 2058 insertions, 1800 deletions
diff --git a/Source/.gitattributes b/Source/.gitattributes
index f69ad9d..0f829a3 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,20 +1,2 @@
-/cmCommandArgumentLexer.cxx generated
-/cmCommandArgumentLexer.h generated
-/cmCommandArgumentParser.cxx generated
-/cmCommandArgumentParserTokens.h generated
-/cmDependsJavaLexer.cxx generated
-/cmDependsJavaLexer.h generated
-/cmDependsJavaParser.cxx generated
-/cmDependsJavaParserTokens.h generated
-/cmExprLexer.cxx generated
-/cmExprLexer.h generated
-/cmExprParser.cxx generated
-/cmExprParserTokens.h generated
-/cmFortranLexer.cxx generated
-/cmFortranLexer.h generated
-/cmFortranParser.cxx generated
-/cmFortranParserTokens.h generated
-/cmListFileLexer.c generated
-
# Do not format third-party sources.
/kwsys/** -format.clang-format
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8d683cb3f..40403ca 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -78,6 +78,7 @@ configure_file(
include_directories(
"${CMake_BINARY_DIR}/Source"
"${CMake_SOURCE_DIR}/Source"
+ "${CMake_SOURCE_DIR}/Source/LexerParser"
${CMAKE_ZLIB_INCLUDES}
${CMAKE_EXPAT_INCLUDES}
${CMAKE_TAR_INCLUDES}
@@ -88,61 +89,6 @@ include_directories(
# let cmake know it is supposed to use it
add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
-option(CMAKE_REGENERATE_YACCLEX
- "Regenerate YACC and LEXX files" OFF)
-mark_as_advanced(CMAKE_REGENERATE_YACCLEX)
-if(CMAKE_REGENERATE_YACCLEX)
- set(parsersLexers cmFortran cmCommandArgument cmExpr)
- find_program(YACC_EXECUTABLE
- NAMES yacc bison
- PATHS /usr/bin
- DOC "Yacc or Bison executable")
- find_program(FLEX_EXECUTABLE
- NAMES flex
- PATHS /usr/bin
- DOC "Flex executable")
- mark_as_advanced(YACC_EXECUTABLE FLEX_EXECUTABLE)
- if(YACC_EXECUTABLE)
- set(BISON_FLAGS)
- if(YACC_EXECUTABLE MATCHES "bison")
- set(BISON_FLAGS "--yacc")
- endif()
- set(yacc_files)
- foreach(name ${parsersLexers})
- set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y")
- set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx")
- set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h")
- add_custom_command(
- OUTPUT "${dst}"
- DEPENDS "${src}"
- COMMAND
- ${YACC_EXECUTABLE}
- --name-prefix=${name}_yy --defines=${hdr} -o${dst} ${src}
- )
- set(yacc_files ${yacc_files} "${dst}")
- endforeach()
- add_custom_target(RerunYacc DEPENDS ${yacc_files})
- endif()
- if(FLEX_EXECUTABLE)
- set(lex_files)
- foreach(name ${parsersLexers})
- set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l")
- set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx")
- set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h")
- add_custom_command(
- OUTPUT "${dst}"
- DEPENDS "${src}"
- COMMAND
- ${FLEX_EXECUTABLE}
- --prefix=${name}_yy --header-file=${hdr} -o${dst} ${src}
- )
- set(lex_files ${lex_files} "${dst}")
- endforeach()
- add_custom_target(RerunLex DEPENDS ${lex_files})
- endif()
-
-endif()
-
# Check if we can build the ELF parser.
if(CMAKE_USE_ELF_PARSER)
set(ELF_SRCS cmELF.h cmELF.cxx)
@@ -157,14 +103,40 @@ endif()
# Sources for CMakeLib
#
set(SRCS
+ # Lexers/Parsers
+ LexerParser/cmCommandArgumentLexer.cxx
+ LexerParser/cmCommandArgumentLexer.h
+ LexerParser/cmCommandArgumentLexer.in.l
+ LexerParser/cmCommandArgumentParser.cxx
+ LexerParser/cmCommandArgumentParserTokens.h
+ LexerParser/cmCommandArgumentParser.y
+ LexerParser/cmDependsJavaLexer.cxx
+ LexerParser/cmDependsJavaLexer.h
+ LexerParser/cmDependsJavaLexer.in.l
+ LexerParser/cmDependsJavaParser.cxx
+ LexerParser/cmDependsJavaParserTokens.h
+ LexerParser/cmDependsJavaParser.y
+ LexerParser/cmExprLexer.cxx
+ LexerParser/cmExprLexer.h
+ LexerParser/cmExprLexer.in.l
+ LexerParser/cmExprParser.cxx
+ LexerParser/cmExprParserTokens.h
+ LexerParser/cmExprParser.y
+ LexerParser/cmFortranLexer.cxx
+ LexerParser/cmFortranLexer.h
+ LexerParser/cmFortranLexer.in.l
+ LexerParser/cmFortranParser.cxx
+ LexerParser/cmFortranParserTokens.h
+ LexerParser/cmFortranParser.y
+ LexerParser/cmListFileLexer.c
+ LexerParser/cmListFileLexer.in.l
+
cmArchiveWrite.cxx
cmBase32.cxx
cmCacheManager.cxx
cmCacheManager.h
cmCLocaleEnvironmentScope.h
cmCLocaleEnvironmentScope.cxx
- cmCommandArgumentLexer.cxx
- cmCommandArgumentParser.cxx
cmCommandArgumentParserHelper.cxx
cmCommonTargetGenerator.cxx
cmCommonTargetGenerator.h
@@ -196,8 +168,6 @@ set(SRCS
cmDependsFortran.h
cmDependsJava.cxx
cmDependsJava.h
- cmDependsJavaLexer.cxx
- cmDependsJavaParser.cxx
cmDependsJavaParserHelper.cxx
cmDependsJavaParserHelper.h
cmDocumentation.cxx
@@ -206,8 +176,6 @@ set(SRCS
cmDynamicLoader.cxx
cmDynamicLoader.h
${ELF_SRCS}
- cmExprLexer.cxx
- cmExprParser.cxx
cmExprParserHelper.cxx
cmExportBuildAndroidMKGenerator.h
cmExportBuildAndroidMKGenerator.cxx
@@ -247,10 +215,6 @@ set(SRCS
cmFilePathChecksum.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
- cmFortranLexer.cxx
- cmFortranLexer.h
- cmFortranParser.cxx
- cmFortranParser.h
cmFortranParserImpl.cxx
cmGeneratedFileStream.cxx
cmGeneratorExpressionContext.cxx
@@ -302,7 +266,6 @@ set(SRCS
cmLinkLineDeviceComputer.h
cmListFileCache.cxx
cmListFileCache.h
- cmListFileLexer.c
cmLocalCommonGenerator.cxx
cmLocalCommonGenerator.h
cmLocalGenerator.cxx
@@ -904,10 +867,6 @@ set(CPACK_SRCS
CPack/cmCPackGenerator.cxx
CPack/cmCPackLog.cxx
CPack/cmCPackNSISGenerator.cxx
- CPack/IFW/cmCPackIFWPackage.cxx
- CPack/IFW/cmCPackIFWInstaller.cxx
- CPack/IFW/cmCPackIFWRepository.cxx
- CPack/IFW/cmCPackIFWGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
CPack/cmCPackTGZGenerator.cxx
CPack/cmCPackTXZGenerator.cxx
@@ -916,6 +875,19 @@ set(CPACK_SRCS
CPack/cmCPackZIPGenerator.cxx
CPack/cmCPack7zGenerator.cxx
)
+# CPack IFW generator
+set(CPACK_SRCS ${CPACK_SRCS}
+ CPack/IFW/cmCPackIFWCommon.cxx
+ CPack/IFW/cmCPackIFWCommon.h
+ CPack/IFW/cmCPackIFWGenerator.cxx
+ CPack/IFW/cmCPackIFWGenerator.h
+ CPack/IFW/cmCPackIFWInstaller.cxx
+ CPack/IFW/cmCPackIFWInstaller.h
+ CPack/IFW/cmCPackIFWPackage.cxx
+ CPack/IFW/cmCPackIFWPackage.h
+ CPack/IFW/cmCPackIFWRepository.cxx
+ CPack/IFW/cmCPackIFWRepository.h
+ )
if(CYGWIN)
set(CPACK_SRCS ${CPACK_SRCS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ea6e0e2..4009571 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170421)
+set(CMake_VERSION_PATCH 20170505)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
new file mode 100644
index 0000000..60954ea
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -0,0 +1,86 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCPackIFWCommon.h"
+
+#include "cmCPackGenerator.h"
+#include "cmCPackIFWGenerator.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmSystemTools.h"
+#include "cmTimestamp.h"
+#include "cmVersionConfig.h"
+#include "cmXMLWriter.h"
+
+#include <sstream>
+
+cmCPackIFWCommon::cmCPackIFWCommon()
+ : Generator(CM_NULLPTR)
+{
+}
+
+const char* cmCPackIFWCommon::GetOption(const std::string& op) const
+{
+ return Generator ? Generator->cmCPackGenerator::GetOption(op) : CM_NULLPTR;
+}
+
+bool cmCPackIFWCommon::IsOn(const std::string& op) const
+{
+ return Generator ? Generator->cmCPackGenerator::IsOn(op) : false;
+}
+
+bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
+{
+ return Generator ? Generator->cmCPackGenerator::IsSetToOff(op) : false;
+}
+
+bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
+{
+ return Generator ? Generator->cmCPackGenerator::IsSetToEmpty(op) : false;
+}
+
+bool cmCPackIFWCommon::IsVersionLess(const char* version)
+{
+ if (!Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, Generator->FrameworkVersion.data(), version);
+}
+
+bool cmCPackIFWCommon::IsVersionGreater(const char* version)
+{
+ if (!Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER, Generator->FrameworkVersion.data(), version);
+}
+
+bool cmCPackIFWCommon::IsVersionEqual(const char* version)
+{
+ if (!Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_EQUAL, Generator->FrameworkVersion.data(), version);
+}
+
+void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout)
+{
+ if (!Generator) {
+ return;
+ }
+
+ std::ostringstream comment;
+ comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
+ << "for QtIFW ";
+ if (IsVersionEqual("1.9.9")) {
+ comment << "less 2.0";
+ } else {
+ comment << Generator->FrameworkVersion;
+ }
+ comment << " tools at " << cmTimestamp().CurrentTime("", true);
+ xout.Comment(comment.str().c_str());
+}
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h
new file mode 100644
index 0000000..66b6e89
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.h
@@ -0,0 +1,65 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmCPackIFWCommon_h
+#define cmCPackIFWCommon_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+
+class cmCPackIFWGenerator;
+class cmXMLWriter;
+
+/** \class cmCPackIFWCommon
+ * \brief A base class for CPack IFW generator implementation subclasses
+ */
+class cmCPackIFWCommon
+{
+public:
+ // Constructor
+
+ /**
+ * Construct Part
+ */
+ cmCPackIFWCommon();
+
+public:
+ // Internal implementation
+
+ const char* GetOption(const std::string& op) const;
+ bool IsOn(const std::string& op) const;
+ bool IsSetToOff(const std::string& op) const;
+ bool IsSetToEmpty(const std::string& op) const;
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionLess(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionGreater(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionEqual(const char* version);
+
+ cmCPackIFWGenerator* Generator;
+
+protected:
+ void WriteGeneratedByToStrim(cmXMLWriter& xout);
+};
+
+#define cmCPackIFWLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ if (Generator) { \
+ Generator->Logger->Log(cmCPackLog::LOG_##logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } \
+ } while (false)
+
+#endif // cmCPackIFWCommon_h
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index fa8982f..a9628d6 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -4,48 +4,29 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
-#include "cmTimestamp.h"
-#include "cmVersionConfig.h"
-#include "cmXMLWriter.h"
#include <sstream>
#include <utility>
cmCPackIFWGenerator::cmCPackIFWGenerator()
{
+ Generator = this;
}
cmCPackIFWGenerator::~cmCPackIFWGenerator()
{
}
-bool cmCPackIFWGenerator::IsVersionLess(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionGreater(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionEqual(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
- FrameworkVersion.data(), version);
-}
-
int cmCPackIFWGenerator::PackageFiles()
{
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
// Installer configuragion
Installer.GenerateInstallerFile();
@@ -85,11 +66,10 @@ int cmCPackIFWGenerator::PackageFiles()
}
}
ifwCmd += " " + this->toplevel + "/repository";
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository"
- << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -98,22 +78,24 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
if (!Repository.RepositoryUpdate.empty() &&
!Repository.PatchUpdatesXml()) {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" "
- << "file: " << this->toplevel + "/repository/Updates.xml"
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" "
+ << "file: "
+ << this->toplevel + "/repository/Updates.xml"
+ << std::endl);
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: "
- << this->toplevel << "/repository generated" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- repository: " << this->toplevel
+ << "/repository generated"
+ << std::endl);
}
// Run binary creator
@@ -177,10 +159,10 @@ int cmCPackIFWGenerator::PackageFiles()
} else {
ifwCmd += " installer";
}
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -189,10 +171,10 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
}
@@ -243,10 +225,9 @@ int cmCPackIFWGenerator::InitializeInternal()
}
if (BinCreator.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW compiler \"binarycreator\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
@@ -309,10 +290,10 @@ int cmCPackIFWGenerator::InitializeInternal()
}
if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW repository generator \"repogen\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ cmCPackIFWLogger(ERROR,
+ "Cannot find QtIFW repository generator \"repogen\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
@@ -381,9 +362,9 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
}
} else {
Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component \"" << component->Name << "\""
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component \"" << component->Name
+ << "\"" << std::endl);
}
return component;
@@ -416,9 +397,9 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
BinaryPackages.insert(package);
} else {
Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component group \"" << group->Name
- << "\"" << std::endl);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component group \"" << group->Name
+ << "\"" << std::endl);
}
return group;
}
@@ -561,24 +542,10 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
} else {
Repositories.erase(repositoryName);
repository = CM_NULLPTR;
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
- << repositoryName << "\""
- << " configuration. Repository will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Invalid repository \""
+ << repositoryName << "\""
+ << " configuration. Repository will be skipped."
+ << std::endl);
}
return repository;
}
-
-void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- std::ostringstream comment;
- comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
- << "for QtIFW ";
- if (IsVersionLess("2.0")) {
- comment << "less 2.0";
- } else {
- comment << FrameworkVersion;
- }
- comment << " tools at " << cmTimestamp().CurrentTime("", true);
- xout.Comment(comment.str().c_str());
-}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 688db4b..8348cee 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -3,10 +3,11 @@
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
-#include "cmConfigure.h"
+#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
@@ -16,14 +17,12 @@
#include <string>
#include <vector>
-class cmXMLWriter;
-
/** \class cmCPackIFWGenerator
* \brief A generator for Qt Installer Framework tools
*
* http://qt-project.org/doc/qtinstallerframework/index.html
*/
-class cmCPackIFWGenerator : public cmCPackGenerator
+class cmCPackIFWGenerator : public cmCPackGenerator, public cmCPackIFWCommon
{
public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
@@ -35,6 +34,11 @@ public:
typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
DependenceMap;
+ using cmCPackIFWCommon::GetOption;
+ using cmCPackIFWCommon::IsOn;
+ using cmCPackIFWCommon::IsSetToOff;
+ using cmCPackIFWCommon::IsSetToEmpty;
+
/**
* Construct IFW generator
*/
@@ -45,21 +49,6 @@ public:
*/
~cmCPackIFWGenerator() CM_OVERRIDE;
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionLess(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionGreater(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionEqual(const char* version);
-
protected:
// cmCPackGenerator reimplementation
@@ -124,12 +113,11 @@ protected:
cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
protected:
// Data
friend class cmCPackIFWPackage;
+ friend class cmCPackIFWCommon;
friend class cmCPackIFWInstaller;
friend class cmCPackIFWRepository;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 3aebbc8..317137f 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -2,69 +2,29 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWInstaller.h"
-#include "cmConfigure.h"
-#include <sstream>
-#include <stddef.h>
-#include <utility>
-
-#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
+#include <sstream>
+#include <stddef.h>
+#include <utility>
cmCPackIFWInstaller::cmCPackIFWInstaller()
- : Generator(CM_NULLPTR)
{
}
-const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWInstaller::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
-}
-
void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue)
{
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "Option "
+ cmCPackIFWLogger(
+ WARNING, "Option "
<< optionName << " is set to \"" << optionValue
<< "\" but will be skipped because the specified file does not exist."
<< std::endl);
@@ -171,17 +131,16 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// WizardStyle
if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
- if (WizardStyle.compare("Modern") == 0 &&
- WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 &&
- WizardStyle.compare("Classic") == 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING,
- "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
+ // Setting the user value in any case
+ WizardStyle = option;
+ // Check known values
+ if (WizardStyle != "Modern" && WizardStyle != "Aero" &&
+ WizardStyle != "Mac" && WizardStyle != "Classic") {
+ cmCPackIFWLogger(
+ WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl);
}
-
- WizardStyle = option;
}
// WizardDefaultWidth
@@ -288,7 +247,7 @@ public:
hasFiles = false;
hasErrors = false;
- basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data());
+ basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]);
ParseFile(installer->Resources[r].data());
@@ -360,8 +319,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
cmSystemTools::GetFilenameName(InstallerApplicationIcon);
std::string path = Directory + "/config/" + name;
name = cmSystemTools::GetFilenameWithoutExtension(name);
- cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon.data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path);
xout.Element("InstallerApplicationIcon", name);
}
@@ -369,8 +327,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!InstallerWindowIcon.empty()) {
std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon.data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path);
xout.Element("InstallerWindowIcon", name);
}
@@ -378,7 +335,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!Logo.empty()) {
std::string name = cmSystemTools::GetFilenameName(Logo);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Logo, path);
xout.Element("Logo", name);
}
@@ -386,7 +343,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!Banner.empty()) {
std::string name = cmSystemTools::GetFilenameName(Banner);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Banner, path);
xout.Element("Banner", name);
}
@@ -394,7 +351,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!Watermark.empty()) {
std::string name = cmSystemTools::GetFilenameName(Watermark);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Watermark, path);
xout.Element("Watermark", name);
}
@@ -402,7 +359,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!Background.empty()) {
std::string name = cmSystemTools::GetFilenameName(Background);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Background, path);
xout.Element("Background", name);
}
@@ -480,7 +437,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (!IsVersionLess("2.0") && !ControlScript.empty()) {
std::string name = cmSystemTools::GetFilenameName(ControlScript);
std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path);
xout.Element("ControlScript", name);
}
@@ -492,13 +449,12 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
if (parser.ParseResource(i)) {
std::string name = cmSystemTools::GetFilenameName(Resources[i]);
std::string path = Directory + "/resources/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path);
resources.push_back(name);
} else {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \""
- << Resources[i] << "\". Resource will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Can't copy resources from \""
+ << Resources[i] << "\". Resource will be skipped."
+ << std::endl);
}
}
Resources = resources;
@@ -537,10 +493,3 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
package->GeneratePackageFile();
}
}
-
-void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 64239cf..b635f42 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -5,19 +5,19 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
#include <map>
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmCPackIFWPackage;
class cmCPackIFWRepository;
-class cmXMLWriter;
/** \class cmCPackIFWInstaller
* \brief A binary installer to be created CPack IFW generator
*/
-class cmCPackIFWInstaller
+class cmCPackIFWInstaller : public cmCPackIFWCommon
{
public:
// Types
@@ -111,28 +111,17 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
void ConfigureFromOptions();
void GenerateInstallerFile();
void GeneratePackageFiles();
- cmCPackIFWGenerator* Generator;
PackagesMap Packages;
RepositoriesVector RemoteRepositories;
std::string Directory;
protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
-private:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
};
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 2a95ba8..7a0a00c 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -3,34 +3,19 @@
#include "cmCPackIFWPackage.h"
#include "cmCPackComponentGroup.h"
-#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWInstaller.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmXMLWriter.h"
-#include "cmConfigure.h"
#include <map>
#include <sstream>
#include <stddef.h>
-//----------------------------------------------------------------- Logger ---
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
-
//---------------------------------------------------------- CompareStruct ---
cmCPackIFWPackage::CompareStruct::CompareStruct()
: Type(CompareNone)
@@ -104,45 +89,8 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
//------------------------------------------------------ cmCPackIFWPackage ---
cmCPackIFWPackage::cmCPackIFWPackage()
- : Generator(CM_NULLPTR)
- , Installer(CM_NULLPTR)
-{
-}
-
-const char* cmCPackIFWPackage::GetOption(const std::string& op) const
-{
- const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR;
- return option && *option ? option : CM_NULLPTR;
-}
-
-bool cmCPackIFWPackage::IsOn(const std::string& op) const
+ : Installer(CM_NULLPTR)
{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToOff(const std::string& op) const
-{
- return Generator ? Generator->IsSetToOff(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToEmpty(const std::string& op) const
-{
- return Generator ? Generator->IsSetToEmpty(op) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
}
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
@@ -264,11 +212,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
Licenses.clear();
cmSystemTools::ExpandListArgument(option, Licenses);
if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
Licenses.clear();
}
}
@@ -276,8 +224,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component \"" << component->Name << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
@@ -341,11 +289,11 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
Licenses.clear();
cmSystemTools::ExpandListArgument(option, Licenses);
if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
Licenses.clear();
}
}
@@ -353,8 +301,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component group \"" << group->Name
<< "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
@@ -514,11 +462,11 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
Default.clear();
} else if (const char* value = GetOption(option)) {
std::string lowerValue = cmsys::SystemTools::LowerCase(value);
- if (lowerValue.compare("true") == 0) {
+ if (lowerValue == "true") {
Default = "true";
- } else if (lowerValue.compare("false") == 0) {
+ } else if (lowerValue == "false") {
Default = "false";
- } else if (lowerValue.compare("script") == 0) {
+ } else if (lowerValue == "script") {
Default = "script";
} else {
Default = value;
@@ -590,7 +538,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
if (!Script.empty()) {
std::string name = cmSystemTools::GetFilenameName(Script);
std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(Script, path);
xout.Element("Script", name);
}
@@ -599,8 +547,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
for (size_t i = 0; i < userInterfaces.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]);
std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path);
userInterfaces[i] = name;
}
if (!userInterfaces.empty()) {
@@ -616,8 +563,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
for (size_t i = 0; i < translations.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(translations[i]);
std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(translations[i], path);
translations[i] = name;
}
if (!translations.empty()) {
@@ -675,7 +621,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
for (size_t i = 1; i < licenses.size(); i += 2) {
std::string name = cmSystemTools::GetFilenameName(licenses[i]);
std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path);
licenses[i] = name;
}
if (!licenses.empty()) {
@@ -716,10 +662,3 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.EndElement();
xout.EndDocument();
}
-
-void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 025a03e..f9e577a 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -5,20 +5,20 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
#include <set>
#include <string>
#include <vector>
class cmCPackComponent;
class cmCPackComponentGroup;
-class cmCPackIFWGenerator;
class cmCPackIFWInstaller;
-class cmXMLWriter;
/** \class cmCPackIFWPackage
* \brief A single component to be installed by CPack IFW generator
*/
-class cmCPackIFWPackage
+class cmCPackIFWPackage : public cmCPackIFWCommon
{
public:
// Types
@@ -119,15 +119,6 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
- bool IsSetToOff(const std::string& op) const;
- bool IsSetToEmpty(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
std::string GetComponentName(cmCPackComponent* component);
void DefaultConfiguration();
@@ -140,8 +131,6 @@ public:
void GeneratePackageFile();
- // Pointer to generator
- cmCPackIFWGenerator* Generator;
// Pointer to installer
cmCPackIFWInstaller* Installer;
// Collection of dependencies
@@ -152,9 +141,6 @@ public:
std::set<DependenceStruct*> AlienAutoDependOn;
// Patch to package directory
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWPackage_h
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 8ce375e..9190596 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -2,32 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWRepository.h"
-#include "cmCPackGenerator.h"
#include "cmCPackIFWGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#include "cmConfigure.h"
#include <stddef.h>
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
-
cmCPackIFWRepository::cmCPackIFWRepository()
: Update(None)
- , Generator(CM_NULLPTR)
{
}
@@ -53,31 +37,6 @@ bool cmCPackIFWRepository::IsValid() const
return valid;
}
-const char* cmCPackIFWRepository::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWRepository::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
-}
-
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
@@ -325,10 +284,3 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
xout.EndElement();
}
}
-
-void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index c09a158..227cfae 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -5,16 +5,17 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmXMLWriter;
/** \class cmCPackIFWRepository
* \brief A remote repository to be created CPack IFW generator
*/
-class cmCPackIFWRepository
+class cmCPackIFWRepository : public cmCPackIFWCommon
{
public:
// Types
@@ -72,13 +73,6 @@ public:
bool IsValid() const;
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
bool ConfigureFromOptions();
bool PatchUpdatesXml();
@@ -87,12 +81,8 @@ public:
void WriteRepositoryUpdate(cmXMLWriter& xout);
void WriteRepositoryUpdates(cmXMLWriter& xout);
- cmCPackIFWGenerator* Generator;
RepositoriesVector RepositoryUpdate;
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWRepository_h
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 2df23fd..274dfd0 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -677,10 +677,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
cpackPackageDesktopLinksList);
}
- AddDirectoryAndFileDefinitons(rootPath, "INSTALL_ROOT", directoryDefinitions,
- fileDefinitions, featureDefinitions,
- cpackPackageExecutablesList,
- cpackPackageDesktopLinksList, shortcuts);
+ AddDirectoryAndFileDefinitions(
+ rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions,
+ featureDefinitions, cpackPackageExecutablesList,
+ cpackPackageDesktopLinksList, shortcuts);
featureDefinitions.EndElement("FeatureRef");
@@ -841,7 +841,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
return true;
}
-void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
+void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
@@ -906,12 +906,12 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
directoryDefinitions.AddAttribute("Name", fileName);
+ this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
- AddDirectoryAndFileDefinitons(
+ AddDirectoryAndFileDefinitions(
fullPath, subDirectoryId, directoryDefinitions, fileDefinitions,
featureDefinitions, packageExecutables, desktopExecutables, shortcuts);
- this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory");
} else {
cmInstalledFile const* installedFile = this->GetInstalledFile(
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 353d6c0..b2633a7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -104,7 +104,7 @@ private:
bool RunLightCommand(std::string const& objectFiles);
- void AddDirectoryAndFileDefinitons(
+ void AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 79a9fdd..0be4377 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -44,6 +44,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
+ patch.ApplyFragment("CM_G_" + group.Name, *this);
+
for (std::vector<cmCPackComponentGroup*>::const_iterator i =
group.Subgroups.begin();
i != group.Subgroups.end(); ++i) {
@@ -56,8 +58,6 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
EmitFeatureForComponent(**i, patch);
}
- patch.ApplyFragment("CM_G_" + group.Name, *this);
-
EndElement("Feature");
}
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 7aa1212..b4cd1a3 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -136,6 +136,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
}
}
+ patch.ApplyFragment(componentId, *this);
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);
@@ -147,16 +148,15 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
if (!(fileMode & S_IWRITE)) {
AddAttribute("ReadOnly", "yes");
}
+ patch.ApplyFragment(fileId, *this);
if (installedFile) {
cmWIXAccessControlList acl(Logger, *installedFile, *this);
acl.Apply();
}
- patch.ApplyFragment(fileId, *this);
EndElement("File");
- patch.ApplyFragment(componentId, *this);
EndElement("Component");
EndElement("DirectoryRef");
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index 3a7dbfd..287a644 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -29,7 +29,11 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
const cmWIXPatchElement& fragment = i->second;
-
+ for (cmWIXPatchElement::attributes_t::const_iterator attr_i =
+ fragment.attributes.begin();
+ attr_i != fragment.attributes.end(); ++attr_i) {
+ writer.AddAttribute(attr_i->first, attr_i->second);
+ }
this->ApplyElementChildren(fragment, writer);
Fragments.erase(i);
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 7f2ae19..0dcc74a 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
void cmWIXPatchParser::StartFragment(const char** attributes)
{
+ cmWIXPatchElement* new_element = CM_NULLPTR;
+ /* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
- std::string key = attributes[i];
- std::string value = attributes[i + 1];
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) {
@@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError(tmp.str());
}
- ElementStack.push_back(&Fragments[value]);
- } else {
- ReportValidationError(
- "The only allowed 'CPackWixFragment' attribute is 'Id'");
+ new_element = &Fragments[value];
+ ElementStack.push_back(new_element);
+ }
+ }
+
+ /* add any additional attributes for the fragement */
+ if (!new_element) {
+ ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
+ } else {
+ for (size_t i = 0; attributes[i]; i += 2) {
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
+
+ if (key != "Id") {
+ new_element->attributes[key] = value;
+ }
}
}
}
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index c0c96cd..52c7e35 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -7,8 +7,8 @@
#include "cmXMLParser.h"
-#include <list>
#include <map>
+#include <vector>
struct cmWIXPatchNode
{
@@ -36,7 +36,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::list<cmWIXPatchNode*> child_list_t;
+ typedef std::vector<cmWIXPatchNode*> child_list_t;
typedef std::map<std::string, std::string> attributes_t;
std::string name;
@@ -84,7 +84,7 @@ private:
fragment_map_t& Fragments;
- std::list<cmWIXPatchElement*> ElementStack;
+ std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index a95ca76..c5495c6 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -6,7 +6,6 @@
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
-#include <list>
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -314,7 +313,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
const std::string& tempDir = tempInstallDirectory;
for (it = installDirectoriesVector.begin();
it != installDirectoriesVector.end(); ++it) {
- std::list<std::pair<std::string, std::string> > symlinkedFiles;
+ std::vector<std::pair<std::string, std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = *it;
@@ -378,7 +377,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
/* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) {
- std::list<std::pair<std::string, std::string> >::iterator symlinkedIt;
+ std::vector<std::pair<std::string, std::string> >::iterator
+ symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/" + subdir;
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 4d970d5..87c532c 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -2222,7 +2222,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
if (line.empty() || line[0] == '#') {
// Ignore blank and comment lines.
continue;
- } else if (line[0] == ' ') {
+ }
+ if (line[0] == ' ') {
// Label lines appear indented by one space.
std::string label = line.substr(1);
int id = this->GetLabelId(label);
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 7195bb3..a782150 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -306,7 +306,8 @@ void cmCTestLaunch::LoadLabels()
if (line.empty() || line[0] == '#') {
// Ignore blank and comment lines.
continue;
- } else if (line[0] == ' ') {
+ }
+ if (line[0] == ' ') {
// Label lines appear indented by one space.
if (inTarget || inSource) {
this->Labels.insert(line.c_str() + 1);
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index d738a1b..fdc16b1 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -561,7 +561,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
// In parallel test runs repeatedly move dependencies of the tests on
// the current dependency level to the next level until no
// further dependencies exist.
- while (priorityStack.back().size()) {
+ while (!priorityStack.back().empty()) {
TestSet& previousSet = priorityStack.back();
priorityStack.push_back(TestSet());
TestSet& currentSet = priorityStack.back();
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index a4853b7..fe23075 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -167,6 +167,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
std::vector<std::pair<cmsys::RegularExpression, std::string> >::iterator
passIt;
bool forceFail = false;
+ bool skipped = false;
bool outputTestErrorsToConsole = false;
if (!this->TestProperties->RequiredRegularExpressions.empty() &&
this->FailedDependencies.empty()) {
@@ -219,6 +220,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
this->TestResult.CompletionStatus = s.str();
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
+ skipped = true;
} else if ((success && !this->TestProperties->WillFail) ||
(!success && this->TestProperties->WillFail)) {
this->TestResult.Status = cmCTestTestHandler::COMPLETED;
@@ -338,7 +340,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
compress ? this->CompressedOutput : this->ProcessOutput;
this->TestResult.CompressOutput = compress;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
- this->TestResult.CompletionStatus = "Completed";
+ if (!skipped) {
+ this->TestResult.CompletionStatus = "Completed";
+ }
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
this->MemCheckPostProcess();
this->ComputeWeightedCost();
@@ -349,7 +353,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->TestHandler->TestResults.push_back(this->TestResult);
}
delete this->TestProcess;
- return passed;
+ return passed || skipped;
}
bool cmCTestRunTest::StartAgain()
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 0b87281..f60f78c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -103,8 +103,8 @@ bool cmCTestSVN::NoteOldRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.OldRevision = this->LoadInfo(svninfo);
@@ -127,8 +127,8 @@ bool cmCTestSVN::NoteNewRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.NewRevision = this->LoadInfo(svninfo);
@@ -380,8 +380,8 @@ bool cmCTestSVN::LoadRevisions()
{
bool result = true;
// Get revisions for all the external repositories
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
result = this->LoadRevisions(svninfo) && result;
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index d90d387..46b0778 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -8,7 +8,6 @@
#include "cmCTestGlobalVC.h"
#include <iosfwd>
-#include <list>
#include <string>
#include <vector>
@@ -71,7 +70,7 @@ private:
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
- std::list<SVNInfo> Repositories;
+ std::vector<SVNInfo> Repositories;
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index a756188..075b140 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -20,6 +20,9 @@ cmCTestTestCommand::cmCTestTestCommand()
this->Arguments[ctt_INCLUDE] = "INCLUDE";
this->Arguments[ctt_EXCLUDE_LABEL] = "EXCLUDE_LABEL";
this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
+ this->Arguments[ctt_EXCLUDE_FIXTURE] = "EXCLUDE_FIXTURE";
+ this->Arguments[ctt_EXCLUDE_FIXTURE_SETUP] = "EXCLUDE_FIXTURE_SETUP";
+ this->Arguments[ctt_EXCLUDE_FIXTURE_CLEANUP] = "EXCLUDE_FIXTURE_CLEANUP";
this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
this->Arguments[ctt_STOP_TIME] = "STOP_TIME";
@@ -33,10 +36,11 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
const char* ctestTimeout =
this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
- double timeout = this->CTest->GetTimeOut();
+ double timeout;
if (ctestTimeout) {
timeout = atof(ctestTimeout);
} else {
+ timeout = this->CTest->GetTimeOut();
if (timeout <= 0) {
// By default use timeout of 10 minutes
timeout = 600;
@@ -75,6 +79,18 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
handler->SetOption("LabelRegularExpression",
this->Values[ctt_INCLUDE_LABEL]);
}
+ if (this->Values[ctt_EXCLUDE_FIXTURE]) {
+ handler->SetOption("ExcludeFixtureRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE]);
+ }
+ if (this->Values[ctt_EXCLUDE_FIXTURE_SETUP]) {
+ handler->SetOption("ExcludeFixtureSetupRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE_SETUP]);
+ }
+ if (this->Values[ctt_EXCLUDE_FIXTURE_CLEANUP]) {
+ handler->SetOption("ExcludeFixtureCleanupRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE_CLEANUP]);
+ }
if (this->Values[ctt_PARALLEL_LEVEL]) {
handler->SetOption("ParallelLevel", this->Values[ctt_PARALLEL_LEVEL]);
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 1893104..be7e783 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -53,6 +53,9 @@ protected:
ctt_INCLUDE,
ctt_EXCLUDE_LABEL,
ctt_INCLUDE_LABEL,
+ ctt_EXCLUDE_FIXTURE,
+ ctt_EXCLUDE_FIXTURE_SETUP,
+ ctt_EXCLUDE_FIXTURE_CLEANUP,
ctt_PARALLEL_LEVEL,
ctt_SCHEDULE_RANDOM,
ctt_STOP_TIME,
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index dafeec2..a5cc1fa 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -17,6 +17,7 @@
#include <string.h>
#include <time.h>
+#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestBatchTestHandler.h"
#include "cmCTestMultiProcessHandler.h"
@@ -361,6 +362,9 @@ void cmCTestTestHandler::Initialize()
this->ExcludeLabelRegularExpression = "";
this->IncludeRegExp = "";
this->ExcludeRegExp = "";
+ this->ExcludeFixtureRegExp.clear();
+ this->ExcludeFixtureSetupRegExp.clear();
+ this->ExcludeFixtureCleanupRegExp.clear();
TestsToRunString = "";
this->UseUnion = false;
@@ -438,6 +442,18 @@ int cmCTestTestHandler::ProcessHandler()
this->UseExcludeRegExp();
this->SetExcludeRegExp(val);
}
+ val = this->GetOption("ExcludeFixtureRegularExpression");
+ if (val) {
+ this->ExcludeFixtureRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureSetupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureSetupRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureCleanupRegExp = val;
+ }
this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
this->TestResults.clear();
@@ -495,7 +511,8 @@ int cmCTestTestHandler::ProcessHandler()
for (SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit) {
- if (ftit->CompletionStatus == "Disabled") {
+ if (cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") ||
+ ftit->CompletionStatus == "Disabled") {
disabledTests.push_back(*ftit);
}
}
@@ -521,17 +538,22 @@ int cmCTestTestHandler::ProcessHandler()
if (!disabledTests.empty()) {
cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
- << "The following tests are disabled and did not run:"
- << std::endl);
+ << "The following tests did not run:" << std::endl);
this->StartLogFile("TestsDisabled", ofs);
+ const char* disabled_reason;
for (std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator dtit =
disabledTests.begin();
dtit != disabledTests.end(); ++dtit) {
ofs << dtit->TestCount << ":" << dtit->Name << std::endl;
+ if (dtit->CompletionStatus == "Disabled") {
+ disabled_reason = "Disabled";
+ } else {
+ disabled_reason = "Skipped";
+ }
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t"
<< std::setw(3) << dtit->TestCount << " - " << dtit->Name
- << std::endl);
+ << " (" << disabled_reason << ")" << std::endl);
}
}
@@ -544,6 +566,7 @@ int cmCTestTestHandler::ProcessHandler()
for (SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit) {
if (ftit->Status != cmCTestTestHandler::COMPLETED &&
+ !cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") &&
ftit->CompletionStatus != "Disabled") {
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
cmCTestLog(
@@ -820,13 +843,35 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
"Updating test list for fixtures" << std::endl,
this->Quiet);
+ // Prepare regular expression evaluators
+ std::string setupRegExp(this->ExcludeFixtureRegExp);
+ std::string cleanupRegExp(this->ExcludeFixtureRegExp);
+ if (!this->ExcludeFixtureSetupRegExp.empty()) {
+ if (setupRegExp.empty()) {
+ setupRegExp = this->ExcludeFixtureSetupRegExp;
+ } else {
+ setupRegExp.append("(" + setupRegExp + ")|(" +
+ this->ExcludeFixtureSetupRegExp + ")");
+ }
+ }
+ if (!this->ExcludeFixtureCleanupRegExp.empty()) {
+ if (cleanupRegExp.empty()) {
+ cleanupRegExp = this->ExcludeFixtureCleanupRegExp;
+ } else {
+ cleanupRegExp.append("(" + cleanupRegExp + ")|(" +
+ this->ExcludeFixtureCleanupRegExp + ")");
+ }
+ }
+ cmsys::RegularExpression excludeSetupRegex(setupRegExp);
+ cmsys::RegularExpression excludeCleanupRegex(cleanupRegExp);
+
// Prepare some maps to help us find setup and cleanup tests for
// any given fixture
typedef ListOfTests::const_iterator TestIterator;
typedef std::multimap<std::string, TestIterator> FixtureDependencies;
typedef FixtureDependencies::const_iterator FixtureDepsIterator;
FixtureDependencies fixtureSetups;
- FixtureDependencies fixtureDeps;
+ FixtureDependencies fixtureCleanups;
for (ListOfTests::const_iterator it = this->TestList.begin();
it != this->TestList.end(); ++it) {
@@ -836,13 +881,12 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
for (std::set<std::string>::const_iterator depsIt = setups.begin();
depsIt != setups.end(); ++depsIt) {
fixtureSetups.insert(std::make_pair(*depsIt, it));
- fixtureDeps.insert(std::make_pair(*depsIt, it));
}
const std::set<std::string>& cleanups = p.FixturesCleanup;
for (std::set<std::string>::const_iterator depsIt = cleanups.begin();
depsIt != cleanups.end(); ++depsIt) {
- fixtureDeps.insert(std::make_pair(*depsIt, it));
+ fixtureCleanups.insert(std::make_pair(*depsIt, it));
}
}
@@ -916,34 +960,72 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
// added from a previously checked test). A fixture isn't required
// to have setup/cleanup tests.
if (!addedFixtures.insert(requiredFixtureName).second) {
- // Already added this fixture
+ // Already seen this fixture, no need to check it again
continue;
}
- std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
- fixtureDeps.equal_range(requiredFixtureName);
- for (FixtureDepsIterator it = fixtureRange.first;
- it != fixtureRange.second; ++it) {
- ListOfTests::const_iterator lotIt = it->second;
- const cmCTestTestProperties& p = *lotIt;
-
- if (!addedTests.insert(p.Name).second) {
- // Already have p in our test list
- continue;
+
+ // Only add setup tests if this fixture has not been excluded
+ if (setupRegExp.empty() ||
+ !excludeSetupRegex.find(requiredFixtureName)) {
+ std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
+ fixtureSetups.equal_range(requiredFixtureName);
+ for (FixtureDepsIterator it = fixtureRange.first;
+ it != fixtureRange.second; ++it) {
+ ListOfTests::const_iterator lotIt = it->second;
+ const cmCTestTestProperties& p = *lotIt;
+
+ if (!addedTests.insert(p.Name).second) {
+ // Already have p in our test list
+ continue;
+ }
+
+ // This is a test not yet in our list, so add it and
+ // update its index to reflect where it was in the original
+ // full list of all tests (needed to track individual tests
+ // across ctest runs for re-run failed, etc.)
+ tests.push_back(p);
+ tests.back().Index =
+ 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
+ ++fixtureTestsAdded;
+
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Added setup test "
+ << p.Name << " required by fixture "
+ << requiredFixtureName << std::endl,
+ this->Quiet);
}
+ }
- // This is a test not yet in our list, so add it and
- // update its index to reflect where it was in the original
- // full list of all tests (needed to track individual tests
- // across ctest runs for re-run failed, etc.)
- tests.push_back(p);
- tests.back().Index =
- 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
- ++fixtureTestsAdded;
-
- cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Added test "
- << p.Name << " required by fixture "
- << requiredFixtureName << std::endl,
- this->Quiet);
+ // Only add cleanup tests if this fixture has not been excluded
+ if (cleanupRegExp.empty() ||
+ !excludeCleanupRegex.find(requiredFixtureName)) {
+ std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
+ fixtureCleanups.equal_range(requiredFixtureName);
+ for (FixtureDepsIterator it = fixtureRange.first;
+ it != fixtureRange.second; ++it) {
+ ListOfTests::const_iterator lotIt = it->second;
+ const cmCTestTestProperties& p = *lotIt;
+
+ if (!addedTests.insert(p.Name).second) {
+ // Already have p in our test list
+ continue;
+ }
+
+ // This is a test not yet in our list, so add it and
+ // update its index to reflect where it was in the original
+ // full list of all tests (needed to track individual tests
+ // across ctest runs for re-run failed, etc.)
+ tests.push_back(p);
+ tests.back().Index =
+ 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
+ ++fixtureTestsAdded;
+
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Added cleanup test "
+ << p.Name << " required by fixture "
+ << requiredFixtureName << std::endl,
+ this->Quiet);
+ }
}
}
@@ -1633,10 +1715,10 @@ void cmCTestTestHandler::UseExcludeRegExp()
const char* cmCTestTestHandler::GetTestStatus(int status)
{
- static const char statuses[][100] = {
- "Not Run", "Timeout", "SEGFAULT", "ILLEGAL", "INTERRUPT",
- "NUMERICAL", "OTHER_FAULT", "Failed", "BAD_COMMAND", "Completed"
- };
+ static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT",
+ "ILLEGAL", "INTERRUPT", "NUMERICAL",
+ "OTHER_FAULT", "Failed", "BAD_COMMAND",
+ "Completed" };
if (status < cmCTestTestHandler::NOT_RUN ||
status > cmCTestTestHandler::COMPLETED) {
@@ -1727,7 +1809,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
// bcc crashes if we attempt a normal substring comparison,
// hence the following workaround
std::string fileNameSubstring = fileName.substr(0, pattern.length());
- if (fileNameSubstring.compare(pattern) != 0) {
+ if (fileNameSubstring != pattern) {
continue;
}
if (logName == "") {
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 3700f8a..0edcb14 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -280,6 +280,9 @@ private:
std::string ExcludeLabelRegExp;
std::string IncludeRegExp;
std::string ExcludeRegExp;
+ std::string ExcludeFixtureRegExp;
+ std::string ExcludeFixtureSetupRegExp;
+ std::string ExcludeFixtureCleanupRegExp;
cmsys::RegularExpression IncludeLabelRegularExpression;
cmsys::RegularExpression ExcludeLabelRegularExpression;
cmsys::RegularExpression IncludeTestsRegularExpression;
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 9ae48d8..9cdd50b 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -46,7 +46,8 @@ public:
beginSet.push_back("begin");
coverageVector.push_back(-1);
continue;
- } else if (line.find('{') != line.npos) {
+ }
+ if (line.find('{') != line.npos) {
blockComFlag = true;
} else if (line.find('}') != line.npos) {
blockComFlag = false;
diff --git a/Source/Checks/cm_cxx_eq_delete.cxx b/Source/Checks/cm_cxx_eq_delete.cxx
new file mode 100644
index 0000000..809e4cf
--- /dev/null
+++ b/Source/Checks/cm_cxx_eq_delete.cxx
@@ -0,0 +1,14 @@
+struct Foo
+{
+ Foo() {}
+ ~Foo() {}
+ Foo(Foo const&) = delete;
+ Foo& operator=(Foo const&) = delete;
+ int test() const { return 0; }
+};
+
+int main()
+{
+ Foo const foo;
+ return foo.test();
+}
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index 80c9f3b..cd58539 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -33,6 +33,7 @@ endfunction()
if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(auto_ptr)
+ cm_check_cxx_feature(eq_delete)
cm_check_cxx_feature(make_unique)
if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index 45f01aa..90bcc22 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -12,6 +12,8 @@ class cmCursesMainForm;
class cmCursesBoolWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesBoolWidget)
+
public:
cmCursesBoolWidget(int width, int height, int left, int top);
@@ -25,10 +27,6 @@ public:
// Set/Get the value (on/off).
void SetValueAsBool(bool value);
bool GetValueAsBool();
-
-protected:
- cmCursesBoolWidget(const cmCursesBoolWidget& from);
- void operator=(const cmCursesBoolWidget&);
};
#endif // cmCursesBoolWidget_h
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index cdde1a3..d071c91 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -14,7 +14,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include "cmConfigure.h"
#include <assert.h>
#include <vector>
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 1dbcfa4..3c50078 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -3,7 +3,7 @@
#ifndef cmCursesCacheEntryComposite_h
#define cmCursesCacheEntryComposite_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -13,6 +13,8 @@ class cmake;
class cmCursesCacheEntryComposite
{
+ CM_DISABLE_COPY(cmCursesCacheEntryComposite)
+
public:
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
int entrywidth);
@@ -24,9 +26,6 @@ public:
friend class cmCursesMainForm;
protected:
- cmCursesCacheEntryComposite(const cmCursesCacheEntryComposite& from);
- void operator=(const cmCursesCacheEntryComposite&);
-
cmCursesLabelWidget* Label;
cmCursesLabelWidget* IsNewLabel;
cmCursesWidget* Entry;
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index 0381f25..d9bb6ba 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -12,6 +12,8 @@ class cmCursesMainForm;
class cmCursesDummyWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesDummyWidget)
+
public:
cmCursesDummyWidget(int width, int height, int left, int top);
@@ -20,10 +22,6 @@ public:
// when this widget has focus. Returns true if the input was
// handled.
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
-
-protected:
- cmCursesDummyWidget(const cmCursesDummyWidget& from);
- void operator=(const cmCursesDummyWidget&);
};
#endif // cmCursesDummyWidget_h
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h
index b4c04cb..6ad535b 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.h
+++ b/Source/CursesDialog/cmCursesFilePathWidget.h
@@ -3,18 +3,16 @@
#ifndef cmCursesFilePathWidget_h
#define cmCursesFilePathWidget_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesPathWidget.h"
class cmCursesFilePathWidget : public cmCursesPathWidget
{
+ CM_DISABLE_COPY(cmCursesFilePathWidget)
+
public:
cmCursesFilePathWidget(int width, int height, int left, int top);
-
-protected:
- cmCursesFilePathWidget(const cmCursesFilePathWidget& from);
- void operator=(const cmCursesFilePathWidget&);
};
#endif // cmCursesFilePathWidget_h
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 12e5d75..06c1e9c 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesForm.h"
-#include "cmConfigure.h"
-
cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 7eb94a8..553105c 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -3,7 +3,7 @@
#ifndef cmCursesForm_h
#define cmCursesForm_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesStandardIncludes.h"
@@ -11,6 +11,8 @@
class cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesForm)
+
public:
cmCursesForm();
virtual ~cmCursesForm();
@@ -55,9 +57,6 @@ protected:
static cmsys::ofstream DebugFile;
static bool Debug;
- cmCursesForm(const cmCursesForm& form);
- void operator=(const cmCursesForm&);
-
FORM* Form;
};
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index a0de4c6..267de7c 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesLabelWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesLabelWidget)
+
public:
cmCursesLabelWidget(int width, int height, int left, int top,
const std::string& name);
@@ -24,10 +26,6 @@ public:
// when this widget has focus. Returns true if the input was
// handled
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
-
-protected:
- cmCursesLabelWidget(const cmCursesLabelWidget& from);
- void operator=(const cmCursesLabelWidget&);
};
#endif // cmCursesLabelWidget_h
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index d299547..7fb065d 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -159,7 +159,8 @@ void cmCursesLongMessageForm::HandleInput()
// quit
if (key == 'o' || key == 'e') {
break;
- } else if (key == KEY_DOWN || key == ctrl('n')) {
+ }
+ if (key == KEY_DOWN || key == ctrl('n')) {
form_driver(this->Form, REQ_SCR_FLINE);
} else if (key == KEY_UP || key == ctrl('p')) {
form_driver(this->Form, REQ_SCR_BLINE);
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index ab49c07..cd8e095 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -13,6 +13,8 @@
class cmCursesLongMessageForm : public cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesLongMessageForm)
+
public:
cmCursesLongMessageForm(std::vector<std::string> const& messages,
const char* title);
@@ -38,9 +40,6 @@ public:
void UpdateStatusBar() CM_OVERRIDE;
protected:
- cmCursesLongMessageForm(const cmCursesLongMessageForm& from);
- void operator=(const cmCursesLongMessageForm&);
-
std::string Messages;
std::string Title;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 939c736..ca824c0 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -764,9 +764,8 @@ void cmCursesMainForm::HandleInput()
// quit
if (key == 'q') {
break;
- } else {
- continue;
}
+ continue;
}
currentField = current_field(this->Form);
@@ -826,7 +825,7 @@ void cmCursesMainForm::HandleInput()
// (index always corresponds to the value field)
// scroll down with arrow down, ctrl+n (emacs binding), or j (vim
// binding)
- else if (key == KEY_DOWN || key == ctrl('n') || key == 'j') {
+ if (key == KEY_DOWN || key == ctrl('n') || key == 'j') {
FIELD* cur = current_field(this->Form);
size_t findex = field_index(cur);
if (findex == 3 * this->NumberOfVisibleEntries - 1) {
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index b91211e..e35cf3e 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -23,6 +23,8 @@ class cmake;
*/
class cmCursesMainForm : public cmCursesForm
{
+ CM_DISABLE_COPY(cmCursesMainForm)
+
public:
cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
~cmCursesMainForm() CM_OVERRIDE;
@@ -103,9 +105,6 @@ public:
static void UpdateProgress(const char* msg, float prog, void*);
protected:
- cmCursesMainForm(const cmCursesMainForm& from);
- void operator=(const cmCursesMainForm&);
-
// Copy the cache values from the user interface to the actual
// cache.
void FillCacheManagerFromUI();
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index 4b2e8b4..7f4416f 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -15,6 +15,8 @@ class cmCursesMainForm;
class cmCursesOptionsWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesOptionsWidget)
+
public:
cmCursesOptionsWidget(int width, int height, int left, int top);
@@ -29,8 +31,6 @@ public:
void PreviousOption();
protected:
- cmCursesOptionsWidget(const cmCursesOptionsWidget& from);
- void operator=(const cmCursesOptionsWidget&);
std::vector<std::string> Options;
std::vector<std::string>::size_type CurrentOption;
};
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index 097eeca..ae6c16d 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesPathWidget : public cmCursesStringWidget
{
+ CM_DISABLE_COPY(cmCursesPathWidget)
+
public:
cmCursesPathWidget(int width, int height, int left, int top);
@@ -26,9 +28,6 @@ public:
void OnType(int& key, cmCursesMainForm* fm, WINDOW* w) CM_OVERRIDE;
protected:
- cmCursesPathWidget(const cmCursesPathWidget& from);
- void operator=(const cmCursesPathWidget&);
-
std::string LastString;
std::string LastGlob;
bool Cycle;
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index c07bfce..5eb3366 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -20,6 +20,8 @@ class cmCursesMainForm;
class cmCursesStringWidget : public cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesStringWidget)
+
public:
cmCursesStringWidget(int width, int height, int left, int top);
@@ -60,9 +62,6 @@ public:
bool PrintKeys() CM_OVERRIDE;
protected:
- cmCursesStringWidget(const cmCursesStringWidget& from);
- void operator=(const cmCursesStringWidget&);
-
// true if the widget is in edit mode
bool InEdit;
char* OriginalString;
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 229a050..054f27e 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesWidget.h"
-#include "cmConfigure.h"
-
cmCursesWidget::cmCursesWidget(int width, int height, int left, int top)
{
this->Field = new_field(height, width, top, left, 0, 0);
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 5ce8a75..3470d70 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -3,7 +3,7 @@
#ifndef cmCursesWidget_h
#define cmCursesWidget_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmCursesStandardIncludes.h"
#include "cmStateTypes.h"
@@ -14,6 +14,8 @@ class cmCursesMainForm;
class cmCursesWidget
{
+ CM_DISABLE_COPY(cmCursesWidget)
+
public:
cmCursesWidget(int width, int height, int left, int top);
virtual ~cmCursesWidget();
@@ -59,9 +61,6 @@ public:
friend class cmCursesMainForm;
protected:
- cmCursesWidget(const cmCursesWidget& from);
- void operator=(const cmCursesWidget&);
-
cmStateEnums::CacheEntryType Type;
std::string Value;
FIELD* Field;
diff --git a/Source/LexerParser/.clang-tidy b/Source/LexerParser/.clang-tidy
new file mode 100644
index 0000000..52b11bf
--- /dev/null
+++ b/Source/LexerParser/.clang-tidy
@@ -0,0 +1,6 @@
+---
+# We want to disable all checks for generated code. However, clang-tidy will
+# assume we did not configure it correctly. Just add one check that will never
+# be found.
+Checks: '-*,llvm-twine-local'
+...
diff --git a/Source/LexerParser/.gitattributes b/Source/LexerParser/.gitattributes
new file mode 100644
index 0000000..47eedfb
--- /dev/null
+++ b/Source/LexerParser/.gitattributes
@@ -0,0 +1,17 @@
+/cmCommandArgumentLexer.cxx generated
+/cmCommandArgumentLexer.h generated
+/cmCommandArgumentParser.cxx generated
+/cmCommandArgumentParserTokens.h generated
+/cmDependsJavaLexer.cxx generated
+/cmDependsJavaLexer.h generated
+/cmDependsJavaParser.cxx generated
+/cmDependsJavaParserTokens.h generated
+/cmExprLexer.cxx generated
+/cmExprLexer.h generated
+/cmExprParser.cxx generated
+/cmExprParserTokens.h generated
+/cmFortranLexer.cxx generated
+/cmFortranLexer.h generated
+/cmFortranParser.cxx generated
+/cmFortranParserTokens.h generated
+/cmListFileLexer.c generated
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx
index 12dce37..12dce37 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/LexerParser/cmCommandArgumentLexer.cxx
diff --git a/Source/cmCommandArgumentLexer.h b/Source/LexerParser/cmCommandArgumentLexer.h
index 82e87b5..82e87b5 100644
--- a/Source/cmCommandArgumentLexer.h
+++ b/Source/LexerParser/cmCommandArgumentLexer.h
diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l
index e3a8094..e3a8094 100644
--- a/Source/cmCommandArgumentLexer.in.l
+++ b/Source/LexerParser/cmCommandArgumentLexer.in.l
diff --git a/Source/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx
index aed0826..aed0826 100644
--- a/Source/cmCommandArgumentParser.cxx
+++ b/Source/LexerParser/cmCommandArgumentParser.cxx
diff --git a/Source/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y
index d6c8312..55a88df 100644
--- a/Source/cmCommandArgumentParser.y
+++ b/Source/LexerParser/cmCommandArgumentParser.y
@@ -189,4 +189,3 @@ void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
{
yyGetParser->Error(message);
}
-
diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/LexerParser/cmCommandArgumentParserTokens.h
index 3172182..3172182 100644
--- a/Source/cmCommandArgumentParserTokens.h
+++ b/Source/LexerParser/cmCommandArgumentParserTokens.h
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx
index 8159f47..8159f47 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/LexerParser/cmDependsJavaLexer.cxx
diff --git a/Source/cmDependsJavaLexer.h b/Source/LexerParser/cmDependsJavaLexer.h
index ccadd70..ccadd70 100644
--- a/Source/cmDependsJavaLexer.h
+++ b/Source/LexerParser/cmDependsJavaLexer.h
diff --git a/Source/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l
index 8cb42b1..8cb42b1 100644
--- a/Source/cmDependsJavaLexer.in.l
+++ b/Source/LexerParser/cmDependsJavaLexer.in.l
diff --git a/Source/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx
index bc45d45..bc45d45 100644
--- a/Source/cmDependsJavaParser.cxx
+++ b/Source/LexerParser/cmDependsJavaParser.cxx
diff --git a/Source/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y
index 1137f39..f7eb228 100644
--- a/Source/cmDependsJavaParser.y
+++ b/Source/LexerParser/cmDependsJavaParser.y
@@ -242,7 +242,7 @@ jp_DECIMALINTEGERLITERAL
yyGetParser->SetCurrentCombine("");
}
|
-jp_HEXINTEGERLITERAL
+jp_HEXINTEGERLITERAL
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3212,4 +3212,3 @@ void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message)
{
yyGetParser->Error(message);
}
-
diff --git a/Source/cmDependsJavaParserTokens.h b/Source/LexerParser/cmDependsJavaParserTokens.h
index 7f18f1d..7f18f1d 100644
--- a/Source/cmDependsJavaParserTokens.h
+++ b/Source/LexerParser/cmDependsJavaParserTokens.h
diff --git a/Source/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx
index fb6f0db..fb6f0db 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/LexerParser/cmExprLexer.cxx
diff --git a/Source/cmExprLexer.h b/Source/LexerParser/cmExprLexer.h
index 835a7a3..835a7a3 100644
--- a/Source/cmExprLexer.h
+++ b/Source/LexerParser/cmExprLexer.h
diff --git a/Source/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l
index 25ddba4..25ddba4 100644
--- a/Source/cmExprLexer.in.l
+++ b/Source/LexerParser/cmExprLexer.in.l
diff --git a/Source/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index 19efca1..67664a5 100644
--- a/Source/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -1696,4 +1696,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
cmExpr_yyget_extra(yyscanner)->Error(message);
}
-
diff --git a/Source/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index 220f7c8..d1c3a97 100644
--- a/Source/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -162,4 +162,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
cmExpr_yyget_extra(yyscanner)->Error(message);
}
-
diff --git a/Source/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h
index 84b2bbd..84b2bbd 100644
--- a/Source/cmExprParserTokens.h
+++ b/Source/LexerParser/cmExprParserTokens.h
diff --git a/Source/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx
index 01c09ac..01c09ac 100644
--- a/Source/cmFortranLexer.cxx
+++ b/Source/LexerParser/cmFortranLexer.cxx
diff --git a/Source/cmFortranLexer.h b/Source/LexerParser/cmFortranLexer.h
index ddda919..ddda919 100644
--- a/Source/cmFortranLexer.h
+++ b/Source/LexerParser/cmFortranLexer.h
diff --git a/Source/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l
index 1121210..1121210 100644
--- a/Source/cmFortranLexer.in.l
+++ b/Source/LexerParser/cmFortranLexer.in.l
diff --git a/Source/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx
index 2b3452f..2b3452f 100644
--- a/Source/cmFortranParser.cxx
+++ b/Source/LexerParser/cmFortranParser.cxx
diff --git a/Source/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y
index acfb40a..acfb40a 100644
--- a/Source/cmFortranParser.y
+++ b/Source/LexerParser/cmFortranParser.y
diff --git a/Source/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h
index 8d6a5fe..8d6a5fe 100644
--- a/Source/cmFortranParserTokens.h
+++ b/Source/LexerParser/cmFortranParserTokens.h
diff --git a/Source/cmListFileLexer.c b/Source/LexerParser/cmListFileLexer.c
index 3dd3b85..3dd3b85 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/LexerParser/cmListFileLexer.c
diff --git a/Source/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l
index 5152dbf..5152dbf 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/LexerParser/cmListFileLexer.in.l
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 2e11a8a..8619fe9 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -160,6 +160,19 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES})
+# Files generated by MOC, RCC, and UIC may produce clang-tidy warnings.
+# We generate a dummy .clang-tidy file in the binary directory that disables
+# all clang-tidy checks except one that will never match. This one check is
+# necessary; clang-tidy reports an error when no checks are enabled.
+# Since the Qt code generators will generate source files in the binary tree,
+# clang-tidy will load the configuration from this dummy file when the sources
+# are built.
+file(WRITE "${QtDialog_BINARY_DIR}/.clang-tidy" "
+---
+Checks: '-*,llvm-twine-local'
+...
+")
+
if(APPLE)
file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
LIMIT_COUNT 1 REGEX "^Copyright 2000-20[0-9][0-9] Kitware")
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 6026a57..691e3ae 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -235,35 +235,29 @@ public:
symbol.erase(posAt);
}
}
- // For i386 builds we don't need to remove _
+ // For i386 builds we need to remove _
if (this->IsI386 && symbol[0] == '_') {
symbol.erase(0, 1);
}
- /*
- Check whether it is "Scalar deleting destructor" and
- "Vector deleting destructor"
- */
+ // Check whether it is "Scalar deleting destructor" and "Vector
+ // deleting destructor"
+ // if scalarPrefix and vectorPrefix are not found then print the
+ // symbol
const char* scalarPrefix = "??_G";
const char* vectorPrefix = "??_E";
- // original code had a check for
- // symbol.find("real@") == std::string::npos)
- // but if this disallows memmber functions with the name real
- // if scalarPrefix and vectorPrefix are not found then print
- // the symbol
if (symbol.compare(0, 4, scalarPrefix) &&
symbol.compare(0, 4, vectorPrefix)) {
SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
.Characteristics;
- if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
- // Read only (i.e. constants) must be excluded
- this->DataSymbols.insert(symbol);
- } else {
- if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
- (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
- this->Symbols.insert(symbol);
- } else {
- // printf(" strange symbol: %s \n",symbol.c_str());
+
+ if (SectChar & IMAGE_SCN_MEM_EXECUTE) {
+ this->Symbols.insert(symbol);
+ } else if (SectChar & IMAGE_SCN_MEM_READ) {
+ // skip __real@ and __xmm@
+ if (symbol.find("_real") == std::string::npos &&
+ symbol.find("_xmm") == std::string::npos) {
+ this->DataSymbols.insert(symbol);
}
}
}
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 34ec0e3..dbd4dd1 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -32,7 +32,8 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (*i == "EXCLUDE_FROM_ALL") {
excludeFromAll = true;
continue;
- } else if (binArg.empty()) {
+ }
+ if (binArg.empty()) {
binArg = *i;
} else {
this->SetError("called with incorrect number of arguments");
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 70581ad..4adfe23 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -360,7 +360,8 @@ std::string cmWrap(std::string const& prefix, Range const& r,
}
template <typename Range>
-std::string cmWrap(char prefix, Range const& r, char suffix, std::string sep)
+std::string cmWrap(char prefix, Range const& r, char suffix,
+ std::string const& sep)
{
return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep);
}
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index c4065e1..e956cb2 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -3,13 +3,15 @@
#ifndef cmCLocaleEnvironmentScope_h
#define cmCLocaleEnvironmentScope_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <map>
#include <string>
class cmCLocaleEnvironmentScope
{
+ CM_DISABLE_COPY(cmCLocaleEnvironmentScope)
+
public:
cmCLocaleEnvironmentScope();
~cmCLocaleEnvironmentScope();
diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx
index ae6b0a1..57a8b38 100644
--- a/Source/cmCPackPropertiesGenerator.cxx
+++ b/Source/cmCPackPropertiesGenerator.cxx
@@ -19,7 +19,7 @@ cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
}
void cmCPackPropertiesGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent const& indent)
+ std::ostream& os, const std::string& config, Indent indent)
{
std::string const& expandedFileName =
this->InstalledFile.GetNameExpression().Evaluate(this->LG, config);
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index 6df5297..48f4c10 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackPropertiesGenerator_h
#define cmCPackPropertiesGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmScriptGenerator.h"
@@ -20,6 +20,8 @@ class cmLocalGenerator;
*/
class cmCPackPropertiesGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmCPackPropertiesGenerator)
+
public:
cmCPackPropertiesGenerator(cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
@@ -27,7 +29,7 @@ public:
protected:
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
- Indent const& indent) CM_OVERRIDE;
+ Indent indent) CM_OVERRIDE;
cmLocalGenerator* LG;
cmInstalledFile const& InstalledFile;
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 46fa86e..010221e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1899,6 +1899,34 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
->SetPersistentOption("ExcludeRegularExpression", args[i].c_str());
}
+ if (this->CheckArgument(arg, "-FA", "--fixture-exclude-any") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureRegularExpression",
+ args[i].c_str());
+ }
+ if (this->CheckArgument(arg, "-FS", "--fixture-exclude-setup") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureSetupRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureSetupRegularExpression",
+ args[i].c_str());
+ }
+ if (this->CheckArgument(arg, "-FC", "--fixture-exclude-cleanup") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureCleanupRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureCleanupRegularExpression",
+ args[i].c_str());
+ }
+
if (this->CheckArgument(arg, "--rerun-failed")) {
this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index f4a75d5..62eced0 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -24,6 +24,8 @@ struct cmListFileArgument;
*/
class cmCommand
{
+ CM_DISABLE_COPY(cmCommand)
+
public:
/**
* Construct the command. By default it has no makefile.
@@ -103,10 +105,6 @@ public:
*/
void SetError(const std::string& e);
-private:
- cmCommand(cmCommand const&); // = delete;
- cmCommand& operator=(cmCommand const&); // = delete;
-
protected:
cmMakefile* Makefile;
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 153efc4..4eb4531 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -8,7 +8,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include "cmConfigure.h"
#include <iostream>
#include <sstream>
#include <string.h>
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index 2b65a5a..465ca9e 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -3,7 +3,7 @@
#ifndef cmCommandArgumentParserHelper_h
#define cmCommandArgumentParserHelper_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
#include <vector>
@@ -12,6 +12,8 @@ class cmMakefile;
class cmCommandArgumentParserHelper
{
+ CM_DISABLE_COPY(cmCommandArgumentParserHelper)
+
public:
struct ParserType
{
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 178a7ce..391d65c 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -43,17 +43,6 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
}
-void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
- const std::string& lang)
-{
- // Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
-
- if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) {
- this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
- }
-}
-
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
cmLinkLineComputer* linkLineComputer, std::string& flags)
{
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 8ba2e22..c36145f 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -28,9 +28,6 @@ public:
std::string const& GetConfigName() const;
protected:
- // Add language feature flags.
- void AddFeatureFlags(std::string& flags, const std::string& lang);
-
// Feature query methods.
const char* GetFeature(const std::string& feature);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 60878e4..00e3ad2 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -36,12 +36,6 @@ public:
, Target(CM_NULLPTR)
{
}
- Item(Item const& item)
- : Value(item.Value)
- , IsPath(item.IsPath)
- , Target(item.Target)
- {
- }
Item(std::string const& v, bool p,
cmGeneratorTarget const* target = CM_NULLPTR)
: Value(v)
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index e30b43f..970fde5 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -21,6 +21,7 @@
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMake_HAVE_CXX_AUTO_PTR
+#cmakedefine CMake_HAVE_CXX_EQ_DELETE
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_NULLPTR
#cmakedefine CMake_HAVE_CXX_OVERRIDE
@@ -30,6 +31,12 @@
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
+#ifdef CMake_HAVE_CXX_EQ_DELETE
+#define CM_EQ_DELETE = delete
+#else
+#define CM_EQ_DELETE
+#endif
+
#ifdef CMake_HAVE_CXX_NULLPTR
#define CM_NULLPTR nullptr
#else
@@ -42,4 +49,8 @@
#define CM_OVERRIDE
#endif
+#define CM_DISABLE_COPY(Class) \
+ Class(Class const&) CM_EQ_DELETE; \
+ Class& operator=(Class const&) CM_EQ_DELETE;
+
#endif
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 021ad10..c380d85 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -3,7 +3,7 @@
#ifndef cmCryptoHash_h
#define cmCryptoHash_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <stddef.h>
#include <string>
@@ -16,6 +16,8 @@
*/
class cmCryptoHash
{
+ CM_DISABLE_COPY(cmCryptoHash)
+
public:
enum Algo
{
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 160e8e1..ddb8918 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -65,12 +65,6 @@ private:
, Used(false)
{
}
- Def(Def const& d)
- : std_string(d)
- , Exists(d.Exists)
- , Used(d.Used)
- {
- }
bool Exists;
bool Used;
};
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index a80b585..b33feb9 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -24,6 +24,8 @@ class cmLocalGenerator;
*/
class cmDepends
{
+ CM_DISABLE_COPY(cmDepends)
+
public:
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
@@ -116,10 +118,6 @@ protected:
std::vector<std::string> IncludePath;
void SetIncludePathFromLanguage(const std::string& lang);
-
-private:
- cmDepends(cmDepends const&); // Purposely not implemented.
- void operator=(cmDepends const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 4f52826..250d40f 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -22,6 +22,8 @@ class cmLocalGenerator;
*/
class cmDependsC : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsC)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -93,10 +95,6 @@ protected:
void WriteCacheFile() const;
void ReadCacheFile();
-
-private:
- cmDependsC(cmDependsC const&); // Purposely not implemented.
- void operator=(cmDependsC const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index a9a1ed3..ec208af 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -21,6 +21,8 @@ class cmLocalGenerator;
*/
class cmDependsFortran : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsFortran)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -77,9 +79,6 @@ protected:
cmDependsFortranInternals* Internal;
private:
- cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
- void operator=(cmDependsFortran const&); // Purposely not implemented.
-
std::string MaybeConvertToRelativePath(std::string const& base,
std::string const& path);
};
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 6efa51a..a07bf09 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -17,6 +17,8 @@
*/
class cmDependsJava : public cmDepends
{
+ CM_DISABLE_COPY(cmDependsJava)
+
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -33,10 +35,6 @@ protected:
bool CheckDependencies(
std::istream& internalDepends, const char* internalDependsFileName,
std::map<std::string, DependencyVector>& validDeps) CM_OVERRIDE;
-
-private:
- cmDependsJava(cmDependsJava const&); // Purposely not implemented.
- void operator=(cmDependsJava const&); // Purposely not implemented.
};
#endif
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 5f25113..c6286b3 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -129,28 +129,19 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
this->CurrentArgument = i->Argument;
// If a file name was given, use it. Otherwise, default to the
// given stream.
- cmsys::ofstream* fout = CM_NULLPTR;
+ cmsys::ofstream fout;
std::ostream* s = &os;
if (!i->Filename.empty()) {
- fout = new cmsys::ofstream(i->Filename.c_str());
- if (fout) {
- s = fout;
- } else {
- result = false;
- }
+ fout.open(i->Filename.c_str());
+ s = &fout;
} else if (++count > 1) {
os << "\n\n";
}
// Print this documentation type to the stream.
- if (!this->PrintDocumentation(i->HelpType, *s) || !*s) {
+ if (!this->PrintDocumentation(i->HelpType, *s) || s->fail()) {
result = false;
}
-
- // Close the file if we wrote one.
- if (fout) {
- delete fout;
- }
}
return result;
}
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 76a4a29..f530ba7 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDynamicLoader.h"
-#include "cmConfigure.h"
-
#include <map>
#include <string>
#include <utility>
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index dd69b40..7c46dd5 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -8,12 +8,14 @@
#ifndef cmDynamicLoader_h
#define cmDynamicLoader_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmsys/DynamicLoader.hxx" // IWYU pragma: export
class cmDynamicLoader
{
+ CM_DISABLE_COPY(cmDynamicLoader)
+
public:
// Description:
// Load a dynamic library into the current process.
@@ -28,10 +30,6 @@ public:
protected:
cmDynamicLoader() {}
~cmDynamicLoader() {}
-
-private:
- cmDynamicLoader(const cmDynamicLoader&); // Not implemented.
- void operator=(const cmDynamicLoader&); // Not implemented.
};
#endif
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 2a8137f..d23abec 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -44,6 +44,9 @@ typedef struct Elf32_Rela Elf32_Rela;
#ifdef _SCO_DS
#include <link.h> // For DT_SONAME etc.
#endif
+#ifndef DT_RUNPATH
+#define DT_RUNPATH 29
+#endif
// Low-level byte swapping implementation.
template <size_t s>
@@ -154,11 +157,7 @@ public:
// Lookup the RUNPATH in the DYNAMIC section.
StringEntry const* GetRunPath()
{
-#if defined(DT_RUNPATH)
return this->GetDynamicSectionString(DT_RUNPATH);
-#else
- return 0;
-#endif
}
// Return the recorded ELF type.
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 034a266..2c25e9b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,11 +10,11 @@
#include "cmsys/String.hxx"
#include <algorithm>
#include <assert.h>
-#include <list>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <vector>
#include "cmAlgorithms.h"
#include "cmCommandArgumentsHelper.h"
@@ -613,8 +613,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
continue;
}
- else if ((c >= 0x20 && c < 0x7F) || c == '\t' ||
- (c == '\n' && newline_consume)) {
+ if ((c >= 0x20 && c < 0x7F) || c == '\t' ||
+ (c == '\n' && newline_consume)) {
// This is an ASCII character that may be part of a string.
// Cast added to avoid compiler warning. Cast is ok because
// c is guaranteed to fit in char by the above if...
@@ -2618,7 +2618,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
- std::list<std::string> curl_headers;
+ std::vector<std::string> curl_headers;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -2862,7 +2862,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
struct curl_slist* headers = CM_NULLPTR;
- for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ for (std::vector<std::string>::const_iterator h = curl_headers.begin();
h != curl_headers.end(); ++h) {
headers = ::curl_slist_append(headers, h->c_str());
}
@@ -2952,7 +2952,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
- std::list<std::string> curl_headers;
+ std::vector<std::string> curl_headers;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -3120,7 +3120,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
}
struct curl_slist* headers = CM_NULLPTR;
- for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ for (std::vector<std::string>::const_iterator h = curl_headers.begin();
h != curl_headers.end(); ++h) {
headers = ::curl_slist_append(headers, h->c_str());
}
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 8f996cf..ccef508 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -3,7 +3,7 @@
#ifndef cmFileLock_h
#define cmFileLock_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -21,6 +21,8 @@ class cmFileLockResult;
*/
class cmFileLock
{
+ CM_DISABLE_COPY(cmFileLock)
+
public:
cmFileLock();
~cmFileLock();
@@ -44,9 +46,6 @@ public:
bool IsLocked(const std::string& filename) const;
private:
- cmFileLock(const cmFileLock&);
- cmFileLock& operator=(const cmFileLock&);
-
cmFileLockResult OpenFile();
cmFileLockResult LockWithoutTimeout();
cmFileLockResult LockWithTimeout(unsigned long timeoutSec);
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index 09c984c..c96a8c2 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -3,16 +3,18 @@
#ifndef cmFileLockPool_h
#define cmFileLockPool_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
-#include <list>
#include <string>
+#include <vector>
class cmFileLock;
class cmFileLockResult;
class cmFileLockPool
{
+ CM_DISABLE_COPY(cmFileLockPool)
+
public:
cmFileLockPool();
~cmFileLockPool();
@@ -52,13 +54,12 @@ public:
cmFileLockResult Release(const std::string& filename);
private:
- cmFileLockPool(const cmFileLockPool&);
- cmFileLockPool& operator=(const cmFileLockPool&);
-
bool IsAlreadyLocked(const std::string& filename) const;
class ScopePool
{
+ CM_DISABLE_COPY(ScopePool)
+
public:
ScopePool();
~ScopePool();
@@ -69,17 +70,14 @@ private:
bool IsAlreadyLocked(const std::string& filename) const;
private:
- ScopePool(const ScopePool&);
- ScopePool& operator=(const ScopePool&);
-
- typedef std::list<cmFileLock*> List;
+ typedef std::vector<cmFileLock*> List;
typedef List::iterator It;
typedef List::const_iterator CIt;
List Locks;
};
- typedef std::list<ScopePool*> List;
+ typedef std::vector<ScopePool*> List;
typedef List::iterator It;
typedef List::const_iterator CIt;
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index 9e66035..ed794c3 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -236,7 +236,7 @@ public:
cmFileMonitor::Callback cb)
: Parent(p)
, PathSegment(ps)
- , CbList({ cb })
+ , CbList({ std::move(cb) })
{
assert(p);
assert(!ps.empty());
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 694ce8a..34516f5 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -31,6 +31,8 @@ struct cmGeneratorExpressionEvaluator;
*/
class cmGeneratorExpression
{
+ CM_DISABLE_COPY(cmGeneratorExpression)
+
public:
/** Construct. */
cmGeneratorExpression(
@@ -61,14 +63,13 @@ public:
static std::string StripEmptyListElements(const std::string& input);
private:
- cmGeneratorExpression(const cmGeneratorExpression&);
- void operator=(const cmGeneratorExpression&);
-
cmListFileBacktrace Backtrace;
};
class cmCompiledGeneratorExpression
{
+ CM_DISABLE_COPY(cmCompiledGeneratorExpression)
+
public:
const char* Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet = false,
@@ -133,9 +134,6 @@ private:
friend class cmGeneratorExpression;
- cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression&);
- void operator=(const cmCompiledGeneratorExpression&);
-
cmListFileBacktrace Backtrace;
std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const std::string Input;
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index a6a341b..a0a826a 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -30,8 +30,7 @@ struct cmGeneratorExpressionEvaluator
cmGeneratorExpressionDAGChecker*) const = 0;
private:
- cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator&);
- void operator=(const cmGeneratorExpressionEvaluator&);
+ CM_DISABLE_COPY(cmGeneratorExpressionEvaluator)
};
struct TextContent : public cmGeneratorExpressionEvaluator
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 10a7706..3f50e32 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2919,6 +2919,19 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
}
}
+bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const
+{
+ std::vector<std::string> features;
+ this->GetCompileFeatures(features, config);
+ for (std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it) {
+ if (!this->Makefile->AddRequiredTargetFeature(this->Target, *it)) {
+ return false;
+ }
+ }
+ return true;
+}
+
std::string cmGeneratorTarget::GetImportedLibName(
std::string const& config) const
{
@@ -3973,15 +3986,14 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
<< theTarget->GetName() << "\".\n";
cmSystemTools::Error(e.str().c_str());
break;
- } else {
- propContent = consistent.second;
- continue;
}
- } else {
- // Explicitly set on target and not set in iface. Can't disagree.
+ propContent = consistent.second;
continue;
}
- } else if (impliedByUse) {
+ // Explicitly set on target and not set in iface. Can't disagree.
+ continue;
+ }
+ if (impliedByUse) {
propContent = impliedValue<PropertyType>(propContent);
if (ifaceIsSet) {
@@ -3999,43 +4011,36 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
<< "\" is in conflict.\n";
cmSystemTools::Error(e.str().c_str());
break;
- } else {
- propContent = consistent.second;
- continue;
}
- } else {
- // Implicitly set on target and not set in iface. Can't disagree.
+ propContent = consistent.second;
continue;
}
- } else {
- if (ifaceIsSet) {
- if (propInitialized) {
- std::pair<bool, PropertyType> consistent =
- consistentProperty(propContent, ifacePropContent, t);
- report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent.second);
- if (!consistent.first) {
- std::ostringstream e;
- e << "The INTERFACE_" << p << " property of \""
- << theTarget->GetName() << "\" does\nnot agree with the value "
- "of "
- << p << " already determined\nfor \"" << tgt->GetName()
- << "\".\n";
- cmSystemTools::Error(e.str().c_str());
- break;
- } else {
- propContent = consistent.second;
- continue;
- }
- } else {
- report += reportEntry + "(Interface set)\n";
- propContent = ifacePropContent;
- propInitialized = true;
+ // Implicitly set on target and not set in iface. Can't disagree.
+ continue;
+ }
+ if (ifaceIsSet) {
+ if (propInitialized) {
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent, ifacePropContent, t);
+ report += reportEntry;
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first) {
+ std::ostringstream e;
+ e << "The INTERFACE_" << p << " property of \""
+ << theTarget->GetName() << "\" does\nnot agree with the value of "
+ << p << " already determined\nfor \"" << tgt->GetName() << "\".\n";
+ cmSystemTools::Error(e.str().c_str());
+ break;
}
- } else {
- // Not set. Nothing to agree on.
+ propContent = consistent.second;
continue;
}
+ report += reportEntry + "(Interface set)\n";
+ propContent = ifacePropContent;
+ propInitialized = true;
+ } else {
+ // Not set. Nothing to agree on.
+ continue;
}
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 8a687e8..134b7c7 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -27,6 +27,8 @@ class cmTarget;
class cmGeneratorTarget
{
+ CM_DISABLE_COPY(cmGeneratorTarget)
+
public:
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
~cmGeneratorTarget();
@@ -410,6 +412,8 @@ public:
/** Add the target output files to the global generator manifest. */
void ComputeTargetManifest(const std::string& config) const;
+ bool ComputeCompileFeatures(std::string const& config) const;
+
/**
* Trace through the source files in this target and add al source files
* that they depend on, used by all generators
@@ -512,11 +516,6 @@ public:
, MacFolder(CM_NULLPTR)
{
}
- SourceFileFlags(SourceFileFlags const& r)
- : Type(r.Type)
- , MacFolder(r.MacFolder)
- {
- }
SourceFileType Type;
const char* MacFolder; // location inside Mac content folders
};
@@ -706,9 +705,6 @@ private:
void CheckPropertyCompatibility(cmComputeLinkInformation* info,
const std::string& config) const;
- cmGeneratorTarget(cmGeneratorTarget const&);
- void operator=(cmGeneratorTarget const&);
-
struct LinkImplClosure : public std::vector<cmGeneratorTarget const*>
{
LinkImplClosure()
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index ba623d5..7032cd5 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -232,10 +232,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
const char* lang = language.c_str();
if (notKernel) {
- this->LocalGenerator->AddLanguageFlags(flags, lang, config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang, config);
} else {
- this->LocalGenerator->AddLanguageFlags(
- flags, lang + std::string("_GHS_KERNEL"), config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang + std::string("_GHS_KERNEL"),
+ config);
}
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
config);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 50ad1a8..f3eb249 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1272,6 +1272,18 @@ bool cmGlobalGenerator::Compute()
this->LocalGenerators[i]->AddHelperCommands();
}
+ // Finalize the set of compile features for each target.
+ // FIXME: This turns into calls to cmMakefile::AddRequiredTargetFeature
+ // which actually modifies the <lang>_STANDARD target property
+ // on the original cmTarget instance. It accumulates features
+ // across all configurations. Some refactoring is needed to
+ // compute a per-config resulta purely during generation.
+ for (i = 0; i < this->LocalGenerators.size(); ++i) {
+ if (!this->LocalGenerators[i]->ComputeTargetCompileFeatures()) {
+ return false;
+ }
+ }
+
#ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmGeneratorTarget const*>::iterator it =
autogenTargets.begin();
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index aa2dd22..cc7ffed 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -560,12 +560,6 @@ private:
: LastDiskTime(-1)
{
}
- DirectoryContent(DirectoryContent const& dc)
- : LastDiskTime(dc.LastDiskTime)
- , All(dc.All)
- , Generated(dc.Generated)
- {
- }
};
std::map<std::string, DirectoryContent> DirectoryContentMap;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index e61cbd9..587e18a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -966,8 +966,14 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
}
}
+std::string OrderDependsTargetForTarget(cmGeneratorTarget const* target)
+{
+ return "cmake_object_order_depends_target_" + target->GetName();
+}
+
void cmGlobalNinjaGenerator::AppendTargetOutputs(
- cmGeneratorTarget const* target, cmNinjaDeps& outputs)
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends)
{
std::string configName =
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -979,15 +985,27 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
bool realname = target->IsFrameworkOnApple();
switch (target->GetType()) {
- case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
+ if (depends == DependOnTargetOrdering) {
+ outputs.push_back(OrderDependsTargetForTarget(target));
+ break;
+ }
+ }
+ // FALLTHROUGH
+ case cmStateEnums::EXECUTABLE: {
outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath(
configName, cmStateEnums::RuntimeBinaryArtifact, realname)));
break;
}
- case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
+ if (depends == DependOnTargetOrdering) {
+ outputs.push_back(OrderDependsTargetForTarget(target));
+ break;
+ }
+ }
+ // FALLTHROUGH
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::UTILITY: {
std::string path =
@@ -1003,7 +1021,8 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
}
void cmGlobalNinjaGenerator::AppendTargetDepends(
- cmGeneratorTarget const* target, cmNinjaDeps& outputs)
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends)
{
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
// These depend only on other CMake-provided targets, e.g. "all".
@@ -1023,7 +1042,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
- this->AppendTargetOutputs(*i, outs);
+ this->AppendTargetOutputs(*i, outs, depends);
}
std::sort(outs.begin(), outs.end());
outputs.insert(outputs.end(), outs.begin(), outs.end());
@@ -1823,10 +1842,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
+ std::vector<std::string> arg_full =
+ cmSystemTools::HandleResponseFile(argBeg, argEnd);
+
std::string arg_dd;
std::string arg_tdi;
std::vector<std::string> arg_ddis;
- for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) {
+ for (std::vector<std::string>::const_iterator a = arg_full.begin();
+ a != arg_full.end(); ++a) {
std::string const& arg = *a;
if (cmHasLiteralPrefix(arg, "--tdi=")) {
arg_tdi = arg.substr(6);
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index e06afb0..b1d6155 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -316,10 +316,12 @@ public:
ASD.insert(deps.begin(), deps.end());
}
- void AppendTargetOutputs(cmGeneratorTarget const* target,
- cmNinjaDeps& outputs);
- void AppendTargetDepends(cmGeneratorTarget const* target,
- cmNinjaDeps& outputs);
+ void AppendTargetOutputs(
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends = DependOnTargetArtifact);
+ void AppendTargetDepends(
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends = DependOnTargetArtifact);
void AppendTargetDependsClosure(cmGeneratorTarget const* target,
cmNinjaDeps& outputs);
void AddDependencyToAll(cmGeneratorTarget* target);
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index 2312bc0..da2bf8c 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -164,7 +164,7 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return true;
+ return cmSystemTools::FileExists(win81Root + "/um/windows.h", true);
}
return false;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 14ec72f..f067d8f 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -12,6 +12,7 @@
#include "cmsys/Encoding.hxx"
#include <assert.h>
+#include <vector>
#include <windows.h>
static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
@@ -293,6 +294,19 @@ void cmGlobalVisualStudio7Generator::Generate()
if (!cmSystemTools::GetErrorOccuredFlag()) {
this->CallVisualStudioMacro(MacroReload);
}
+
+ if (this->Version == VS8 && !this->CMakeInstance->GetIsInTryCompile()) {
+ const char* cmakeWarnVS8 =
+ this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS8");
+ if (!cmakeWarnVS8 || !cmSystemTools::IsOff(cmakeWarnVS8)) {
+ this->CMakeInstance->IssueMessage(
+ cmake::WARNING,
+ "The \"Visual Studio 8 2005\" generator is deprecated "
+ "and will be removed in a future version of CMake."
+ "\n"
+ "Add CMAKE_WARN_VS8=OFF to the cache to disable this warning.");
+ }
+ }
}
void cmGlobalVisualStudio7Generator::OutputSLNFile(
@@ -667,10 +681,10 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
// default build if another target depends on it
int type = target->GetType();
if (type == cmStateEnums::GLOBAL_TARGET) {
- std::list<std::string> targetNames;
+ std::vector<std::string> targetNames;
targetNames.push_back("INSTALL");
targetNames.push_back("PACKAGE");
- for (std::list<std::string>::const_iterator t = targetNames.begin();
+ for (std::vector<std::string>::const_iterator t = targetNames.begin();
t != targetNames.end(); ++t) {
// check if target <*t> is part of default build
if (target->GetName() == *t) {
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 1fcb5ac..7a42b72 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -54,7 +54,7 @@ public:
void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
entry.Name = std::string(vs8generatorName) + " [arch]";
- entry.Brief = "Generates Visual Studio 2005 project files. "
+ entry.Brief = "Deprecated. Generates Visual Studio 2005 project files. "
"Optional [arch] can be \"Win64\".";
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4213751..e2cb755 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -133,21 +133,15 @@ public:
bool SupportsPlatform() const CM_OVERRIDE { return false; }
};
-cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
- std::string const& version)
+cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(
+ cmake* cm, std::string const& version_string, unsigned int version_number)
: cmGlobalGenerator(cm)
{
- this->VersionString = version;
-
- // Compute an integer form of the version number.
- unsigned int v[2] = { 0, 0 };
- sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]);
- this->XcodeVersion = 10 * v[0] + v[1];
+ this->VersionString = version_string;
+ this->XcodeVersion = version_number;
this->RootObject = 0;
this->MainGroupChildren = 0;
- this->SourcesGroupChildren = 0;
- this->ResourcesGroupChildren = 0;
this->CurrentMakefile = 0;
this->CurrentLocalGenerator = 0;
this->XcodeBuildCommandInitialized = false;
@@ -189,13 +183,21 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist");
}
- CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
- new cmGlobalXCodeGenerator(cm, parser.Version));
- if (gg->XcodeVersion == 20) {
- cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
- "using Xcode 15 generator\n");
- gg->XcodeVersion = 15;
+ std::string const& version_string = parser.Version;
+
+ // Compute an integer form of the version number.
+ unsigned int v[2] = { 0, 0 };
+ sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]);
+ unsigned int version_number = 10 * v[0] + v[1];
+
+ if (version_number < 30) {
+ cm->IssueMessage(cmake::FATAL_ERROR,
+ "Xcode " + version_string + " not supported.");
+ return CM_NULLPTR;
}
+
+ CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
+ new cmGlobalXCodeGenerator(cm, version_string, version_number));
return gg.release();
#else
std::cerr << "CMake should be built with cmake to use Xcode, "
@@ -242,29 +244,25 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
- if (this->XcodeVersion >= 30) {
- if (ts.find_first_of(",=") != ts.npos) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "does not recognize the toolset\n"
- " " << ts << "\n"
- "that was specified.";
- /* clang-format on */
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
- return false;
- }
- this->GeneratorToolset = ts;
- if (!this->GeneratorToolset.empty()) {
- mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
- this->GeneratorToolset.c_str());
- }
- return true;
- } else {
- return cmGlobalGenerator::SetGeneratorToolset(ts, mf);
+ if (ts.find_first_of(",=") != ts.npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not recognize the toolset\n"
+ " " << ts << "\n"
+ "that was specified.";
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
}
+ this->GeneratorToolset = ts;
+ if (!this->GeneratorToolset.empty()) {
+ mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
+ this->GeneratorToolset.c_str());
+ }
+ return true;
}
void cmGlobalXCodeGenerator::EnableLanguage(
@@ -272,16 +270,13 @@ void cmGlobalXCodeGenerator::EnableLanguage(
{
mf->AddDefinition("XCODE", "1");
mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
- if (this->XcodeVersion == 15) {
- } else {
- if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
- mf->AddCacheDefinition(
- "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
- "Semicolon separated list of supported configuration types, "
- "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
- "anything else will be ignored.",
- cmStateEnums::STRING);
- }
+ if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
+ mf->AddCacheDefinition(
+ "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
+ "Semicolon separated list of supported configuration types, "
+ "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
+ "anything else will be ignored.",
+ cmStateEnums::STRING);
}
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
@@ -301,9 +296,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand(
makeCommand.push_back("-project");
std::string projectArg = projectName;
projectArg += ".xcode";
- if (this->XcodeVersion > 20) {
- projectArg += "proj";
- }
+ projectArg += "proj";
makeCommand.push_back(projectArg);
bool clean = false;
@@ -323,13 +316,8 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand(
} else {
makeCommand.push_back("ALL_BUILD");
}
- if (this->XcodeVersion == 15) {
- makeCommand.push_back("-buildstyle");
- makeCommand.push_back("Development");
- } else {
- makeCommand.push_back("-configuration");
- makeCommand.push_back(!config.empty() ? config : "Debug");
- }
+ makeCommand.push_back("-configuration");
+ makeCommand.push_back(!config.empty() ? config : "Debug");
makeCommand.insert(makeCommand.end(), makeOptions.begin(),
makeOptions.end());
}
@@ -391,9 +379,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
std::string target = tName;
std::replace(target.begin(), target.end(), ' ', '_');
std::string out = "PostBuild." + target;
- if (this->XcodeVersion > 20) {
- out += "." + configName;
- }
+ out += "." + configName;
return out;
}
@@ -603,12 +589,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj)
cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(
cmXCodeObject::PBXType ptype)
{
- cmXCodeObject* obj;
- if (this->XcodeVersion == 15) {
- obj = new cmXCodeObject(ptype, cmXCodeObject::OBJECT);
- } else {
- obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT);
- }
+ cmXCodeObject* obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT);
this->addObject(obj);
return obj;
}
@@ -718,18 +699,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmXCodeObject* buildFile =
this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), gtgt, lang, sf);
- cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
settings->AddAttributeIfNotEmpty("COMPILER_FLAGS",
this->CreateString(flags));
- // Is this a resource file in this target? Add it to the resources group...
- //
-
cmGeneratorTarget::SourceFileFlags tsFlags =
gtgt->GetTargetSourceFileFlags(sf);
- bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
@@ -739,10 +715,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
if (gtgt->IsFrameworkOnApple()) {
if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) {
attrs->AddObject(this->CreateString("Private"));
- isResource = true;
} else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) {
attrs->AddObject(this->CreateString("Public"));
- isResource = true;
}
}
@@ -762,14 +736,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
- // Add the fileRef to the top level Resources group/folder if it is not
- // already there.
- //
- if (isResource && this->ResourcesGroupChildren &&
- !this->ResourcesGroupChildren->HasObject(fileRef)) {
- this->ResourcesGroupChildren->AddObject(fileRef);
- }
-
buildFile->AddAttributeIfNotEmpty("settings", settings);
return buildFile;
}
@@ -894,9 +860,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
fileRef->AddAttribute("name", this->CreateString(name));
fileRef->AddAttribute("path", this->CreateString(path));
fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree));
- if (this->XcodeVersion == 15) {
- fileRef->AddAttribute("refType", this->CreateString("4"));
- }
return fileRef;
}
@@ -1561,9 +1524,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
std::vector<cmCustomCommand> const& commands, const std::string& configName)
{
std::string makefileName = makefileBasename;
- if (this->XcodeVersion > 20) {
- makefileName += configName;
- }
+ makefileName += configName;
cmGeneratedFileStream makefileStream(makefileName.c_str());
if (!makefileStream) {
return;
@@ -1684,7 +1645,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string& flags = cflags[lang];
// Add language-specific flags.
- this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
+ this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang,
+ configName);
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
@@ -1704,19 +1666,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
return;
}
- // Check IPO related warning/error.
- gtgt->IsIPOEnabled(configName);
+ if (gtgt->IsIPOEnabled(configName)) {
+ const char* ltoValue =
+ this->CurrentMakefile->IsOn("_CMAKE_LTO_THIN") ? "YES_THIN" : "YES";
+ buildSettings->AddAttribute("LLVM_LTO", this->CreateString(ltoValue));
+ }
// Add define flags
this->CurrentLocalGenerator->AppendFlags(
defFlags, this->CurrentMakefile->GetDefineFlags());
// Add preprocessor definitions for this target and configuration.
- BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30);
- if (this->XcodeVersion > 15) {
- this->AppendDefines(
- ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
- }
+ BuildObjectListOrString ppDefs(this, true);
+ this->AppendDefines(
+ ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
if (const char* exportMacro = gtgt->GetExportMacro()) {
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro);
@@ -1816,16 +1779,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
gtgt->GetType() == cmStateEnums::EXECUTABLE) {
- if (this->XcodeVersion >= 21) {
- if (!gtgt->UsesDefaultOutputDir(configName,
- cmStateEnums::RuntimeBinaryArtifact)) {
- std::string pncdir = gtgt->GetDirectory(configName);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir));
- }
- } else {
- buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir));
- pndir = gtgt->GetDirectory(configName);
+ if (!gtgt->UsesDefaultOutputDir(configName,
+ cmStateEnums::RuntimeBinaryArtifact)) {
+ std::string pncdir = gtgt->GetDirectory(configName);
+ buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+ this->CreateString(pncdir));
}
if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) {
@@ -1841,16 +1799,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
pnbase = gtgt->GetName();
pnsuffix = ".a";
- if (this->XcodeVersion >= 21) {
- std::string pncdir = this->GetObjectsNormalDirectory(
- this->CurrentProject, configName, gtgt);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir));
- } else {
- buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir));
- pndir = this->GetObjectsNormalDirectory(this->CurrentProject, configName,
- gtgt);
- }
+ std::string pncdir =
+ this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt);
+ buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+ this->CreateString(pncdir));
}
// Store the product name for all target types.
@@ -1919,7 +1871,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist));
- } else if (this->XcodeVersion >= 22) {
+ } else {
buildSettings->AddAttribute("MACH_O_TYPE",
this->CreateString("mh_bundle"));
buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
@@ -1931,14 +1883,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions += " ";
extraLinkOptions += createFlags;
}
- } else {
- // Add the flags to create a module.
- std::string createFlags = this->LookupFlags(
- "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle");
- if (!createFlags.empty()) {
- extraLinkOptions += " ";
- extraLinkOptions += createFlags;
- }
}
break;
}
@@ -2004,14 +1948,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
default:
break;
}
- if (this->XcodeVersion >= 22 && this->XcodeVersion < 40) {
+ if (this->XcodeVersion < 40) {
buildSettings->AddAttribute("PREBINDING", this->CreateString("NO"));
}
- BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
- BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
- BuildObjectListOrString sysdirs(this, this->XcodeVersion >= 30);
- BuildObjectListOrString sysfdirs(this, this->XcodeVersion >= 30);
+ BuildObjectListOrString dirs(this, true);
+ BuildObjectListOrString fdirs(this, true);
+ BuildObjectListOrString sysdirs(this, true);
+ BuildObjectListOrString sysfdirs(this, true);
const bool emitSystemIncludes = this->XcodeVersion >= 83;
std::vector<std::string> includes;
@@ -2242,18 +2186,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString(""));
buildSettings->AddAttribute("SECTORDER_FLAGS", this->CreateString(""));
buildSettings->AddAttribute("USE_HEADERMAP", this->CreateString("NO"));
- if (this->XcodeVersion >= 30) {
- cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- group->AddObject(this->CreateString("-Wmost"));
- group->AddObject(this->CreateString("-Wno-four-char-constants"));
- group->AddObject(this->CreateString("-Wno-unknown-pragmas"));
- group->AddObject(this->CreateString("$(inherited)"));
- buildSettings->AddAttribute("WARNING_CFLAGS", group);
- } else {
- buildSettings->AddAttribute(
- "WARNING_CFLAGS", this->CreateString("-Wmost -Wno-four-char-constants"
- " -Wno-unknown-pragmas"));
- }
+ cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ group->AddObject(this->CreateString("-Wmost"));
+ group->AddObject(this->CreateString("-Wno-four-char-constants"));
+ group->AddObject(this->CreateString("-Wno-unknown-pragmas"));
+ group->AddObject(this->CreateString("$(inherited)"));
+ buildSettings->AddAttribute("WARNING_CFLAGS", group);
// Runtime version information.
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
@@ -2333,16 +2271,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0,
gtgt);
target->AddAttribute("buildPhases", buildPhases);
- if (this->XcodeVersion > 20) {
- this->AddConfigurations(target, gtgt);
- } else {
- std::string theConfig =
- this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- cmXCodeObject* buildSettings =
- this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- this->CreateBuildSettings(gtgt, buildSettings, theConfig);
- target->AddAttribute("buildSettings", buildSettings);
- }
+ this->AddConfigurations(target, gtgt);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(gtgt->GetName()));
@@ -2444,8 +2373,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
else if (target->IsCFBundleOnApple())
return "wrapper.plug-in";
else
- return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable"
- : "compiled.mach-o.dylib");
+ return "compiled.mach-o.executable";
case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework"
@@ -2478,9 +2406,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
else if (target->IsCFBundleOnApple())
return "com.apple.product-type.bundle";
else
- return ((this->XcodeVersion >= 22)
- ? "com.apple.product-type.tool"
- : "com.apple.product-type.library.dynamic");
+ return "com.apple.product-type.tool";
case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework"
@@ -2506,15 +2432,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("buildRules", buildRules);
std::string defConfig;
- if (this->XcodeVersion > 20) {
- defConfig = this->AddConfigurations(target, gtgt);
- } else {
- cmXCodeObject* buildSettings =
- this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- this->CreateBuildSettings(gtgt, buildSettings, defConfig);
- target->AddAttribute("buildSettings", buildSettings);
- }
+ defConfig = this->AddConfigurations(target, gtgt);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(gtgt->GetName()));
@@ -2533,9 +2451,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fullName = gtgt->GetFullName(defConfig);
}
fileRef->AddAttribute("path", this->CreateString(fullName));
- if (this->XcodeVersion == 15) {
- fileRef->AddAttribute("refType", this->CreateString("0"));
- }
fileRef->AddAttribute("sourceTree",
this->CreateString("BUILT_PRODUCTS_DIR"));
fileRef->SetComment(gtgt->GetName());
@@ -2636,32 +2551,25 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
cmXCodeObject* target, const char* attribute, const char* value,
const std::string& configName)
{
- if (this->XcodeVersion < 21) {
- // There is only one configuration. Add the setting to the buildSettings
- // of the target.
- this->AppendOrAddBuildSetting(target->GetObject("buildSettings"),
- attribute, value);
- } else {
- // There are multiple configurations. Add the setting to the
- // buildSettings of the configuration name given.
- cmXCodeObject* configurationList =
- target->GetObject("buildConfigurationList")->GetObject();
- cmXCodeObject* buildConfigs =
- configurationList->GetObject("buildConfigurations");
- std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
- // each configuration and the target itself has a buildSettings in it
- // list.push_back(target);
- for (std::vector<cmXCodeObject*>::iterator i = list.begin();
- i != list.end(); ++i) {
- if (!configName.empty()) {
- if ((*i)->GetObject("name")->GetString() == configName) {
- cmXCodeObject* settings = (*i)->GetObject("buildSettings");
- this->AppendOrAddBuildSetting(settings, attribute, value);
- }
- } else {
+ // There are multiple configurations. Add the setting to the
+ // buildSettings of the configuration name given.
+ cmXCodeObject* configurationList =
+ target->GetObject("buildConfigurationList")->GetObject();
+ cmXCodeObject* buildConfigs =
+ configurationList->GetObject("buildConfigurations");
+ std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
+ // each configuration and the target itself has a buildSettings in it
+ // list.push_back(target);
+ for (std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end();
+ ++i) {
+ if (!configName.empty()) {
+ if ((*i)->GetObject("name")->GetString() == configName) {
cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
}
+ } else {
+ cmXCodeObject* settings = (*i)->GetObject("buildSettings");
+ this->AppendOrAddBuildSetting(settings, attribute, value);
}
}
}
@@ -2741,13 +2649,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
libDir != libDirs.end(); ++libDir) {
if (libDir->size() && *libDir != "/usr/lib") {
- if (this->XcodeVersion > 15) {
- // Now add the same one but append
- // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
- linkDirs += " ";
- linkDirs += this->XCodeEscapePath(
- *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
- }
+ // Now add the same one but append
+ // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
+ linkDirs += " ";
+ linkDirs += this->XCodeEscapePath(
+ *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
linkDirs += " ";
linkDirs += this->XCodeEscapePath(*libDir);
}
@@ -2849,9 +2755,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent,
this->CreateObject(cmXCodeObject::OBJECT_LIST);
group->AddAttribute("name", this->CreateString(name));
group->AddAttribute("children", groupChildren);
- if (this->XcodeVersion == 15) {
- group->AddAttribute("refType", this->CreateString("4"));
- }
group->AddAttribute("sourceTree", this->CreateString("<group>"));
if (parentChildren)
parentChildren->AddObject(group);
@@ -2899,7 +2802,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
tgroup = this->CreatePBXGroup(tgroup, tgt_folders[i]);
this->TargetGroup[curr_tgt_folder] = tgroup;
if (i == 0) {
- this->SourcesGroupChildren->AddObject(tgroup);
+ this->MainGroupChildren->AddObject(tgroup);
}
}
}
@@ -2945,69 +2848,27 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
{
this->ClearXCodeObjects();
this->RootObject = 0;
- this->SourcesGroupChildren = 0;
- this->ResourcesGroupChildren = 0;
this->MainGroupChildren = 0;
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
- cmXCodeObject* developBuildStyle =
- this->CreateObject(cmXCodeObject::PBXBuildStyle);
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- if (this->XcodeVersion == 15) {
- developBuildStyle->AddAttribute("name", this->CreateString("Development"));
- developBuildStyle->AddAttribute("buildSettings", group);
- listObjs->AddObject(developBuildStyle);
- group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("YES"));
- cmXCodeObject* deployBuildStyle =
+ for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
+ cmXCodeObject* buildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
- deployBuildStyle->AddAttribute("name", this->CreateString("Deployment"));
- deployBuildStyle->AddAttribute("buildSettings", group);
- listObjs->AddObject(deployBuildStyle);
- } else {
- for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
- cmXCodeObject* buildStyle =
- this->CreateObject(cmXCodeObject::PBXBuildStyle);
- const char* name = this->CurrentConfigurationTypes[i].c_str();
- buildStyle->AddAttribute("name", this->CreateString(name));
- buildStyle->SetComment(name);
- cmXCodeObject* sgroup =
- this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
- buildStyle->AddAttribute("buildSettings", sgroup);
- listObjs->AddObject(buildStyle);
- }
+ const char* name = this->CurrentConfigurationTypes[i].c_str();
+ buildStyle->AddAttribute("name", this->CreateString(name));
+ buildStyle->SetComment(name);
+ cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
+ buildStyle->AddAttribute("buildSettings", sgroup);
+ listObjs->AddObject(buildStyle);
}
cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup);
this->MainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST);
mainGroup->AddAttribute("children", this->MainGroupChildren);
- if (this->XcodeVersion == 15) {
- mainGroup->AddAttribute("refType", this->CreateString("4"));
- }
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
- sourcesGroup->AddAttribute("children", this->SourcesGroupChildren);
- if (this->XcodeVersion == 15) {
- sourcesGroup->AddAttribute("refType", this->CreateString("4"));
- }
- sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- this->MainGroupChildren->AddObject(sourcesGroup);
-
- cmXCodeObject* resourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->ResourcesGroupChildren =
- this->CreateObject(cmXCodeObject::OBJECT_LIST);
- resourcesGroup->AddAttribute("name", this->CreateString("Resources"));
- resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren);
- if (this->XcodeVersion == 15) {
- resourcesGroup->AddAttribute("refType", this->CreateString("4"));
- }
- resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- this->MainGroupChildren->AddObject(resourcesGroup);
-
// now create the cmake groups
if (!this->CreateGroups(generators)) {
return false;
@@ -3015,9 +2876,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
productGroup->AddAttribute("name", this->CreateString("Products"));
- if (this->XcodeVersion == 15) {
- productGroup->AddAttribute("refType", this->CreateString("4"));
- }
productGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
cmXCodeObject* productGroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
@@ -3039,24 +2897,22 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->RootObject->AddAttribute("buildStyles", listObjs);
this->RootObject->AddAttribute("hasScannedForEncodings",
this->CreateString("0"));
- if (this->XcodeVersion >= 30) {
- group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- group->AddAttribute("BuildIndependentTargetsInParallel",
- this->CreateString("YES"));
- std::ostringstream v;
- v << std::setfill('0') << std::setw(4) << XcodeVersion * 10;
- group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str()));
- this->RootObject->AddAttribute("attributes", group);
- if (this->XcodeVersion >= 32)
- this->RootObject->AddAttribute("compatibilityVersion",
- this->CreateString("Xcode 3.2"));
- else if (this->XcodeVersion >= 31)
- this->RootObject->AddAttribute("compatibilityVersion",
- this->CreateString("Xcode 3.1"));
- else
- this->RootObject->AddAttribute("compatibilityVersion",
- this->CreateString("Xcode 3.0"));
- }
+ group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ group->AddAttribute("BuildIndependentTargetsInParallel",
+ this->CreateString("YES"));
+ std::ostringstream v;
+ v << std::setfill('0') << std::setw(4) << XcodeVersion * 10;
+ group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str()));
+ this->RootObject->AddAttribute("attributes", group);
+ if (this->XcodeVersion >= 32)
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.2"));
+ else if (this->XcodeVersion >= 31)
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.1"));
+ else
+ this->RootObject->AddAttribute("compatibilityVersion",
+ this->CreateString("Xcode 3.0"));
// Point Xcode at the top of the source tree.
{
std::string pdir =
@@ -3071,26 +2927,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
typedef std::vector<std::pair<std::string, cmXCodeObject*> > Configs;
Configs configs;
const char* defaultConfigName = "Debug";
- if (this->XcodeVersion == 15) {
- cmXCodeObject* configDebug =
- this->CreateObject(cmXCodeObject::XCBuildConfiguration);
- configDebug->AddAttribute("name", this->CreateString("Debug"));
- configs.push_back(std::make_pair("Debug", configDebug));
- cmXCodeObject* configRelease =
- this->CreateObject(cmXCodeObject::XCBuildConfiguration);
- configRelease->AddAttribute("name", this->CreateString("Release"));
- configs.push_back(std::make_pair("Release", configRelease));
- } else {
- for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
- const char* name = this->CurrentConfigurationTypes[i].c_str();
- if (0 == i) {
- defaultConfigName = name;
- }
- cmXCodeObject* config =
- this->CreateObject(cmXCodeObject::XCBuildConfiguration);
- config->AddAttribute("name", this->CreateString(name));
- configs.push_back(std::make_pair(name, config));
+ for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
+ const char* name = this->CurrentConfigurationTypes[i].c_str();
+ if (0 == i) {
+ defaultConfigName = name;
}
+ cmXCodeObject* config =
+ this->CreateObject(cmXCodeObject::XCBuildConfiguration);
+ config->AddAttribute("name", this->CreateString(name));
+ configs.push_back(std::make_pair(name, config));
}
for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) {
buildConfigurations->AddObject(c->second);
@@ -3247,22 +3092,12 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
void cmGlobalXCodeGenerator::ComputeObjectDirArch()
{
- if (this->XcodeVersion >= 21) {
- if (this->Architectures.size() > 1) {
- this->ObjectDirArch = "$(CURRENT_ARCH)";
- } else if (!this->Architectures.empty()) {
- this->ObjectDirArch = this->Architectures[0];
- } else {
- this->ObjectDirArch = this->ObjectDirArchDefault;
- }
+ if (this->Architectures.size() > 1) {
+ this->ObjectDirArch = "$(CURRENT_ARCH)";
+ } else if (!this->Architectures.empty()) {
+ this->ObjectDirArch = this->Architectures[0];
} else {
-#if defined(__ppc__)
- this->ObjectDirArch = "ppc";
-#elif defined(__i386)
- this->ObjectDirArch = "i386";
-#else
- this->ObjectDirArch = "";
-#endif
+ this->ObjectDirArch = this->ObjectDirArchDefault;
}
}
@@ -3432,10 +3267,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
std::string xcodeDir = root->GetCurrentBinaryDirectory();
xcodeDir += "/";
xcodeDir += root->GetProjectName();
- xcodeDir += ".xcode";
- if (this->XcodeVersion > 20) {
- xcodeDir += "proj";
- }
+ xcodeDir += ".xcodeproj";
cmSystemTools::MakeDirectory(xcodeDir.c_str());
std::string xcodeProjFile = xcodeDir + "/project.pbxproj";
cmGeneratedFileStream fout(xcodeProjFile.c_str());
@@ -3524,20 +3356,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout);
fout << "};\n";
cmXCodeObject::Indent(1, fout);
- if (this->XcodeVersion >= 21) {
- if (this->XcodeVersion >= 32)
- fout << "objectVersion = 46;\n";
- else if (this->XcodeVersion >= 31)
- fout << "objectVersion = 45;\n";
- else if (this->XcodeVersion >= 30)
- fout << "objectVersion = 44;\n";
- else
- fout << "objectVersion = 42;\n";
- cmXCode21Object::PrintList(this->XCodeObjects, fout);
- } else {
- fout << "objectVersion = 39;\n";
- cmXCodeObject::PrintList(this->XCodeObjects, fout);
- }
+ if (this->XcodeVersion >= 32)
+ fout << "objectVersion = 46;\n";
+ else if (this->XcodeVersion >= 31)
+ fout << "objectVersion = 45;\n";
+ else
+ fout << "objectVersion = 44;\n";
+ cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId()
<< " /* Project object */;\n";
@@ -3546,9 +3371,7 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const
{
- return this->XcodeVersion >= 21
- ? "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"
- : ".";
+ return "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
}
std::string cmGlobalXCodeGenerator::ExpandCFGIntDir(
@@ -3611,12 +3434,10 @@ void cmGlobalXCodeGenerator::AppendDirectoryForConfig(
const std::string& prefix, const std::string& config,
const std::string& suffix, std::string& dir)
{
- if (this->XcodeVersion > 20) {
- if (!config.empty()) {
- dir += prefix;
- dir += config;
- dir += suffix;
- }
+ if (!config.empty()) {
+ dir += prefix;
+ dir += config;
+ dir += suffix;
}
}
@@ -3741,11 +3562,6 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(
// i.e. "Can I build Debug and Release in the same tree?"
bool cmGlobalXCodeGenerator::IsMultiConfig() const
{
- // Old Xcode 1.5 is single config:
- if (this->XcodeVersion == 15) {
- return false;
- }
-
// Newer Xcode versions are multi config:
return true;
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index a733d5c..f38fa3c 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -32,7 +32,8 @@ struct cmDocumentationEntry;
class cmGlobalXCodeGenerator : public cmGlobalGenerator
{
public:
- cmGlobalXCodeGenerator(cmake* cm, std::string const& version);
+ cmGlobalXCodeGenerator(cmake* cm, std::string const& version_string,
+ unsigned int version_number);
static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator.
@@ -89,6 +90,8 @@ public:
bool HasKnownObjectFileLocation(std::string* reason) const CM_OVERRIDE;
+ bool IsIPOSupported() const CM_OVERRIDE { return true; }
+
bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;
@@ -250,8 +253,6 @@ private:
std::string PostBuildMakeTarget(std::string const& tName,
std::string const& configName);
cmXCodeObject* MainGroupChildren;
- cmXCodeObject* SourcesGroupChildren;
- cmXCodeObject* ResourcesGroupChildren;
cmMakefile* CurrentMakefile;
cmLocalGenerator* CurrentLocalGenerator;
std::vector<std::string> CurrentConfigurationTypes;
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index 527db16..46cf878 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -15,26 +15,11 @@
class cmGraphEdge
{
public:
- cmGraphEdge()
- : Dest(0)
- , Strong(true)
- {
- }
- cmGraphEdge(int n)
- : Dest(n)
- , Strong(true)
- {
- }
- cmGraphEdge(int n, bool s)
+ cmGraphEdge(int n = 0, bool s = true)
: Dest(n)
, Strong(s)
{
}
- cmGraphEdge(cmGraphEdge const& r)
- : Dest(r.Dest)
- , Strong(r.Strong)
- {
- }
operator int() const { return this->Dest; }
bool IsStrong() const { return this->Strong; }
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index dfb3aeb..54ad85c 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -48,7 +48,7 @@ void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg)
}
void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
if (this->ActionsPerConfig) {
this->cmInstallGenerator::GenerateScriptActions(os, indent);
@@ -58,7 +58,7 @@ void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
}
void cmInstallDirectoryGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent const& indent)
+ std::ostream& os, const std::string& config, Indent indent)
{
std::vector<std::string> dirs;
cmGeneratorExpression ge;
@@ -82,7 +82,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
}
void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
- std::ostream& os, const std::string& config, Indent const& indent,
+ std::ostream& os, const std::string& config, Indent indent,
std::vector<std::string> const& dirs)
{
// Write code to install the directories.
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 029ce46..aa2cbc6 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -34,12 +34,11 @@ public:
std::string GetDestination(std::string const& config) const;
protected:
- void GenerateScriptActions(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
- Indent const& indent) CM_OVERRIDE;
+ Indent indent) CM_OVERRIDE;
void AddDirectoryInstallRule(std::ostream& os, const std::string& config,
- Indent const& indent,
+ Indent indent,
std::vector<std::string> const& dirs);
cmLocalGenerator* LocalGenerator;
std::vector<std::string> Directories;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 39fab4f..b176e85 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -166,7 +166,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
}
void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
// Create the main install rules first.
this->cmInstallGenerator::GenerateScriptConfigs(os, indent);
@@ -189,7 +189,7 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
}
void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
// Remove old per-configuration export files if the main changes.
std::string installedDir = "$ENV{DESTDIR}";
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 3a46a72..047e6b3 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -44,10 +44,8 @@ public:
protected:
void GenerateScript(std::ostream& os) CM_OVERRIDE;
- void GenerateScriptConfigs(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
- void GenerateScriptActions(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE;
void GenerateImportFile(cmExportSet const* exportSet);
void GenerateImportFile(const char* config, cmExportSet const* exportSet);
void ComputeTempDir();
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 7daea38..6323a91 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -54,7 +54,7 @@ std::string cmInstallFilesGenerator::GetDestination(
}
void cmInstallFilesGenerator::AddFilesInstallRule(
- std::ostream& os, std::string const& config, Indent const& indent,
+ std::ostream& os, std::string const& config, Indent indent,
std::vector<std::string> const& files)
{
// Write code to install the files.
@@ -67,7 +67,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
}
void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
if (this->ActionsPerConfig) {
this->cmInstallGenerator::GenerateScriptActions(os, indent);
@@ -77,7 +77,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
}
void cmInstallFilesGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent const& indent)
+ std::ostream& os, const std::string& config, Indent indent)
{
std::vector<std::string> files;
cmGeneratorExpression ge;
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 578763b..62b57f9 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -34,12 +34,11 @@ public:
std::string GetDestination(std::string const& config) const;
protected:
- void GenerateScriptActions(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
- Indent const& indent) CM_OVERRIDE;
+ Indent indent) CM_OVERRIDE;
void AddFilesInstallRule(std::ostream& os, std::string const& config,
- Indent const& indent,
+ Indent indent,
std::vector<std::string> const& files);
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index bb1dd54..de19f98 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -21,6 +21,8 @@ class cmMakefile;
*/
class cmInstallGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmInstallGenerator)
+
public:
enum MessageLevel
{
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 1827ed3..84d6f7a 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -58,7 +58,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
}
void cmInstallTargetGenerator::GenerateScriptForConfig(
- std::ostream& os, const std::string& config, Indent const& indent)
+ std::ostream& os, const std::string& config, Indent indent)
{
cmStateEnums::TargetType targetType = this->Target->GetType();
cmInstallType type = cmInstallType();
@@ -339,7 +339,7 @@ static std::string computeInstallObjectDir(cmGeneratorTarget* gt,
}
void cmInstallTargetGenerator::GenerateScriptForConfigObjectLibrary(
- std::ostream& os, const std::string& config, Indent const& indent)
+ std::ostream& os, const std::string& config, Indent indent)
{
// Compute all the object files inside this target
std::vector<std::string> objects;
@@ -444,7 +444,7 @@ void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
}
-void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent,
+void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent,
const std::string& config,
std::string const& file,
TweakMethod tweak)
@@ -460,7 +460,7 @@ void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent,
}
}
-void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent,
+void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent,
const std::string& config,
std::vector<std::string> const& files,
TweakMethod tweak)
@@ -500,7 +500,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file)
}
void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
- Indent const& indent,
+ Indent indent,
const std::string& config,
std::string const& file)
{
@@ -508,7 +508,7 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
}
void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
- Indent const& indent,
+ Indent indent,
const std::string& config,
std::string const& file)
{
@@ -520,7 +520,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
}
void cmInstallTargetGenerator::AddInstallNamePatchRule(
- std::ostream& os, Indent const& indent, const std::string& config,
+ std::ostream& os, Indent indent, const std::string& config,
std::string const& toDestDirPath)
{
if (this->ImportLibrary ||
@@ -621,7 +621,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
}
void cmInstallTargetGenerator::AddRPathCheckRule(
- std::ostream& os, Indent const& indent, const std::string& config,
+ std::ostream& os, Indent indent, const std::string& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
@@ -655,7 +655,7 @@ void cmInstallTargetGenerator::AddRPathCheckRule(
}
void cmInstallTargetGenerator::AddChrpathPatchRule(
- std::ostream& os, Indent const& indent, const std::string& config,
+ std::ostream& os, Indent indent, const std::string& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
@@ -750,8 +750,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
}
}
-void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
- Indent const& indent,
+void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath)
{
@@ -779,8 +778,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
os << indent << "endif()\n";
}
-void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
- Indent const& indent,
+void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath)
{
// Static libraries need ranlib on this platform.
@@ -805,7 +803,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
}
void cmInstallTargetGenerator::AddUniversalInstallRule(
- std::ostream& os, Indent const& indent, const std::string& toDestDirPath)
+ std::ostream& os, Indent indent, const std::string& toDestDirPath)
{
cmMakefile const* mf = this->Target->Target->GetMakefile();
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 6aaa3ba..cf2de58 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -67,42 +67,39 @@ public:
protected:
void GenerateScript(std::ostream& os) CM_OVERRIDE;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
- Indent const& indent) CM_OVERRIDE;
+ Indent indent) CM_OVERRIDE;
void GenerateScriptForConfigObjectLibrary(std::ostream& os,
const std::string& config,
- Indent const& indent);
- typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&,
- Indent const&,
+ Indent indent);
+ typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&, Indent,
const std::string&,
std::string const&);
- void AddTweak(std::ostream& os, Indent const& indent,
- const std::string& config, std::string const& file,
- TweakMethod tweak);
- void AddTweak(std::ostream& os, Indent const& indent,
- const std::string& config,
+ void AddTweak(std::ostream& os, Indent indent, const std::string& config,
+ std::string const& file, TweakMethod tweak);
+ void AddTweak(std::ostream& os, Indent indent, const std::string& config,
std::vector<std::string> const& files, TweakMethod tweak);
std::string GetDestDirPath(std::string const& file);
- void PreReplacementTweaks(std::ostream& os, Indent const& indent,
+ void PreReplacementTweaks(std::ostream& os, Indent indent,
const std::string& config,
std::string const& file);
- void PostReplacementTweaks(std::ostream& os, Indent const& indent,
+ void PostReplacementTweaks(std::ostream& os, Indent indent,
const std::string& config,
std::string const& file);
- void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
+ void AddInstallNamePatchRule(std::ostream& os, Indent indent,
const std::string& config,
const std::string& toDestDirPath);
- void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
+ void AddChrpathPatchRule(std::ostream& os, Indent indent,
const std::string& config,
std::string const& toDestDirPath);
- void AddRPathCheckRule(std::ostream& os, Indent const& indent,
+ void AddRPathCheckRule(std::ostream& os, Indent indent,
const std::string& config,
std::string const& toDestDirPath);
- void AddStripRule(std::ostream& os, Indent const& indent,
+ void AddStripRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
- void AddRanlibRule(std::ostream& os, Indent const& indent,
+ void AddRanlibRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
- void AddUniversalInstallRule(std::ostream& os, Indent const& indent,
+ void AddUniversalInstallRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
std::string TargetName;
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index ae300e6..f0fded2 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -32,11 +32,6 @@ public:
, Target(t)
{
}
- cmLinkItem(cmLinkItem const& r)
- : std_string(r)
- , Target(r.Target)
- {
- }
cmGeneratorTarget const* Target;
};
@@ -56,12 +51,6 @@ public:
, FromGenex(fromGenex)
{
}
- cmLinkImplItem(cmLinkImplItem const& r)
- : cmLinkItem(r)
- , Backtrace(r.Backtrace)
- , FromGenex(r.FromGenex)
- {
- }
cmListFileBacktrace Backtrace;
bool FromGenex;
};
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index bf65347..27b8adb 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -4,7 +4,7 @@
#ifndef cmLinkLineComputer_h
#define cmLinkLineComputer_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <string>
@@ -16,6 +16,8 @@ class cmOutputConverter;
class cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmLinkLineComputer)
+
public:
cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 6789555..bf30b39 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -39,9 +39,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
continue;
}
- if (li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- li->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
- li->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
+ bool skippable = false;
+ switch (li->Target->GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ skippable = true;
+ break;
+ case cmStateEnums::STATIC_LIBRARY:
+ // If a static library is resolving its device linking, it should
+ // be removed for other device linking
+ skippable =
+ li->Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
+ break;
+ default:
+ break;
+ }
+
+ if (skippable) {
continue;
}
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index a827b06..e9e98ac 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -18,6 +18,8 @@ class cmStateDirectory;
class cmLinkLineDeviceComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmLinkLineDeviceComputer)
+
public:
cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
@@ -33,6 +35,8 @@ public:
class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
{
+ CM_DISABLE_COPY(cmNinjaLinkLineDeviceComputer)
+
public:
cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir,
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 16297f3..929b1cd 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -16,7 +16,7 @@
struct cmListFileParser
{
- cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+ cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt,
cmMessenger* messenger, const char* filename);
~cmListFileParser();
void IssueFileOpenError(std::string const& text) const;
@@ -39,7 +39,8 @@ struct cmListFileParser
} Separation;
};
-cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+cmListFileParser::cmListFileParser(cmListFile* lf,
+ cmListFileBacktrace const& lfbt,
cmMessenger* messenger,
const char* filename)
: ListFile(lf)
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index bda4ea3..aa11ba7 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -45,12 +45,6 @@ struct cmListFileArgument
, Line(0)
{
}
- cmListFileArgument(const cmListFileArgument& r)
- : Value(r.Value)
- , Delim(r.Delim)
- , Line(r.Line)
- {
- }
cmListFileArgument(const std::string& v, Delimiter d, long line)
: Value(v)
, Delim(d)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 424ab6f..0ab6e89 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -558,6 +558,31 @@ void cmLocalGenerator::ComputeTargetManifest()
}
}
+bool cmLocalGenerator::ComputeTargetCompileFeatures()
+{
+ // Collect the set of configuration types.
+ std::vector<std::string> configNames;
+ this->Makefile->GetConfigurations(configNames);
+ if (configNames.empty()) {
+ configNames.push_back("");
+ }
+
+ // Process compile features of all targets.
+ std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+ for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t) {
+ cmGeneratorTarget* target = *t;
+ for (std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci) {
+ if (!target->ComputeCompileFeatures(*ci)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool cmLocalGenerator::IsRootMakefile() const
{
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
@@ -742,14 +767,6 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
this->AppendFlagEscape(flags, *i);
}
}
- std::vector<std::string> features;
- target->GetCompileFeatures(features, config);
- for (std::vector<std::string>::const_iterator it = features.begin();
- it != features.end(); ++it) {
- if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) {
- return;
- }
- }
for (std::map<std::string, std::string>::const_iterator it =
target->GetMaxLanguageStandards().begin();
@@ -915,6 +932,9 @@ void cmLocalGenerator::GetTargetFlags(
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
+ const std::string linkLanguage =
+ linkLineComputer->GetLinkerLanguage(target, buildType);
+
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, target);
@@ -976,16 +996,13 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
}
-
- const std::string linkLanguage =
- linkLineComputer->GetLinkerLanguage(target, buildType);
if (linkLanguage.empty()) {
cmSystemTools::Error(
"CMake can not determine linker language for target: ",
target->GetName().c_str());
return;
}
- this->AddLanguageFlags(flags, linkLanguage, buildType);
+ this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
@@ -1040,6 +1057,8 @@ void cmLocalGenerator::GetTargetFlags(
default:
break;
}
+
+ this->AppendIPOLinkerFlags(linkFlags, target, config, linkLanguage);
}
void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
@@ -1050,11 +1069,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
cmMakefile* mf = this->GetMakefile();
// Add language-specific flags.
- this->AddLanguageFlags(flags, lang, config);
-
- if (target->IsIPOEnabled(config)) {
- this->AppendFeatureOptions(flags, lang, "IPO");
- }
+ this->AddLanguageFlags(flags, target, lang, config);
this->AddArchitectureFlags(flags, target, lang, config);
@@ -1287,6 +1302,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
+ cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config)
{
@@ -1295,6 +1311,26 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
flagsVar += lang;
flagsVar += "_FLAGS";
this->AddConfigVariableFlags(flags, flagsVar, config);
+
+ if (target->IsIPOEnabled(config)) {
+ this->AppendFeatureOptions(flags, lang, "IPO");
+ }
+}
+
+void cmLocalGenerator::AddLanguageFlagsForLinking(
+ std::string& flags, cmGeneratorTarget const* target, const std::string& lang,
+ const std::string& config)
+{
+ if (this->Makefile->IsOn("CMAKE_" + lang +
+ "_LINK_WITH_STANDARD_COMPILE_OPTION")) {
+ // This toolchain requires use of the language standard flag
+ // when linking in order to use the matching standard library.
+ // FIXME: If CMake gains an abstraction for standard library
+ // selection, this will have to be reconciled with it.
+ this->AddCompilerRequirementFlag(flags, target, lang);
+ }
+
+ this->AddLanguageFlags(flags, target, lang, config);
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
@@ -1461,7 +1497,11 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
"does not know the compile flags to use to enable it.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
} else {
- this->AppendFlagEscape(flags, opt);
+ std::vector<std::string> optVec;
+ cmSystemTools::ExpandListArgument(opt, optVec);
+ for (size_t i = 0; i < optVec.size(); ++i) {
+ this->AppendFlagEscape(flags, optVec[i]);
+ }
}
return;
}
@@ -1768,6 +1808,38 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
this->AppendFlags(flags, this->EscapeForShell(rawFlag));
}
+void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
+ cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& lang)
+{
+ if (!target->IsIPOEnabled(config)) {
+ return;
+ }
+
+ switch (target->GetType()) {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ break;
+ default:
+ return;
+ }
+
+ const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
+ const char* rawFlagsList = this->Makefile->GetDefinition(name);
+ if (rawFlagsList == CM_NULLPTR) {
+ return;
+ }
+
+ std::vector<std::string> flagsList;
+ cmSystemTools::ExpandListArgument(rawFlagsList, flagsList);
+ for (std::vector<std::string>::const_iterator oi = flagsList.begin();
+ oi != flagsList.end(); ++oi) {
+ this->AppendFlagEscape(flags, *oi);
+ }
+}
+
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
const char* defines_list) const
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1459a05..e888094 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -70,6 +70,8 @@ public:
*/
void ComputeTargetManifest();
+ bool ComputeTargetCompileFeatures();
+
bool IsRootMakefile() const;
///! Get the makefile for this generator
@@ -98,8 +100,12 @@ public:
const std::string& lang,
const std::string& config);
- void AddLanguageFlags(std::string& flags, const std::string& lang,
- const std::string& config);
+ void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
+ const std::string& lang, const std::string& config);
+ void AddLanguageFlagsForLinking(std::string& flags,
+ cmGeneratorTarget const* target,
+ const std::string& lang,
+ const std::string& config);
void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string& flags,
@@ -115,6 +121,9 @@ public:
virtual void AppendFlags(std::string& flags, const char* newFlags);
virtual void AppendFlagEscape(std::string& flags,
const std::string& rawFlag);
+ void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& lang);
///! Get the include flags for the current makefile and language
std::string GetIncludeFlags(const std::vector<std::string>& includes,
cmGeneratorTarget* target,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 00f5e4b..e0e3e54 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -281,9 +281,11 @@ void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target,
}
void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target,
- cmNinjaDeps& outputs)
+ cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends)
{
- this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs);
+ this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs,
+ depends);
}
void cmLocalNinjaGenerator::AppendCustomCommandDeps(
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index fda4578..a45e018 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -63,7 +63,9 @@ public:
std::string BuildCommandLine(const std::vector<std::string>& cmdLines);
void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs);
- void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs);
+ void AppendTargetDepends(
+ cmGeneratorTarget* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends = DependOnTargetArtifact);
void AddCustomCommandTarget(cmCustomCommand const* cc,
cmGeneratorTarget* target);
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index b98009f..9f90a3a 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -10,7 +10,7 @@
class cmLocaleRAII
{
- std::string OldLocale;
+ CM_DISABLE_COPY(cmLocaleRAII)
public:
cmLocaleRAII()
@@ -19,6 +19,9 @@ public:
setlocale(LC_CTYPE, "");
}
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); }
+
+private:
+ std::string OldLocale;
};
#endif
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index 612658c..e494060 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -15,6 +15,8 @@ class cmStateDirectory;
class cmMSVC60LinkLineComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmMSVC60LinkLineComputer)
+
public:
cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4ed76c7..cb11060 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3153,7 +3153,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
langs.reserve(lang.size());
for (std::vector<std::string>::const_iterator i = lang.begin();
i != lang.end(); ++i) {
- if (i->compare("RC") == 0) {
+ if (*i == "RC") {
langsRC.push_back(*i);
} else {
langs.push_back(*i);
@@ -4002,6 +4002,13 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
return false;
}
+ // Deprecate old policies, especially those that require a lot
+ // of code to maintain the old behavior.
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0036) {
+ this->IssueMessage(cmake::DEPRECATION_WARNING,
+ cmPolicies::GetPolicyDeprecatedWarning(id));
+ }
+
this->StateSnapshot.SetPolicy(id, status);
return true;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7543a89..52a6498 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -54,6 +54,8 @@ class cmVariableWatch;
*/
class cmMakefile
{
+ CM_DISABLE_COPY(cmMakefile)
+
public:
/* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var);
@@ -709,6 +711,7 @@ public:
/** Helper class to push and pop scopes automatically. */
class ScopePushPop
{
+ CM_DISABLE_COPY(ScopePushPop)
public:
ScopePushPop(cmMakefile* m)
: Makefile(m)
@@ -829,9 +832,6 @@ protected:
cmExecutionStatus& status);
private:
- cmMakefile(const cmMakefile& mf);
- cmMakefile& operator=(const cmMakefile& mf);
-
cmStateSnapshot StateSnapshot;
cmListFileBacktrace Backtrace;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index a93b42d..359b9fd 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -122,7 +122,11 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
std::string buildEcho = "Linking ";
buildEcho += linkLanguage;
buildEcho += " device code ";
- buildEcho += targetOutputReal;
+ buildEcho += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ this->DeviceLinkObject),
+ cmOutputConverter::SHELL);
this->LocalGenerator->AppendEcho(
commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
@@ -146,7 +150,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
linkLanguage, *this->GeneratorTarget));
// Add language feature flags.
- this->AddFeatureFlags(flags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
@@ -429,7 +434,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
// Add language feature flags.
- this->AddFeatureFlags(flags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
@@ -451,6 +457,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
}
+ this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
+ this->ConfigName, linkLanguage);
+
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index e017b29..2b37b4d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -127,6 +127,24 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
+ const std::string cuda_lang("CUDA");
+ cmGeneratorTarget::LinkClosure const* closure =
+ this->GeneratorTarget->GetLinkClosure(this->ConfigName);
+
+ const bool hasCUDA =
+ (std::find(closure->Languages.begin(), closure->Languages.end(),
+ cuda_lang) != closure->Languages.end());
+
+ const bool resolveDeviceSymbols =
+ this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
+ if (hasCUDA && resolveDeviceSymbols) {
+ std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
+ std::string extraFlags;
+ this->LocalGenerator->AppendFlags(
+ extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+ this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, false);
+ }
+
std::string linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
@@ -292,8 +310,12 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
cmLocalUnixMakefileGenerator3::EchoProgress progress;
this->MakeEchoProgress(progress);
// Add the link message.
- std::string buildEcho = "Linking " + linkLanguage + " device code";
- buildEcho += targetOutputReal;
+ std::string buildEcho = "Linking " + linkLanguage + " device code ";
+ buildEcho += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ this->DeviceLinkObject),
+ cmOutputConverter::SHELL);
this->LocalGenerator->AppendEcho(
commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
@@ -373,9 +395,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
vars.LinkFlags = linkFlags.c_str();
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
- // Add language feature flags.
+ // Add language-specific flags.
std::string langFlags;
- this->AddFeatureFlags(langFlags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
vars.LanguageCompileFlags = langFlags.c_str();
@@ -471,6 +494,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Create set of linking flags.
std::string linkFlags;
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
+ this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
+ this->ConfigName, linkLanguage);
// Add OSX version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -831,9 +856,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
}
- // Add language feature flags.
+ // Add language-specific flags.
std::string langFlags;
- this->AddFeatureFlags(langFlags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
@@ -857,6 +883,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> object_strings;
this->WriteObjectsStrings(object_strings, archiveCommandLimit);
+ // Add the cuda device object to the list of archive files. This will
+ // only occur on archives which have CUDA_RESOLVE_DEVICE_SYMBOLS enabled
+ if (!this->DeviceLinkObject.empty()) {
+ object_strings.push_back(this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ this->DeviceLinkObject),
+ cmOutputConverter::SHELL));
+ }
+
// Create the archive with the first set of objects.
std::vector<std::string>::iterator osi = object_strings.begin();
{
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index db6d4a8..e612e88 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -16,6 +16,8 @@ class cmStateDirectory;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
+ CM_DISABLE_COPY(cmNinjaLinkLineComputer)
+
public:
cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index cfc91bd..0331828 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -447,6 +447,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
// an executable or a dynamic library.
std::string linkCmd;
switch (this->GetGeneratorTarget()->GetType()) {
+ case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
const std::string cudaLinkCmd(
@@ -559,11 +560,15 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
case cmStateEnums::EXECUTABLE:
shouldHaveDeviceLinking = true;
break;
+ case cmStateEnums::STATIC_LIBRARY:
+ shouldHaveDeviceLinking =
+ genTarget.GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
+ break;
default:
break;
}
- if (!shouldHaveDeviceLinking || !hasCUDA) {
+ if (!(shouldHaveDeviceLinking && hasCUDA)) {
return;
}
@@ -650,7 +655,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t = "";
- localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName);
+ localGen.AddLanguageFlagsForLinking(t, &genTarget, cudaLinkLanguage,
+ cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
@@ -869,7 +875,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["ARCH_FLAGS"] = t;
t = "";
t += lwyuFlags;
- localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
+ localGen.AddLanguageFlagsForLinking(t, &genTarget, TargetLinkLanguage,
+ cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 7c417a4..7e29681 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -117,7 +117,7 @@ bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang) const
std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget()
{
- return "cmake_order_depends_target_" + this->GetTargetName();
+ return "cmake_object_order_depends_target_" + this->GetTargetName();
}
// TODO: Most of the code is picked up from
@@ -557,13 +557,26 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// Write the rule for ninja dyndep file generation.
std::vector<std::string> ddCmds;
+#ifdef _WIN32
+ // Windows command line length is limited -> use response file for dyndep
+ // rules
+ std::string ddRspFile = "$out.rsp";
+ std::string ddRspContent = "$in";
+ std::string ddInput = "@" + ddRspFile;
+#else
+ std::string ddRspFile;
+ std::string ddRspContent;
+ std::string ddInput = "$in";
+#endif
+
// Run CMake dependency scanner on preprocessed output.
std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
ddCmds.push_back(cmake + " -E cmake_ninja_dyndep"
" --tdi=" +
tdi + " --dd=$out"
- " $in");
+ " " +
+ ddInput);
std::string const ddCmdLine =
this->GetLocalGenerator()->BuildCommandLine(ddCmds);
@@ -575,9 +588,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
this->GetGlobalGenerator()->AddRule(
this->LanguageDyndepRule(lang), ddCmdLine, ddDesc.str(), ddComment.str(),
/*depfile*/ "",
- /*deps*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
+ /*deps*/ "", ddRspFile, ddRspContent,
/*restat*/ "",
/*generator*/ false);
}
@@ -718,8 +729,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
}
cmNinjaDeps orderOnlyDeps;
- this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
- orderOnlyDeps);
+ this->GetLocalGenerator()->AppendTargetDepends(
+ this->GeneratorTarget, orderOnlyDeps, DependOnTargetOrdering);
// Add order-only dependencies on other files associated with the target.
orderOnlyDeps.insert(orderOnlyDeps.end(), this->ExtraFiles.begin(),
@@ -740,7 +751,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
std::back_inserter(orderOnlyDeps), MapToNinjaPath());
}
- if (!orderOnlyDeps.empty()) {
+ std::sort(orderOnlyDeps.begin(), orderOnlyDeps.end());
+ orderOnlyDeps.erase(std::unique(orderOnlyDeps.begin(), orderOnlyDeps.end()),
+ orderOnlyDeps.end());
+
+ {
cmNinjaDeps orderOnlyTarget;
orderOnlyTarget.push_back(this->OrderDependsTargetForTarget());
this->GetGlobalGenerator()->WritePhonyBuild(
@@ -753,7 +768,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
for (std::vector<cmSourceFile const*>::const_iterator si =
objectSources.begin();
si != objectSources.end(); ++si) {
- this->WriteObjectBuildStatement(*si, !orderOnlyDeps.empty());
+ this->WriteObjectBuildStatement(*si);
}
if (!this->DDIFiles.empty()) {
@@ -770,6 +785,17 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
ddOutputs.push_back(this->GetDyndepFilePath("Fortran"));
+ // Make sure dyndep files for all our dependencies have already
+ // been generated so that the 'FortranModules.json' files they
+ // produced as side-effects are available for us to read.
+ // Ideally we should depend on the 'FortranModules.json' files
+ // from our dependencies directly, but we don't know which of
+ // our dependencies produces them. Fixing this will require
+ // refactoring the Ninja generator to generate targets in
+ // dependency order so that we can collect the needed information.
+ this->GetLocalGenerator()->AppendTargetDepends(
+ this->GeneratorTarget, ddOrderOnlyDeps, DependOnTargetArtifact);
+
this->GetGlobalGenerator()->WriteBuild(
this->GetBuildFileStream(), ddComment, ddRule, ddOutputs, ddImplicitOuts,
ddExplicitDeps, ddImplicitDeps, ddOrderOnlyDeps, ddVars);
@@ -779,7 +805,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
}
void cmNinjaTargetGenerator::WriteObjectBuildStatement(
- cmSourceFile const* source, bool writeOrderDependsTargetForTarget)
+ cmSourceFile const* source)
{
std::string const language = source->GetLanguage();
std::string const sourceFileName =
@@ -830,9 +856,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
cmNinjaDeps orderOnlyDeps;
- if (writeOrderDependsTargetForTarget) {
- orderOnlyDeps.push_back(this->OrderDependsTargetForTarget());
- }
+ orderOnlyDeps.push_back(this->OrderDependsTargetForTarget());
// If the source file is GENERATED and does not have a custom command
// (either attached to this source file or another one), assume that one of
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 9ce8651..5eb7a9a 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -119,8 +119,7 @@ protected:
void WriteLanguageRules(const std::string& language);
void WriteCompileRule(const std::string& language);
void WriteObjectBuildStatements();
- void WriteObjectBuildStatement(cmSourceFile const* source,
- bool writeOrderDependsTargetForTarget);
+ void WriteObjectBuildStatement(cmSourceFile const* source);
void WriteTargetDependInfo(std::string const& lang);
void ExportObjectCompileCommand(
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index b4af70e..ec435d9 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -9,6 +9,12 @@
#include <string>
#include <vector>
+enum cmNinjaTargetDepends
+{
+ DependOnTargetArtifact,
+ DependOnTargetOrdering
+};
+
typedef std::vector<std::string> cmNinjaDeps;
typedef std::map<std::string, std::string> cmNinjaVars;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 8b8cf07..2339d68 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -188,9 +188,8 @@ protected:
if (qstart == std::string::npos) {
cmSystemTools::Error("unknown include directive ", line.c_str());
continue;
- } else {
- qend = line.find('>', qstart + 1);
}
+ qend = line.find('>', qstart + 1);
} else {
qend = line.find('\"', qstart + 1);
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 837557b..da3edd4 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -275,6 +275,22 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
return msg.str();
}
+std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id)
+{
+ std::ostringstream msg;
+ /* clang-format off */
+ msg <<
+ "The OLD behavior for policy " << idToString(id) << " "
+ "will be removed from a future version of CMake.\n"
+ "The cmake-policies(7) manual explains that the OLD behaviors of all "
+ "policies are deprecated and that a policy should be set to OLD only "
+ "under specific short-term circumstances. Projects should be ported "
+ "to the NEW behavior and not rely on setting a policy to OLD."
+ ;
+ /* clang-format on */
+ return msg.str();
+}
+
///! return an error string for when a required policy is unspecified
std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 120beb6..69cbc18 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -279,6 +279,7 @@ public:
///! return a warning string for a given policy
static std::string GetPolicyWarning(cmPolicies::PolicyID id);
+ static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
///! return an error string for when a required policy is unspecified
static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index d142693..eec1fc6 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -15,6 +15,7 @@
#include <utility>
#include "cmAlgorithms.h"
+#include "cmCryptoHash.h"
#include "cmFilePathChecksum.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -31,9 +32,9 @@
// -- Static variables
-static const char* SettingsKeyMoc = "AM_MOC_OLD_SETTINGS";
-static const char* SettingsKeyUic = "AM_UIC_OLD_SETTINGS";
-static const char* SettingsKeyRcc = "AM_RCC_OLD_SETTINGS";
+static const char* SettingsKeyMoc = "AM_MOC_SETTINGS_HASH";
+static const char* SettingsKeyUic = "AM_UIC_SETTINGS_HASH";
+static const char* SettingsKeyRcc = "AM_RCC_SETTINGS_HASH";
// -- Static functions
@@ -42,6 +43,25 @@ inline static std::string Quoted(const std::string& text)
return cmQtAutoGeneratorCommon::Quoted(text);
}
+static std::string QuotedCommand(const std::vector<std::string>& command)
+{
+ std::string res;
+ for (std::vector<std::string>::const_iterator cit = command.begin();
+ cit != command.end(); ++cit) {
+ if (!res.empty()) {
+ res.push_back(' ');
+ }
+ const std::string cesc = Quoted(*cit);
+ if (cit->empty() || (cesc.size() > (cit->size() + 2)) ||
+ (cesc.find(' ') != std::string::npos)) {
+ res += cesc;
+ } else {
+ res += *cit;
+ }
+ }
+ return res;
+}
+
static void InfoGet(cmMakefile* makefile, const char* key, std::string& value)
{
value = makefile->GetSafeDefinition(key);
@@ -76,30 +96,25 @@ static void InfoGet(cmMakefile* makefile, const char* key,
cmSystemTools::ExpandListArgument(valueConf, list);
}
-static std::string SettingsFile(const std::string& targetDirectory)
-{
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
- cmSystemTools::ConvertToUnixSlashes(filename);
- filename += "/AutogenOldSettings.cmake";
- return filename;
-}
-
inline static bool SettingsMatch(cmMakefile* makefile, const char* key,
const std::string& value)
{
return (value == makefile->GetSafeDefinition(key));
}
-static void SettingWrite(std::ostream& ostr, const char* key,
- const std::string& value)
+static void SettingAppend(std::string& str, const char* key,
+ const std::string& value)
{
if (!value.empty()) {
- ostr << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value)
- << ")\n";
+ str += "set(";
+ str += key;
+ str += " ";
+ str += cmOutputConverter::EscapeForCMake(value);
+ str += ")\n";
}
}
-std::string subDirPrefix(const std::string& fileName)
+static std::string SubDirPrefix(const std::string& fileName)
{
std::string res(cmsys::SystemTools::GetFilenamePath(fileName));
if (!res.empty()) {
@@ -236,12 +251,13 @@ static void UicMergeOptions(std::vector<std::string>& opts,
cmQtAutoGenerators::cmQtAutoGenerators()
: Verbose(cmsys::SystemTools::HasEnv("VERBOSE"))
, ColorOutput(true)
- , RunMocFailed(false)
- , RunUicFailed(false)
- , RunRccFailed(false)
- , GenerateAllMoc(false)
- , GenerateAllUic(false)
- , GenerateAllRcc(false)
+ , MocSettingsChanged(false)
+ , MocPredefsChanged(false)
+ , MocRunFailed(false)
+ , UicSettingsChanged(false)
+ , UicRunFailed(false)
+ , RccSettingsChanged(false)
+ , RccRunFailed(false)
{
std::string colorEnv;
@@ -254,16 +270,16 @@ cmQtAutoGenerators::cmQtAutoGenerators()
}
}
- this->MacroFilters[0].first = "Q_OBJECT";
- this->MacroFilters[0].second.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
- this->MacroFilters[1].first = "Q_GADGET";
- this->MacroFilters[1].second.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
+ this->MocMacroFilters[0].first = "Q_OBJECT";
+ this->MocMacroFilters[0].second.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ this->MocMacroFilters[1].first = "Q_GADGET";
+ this->MocMacroFilters[1].second.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
// Precompile regular expressions
- this->RegExpMocInclude.compile(
+ this->MocRegExpInclude.compile(
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- this->RegExpUicInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+"
+ this->UicRegExpInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
}
@@ -286,12 +302,12 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
bool success = false;
if (this->ReadAutogenInfoFile(mf.get(), targetDirectory, config)) {
// Read old settings
- this->SettingsFileRead(mf.get(), targetDirectory);
+ this->SettingsFileRead(mf.get());
// Init and run
this->Init(mf.get());
if (this->RunAutogen()) {
// Write current settings
- if (this->SettingsFileWrite(targetDirectory)) {
+ if (this->SettingsFileWrite()) {
success = true;
}
}
@@ -338,6 +354,13 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
return false;
}
+ // - Old settings file
+ {
+ this->SettingsFile = cmSystemTools::CollapseFullPath(targetDirectory);
+ cmSystemTools::ConvertToUnixSlashes(this->SettingsFile);
+ this->SettingsFile += "/AutogenOldSettings.cmake";
+ }
+
// - Target names
InfoGet(makefile, "AM_TARGET_NAME", this->AutogenTargetName);
InfoGet(makefile, "AM_ORIGIN_TARGET_NAME", this->OriginTargetName);
@@ -489,83 +512,87 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
return true;
}
-void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile,
- const std::string& targetDirectory)
+void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
{
// Compose current settings strings
- if (this->MocEnabled()) {
- std::string& str = this->SettingsStringMoc;
- str += JoinOptionsList(this->MocDefinitions);
- str += " ~~~ ";
- str += JoinOptionsList(this->MocIncludePaths);
- str += " ~~~ ";
- str += JoinOptionsList(this->MocOptions);
- str += " ~~~ ";
- str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
- str += " ~~~ ";
- }
- if (this->UicEnabled()) {
- std::string& str = this->SettingsStringUic;
- str += JoinOptionsList(this->UicTargetOptions);
- str += " ~~~ ";
- str += JoinOptionsMap(this->UicOptions);
- str += " ~~~ ";
- }
- if (this->RccEnabled()) {
- std::string& str = this->SettingsStringRcc;
- str += JoinOptionsMap(this->RccOptions);
- str += " ~~~ ";
+ {
+ cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
+ if (this->MocEnabled()) {
+ std::string str;
+ str += JoinOptionsList(this->MocDefinitions);
+ str += " ~~~ ";
+ str += JoinOptionsList(this->MocIncludePaths);
+ str += " ~~~ ";
+ str += JoinOptionsList(this->MocOptions);
+ str += " ~~~ ";
+ str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
+ str += " ~~~ ";
+ str += JoinOptionsList(this->MocPredefsCmd);
+ str += " ~~~ ";
+ this->SettingsStringMoc = crypt.HashString(str);
+ }
+ if (this->UicEnabled()) {
+ std::string str;
+ str += JoinOptionsList(this->UicTargetOptions);
+ str += " ~~~ ";
+ str += JoinOptionsMap(this->UicOptions);
+ str += " ~~~ ";
+ this->SettingsStringUic = crypt.HashString(str);
+ }
+ if (this->RccEnabled()) {
+ std::string str;
+ str += JoinOptionsMap(this->RccOptions);
+ str += " ~~~ ";
+ this->SettingsStringRcc = crypt.HashString(str);
+ }
}
// Read old settings
- const std::string filename = SettingsFile(targetDirectory);
- if (makefile->ReadListFile(filename.c_str())) {
+ if (makefile->ReadListFile(this->SettingsFile.c_str())) {
if (!SettingsMatch(makefile, SettingsKeyMoc, this->SettingsStringMoc)) {
- this->GenerateAllMoc = true;
+ this->MocSettingsChanged = true;
}
if (!SettingsMatch(makefile, SettingsKeyUic, this->SettingsStringUic)) {
- this->GenerateAllUic = true;
+ this->UicSettingsChanged = true;
}
if (!SettingsMatch(makefile, SettingsKeyRcc, this->SettingsStringRcc)) {
- this->GenerateAllRcc = true;
+ this->RccSettingsChanged = true;
}
// In case any setting changed remove the old settings file.
// This triggers a full rebuild on the next run if the current
// build is aborted before writing the current settings in the end.
- if (this->GenerateAllAny()) {
- cmSystemTools::RemoveFile(filename);
+ if (this->AnySettingsChanged()) {
+ cmSystemTools::RemoveFile(this->SettingsFile);
}
} else {
// If the file could not be read re-generate everythiung.
- this->GenerateAllMoc = true;
- this->GenerateAllUic = true;
- this->GenerateAllRcc = true;
+ this->MocSettingsChanged = true;
+ this->UicSettingsChanged = true;
+ this->RccSettingsChanged = true;
}
}
-bool cmQtAutoGenerators::SettingsFileWrite(const std::string& targetDirectory)
+bool cmQtAutoGenerators::SettingsFileWrite()
{
bool success = true;
// Only write if any setting changed
- if (this->GenerateAllAny()) {
- const std::string filename = SettingsFile(targetDirectory);
+ if (this->AnySettingsChanged()) {
if (this->Verbose) {
- this->LogInfo("AutoGen: Writing settings file " + filename);
- }
- cmsys::ofstream outfile;
- outfile.open(filename.c_str(), std::ios::trunc);
- if (outfile) {
- SettingWrite(outfile, SettingsKeyMoc, this->SettingsStringMoc);
- SettingWrite(outfile, SettingsKeyUic, this->SettingsStringUic);
- SettingWrite(outfile, SettingsKeyRcc, this->SettingsStringRcc);
- success = outfile.good();
- outfile.close();
- } else {
+ this->LogInfo("AutoGen: Writing settings file " +
+ Quoted(this->SettingsFile));
+ }
+ // Compose settings file content
+ std::string settings;
+ SettingAppend(settings, SettingsKeyMoc, this->SettingsStringMoc);
+ SettingAppend(settings, SettingsKeyUic, this->SettingsStringUic);
+ SettingAppend(settings, SettingsKeyRcc, this->SettingsStringRcc);
+ // Write settings file
+ if (!this->FileWrite("AutoGen", this->SettingsFile, settings)) {
+ this->LogError("AutoGen: Error: Could not write old settings file " +
+ Quoted(this->SettingsFile));
+ // Remove old settings file to trigger a full rebuild on the next run
+ cmSystemTools::RemoveFile(this->SettingsFile);
success = false;
- // Remove old settings file to trigger full rebuild on next run
- cmSystemTools::RemoveFile(filename);
- this->LogError("AutoGen: Error: Writing old settings file failed: " +
- filename);
}
}
return success;
@@ -588,7 +615,7 @@ void cmQtAutoGenerators::Init(cmMakefile* makefile)
}
// Init file path checksum generator
- fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
+ FPathChecksum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
this->ProjectSourceDir,
this->ProjectBinaryDir);
@@ -722,8 +749,8 @@ bool cmQtAutoGenerators::RunAutogen()
bool cmQtAutoGenerators::MocRequired(const std::string& contentText,
std::string* macroName)
{
- for (unsigned int ii = 0; ii != cmArraySize(this->MacroFilters); ++ii) {
- MacroFilter& filter = this->MacroFilters[ii];
+ for (unsigned int ii = 0; ii != cmArraySize(this->MocMacroFilters); ++ii) {
+ MocMacroFilter& filter = this->MocMacroFilters[ii];
// Run a simple find string operation before the expensive
// regular expression check
if (contentText.find(filter.first) != std::string::npos) {
@@ -751,7 +778,7 @@ void cmQtAutoGenerators::MocFindDepends(
// regular expression check
if (contentText.find(filter.key) != std::string::npos) {
// Run regular expression check loop
- const std::string sourcePath = subDirPrefix(absFilename);
+ const std::string sourcePath = SubDirPrefix(absFilename);
const char* contentChars = contentText.c_str();
while (filter.regExp.find(contentChars)) {
// Evaluate match
@@ -852,9 +879,9 @@ void cmQtAutoGenerators::UicParseContent(
const char* contentChars = contentText.c_str();
if (strstr(contentChars, "ui_") != CM_NULLPTR) {
- while (this->RegExpUicInclude.find(contentChars)) {
- uisIncluded[absFilename].push_back(this->RegExpUicInclude.match(1));
- contentChars += this->RegExpUicInclude.end();
+ while (this->UicRegExpInclude.find(contentChars)) {
+ uisIncluded[absFilename].push_back(this->UicRegExpInclude.match(1));
+ contentChars += this->UicRegExpInclude.end();
}
}
}
@@ -871,7 +898,7 @@ bool cmQtAutoGenerators::MocParseSourceContent(
this->LogInfo("AutoMoc: Checking " + absFilename);
}
- const std::string scannedFileAbsPath = subDirPrefix(absFilename);
+ const std::string scannedFileAbsPath = SubDirPrefix(absFilename);
const std::string scannedFileBasename =
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
@@ -887,10 +914,10 @@ bool cmQtAutoGenerators::MocParseSourceContent(
const char* contentChars = contentText.c_str();
if (strstr(contentChars, "moc") != CM_NULLPTR) {
// Iterate over all included moc files
- while (this->RegExpMocInclude.find(contentChars)) {
- const std::string incString = this->RegExpMocInclude.match(1);
+ while (this->MocRegExpInclude.find(contentChars)) {
+ const std::string incString = this->MocRegExpInclude.match(1);
// Basename of the moc include
- const std::string incSubDir(subDirPrefix(incString));
+ const std::string incSubDir(SubDirPrefix(incString));
const std::string incBasename =
cmsys::SystemTools::GetFilenameWithoutLastExtension(incString);
@@ -1008,7 +1035,7 @@ bool cmQtAutoGenerators::MocParseSourceContent(
}
}
// Forward content pointer
- contentChars += this->RegExpMocInclude.end();
+ contentChars += this->MocRegExpInclude.end();
}
}
@@ -1076,7 +1103,7 @@ void cmQtAutoGenerators::SearchHeadersForSourceFile(
{
std::string basepaths[2];
{
- std::string bpath = subDirPrefix(absFilename);
+ std::string bpath = SubDirPrefix(absFilename);
bpath += cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
// search for default header files and private header files
basepaths[0] = bpath;
@@ -1150,54 +1177,7 @@ bool cmQtAutoGenerators::MocGenerateAll(
return true;
}
- // Generate moc_predefs
- if (!this->MocPredefsCmd.empty()) {
- if (!this->MakeParentDirectory(this->MocPredefsFileAbs)) {
- this->LogError("AutoMoc: Error creating directory for " +
- this->MocPredefsFileRel);
- return false;
- }
- this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel);
-
- std::vector<std::string> cmd = this->MocPredefsCmd;
- cmd.insert(cmd.end(), this->MocIncludes.begin(), this->MocIncludes.end());
- for (std::vector<std::string>::const_iterator it =
- this->MocDefinitions.begin();
- it != this->MocDefinitions.end(); ++it) {
- cmd.push_back("-D" + (*it));
- }
- cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
-
- std::string output;
- bool moc_predefsGenerated = this->RunCommand(cmd, output, false);
- if (!moc_predefsGenerated) {
- return false;
- }
-
- // actually write the file
- cmsys::ofstream outfile;
- outfile.open(this->MocPredefsFileAbs.c_str(), std::ios::trunc);
- if (!outfile) {
- moc_predefsGenerated = false;
- this->LogError("AutoMoc: Error opening " + this->MocPredefsFileRel);
- } else {
- outfile << output;
- // Check for write errors
- if (!outfile.good()) {
- moc_predefsGenerated = false;
- this->LogError("AutoMoc: Error writing " + this->MocPredefsFileRel);
- }
- }
-
- if (!moc_predefsGenerated) {
- return false;
- }
- }
-
- bool mocCompFileGenerated = false;
- bool mocCompChanged = false;
-
- // look for name collisions
+ // Look for name collisions
{
std::multimap<std::string, std::string> collisions;
// Test merged map of included and notIncluded
@@ -1215,6 +1195,55 @@ bool cmQtAutoGenerators::MocGenerateAll(
return false;
}
}
+
+ // Generate moc_predefs
+ if (!this->MocPredefsCmd.empty()) {
+ if (this->MocSettingsChanged ||
+ FileAbsentOrOlder(this->MocPredefsFileAbs, this->SettingsFile)) {
+ this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel);
+
+ std::string output;
+ {
+ // Compose command
+ std::vector<std::string> cmd = this->MocPredefsCmd;
+ // Add includes
+ cmd.insert(cmd.end(), this->MocIncludes.begin(),
+ this->MocIncludes.end());
+ // Add definitions
+ for (std::vector<std::string>::const_iterator it =
+ this->MocDefinitions.begin();
+ it != this->MocDefinitions.end(); ++it) {
+ cmd.push_back("-D" + (*it));
+#ifdef _WIN32
+ cmd.push_back("-DWIN32");
+#endif
+ }
+ // Add options
+ cmd.insert(cmd.end(), this->MocOptions.begin(),
+ this->MocOptions.end());
+ // Execute command
+ if (!this->RunCommand(cmd, output, false)) {
+ {
+ std::ostringstream ost;
+ ost << "AutoMoc: Error: moc predefs generation command failed\n";
+ ost << "AutoMoc: Command:\n" << QuotedCommand(cmd) << "\n";
+ ost << "AutoMoc: Command output:\n" << output << "\n";
+ this->LogError(ost.str());
+ }
+ return false;
+ }
+ }
+ // (Re)write predefs file only on demand
+ if (this->FileDiffers(this->MocPredefsFileAbs, output)) {
+ if (this->FileWrite("AutoMoc", this->MocPredefsFileAbs, output)) {
+ this->MocPredefsChanged = true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
// Generate moc files that are included by source files.
{
const std::string subDir = "include/";
@@ -1222,13 +1251,15 @@ bool cmQtAutoGenerators::MocGenerateAll(
mocsIncluded.begin();
it != mocsIncluded.end(); ++it) {
if (!this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) {
- if (this->RunMocFailed) {
+ if (this->MocRunFailed) {
return false;
}
}
}
}
+
// Generate moc files that are _not_ included by source files.
+ bool mocCompFileGenerated = false;
{
const std::string subDir;
for (std::map<std::string, std::string>::const_iterator it =
@@ -1237,7 +1268,7 @@ bool cmQtAutoGenerators::MocGenerateAll(
if (this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) {
mocCompFileGenerated = true;
} else {
- if (this->RunMocFailed) {
+ if (this->MocRunFailed) {
return false;
}
}
@@ -1263,37 +1294,11 @@ bool cmQtAutoGenerators::MocGenerateAll(
automocSource = ost.str();
}
- // Check if the content of moc_compilation.cpp changed
- {
- std::string oldContents;
- if (ReadAll(oldContents, this->MocCppFilenameAbs)) {
- mocCompChanged = (oldContents != automocSource);
- } else {
- mocCompChanged = true;
- }
- }
-
- bool success = true;
- if (mocCompChanged) {
+ if (this->FileDiffers(this->MocCppFilenameAbs, automocSource)) {
// Actually write moc_compilation.cpp
this->LogBold("Generating MOC compilation " + this->MocCppFilenameRel);
-
- // Make sure the parent directory exists
- success = this->MakeParentDirectory(this->MocCppFilenameAbs);
- if (success) {
- cmsys::ofstream outfile;
- outfile.open(this->MocCppFilenameAbs.c_str(), std::ios::trunc);
- if (!outfile) {
- success = false;
- this->LogError("AutoMoc: Error opening " + this->MocCppFilenameAbs);
- } else {
- outfile << automocSource;
- // Check for write errors
- if (!outfile.good()) {
- success = false;
- this->LogError("AutoMoc: Error writing " + this->MocCppFilenameAbs);
- }
- }
+ if (!this->FileWrite("AutoMoc", this->MocCppFilenameAbs, automocSource)) {
+ return false;
}
} else if (mocCompFileGenerated) {
// Only touch moc_compilation.cpp
@@ -1303,7 +1308,7 @@ bool cmQtAutoGenerators::MocGenerateAll(
cmSystemTools::Touch(this->MocCppFilenameAbs, false);
}
- return success;
+ return true;
}
/**
@@ -1315,7 +1320,7 @@ bool cmQtAutoGenerators::MocGenerateFile(
const std::map<std::string, std::set<std::string> >& mocDepends)
{
bool mocGenerated = false;
- bool generateMoc = this->GenerateAllMoc;
+ bool generateMoc = this->MocSettingsChanged || this->MocPredefsChanged;
const std::string mocFileRel =
this->AutogenBuildSubDir + subDir + mocFileName;
@@ -1344,10 +1349,11 @@ bool cmQtAutoGenerators::MocGenerateFile(
this->LogBold("Generating MOC source " + mocFileRel);
// Make sure the parent directory exists
- if (this->MakeParentDirectory(mocFileAbs)) {
+ if (this->MakeParentDirectory("AutoMoc", mocFileAbs)) {
// Compose moc command
std::vector<std::string> cmd;
cmd.push_back(this->MocExecutable);
+ // Add includes
cmd.insert(cmd.end(), this->MocIncludes.begin(),
this->MocIncludes.end());
// Add definitions
@@ -1356,14 +1362,16 @@ bool cmQtAutoGenerators::MocGenerateFile(
it != this->MocDefinitions.end(); ++it) {
cmd.push_back("-D" + (*it));
}
+#ifdef _WIN32
+ cmd.push_back("-DWIN32");
+#endif
+ // Add options
cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
+ // Add predefs include
if (!this->MocPredefsFileAbs.empty()) {
cmd.push_back("--include");
cmd.push_back(this->MocPredefsFileAbs);
}
-#ifdef _WIN32
- cmd.push_back("-DWIN32");
-#endif
cmd.push_back("-o");
cmd.push_back(mocFileAbs);
cmd.push_back(sourceFile);
@@ -1379,16 +1387,16 @@ bool cmQtAutoGenerators::MocGenerateFile(
std::ostringstream ost;
ost << "AutoMoc: Error: moc process failed for\n";
ost << Quoted(mocFileRel) << "\n";
- ost << "AutoMoc: Command:\n" << cmJoin(cmd, " ") << "\n";
+ ost << "AutoMoc: Command:\n" << QuotedCommand(cmd) << "\n";
ost << "AutoMoc: Command output:\n" << output << "\n";
this->LogError(ost.str());
}
cmSystemTools::RemoveFile(mocFileAbs);
- this->RunMocFailed = true;
+ this->MocRunFailed = true;
}
} else {
// Parent directory creation failed
- this->RunMocFailed = true;
+ this->MocRunFailed = true;
}
}
return mocGenerated;
@@ -1401,7 +1409,7 @@ bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile,
bool success = false;
// Search in vicinity of the source
{
- std::string testPath = subDirPrefix(sourceFile);
+ std::string testPath = SubDirPrefix(sourceFile);
testPath += includeString;
if (cmsys::SystemTools::FileExists(testPath.c_str())) {
absFile = cmsys::SystemTools::GetRealPath(testPath);
@@ -1447,7 +1455,7 @@ bool cmQtAutoGenerators::UicGenerateAll(
for (std::vector<std::string>::const_iterator uit = sourceIncs.begin();
uit != sourceIncs.end(); ++uit) {
// Remove ui_ from the begin filename by substr()
- const std::string uiBasePath = subDirPrefix(*uit);
+ const std::string uiBasePath = SubDirPrefix(*uit);
const std::string uiBaseName =
cmsys::SystemTools::GetFilenameWithoutLastExtension(*uit).substr(3);
const std::string searchFileName = uiBasePath + uiBaseName + ".ui";
@@ -1487,7 +1495,7 @@ bool cmQtAutoGenerators::UicGenerateAll(
it->second.begin();
sit != it->second.end(); ++sit) {
if (!this->UicGenerateFile(it->first, sit->first, sit->second)) {
- if (this->RunUicFailed) {
+ if (this->UicRunFailed) {
return false;
}
}
@@ -1505,7 +1513,7 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
const std::string& uiOutputFile)
{
bool uicGenerated = false;
- bool generateUic = this->GenerateAllUic;
+ bool generateUic = this->UicSettingsChanged;
const std::string uicFileRel =
this->AutogenBuildSubDir + "include/" + uiOutputFile;
@@ -1520,7 +1528,7 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
this->LogBold("Generating UIC header " + uicFileRel);
// Make sure the parent directory exists
- if (this->MakeParentDirectory(uicFileAbs)) {
+ if (this->MakeParentDirectory("AutoUic", uicFileAbs)) {
// Compose uic command
std::vector<std::string> cmd;
cmd.push_back(this->UicExecutable);
@@ -1550,16 +1558,16 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
ost << "AutoUic: Error: uic process failed for\n";
ost << Quoted(uicFileRel) << " needed by\n";
ost << Quoted(realName) << "\n";
- ost << "AutoUic: Command:\n" << cmJoin(cmd, " ") << "\n";
+ ost << "AutoUic: Command:\n" << QuotedCommand(cmd) << "\n";
ost << "AutoUic: Command output:\n" << output << "\n";
this->LogError(ost.str());
}
cmSystemTools::RemoveFile(uicFileAbs);
- this->RunUicFailed = true;
+ this->UicRunFailed = true;
}
} else {
// Parent directory creation failed
- this->RunUicFailed = true;
+ this->UicRunFailed = true;
}
}
return uicGenerated;
@@ -1601,7 +1609,7 @@ bool cmQtAutoGenerators::RccGenerateAll()
si != qrcGenMap.end(); ++si) {
bool unique = FileNameIsUnique(si->first, qrcGenMap);
if (!this->RccGenerateFile(si->first, si->second, unique)) {
- if (this->RunRccFailed) {
+ if (this->RccRunFailed) {
return false;
}
}
@@ -1617,7 +1625,7 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
bool unique_n)
{
bool rccGenerated = false;
- bool generateRcc = this->GenerateAllRcc;
+ bool generateRcc = this->RccSettingsChanged;
const std::string rccBuildFile = this->CurrentBinaryDir + rccOutputFile;
@@ -1638,7 +1646,7 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
} else {
files = CM_NULLPTR;
this->LogError(error);
- this->RunRccFailed = true;
+ this->RccRunFailed = true;
}
}
// Test if any input file is newer than the build file
@@ -1658,13 +1666,13 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
this->LogBold("Generating RCC source " + rccOutputFile);
// Make sure the parent directory exists
- if (this->MakeParentDirectory(rccBuildFile)) {
+ if (this->MakeParentDirectory("AutoRcc", rccBuildFile)) {
// Compose symbol name
std::string symbolName =
cmsys::SystemTools::GetFilenameWithoutLastExtension(rccInputFile);
if (!unique_n) {
symbolName += "_";
- symbolName += fpathCheckSum.getPart(rccInputFile);
+ symbolName += FPathChecksum.getPart(rccInputFile);
}
// Replace '-' with '_'. The former is valid for
// file names but not for symbol names.
@@ -1696,16 +1704,16 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
std::ostringstream ost;
ost << "AutoRcc: Error: rcc process failed for\n";
ost << Quoted(rccOutputFile) << "\n";
- ost << "AutoRcc: Command:\n" << cmJoin(cmd, " ") << "\n";
+ ost << "AutoRcc: Command:\n" << QuotedCommand(cmd) << "\n";
ost << "AutoRcc: Command output:\n" << output << "\n";
this->LogError(ost.str());
}
cmSystemTools::RemoveFile(rccBuildFile);
- this->RunRccFailed = true;
+ this->RccRunFailed = true;
}
} else {
// Parent directory creation failed
- this->RunRccFailed = true;
+ this->RccRunFailed = true;
}
}
return rccGenerated;
@@ -1776,23 +1784,6 @@ void cmQtAutoGenerators::LogError(const std::string& message) const
}
}
-void cmQtAutoGenerators::LogCommand(
- const std::vector<std::string>& command) const
-{
- std::vector<std::string> cmdEscaped;
- typedef std::vector<std::string>::const_iterator Iter;
- for (Iter cit = command.begin(); cit != command.end(); ++cit) {
- const std::string cesc = Quoted(*cit);
- if ((cesc.size() > (cit->size() + 2)) ||
- (cesc.find(' ') != std::string::npos)) {
- cmdEscaped.push_back(cesc);
- } else {
- cmdEscaped.push_back(*cit);
- }
- }
- this->LogInfo(cmJoin(cmdEscaped, " "));
-}
-
/**
* @brief Collects name collisions as output/input pairs
* @return True if there were collisions
@@ -1831,7 +1822,7 @@ std::string cmQtAutoGenerators::ChecksumedPath(const std::string& sourceFile,
const char* basePrefix,
const char* baseSuffix) const
{
- std::string res = fpathCheckSum.getPart(sourceFile);
+ std::string res = FPathChecksum.getPart(sourceFile);
res += "/";
res += basePrefix;
res += cmsys::SystemTools::GetFilenameWithoutLastExtension(sourceFile);
@@ -1843,19 +1834,66 @@ std::string cmQtAutoGenerators::ChecksumedPath(const std::string& sourceFile,
* @brief Generates the parent directory of the given file on demand
* @return True on success
*/
-bool cmQtAutoGenerators::MakeParentDirectory(const std::string& filename) const
+bool cmQtAutoGenerators::MakeParentDirectory(const char* logPrefix,
+ const std::string& filename) const
{
bool success = true;
const std::string dirName = cmSystemTools::GetFilenamePath(filename);
if (!dirName.empty()) {
success = cmsys::SystemTools::MakeDirectory(dirName);
if (!success) {
- this->LogError("AutoGen: Error: Directory creation failed: " + dirName);
+ std::string error = logPrefix;
+ error += ": Error: Parent directory creation failed for ";
+ error += Quoted(filename);
+ this->LogError(error);
}
}
return success;
}
+bool cmQtAutoGenerators::FileDiffers(const std::string& filename,
+ const std::string& content)
+{
+ bool differs = true;
+ {
+ std::string oldContents;
+ if (ReadAll(oldContents, filename)) {
+ differs = (oldContents != content);
+ }
+ }
+ return differs;
+}
+
+bool cmQtAutoGenerators::FileWrite(const char* logPrefix,
+ const std::string& filename,
+ const std::string& content)
+{
+ std::string error;
+ // Make sure the parent directory exists
+ if (this->MakeParentDirectory(logPrefix, filename)) {
+ cmsys::ofstream outfile;
+ outfile.open(filename.c_str(), std::ios::trunc);
+ if (outfile) {
+ outfile << content;
+ // Check for write errors
+ if (!outfile.good()) {
+ error = logPrefix;
+ error += ": Error writing ";
+ error += Quoted(filename);
+ }
+ } else {
+ error = logPrefix;
+ error = ": Error opening ";
+ error += Quoted(filename);
+ }
+ }
+ if (!error.empty()) {
+ this->LogError(error);
+ return false;
+ }
+ return true;
+}
+
/**
* @brief Runs a command and returns true on success
* @return True on success
@@ -1865,7 +1903,7 @@ bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command,
{
// Log command
if (this->Verbose) {
- this->LogCommand(command);
+ this->LogInfo(QuotedCommand(command));
}
// Execute command
int retVal = 0;
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 24c0a33..987110f 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -23,7 +23,7 @@ public:
bool Run(const std::string& targetDirectory, const std::string& config);
private:
- // - Types
+ // -- Types
/// @brief Used to extract additional dependencies from content text
struct MocDependFilter
@@ -31,9 +31,9 @@ private:
std::string key;
cmsys::RegularExpression regExp;
};
- typedef std::pair<std::string, cmsys::RegularExpression> MacroFilter;
+ typedef std::pair<std::string, cmsys::RegularExpression> MocMacroFilter;
- // - Configuration
+ // -- Configuration
bool MocDependFilterPush(const std::string& key, const std::string& regExp);
bool ReadAutogenInfoFile(cmMakefile* makefile,
const std::string& targetDirectory,
@@ -43,22 +43,21 @@ private:
bool UicEnabled() const { return !this->UicExecutable.empty(); }
bool RccEnabled() const { return !this->RccExecutable.empty(); }
- // - Settings file
- void SettingsFileRead(cmMakefile* makefile,
- const std::string& targetDirectory);
- bool SettingsFileWrite(const std::string& targetDirectory);
+ // -- Settings file
+ void SettingsFileRead(cmMakefile* makefile);
+ bool SettingsFileWrite();
- bool GenerateAllAny() const
+ bool AnySettingsChanged() const
{
- return (this->GenerateAllMoc || this->GenerateAllRcc ||
- this->GenerateAllUic);
+ return (this->MocSettingsChanged || this->RccSettingsChanged ||
+ this->UicSettingsChanged);
}
- // - Init and run
+ // -- Init and run
void Init(cmMakefile* makefile);
bool RunAutogen();
- // - Content analysis
+ // -- Content analysis
bool MocRequired(const std::string& contentText,
std::string* macroName = CM_NULLPTR);
void MocFindDepends(
@@ -101,7 +100,7 @@ private:
std::map<std::string, std::string>& mocsNotIncluded,
std::map<std::string, std::set<std::string> >& mocDepends);
- // - Moc file generation
+ // -- Moc file generation
bool MocGenerateAll(
const std::map<std::string, std::string>& mocsIncluded,
const std::map<std::string, std::string>& mocsNotIncluded,
@@ -111,7 +110,7 @@ private:
const std::string& subDir,
const std::map<std::string, std::set<std::string> >& mocDepends);
- // - Uic file generation
+ // -- Uic file generation
bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile,
const std::string& includeString);
bool UicGenerateAll(
@@ -120,12 +119,12 @@ private:
const std::string& uiInputFile,
const std::string& uiOutputFile);
- // - Rcc file generation
+ // -- Rcc file generation
bool RccGenerateAll();
bool RccGenerateFile(const std::string& qrcInputFile,
const std::string& qrcOutputFile, bool unique_n);
- // - Logging
+ // -- Logging
void LogErrorNameCollision(
const std::string& message,
const std::multimap<std::string, std::string>& collisions) const;
@@ -135,14 +134,19 @@ private:
void LogError(const std::string& message) const;
void LogCommand(const std::vector<std::string>& command) const;
- // - Utility
+ // -- Utility
bool NameCollisionTest(
const std::map<std::string, std::string>& genFiles,
std::multimap<std::string, std::string>& collisions) const;
std::string ChecksumedPath(const std::string& sourceFile,
const char* basePrefix,
const char* baseSuffix) const;
- bool MakeParentDirectory(const std::string& filename) const;
+ bool MakeParentDirectory(const char* logPrefix,
+ const std::string& filename) const;
+ bool FileDiffers(const std::string& filename, const std::string& content);
+ bool FileWrite(const char* logPrefix, const std::string& filename,
+ const std::string& content);
+
bool RunCommand(const std::vector<std::string>& command, std::string& output,
bool verbose = true) const;
@@ -153,28 +157,38 @@ private:
bool MocFindIncludedFile(std::string& absFile, const std::string& sourceFile,
const std::string& includeString) const;
- // - Target names
+ // -- Target names
std::string OriginTargetName;
std::string AutogenTargetName;
- // - Directories
+ // -- Directories
std::string ProjectSourceDir;
std::string ProjectBinaryDir;
std::string CurrentSourceDir;
std::string CurrentBinaryDir;
std::string AutogenBuildSubDir;
- // - Qt environment
+ // -- Qt environment
std::string QtMajorVersion;
std::string MocExecutable;
std::string UicExecutable;
std::string RccExecutable;
- // - File lists
+ // -- File lists
std::vector<std::string> Sources;
std::vector<std::string> Headers;
- // - Settings
+ std::vector<std::string> HeaderExtensions;
+ cmFilePathChecksum FPathChecksum;
+ // -- Settings
+ bool IncludeProjectDirsBefore;
+ bool Verbose;
+ bool ColorOutput;
+ std::string SettingsFile;
std::string SettingsStringMoc;
std::string SettingsStringUic;
std::string SettingsStringRcc;
- // - Moc
+ // -- Moc
+ bool MocSettingsChanged;
+ bool MocPredefsChanged;
+ bool MocRelaxedMode;
+ bool MocRunFailed;
std::string MocCppFilenameRel;
std::string MocCppFilenameAbs;
std::string MocPredefsFileRel;
@@ -184,35 +198,24 @@ private:
std::vector<std::string> MocIncludes;
std::vector<std::string> MocDefinitions;
std::vector<std::string> MocOptions;
+ std::vector<std::string> MocPredefsCmd;
std::vector<MocDependFilter> MocDependFilters;
- // - Uic
+ MocMacroFilter MocMacroFilters[2];
+ cmsys::RegularExpression MocRegExpInclude;
+ // -- Uic
+ bool UicSettingsChanged;
+ bool UicRunFailed;
std::vector<std::string> UicSkipList;
std::vector<std::string> UicTargetOptions;
std::map<std::string, std::string> UicOptions;
std::vector<std::string> UicSearchPaths;
- // - Rcc
+ cmsys::RegularExpression UicRegExpInclude;
+ // -- Rcc
+ bool RccSettingsChanged;
+ bool RccRunFailed;
std::vector<std::string> RccSources;
std::map<std::string, std::string> RccOptions;
std::map<std::string, std::vector<std::string> > RccInputs;
- // - Utility
- cmFilePathChecksum fpathCheckSum;
- std::vector<std::string> HeaderExtensions;
- MacroFilter MacroFilters[2];
- cmsys::RegularExpression RegExpMocInclude;
- cmsys::RegularExpression RegExpUicInclude;
- // - moc_predefs
- std::vector<std::string> MocPredefsCmd;
- // - Flags
- bool IncludeProjectDirsBefore;
- bool Verbose;
- bool ColorOutput;
- bool RunMocFailed;
- bool RunUicFailed;
- bool RunRccFailed;
- bool GenerateAllMoc;
- bool GenerateAllUic;
- bool GenerateAllRcc;
- bool MocRelaxedMode;
};
#endif
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 70ffc7d..938cad9 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -96,14 +96,14 @@ void cmRST::ProcessModule(std::istream& is)
if (line == "#") {
this->ProcessLine("");
continue;
- } else if (line.substr(0, 2) == "# ") {
+ }
+ if (line.substr(0, 2) == "# ") {
this->ProcessLine(line.substr(2, line.npos));
continue;
- } else {
- rst = "";
- this->Reset();
- this->OutputLinePending = true;
}
+ rst = "";
+ this->Reset();
+ this->OutputLinePending = true;
}
if (line == "#.rst:") {
rst = "#";
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 2a2dd40..753a1ba 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -4,8 +4,6 @@
#include "cmSystemTools.h"
-#include "cmConfigure.h"
-
cmScriptGenerator::cmScriptGenerator(
const std::string& config_var,
std::vector<std::string> const& configurations)
@@ -90,8 +88,7 @@ void cmScriptGenerator::GenerateScript(std::ostream& os)
this->GenerateScriptConfigs(os, indent);
}
-void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os,
- Indent const& indent)
+void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent)
{
if (this->ActionsPerConfig) {
this->GenerateScriptActionsPerConfig(os, indent);
@@ -100,8 +97,7 @@ void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os,
}
}
-void cmScriptGenerator::GenerateScriptActions(std::ostream& os,
- Indent const& indent)
+void cmScriptGenerator::GenerateScriptActions(std::ostream& os, Indent indent)
{
if (this->ActionsPerConfig) {
// This is reached for single-configuration build generators in a
@@ -112,7 +108,7 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os,
void cmScriptGenerator::GenerateScriptForConfig(std::ostream& /*unused*/,
const std::string& /*unused*/,
- Indent const& /*unused*/)
+ Indent /*unused*/)
{
// No actions for this generator.
}
@@ -138,7 +134,7 @@ bool cmScriptGenerator::GeneratesForConfig(const std::string& config)
}
void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
if (this->Configurations.empty()) {
// This rule is for all configurations.
@@ -153,7 +149,7 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os,
}
void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
- Indent const& indent)
+ Indent indent)
{
if (this->ConfigurationTypes->empty()) {
// In a single-configuration generator there is only one action
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 0e98b27..d0879c6 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmScriptGenerator_h
#define cmScriptGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <ostream>
#include <string>
@@ -35,7 +35,7 @@ private:
int Level;
};
inline std::ostream& operator<<(std::ostream& os,
- cmScriptGeneratorIndent const& indent)
+ cmScriptGeneratorIndent indent)
{
indent.Write(os);
return os;
@@ -47,6 +47,8 @@ inline std::ostream& operator<<(std::ostream& os,
*/
class cmScriptGenerator
{
+ CM_DISABLE_COPY(cmScriptGenerator)
+
public:
cmScriptGenerator(const std::string& config_var,
std::vector<std::string> const& configurations);
@@ -58,12 +60,12 @@ public:
protected:
typedef cmScriptGeneratorIndent Indent;
virtual void GenerateScript(std::ostream& os);
- virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
- virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
+ virtual void GenerateScriptConfigs(std::ostream& os, Indent indent);
+ virtual void GenerateScriptActions(std::ostream& os, Indent indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config,
- Indent const& indent);
- virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {}
+ Indent indent);
+ virtual void GenerateScriptNoConfig(std::ostream&, Indent) {}
virtual bool NeedsScriptNoConfig() const { return false; }
// Test if this generator does something for a given configuration.
@@ -87,8 +89,8 @@ protected:
bool ActionsPerConfig;
private:
- void GenerateScriptActionsOnce(std::ostream& os, Indent const& indent);
- void GenerateScriptActionsPerConfig(std::ostream& os, Indent const& indent);
+ void GenerateScriptActionsOnce(std::ostream& os, Indent indent);
+ void GenerateScriptActionsPerConfig(std::ostream& os, Indent indent);
};
#endif
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index b27d227..7b222a0 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -40,6 +40,13 @@ bool cmSeparateArgumentsCommand::InitialPass(
if (doing == DoingVariable) {
var = args[i];
doing = DoingMode;
+ } else if (doing == DoingMode && args[i] == "NATIVE_COMMAND") {
+#ifdef _WIN32
+ mode = ModeWindows;
+#else
+ mode = ModeUnix;
+#endif
+ doing = DoingCommand;
} else if (doing == DoingMode && args[i] == "UNIX_COMMAND") {
mode = ModeUnix;
doing = DoingCommand;
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 8227ab7..11ee897 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -50,9 +50,8 @@ std::vector<std::string> getConfigurations(const cmake* cm)
bool hasString(const Json::Value& v, const std::string& s)
{
return !v.isNull() &&
- std::find_if(v.begin(), v.end(), [s](const Json::Value& i) {
- return i.asString() == s;
- }) != v.end();
+ std::any_of(v.begin(), v.end(),
+ [s](const Json::Value& i) { return i.asString() == s; });
}
template <class T>
@@ -493,16 +492,14 @@ cmServerResponse cmServerProtocol1_0::ProcessCache(
if (keys.empty()) {
keys = allKeys;
} else {
- for (auto i : keys) {
- if (std::find_if(allKeys.begin(), allKeys.end(),
- [i](const std::string& j) { return i == j; }) ==
- allKeys.end()) {
+ for (const auto& i : keys) {
+ if (std::find(allKeys.begin(), allKeys.end(), i) == allKeys.end()) {
return request.ReportError("Key \"" + i + "\" not found in cache.");
}
}
}
std::sort(keys.begin(), keys.end());
- for (auto key : keys) {
+ for (const auto& key : keys) {
Json::Value entry = Json::objectValue;
entry[kKEY_KEY] = key;
entry[kTYPE_KEY] =
@@ -511,7 +508,7 @@ cmServerResponse cmServerProtocol1_0::ProcessCache(
Json::Value props = Json::objectValue;
bool haveProperties = false;
- for (auto prop : state->GetCacheEntryPropertyList(key)) {
+ for (const auto& prop : state->GetCacheEntryPropertyList(key)) {
haveProperties = true;
props[prop] = state->GetCacheEntryProperty(key, prop);
}
@@ -598,7 +595,7 @@ bool LanguageData::operator==(const LanguageData& other) const
void LanguageData::SetDefines(const std::set<std::string>& defines)
{
std::vector<std::string> result;
- for (auto i : defines) {
+ for (const auto& i : defines) {
result.push_back(i);
}
std::sort(result.begin(), result.end());
@@ -615,11 +612,11 @@ struct hash<LanguageData>
using std::hash;
size_t result =
hash<std::string>()(in.Language) ^ hash<std::string>()(in.Flags);
- for (auto i : in.IncludePathList) {
+ for (const auto& i : in.IncludePathList) {
result = result ^ (hash<std::string>()(i.first) ^
(i.second ? std::numeric_limits<size_t>::max() : 0));
}
- for (auto i : in.Defines) {
+ for (const auto& i : in.Defines) {
result = result ^ hash<std::string>()(i);
}
result =
@@ -643,7 +640,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
}
if (!data.IncludePathList.empty()) {
Json::Value includes = Json::arrayValue;
- for (auto i : data.IncludePathList) {
+ for (const auto& i : data.IncludePathList) {
Json::Value tmp = Json::objectValue;
tmp[kPATH_KEY] = i.first;
if (i.second) {
@@ -661,7 +658,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
result[kIS_GENERATED_KEY] = data.IsGenerated;
Json::Value sourcesValue = Json::arrayValue;
- for (auto i : files) {
+ for (const auto& i : files) {
const std::string relPath =
cmSystemTools::RelativePath(baseDir.c_str(), i.c_str());
sourcesValue.append(relPath.size() < i.size() ? relPath : i);
@@ -819,7 +816,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
std::set<std::string> languages;
target->GetLanguages(languages, config);
std::map<std::string, LanguageData> languageDataMap;
- for (auto lang : languages) {
+ for (const auto& lang : languages) {
LanguageData& ld = languageDataMap[lang];
ld.Language = lang;
lg->GetTargetCompileFlags(target, config, lang, ld.Flags);
@@ -1095,7 +1092,7 @@ cmServerResponse cmServerProtocol1_0::ProcessSetGlobalSettings(
kWARN_UNINITIALIZED_KEY, kWARN_UNUSED_KEY, kWARN_UNUSED_CLI_KEY,
kCHECK_SYSTEM_VARS_KEY
};
- for (auto i : boolValues) {
+ for (const auto& i : boolValues) {
if (!request.Data[i].isNull() && !request.Data[i].isBool()) {
return request.ReportError("\"" + i +
"\" must be unset or a bool value.");
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index da26972..6425913 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -32,9 +32,8 @@ bool cmSetTargetPropertiesCommand::InitialPass(
}
propertyPairs.insert(propertyPairs.end(), j, args.end());
break;
- } else {
- numFiles++;
}
+ numFiles++;
}
if (propertyPairs.empty()) {
this->SetError("called with illegal arguments, maybe missing "
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 4fd379f..e27c675 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -32,9 +32,8 @@ bool cmSetTestsPropertiesCommand::InitialPass(
}
propertyPairs.insert(propertyPairs.end(), j, args.end());
break;
- } else {
- numFiles++;
}
+ numFiles++;
}
if (propertyPairs.empty()) {
this->SetError("called with illegal arguments, maybe "
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 631f2a6..f54d777 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
+#include <algorithm>
+#include <iterator>
#include <set>
#include <sstream>
#include <stddef.h>
@@ -36,21 +38,31 @@ std::string getFullFilePath(const std::string& currentPath,
}
std::set<std::string> getSourceGroupFilesPaths(
- const std::string& currentPath, const std::string& root,
- const std::vector<std::string>& files)
+ const std::string& root, const std::vector<std::string>& files)
{
std::set<std::string> ret;
const std::string::size_type rootLength = root.length();
for (size_t i = 0; i < files.size(); ++i) {
- const std::string fullPath = getFullFilePath(currentPath, files[i]);
-
- ret.insert(fullPath.substr(rootLength + 1)); // +1 to also omnit last '/'
+ ret.insert(files[i].substr(rootLength + 1)); // +1 to also omnit last '/'
}
return ret;
}
+bool rootIsPrefix(const std::string& root,
+ const std::vector<std::string>& files, std::string& error)
+{
+ for (size_t i = 0; i < files.size(); ++i) {
+ if (!cmSystemTools::StringStartsWith(files[i], root.c_str())) {
+ error = "ROOT: " + root + " is not a prefix of file: " + files[i];
+ return false;
+ }
+ }
+
+ return true;
+}
+
cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath,
cmMakefile& makefile)
{
@@ -68,7 +80,22 @@ cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath,
return sg;
}
-bool addFilesToItsSourceGroups(const std::set<std::string>& sgFilesPaths,
+std::string prepareFilePathForTree(const std::string& path)
+{
+ return cmSystemTools::CollapseFullPath(path);
+}
+
+std::vector<std::string> prepareFilesPathsForTree(
+ std::vector<std::string>::const_iterator begin,
+ std::vector<std::string>::const_iterator end)
+{
+ std::vector<std::string> prepared(std::distance(begin, end));
+ std::transform(begin, end, prepared.begin(), prepareFilePathForTree);
+ return prepared;
+}
+
+bool addFilesToItsSourceGroups(const std::string& root,
+ const std::set<std::string>& sgFilesPaths,
const std::string& prefix, cmMakefile& makefile,
std::string& errorMsg)
{
@@ -93,8 +120,7 @@ bool addFilesToItsSourceGroups(const std::set<std::string>& sgFilesPaths,
errorMsg = "Could not create source group for file: " + *it;
return false;
}
- const std::string fullPath =
- getFullFilePath(makefile.GetCurrentSourceDirectory(), *it);
+ const std::string fullPath = getFullFilePath(root, *it);
sg->AddGroupFile(fullPath);
}
}
@@ -233,17 +259,18 @@ bool cmSourceGroupCommand::processTree(const std::vector<std::string>& args,
filesBegin = FilesWithPrefixKeywordIndex + 1;
}
- const std::vector<std::string> filesVector(args.begin() + filesBegin,
- args.end());
+ const std::vector<std::string> filesVector =
+ prepareFilesPathsForTree(args.begin() + filesBegin, args.end());
- std::set<std::string> sourceGroupPaths = getSourceGroupFilesPaths(
- this->Makefile->GetCurrentSourceDirectory(), root, filesVector);
+ if (!rootIsPrefix(root, filesVector, errorMsg)) {
+ return false;
+ }
- addFilesToItsSourceGroups(sourceGroupPaths, prefix, *(this->Makefile),
- errorMsg);
+ std::set<std::string> sourceGroupPaths =
+ getSourceGroupFilesPaths(root, filesVector);
- if (!errorMsg.empty()) {
- this->SetError(errorMsg);
+ if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix,
+ *(this->Makefile), errorMsg)) {
return false;
}
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index b2c6a7c..f36ee37 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -57,11 +57,6 @@ struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap
, Weak(w)
{
}
- PolicyStackEntry(PolicyStackEntry const& r)
- : derived(r)
- , Weak(r.Weak)
- {
- }
bool Weak;
};
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 39625ae..8978e18 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -505,6 +505,39 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
argv.Store(args);
}
+std::vector<std::string> cmSystemTools::HandleResponseFile(
+ std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd)
+{
+ std::vector<std::string> arg_full;
+ for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) {
+ std::string const& arg = *a;
+ if (cmHasLiteralPrefix(arg, "@")) {
+ cmsys::ifstream responseFile(arg.substr(1).c_str(), std::ios::in);
+ if (!responseFile) {
+ std::string error = "failed to open for reading (";
+ error += cmSystemTools::GetLastSystemError();
+ error += "):\n ";
+ error += arg.substr(1);
+ cmSystemTools::Error(error.c_str());
+ } else {
+ std::string line;
+ cmSystemTools::GetLineFromStream(responseFile, line);
+ std::vector<std::string> args2;
+#ifdef _WIN32
+ cmSystemTools::ParseWindowsCommandLine(line.c_str(), args2);
+#else
+ cmSystemTools::ParseUnixCommandLine(line.c_str(), args2);
+#endif
+ arg_full.insert(arg_full.end(), args2.begin(), args2.end());
+ }
+ } else {
+ arg_full.push_back(arg);
+ }
+ }
+ return arg_full;
+}
+
std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
{
std::vector<std::string> args;
@@ -1707,7 +1740,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
for (; outiter != out.end(); ++outiter) {
if ((*outiter == '\r') && ((outiter + 1) == out.end())) {
break;
- } else if (*outiter == '\n' || *outiter == '\0') {
+ }
+ if (*outiter == '\n' || *outiter == '\0') {
std::vector<char>::size_type length = outiter - out.begin();
if (length > 1 && *(outiter - 1) == '\r') {
--length;
@@ -1724,7 +1758,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
for (; erriter != err.end(); ++erriter) {
if ((*erriter == '\r') && ((erriter + 1) == err.end())) {
break;
- } else if (*erriter == '\n' || *erriter == '\0') {
+ }
+ if (*erriter == '\n' || *erriter == '\0') {
std::vector<char>::size_type length = erriter - err.begin();
if (length > 1 && *(erriter - 1) == '\r') {
--length;
@@ -2623,29 +2658,28 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
it = dentries.erase(it);
entriesErased++;
continue;
- } else {
- if (cmELF::TagMipsRldMapRel != 0 &&
- it->first == cmELF::TagMipsRldMapRel) {
- // Background: debuggers need to know the "linker map" which contains
- // the addresses each dynamic object is loaded at. Most arches use
- // the DT_DEBUG tag which the dynamic linker writes to (directly) and
- // contain the location of the linker map, however on MIPS the
- // .dynamic section is always read-only so this is not possible. MIPS
- // objects instead contain a DT_MIPS_RLD_MAP tag which contains the
- // address where the dyanmic linker will write to (an indirect
- // version of DT_DEBUG). Since this doesn't work when using PIE, a
- // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this
- // version contains a relative offset, moving it changes the
- // calculated address. This may cause the dyanmic linker to write
- // into memory it should not be changing.
- //
- // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If
- // we move it up by n bytes, we add n bytes to the value of this tag.
- it->second += entriesErased * sizeof_dentry;
- }
-
- it++;
}
+ if (cmELF::TagMipsRldMapRel != 0 &&
+ it->first == cmELF::TagMipsRldMapRel) {
+ // Background: debuggers need to know the "linker map" which contains
+ // the addresses each dynamic object is loaded at. Most arches use
+ // the DT_DEBUG tag which the dynamic linker writes to (directly) and
+ // contain the location of the linker map, however on MIPS the
+ // .dynamic section is always read-only so this is not possible. MIPS
+ // objects instead contain a DT_MIPS_RLD_MAP tag which contains the
+ // address where the dyanmic linker will write to (an indirect
+ // version of DT_DEBUG). Since this doesn't work when using PIE, a
+ // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this
+ // version contains a relative offset, moving it changes the
+ // calculated address. This may cause the dyanmic linker to write
+ // into memory it should not be changing.
+ //
+ // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If
+ // we move it up by n bytes, we add n bytes to the value of this tag.
+ it->second += entriesErased * sizeof_dentry;
+ }
+
+ it++;
}
// Encode new entries list
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index a8a9995..9de7967 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -3,7 +3,7 @@
#ifndef cmSystemTools_h
#define cmSystemTools_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmProcessOutput.h"
#include "cmsys/Process.h"
@@ -253,6 +253,13 @@ public:
static void ParseUnixCommandLine(const char* command,
std::vector<std::string>& args);
+ /**
+ * Handle response file in an argument list and return a new argument list
+ * **/
+ static std::vector<std::string> HandleResponseFile(
+ std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd);
+
static size_t CalculateCommandLineLengthLimit();
static void EnableMessages() { s_DisableMessages = false; }
@@ -379,9 +386,10 @@ public:
original environment. */
class SaveRestoreEnvironment
{
+ CM_DISABLE_COPY(SaveRestoreEnvironment)
public:
SaveRestoreEnvironment();
- virtual ~SaveRestoreEnvironment();
+ ~SaveRestoreEnvironment();
private:
std::vector<std::string> Env;
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 1839923..daa902e 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -30,7 +30,7 @@ public:
operator cmGeneratorTarget const*() const { return this->Target; }
cmGeneratorTarget const* operator->() const { return this->Target; }
cmGeneratorTarget const& operator*() const { return *this->Target; }
- friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
+ friend bool operator<(cmTargetDepend l, cmTargetDepend r)
{
return l.Target < r.Target;
}
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 4164f3a..be4b378 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -35,15 +35,13 @@ void cmTestGenerator::Compute(cmLocalGenerator* lg)
this->LG = lg;
}
-void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
- Indent const& indent)
+void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent)
{
// Create the tests.
this->cmScriptGenerator::GenerateScriptConfigs(os, indent);
}
-void cmTestGenerator::GenerateScriptActions(std::ostream& os,
- Indent const& indent)
+void cmTestGenerator::GenerateScriptActions(std::ostream& os, Indent indent)
{
if (this->ActionsPerConfig) {
// This is the per-config generation in a single-configuration
@@ -59,7 +57,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os,
void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
const std::string& config,
- Indent const& indent)
+ Indent indent)
{
this->TestGenerated = true;
@@ -125,8 +123,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
}
-void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
- Indent const& indent)
+void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
}
@@ -139,8 +136,7 @@ bool cmTestGenerator::NeedsScriptNoConfig() const
!this->ConfigurationTypes->empty()); // config-dependent command
}
-void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
- Indent const& indent)
+void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
{
this->TestGenerated = true;
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 7214375..b227305 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmTestGenerator_h
#define cmTestGenerator_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmScriptGenerator.h"
@@ -20,6 +20,8 @@ class cmTest;
*/
class cmTestGenerator : public cmScriptGenerator
{
+ CM_DISABLE_COPY(cmTestGenerator)
+
public:
cmTestGenerator(cmTest* test,
std::vector<std::string> const& configurations =
@@ -29,16 +31,13 @@ public:
void Compute(cmLocalGenerator* lg);
protected:
- void GenerateScriptConfigs(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
- void GenerateScriptActions(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
+ void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE;
+ void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
- Indent const& indent) CM_OVERRIDE;
- void GenerateScriptNoConfig(std::ostream& os,
- Indent const& indent) CM_OVERRIDE;
+ Indent indent) CM_OVERRIDE;
+ void GenerateScriptNoConfig(std::ostream& os, Indent indent) CM_OVERRIDE;
bool NeedsScriptNoConfig() const CM_OVERRIDE;
- void GenerateOldStyle(std::ostream& os, Indent const& indent);
+ void GenerateOldStyle(std::ostream& os, Indent indent);
cmLocalGenerator* LG;
cmTest* Test;
diff --git a/Source/cmVS10MASMFlagTable.h b/Source/cmVS10MASMFlagTable.h
index 82e5270..0a45245 100644
--- a/Source/cmVS10MASMFlagTable.h
+++ b/Source/cmVS10MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS10MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS11MASMFlagTable.h b/Source/cmVS11MASMFlagTable.h
index 1aca169..fdf8239 100644
--- a/Source/cmVS11MASMFlagTable.h
+++ b/Source/cmVS11MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS11MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS12MASMFlagTable.h b/Source/cmVS12MASMFlagTable.h
index a7e4a80..acc0d48 100644
--- a/Source/cmVS12MASMFlagTable.h
+++ b/Source/cmVS12MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS12MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS14MASMFlagTable.h b/Source/cmVS14MASMFlagTable.h
index c4e5e1e..82ec9f1 100644
--- a/Source/cmVS14MASMFlagTable.h
+++ b/Source/cmVS14MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS14MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d83662e..c81ba7a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -116,6 +116,10 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
i != this->CudaOptions.end(); ++i) {
delete i->second;
}
+ for (OptionsMap::iterator i = this->CudaLinkOptions.begin();
+ i != this->CudaLinkOptions.end(); ++i) {
+ delete i->second;
+ }
if (!this->BuildFileStream) {
return;
}
@@ -213,6 +217,9 @@ void cmVisualStudio10TargetGenerator::Generate()
if (!this->ComputeCudaOptions()) {
return;
}
+ if (!this->ComputeCudaLinkOptions()) {
+ return;
+ }
if (!this->ComputeMasmOptions()) {
return;
}
@@ -1936,9 +1943,24 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
hasFlags = true;
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ cmIDEFlagTable const* flagtable = CM_NULLPTR;
+ const std::string& srclang = source->GetLanguage();
+ if (srclang == "C" || srclang == "CXX") {
+ flagtable = gg->GetClFlagTable();
+ } else if (srclang == "ASM_MASM" &&
+ this->GlobalGenerator->IsMasmEnabled()) {
+ flagtable = gg->GetMasmFlagTable();
+ } else if (lang == "ASM_NASM" &&
+ this->GlobalGenerator->IsNasmEnabled()) {
+ flagtable = gg->GetNasmFlagTable();
+ } else if (srclang == "RC") {
+ flagtable = gg->GetRcFlagTable();
+ } else if (srclang == "CSharp") {
+ flagtable = gg->GetCSharpFlagTable();
+ }
cmVisualStudioGeneratorOptions clOptions(
this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler,
- gg->GetClFlagTable(), 0, this);
+ flagtable, 0, this);
if (compileAs) {
clOptions.AddFlag("CompileAs", compileAs);
}
@@ -2524,6 +2546,70 @@ void cmVisualStudio10TargetGenerator::WriteCudaOptions(
this->WriteString("</CudaCompile>\n", 2);
}
+bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions()
+{
+ if (!this->GlobalGenerator->IsCudaEnabled()) {
+ return true;
+ }
+ for (std::vector<std::string>::const_iterator i =
+ this->Configurations.begin();
+ i != this->Configurations.end(); ++i) {
+ if (!this->ComputeCudaLinkOptions(*i)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
+ std::string const& configName)
+{
+ cmGlobalVisualStudio10Generator* gg =
+ static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ CM_AUTO_PTR<Options> pOptions(new Options(
+ this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable()));
+ Options& cudaLinkOptions = *pOptions;
+
+ // Determine if we need to do a device link
+ bool doDeviceLinking = false;
+ switch (this->GeneratorTarget->GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ doDeviceLinking = true;
+ break;
+ case cmStateEnums::STATIC_LIBRARY:
+ doDeviceLinking = this->GeneratorTarget->GetPropertyAsBool(
+ "CUDA_RESOLVE_DEVICE_SYMBOLS");
+ break;
+ default:
+ break;
+ }
+
+ cudaLinkOptions.AddFlag("PerformDeviceLink",
+ doDeviceLinking ? "true" : "false");
+
+ this->CudaLinkOptions[configName] = pOptions.release();
+ return true;
+}
+
+void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions(
+ std::string const& configName)
+{
+ if (this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
+ return;
+ }
+
+ if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled()) {
+ return;
+ }
+
+ this->WriteString("<CudaLink>\n", 2);
+ Options& cudaLinkOptions = *(this->CudaLinkOptions[configName]);
+ cudaLinkOptions.OutputFlagMap(*this->BuildFileStream, " ");
+ this->WriteString("</CudaLink>\n", 2);
+}
+
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
{
if (!this->GlobalGenerator->IsMasmEnabled()) {
@@ -3283,6 +3369,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
}
// output link flags <Link></Link>
this->WriteLinkOptions(*i);
+ this->WriteCudaLinkOptions(*i);
// output lib flags <Lib></Lib>
this->WriteLibOptions(*i);
// output manifest flags <Manifest></Manifest>
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index bd270bf..6106615 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -101,6 +101,11 @@ private:
bool ComputeCudaOptions(std::string const& config);
void WriteCudaOptions(std::string const& config,
std::vector<std::string> const& includes);
+
+ bool ComputeCudaLinkOptions();
+ bool ComputeCudaLinkOptions(std::string const& config);
+ void WriteCudaLinkOptions(std::string const& config);
+
bool ComputeMasmOptions();
bool ComputeMasmOptions(std::string const& config);
void WriteMasmOptions(std::string const& config,
@@ -154,6 +159,7 @@ private:
OptionsMap ClOptions;
OptionsMap RcOptions;
OptionsMap CudaOptions;
+ OptionsMap CudaLinkOptions;
OptionsMap MasmOptions;
OptionsMap NasmOptions;
OptionsMap LinkOptions;
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 14c82b1..ed76a88 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -3,7 +3,7 @@
#ifndef cmXMLWiter_h
#define cmXMLWiter_h
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include "cmXMLSafe.h"
@@ -14,6 +14,8 @@
class cmXMLWriter
{
+ CM_DISABLE_COPY(cmXMLWriter)
+
public:
cmXMLWriter(std::ostream& output, std::size_t level = 0);
~cmXMLWriter();
@@ -63,9 +65,6 @@ public:
void SetIndentationElement(std::string const& element);
private:
- cmXMLWriter(const cmXMLWriter&);
- cmXMLWriter& operator=(const cmXMLWriter&);
-
void ConditionalLineBreak(bool condition, std::size_t indent);
void PreAttribute();
diff --git a/Source/cm_auto_ptr.hxx b/Source/cm_auto_ptr.hxx
index 2b5c059..773602a 100644
--- a/Source/cm_auto_ptr.hxx
+++ b/Source/cm_auto_ptr.hxx
@@ -100,10 +100,10 @@ public:
/** Assign from an auto_ptr holding a compatible object. This
transfers ownership to the left-hand-side of the assignment. */
template <class Y>
- auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
+ auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw() // NOLINT
{
this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this;
+ return *this; // NOLINT
}
/**
@@ -127,10 +127,10 @@ public:
/** Assign from another auto_ptr holding an object of the same type.
This transfers ownership to the newly constructed auto_ptr. */
- auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw()
+ auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw() // NOLINT
{
this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this;
+ return *this; // NOLINT
}
/** Destruct and delete the object held. */
@@ -192,7 +192,7 @@ public:
auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
{
this->reset(r.p_);
- return *this;
+ return *this; // NOLINT
}
/** Convert to an auto_ptr_ref. This is used when a function
diff --git a/Source/cmake.h b/Source/cmake.h
index 4c292f0..16a2830 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -55,6 +55,8 @@ struct cmDocumentationEntry;
class cmake
{
+ CM_DISABLE_COPY(cmake)
+
public:
enum MessageType
{
@@ -409,7 +411,7 @@ public:
void WatchUnusedCli(const std::string& var);
cmState* GetState() const { return this->State; }
- void SetCurrentSnapshot(cmStateSnapshot snapshot)
+ void SetCurrentSnapshot(cmStateSnapshot const& snapshot)
{
this->CurrentSnapshot = snapshot;
}
@@ -460,8 +462,6 @@ protected:
cmVariableWatch* VariableWatch;
private:
- cmake(const cmake&); // Not implemented.
- void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData;
bool InTryCompile;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 974dd5f..cc954e6 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1450,7 +1450,8 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
if (*arg == "--") {
++arg;
break;
- } else if (*arg == "--manifests") {
+ }
+ if (*arg == "--manifests") {
for (++arg; arg != argEnd && !cmHasLiteralPrefix(*arg, "-"); ++arg) {
this->UserManifests.push_back(*arg);
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 135062d..15d4cf4 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -52,6 +52,18 @@ static const char* cmDocumentationOptions[][2] = {
"expression." },
{ "-LE <regex>, --label-exclude <regex>", "Exclude tests with labels "
"matching regular expression." },
+ { "-FA <regex>, --fixture-exclude-any <regex>", "Do not automatically "
+ "add any tests for "
+ "fixtures matching "
+ "regular expression." },
+ { "-FS <regex>, --fixture-exclude-setup <regex>", "Do not automatically "
+ "add setup tests for "
+ "fixtures matching "
+ "regular expression." },
+ { "-FC <regex>, --fixture-exclude-cleanup <regex>", "Do not automatically "
+ "add cleanup tests for "
+ "fixtures matching "
+ "regular expression." },
{ "-D <dashboard>, --dashboard <dashboard>", "Execute dashboard test" },
{ "-D <var>:<type>=<value>", "Define a variable for script mode" },
{ "-M <model>, --test-model <model>", "Sets the model for a dashboard" },
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index e15b49e..e915b1a 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -797,6 +797,8 @@ ENDFOREACH()
IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE}
${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB})
@@ -943,6 +945,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
ENDIF()
IF(KWSYS_USE_ConsoleBuf)
ADD_EXECUTABLE(testConsoleBufChild testConsoleBufChild.cxx)
+ SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE})
@@ -972,6 +976,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
${KWSYS_CXX_TESTS}
)
ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS})
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE})
@@ -1039,8 +1045,12 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Some Apple compilers produce bad optimizations in this source.
IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$")
SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0)
- ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL")
+ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND
+ NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
+ NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1"))
# Tell IBM XL not to warn about our test infinite loop
+ # v13.1.1 and newer on Linux ppc64le is clang based and does not accept
+ # the -qsuppress option
SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010)
ENDIF()