summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy3
-rw-r--r--Auxiliary/vim/syntax/cmake.vim2
-rw-r--r--CMakeCPack.cmake18
-rw-r--r--CMakeCPackOptions.cmake.in6
-rw-r--r--CMakeLists.txt6
-rw-r--r--Copyright.txt1
-rw-r--r--Help/dev/source.rst14
-rw-r--r--Help/envvar/ASM_DIALECT.rst11
-rw-r--r--Help/envvar/ASM_DIALECTFLAGS.rst11
-rw-r--r--Help/envvar/CC.rst9
-rw-r--r--Help/envvar/CFLAGS.rst9
-rw-r--r--Help/envvar/CMAKE_CONFIG_TYPE.rst5
-rw-r--r--Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst8
-rw-r--r--Help/envvar/CMAKE_OSX_ARCHITECTURES.rst8
-rw-r--r--Help/envvar/CSFLAGS.rst9
-rw-r--r--Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst5
-rw-r--r--Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst7
-rw-r--r--Help/envvar/CTEST_PARALLEL_LEVEL.rst5
-rw-r--r--Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst4
-rw-r--r--Help/envvar/CUDACXX.rst9
-rw-r--r--Help/envvar/CUDAFLAGS.rst9
-rw-r--r--Help/envvar/CUDAHOSTCXX.rst9
-rw-r--r--Help/envvar/CXX.rst9
-rw-r--r--Help/envvar/CXXFLAGS.rst9
-rw-r--r--Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst5
-rw-r--r--Help/envvar/FC.rst10
-rw-r--r--Help/envvar/FFLAGS.rst9
-rw-r--r--Help/envvar/LDFLAGS.rst10
-rw-r--r--Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst8
-rw-r--r--Help/envvar/RC.rst9
-rw-r--r--Help/envvar/RCFLAGS.rst9
-rw-r--r--Help/index.rst1
-rw-r--r--Help/manual/cmake-env-variables.7.rst54
-rw-r--r--Help/manual/cmake-modules.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst3
-rw-r--r--Help/manual/cmake-qt.7.rst19
-rw-r--r--Help/manual/cmake-variables.7.rst3
-rw-r--r--Help/manual/cmake.1.rst2
-rw-r--r--Help/module/FindOpenACC.rst1
-rw-r--r--Help/policy/CMP0071.rst32
-rw-r--r--Help/prop_sf/SKIP_AUTOGEN.rst13
-rw-r--r--Help/prop_sf/SKIP_AUTOMOC.rst11
-rw-r--r--Help/prop_sf/SKIP_AUTORCC.rst11
-rw-r--r--Help/prop_sf/SKIP_AUTOUIC.rst11
-rw-r--r--Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst5
-rw-r--r--Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst5
-rw-r--r--Help/prop_tgt/AUTOMOC.rst27
-rw-r--r--Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst24
-rw-r--r--Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst21
-rw-r--r--Help/prop_tgt/AUTOUIC.rst4
-rw-r--r--Help/prop_tgt/CUDA_STANDARD.rst2
-rw-r--r--Help/release/dev/FindOpenACC.rst5
-rw-r--r--Help/release/dev/FindOpenGL-glvnd.rst4
-rw-r--r--Help/release/dev/add-vs-shader-properties.rst6
-rw-r--r--Help/release/dev/autogen-macro-names.rst18
-rw-r--r--Help/release/dev/autogen-predefs.rst11
-rw-r--r--Help/release/dev/cpack-rpm-deb-version.rst14
-rw-r--r--Help/release/dev/cpackifw-options.rst6
-rw-r--r--Help/release/dev/graphviz-line-styles.rst6
-rw-r--r--Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst8
-rw-r--r--Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst9
-rw-r--r--Help/variable/CMAKE_CUDA_HOST_COMPILER.rst7
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst8
-rw-r--r--Help/variable/MSVC_VERSION.rst22
-rw-r--r--Modules/AutogenInfo.cmake.in4
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake9
-rw-r--r--Modules/CMakeGenericSystem.cmake2
-rw-r--r--Modules/CMakeGraphVizOptions.cmake3
-rw-r--r--Modules/CPackDeb.cmake52
-rw-r--r--Modules/CPackIFW.cmake34
-rw-r--r--Modules/CPackRPM.cmake25
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake2
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in1
-rw-r--r--Modules/ExternalProject.cmake16
-rw-r--r--Modules/FindBoost.cmake5
-rw-r--r--Modules/FindMatlab.cmake4
-rw-r--r--Modules/FindOpenACC.cmake252
-rw-r--r--Modules/FindOpenGL.cmake319
-rw-r--r--Modules/FindOpenMP.cmake1
-rw-r--r--Modules/GetPrerequisites.cmake1
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx37
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h6
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx2
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx7
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx48
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx50
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx4
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx54
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx5
-rw-r--r--Source/CTest/cmCTestGIT.cxx1
-rw-r--r--Source/CTest/cmCTestLaunch.cxx8
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx2
-rw-r--r--Source/CTest/cmCTestP4.cxx1
-rw-r--r--Source/CTest/cmCTestRunTest.cxx4
-rw-r--r--Source/CTest/cmCTestSVN.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx10
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx14
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx19
-rw-r--r--Source/CTest/cmCTestVC.cxx1
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.cxx4
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx3
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx2
-rw-r--r--Source/Checks/cm_cxx_auto_ptr.cxx18
-rw-r--r--Source/Checks/cm_cxx_eq_delete.cxx14
-rw-r--r--Source/Checks/cm_cxx_features.cmake2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx49
-rw-r--r--Source/cmAlgorithms.h3
-rw-r--r--Source/cmCPluginAPI.cxx35
-rw-r--r--Source/cmCTest.cxx23
-rw-r--r--Source/cmCommonTargetGenerator.cxx1
-rw-r--r--Source/cmConfigure.cmake.h.in13
-rw-r--r--Source/cmCryptoHash.cxx27
-rw-r--r--Source/cmCryptoHash.h5
-rw-r--r--Source/cmCustomCommandGenerator.cxx7
-rw-r--r--Source/cmDependsJavaParserHelper.cxx2
-rw-r--r--Source/cmELF.cxx13
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExportFileGenerator.cxx15
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx14
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx4
-rw-r--r--Source/cmFileCommand.cxx28
-rw-r--r--Source/cmFilePathChecksum.cxx51
-rw-r--r--Source/cmFilePathChecksum.h25
-rw-r--r--Source/cmFileTimeComparison.cxx24
-rw-r--r--Source/cmFindLibraryCommand.cxx6
-rw-r--r--Source/cmFindPackageCommand.cxx37
-rw-r--r--Source/cmFindProgramCommand.cxx4
-rw-r--r--Source/cmForEachCommand.cxx9
-rw-r--r--Source/cmGeneratorExpression.cxx8
-rw-r--r--Source/cmGeneratorExpression.h7
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx14
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h12
-rw-r--r--Source/cmGeneratorExpressionNode.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx47
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx20
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx11
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx403
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmGraphVizWriter.cxx117
-rw-r--r--Source/cmIfCommand.cxx6
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx5
-rw-r--r--Source/cmInstallFilesGenerator.cxx5
-rw-r--r--Source/cmInstalledFile.cxx4
-rw-r--r--Source/cmInstalledFile.h4
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx4
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx11
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx7
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx15
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudioGenerator.h8
-rw-r--r--Source/cmLocalXCodeGenerator.cxx18
-rw-r--r--Source/cmLocalXCodeGenerator.h16
-rw-r--r--Source/cmMachO.cxx9
-rw-r--r--Source/cmMakefile.cxx25
-rw-r--r--Source/cmMakefile.h14
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx10
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx2
-rw-r--r--Source/cmPolicies.cxx2
-rw-r--r--Source/cmQtAutoGen.cxx122
-rw-r--r--Source/cmQtAutoGen.h37
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx436
-rw-r--r--Source/cmQtAutoGeneratorInitializer.h2
-rw-r--r--Source/cmQtAutoGenerators.cxx2314
-rw-r--r--Source/cmQtAutoGenerators.h256
-rw-r--r--Source/cmServer.cxx2
-rw-r--r--Source/cmServerProtocol.cxx3
-rw-r--r--Source/cmSourceFileLocation.cxx15
-rw-r--r--Source/cmSourceFileLocation.h5
-rw-r--r--Source/cmStateDirectory.cxx1
-rw-r--r--Source/cmStringCommand.cxx6
-rw-r--r--Source/cmSystemTools.cxx35
-rw-r--r--Source/cmTarget.cxx7
-rw-r--r--Source/cmVariableWatch.cxx35
-rw-r--r--Source/cmVariableWatch.h3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx88
-rw-r--r--Source/cmWhileCommand.cxx6
-rw-r--r--Source/cmXCode21Object.cxx8
-rw-r--r--Source/cmXCode21Object.h2
-rw-r--r--Source/cmXCodeObject.cxx15
-rw-r--r--Source/cmXCodeObject.h8
-rw-r--r--Source/cmXCodeScheme.cxx18
-rw-r--r--Source/cmXCodeScheme.h10
-rw-r--r--Source/cm_auto_ptr.hxx220
-rw-r--r--Source/cmake.cxx56
-rw-r--r--Source/cmake.h12
-rw-r--r--Source/cmcmd.cxx101
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/CMakeLists.txt1
-rw-r--r--Source/kwsys/SystemTools.cxx98
-rw-r--r--Source/kwsys/SystemTools.hxx.in7
-rw-r--r--Source/kwsys/testIOS.cxx139
-rw-r--r--Source/kwsys/testSystemTools.cxx6
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake2
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake2
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt6
-rw-r--r--Tests/FindOpenGL/CMakeLists.txt7
-rw-r--r--Tests/FindOpenGL/Test/CMakeLists.txt58
-rw-r--r--Tests/QtAutogen/CMakeLists.txt19
-rw-r--r--Tests/QtAutogen/mocMacroName/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/mocMacroName/CustomMacros.hpp8
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.cpp6
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.hpp15
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroAlias.hpp7
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroName.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroName.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.hpp19
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/main.cpp10
-rw-r--r--Tests/QtAutogen/sameName/CMakeLists.txt5
-rw-r--r--Tests/QtAutogen/sameName/aaa/bbb/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.cpp14
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/aaa/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/bbb/aaa/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.hpp1
-rw-r--r--Tests/QtAutogen/sameName/bbb/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.cpp20
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/ccc/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/view.ui24
-rw-r--r--Tests/QtAutogenRerun/CMakeLists.txt199
-rw-r--r--Tests/QtAutogenRerun/mocPlugin.cmake96
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA.hpp4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleB.hpp4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleC.hpp2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleD.hpp2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.cpp3
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp (renamed from Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp)4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json1
-rw-r--r--Tests/QtAutogenRerun/mocRerun.cmake60
-rw-r--r--Tests/QtAutogenRerun/mocRerun/CMakeLists.txt10
-rw-r--r--Tests/QtAutogenRerun/rccDepends.cmake131
-rw-r--r--Tests/QtAutogenRerun/rccDepends/CMakeLists.txt44
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input1.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input2.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1b.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2b.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in6
-rw-r--r--Tests/RunCMake/CMakeLists.txt46
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/RPM/Helpers.cmake3
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake4
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake17
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/test.cmake14
-rw-r--r--Tests/RunCMake/FindBoost/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage-stdout.txt3
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage.cmake2
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake0
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake7
-rw-r--r--Tests/RunCMake/FindBoost/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing.cmake4
-rw-r--r--Tests/RunCMake/get_property/source_properties-stderr.txt8
-rw-r--r--Tests/RunCMake/get_property/source_properties.cmake10
-rw-r--r--Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake17
-rw-r--r--Tests/RunCMake/variable_watch/RunCMakeTest.cmake1
-rw-r--r--Tests/VSResource/CMakeLists.txt7
-rw-r--r--Tests/VSWinStorePhone/CMakeLists.txt6
-rw-r--r--Utilities/IWYU/mapping.imp6
-rwxr-xr-xbootstrap1
306 files changed, 4965 insertions, 3369 deletions
diff --git a/.clang-tidy b/.clang-tidy
index e8d39ce..8d79b0c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -10,12 +10,13 @@ modernize-*,\
-modernize-deprecated-headers,\
-modernize-pass-by-value,\
-modernize-raw-string-literal,\
--modernize-replace-auto-ptr,\
+-modernize-return-braced-init-list,\
-modernize-use-auto,\
-modernize-use-default-member-init,\
-modernize-use-emplace,\
-modernize-use-equals-default,\
-modernize-use-equals-delete,\
+-modernize-use-noexcept,\
-modernize-use-transparent-functors,\
-modernize-use-using,\
performance-*,\
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index f6a73c3..5f9af05 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -38,7 +38,7 @@ syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeCommand,cmakeCo
syn case match
syn keyword cmakeProperty contained
- \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST
+ \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_SHADER_OUTPUT_HEADER_FILE VS_SHADER_VARIABLE_NAME VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST
syn keyword cmakeVariable contained
\ ANDROID APPLE BORLAND BUILD_SHARED_LIBS CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ARCH_ABI CMAKE_ANDROID_ARM_MODE CMAKE_ANDROID_ARM_NEON CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_DEPRECATED_HEADERS CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STANDALONE_TOOLCHAIN CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_DEPEND_FILTERS CMAKE_AUTOMOC_MACRO_NAMES CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_AUTOUIC_SEARCH_PATHS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_RPATH CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_NAME_DIR CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_CODELITE_USE_TARGETS CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNUCC CMAKE_COMPILER_IS_GNUCXX CMAKE_COMPILER_IS_GNUG77 CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CUDA_EXTENSIONS CMAKE_CUDA_STANDARD CMAKE_CUDA_STANDARD_REQUIRED CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DEPENDS_IN_PROJECT_ONLY CMAKE_DIRECTORY_LABELS CMAKE_DL_LIBS CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT CMAKE_ECLIPSE_MAKE_ARGUMENTS CMAKE_ECLIPSE_VERSION CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_INIT CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_SORT_DIRECTION CMAKE_FIND_PACKAGE_SORT_ORDER CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SOLARIS CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_LINK_WHAT_YOU_USE CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_INIT CMAKE_MODULE_PATH CMAKE_MSVCIDE_RUN_PATH CMAKE_NINJA_OUTPUT_PATH_PREFIX CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_DESCRIPTION CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_INIT CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_INIT CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE CMAKE_SYSROOT CMAKE_SYSROOT_COMPILE CMAKE_SYSROOT_LINK CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_Swift_LANGUAGE_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_TRY_COMPILE_TARGET_TYPE CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_CUDA CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_GENERATE_SCHEME CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_INIT_SUBMODULES CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_LABELS_FOR_SUBPROJECTS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_DESCRIPTION PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE XCODE_VERSION
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index a0aacb4..dc9f0ba 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -245,5 +245,23 @@ configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
+set(CPACK_SOURCE_IGNORE_FILES
+ # Files specific to version control.
+ "/\\\\.git/"
+ "/\\\\.gitattributes$"
+ "/\\\\.github/"
+ "/\\\\.gitignore$"
+ "/\\\\.hooks-config$"
+
+ # Cygwin package build.
+ "/\\\\.build/"
+
+ # Temporary files.
+ "\\\\.swp$"
+ "\\\\.#"
+ "/#"
+ "~$"
+ )
+
# include CPack model once all variables are set
include(CPack)
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index ad0c245..a08c97d 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -208,12 +208,6 @@ if(CPACK_GENERATOR MATCHES "IFW")
endif()
-if(CPACK_GENERATOR MATCHES "CygwinSource")
- # when packaging source make sure the .build directory is not included
- set(CPACK_SOURCE_IGNORE_FILES
- "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$")
-endif()
-
if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
if(CMAKE_PACKAGE_QTGUI)
set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c578ec3..f14f62f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,6 +250,12 @@ if(CMake_RUN_CLANG_TIDY)
message(FATAL_ERROR "CMake_RUN_CLANG_TIDY is ON but clang-tidy is not found!")
endif()
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
+
+ # provide definitions for targets that require a rebuild once .clang-tidy changes
+ file(SHA1 ${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy clang_tidy_sha1)
+ set(CLANG_TIDY_DEFINITIONS "CLANG_TIDY_SHA1=${clang_tidy_sha1}")
+ unset(clang_tidy_sha1)
+
endif()
configure_file(.clang-tidy .clang-tidy COPYONLY)
diff --git a/Copyright.txt b/Copyright.txt
index 978be0a..3c92a81 100644
--- a/Copyright.txt
+++ b/Copyright.txt
@@ -76,6 +76,7 @@ The following individuals and institutions are among the Contributors:
* Nicolas Bock <nicolasbock@gmail.com>
* Nicolas Despres <nicolas.despres@gmail.com>
* Nikita Krupen'ko <krnekit@gmail.com>
+* NVIDIA Corporation <www.nvidia.com>
* OpenGamma Ltd. <opengamma.com>
* Per Øyvind Karlsen <peroyvind@mandriva.org>
* Peter Collingbourne <peter@pcc.me.uk>
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index b40a884..d0c19eb 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -26,19 +26,9 @@ C++ Subset Permitted
CMake requires compiling as C++11 or above. However, in order to support
building on older toolchains some constructs need to be handled with care:
-* Do not use ``CM_AUTO_PTR`` or ``std::auto_ptr``.
+* Do not use ``std::auto_ptr``.
- The ``std::auto_ptr`` template is deprecated in C++11. The ``CM_AUTO_PTR``
- macro remains leftover from C++98 support until its uses can be ported to
- ``std::unique_ptr``. Do not add new uses of the macro.
-
-* Use ``CM_EQ_DELETE;`` instead of ``= delete;``.
-
- Older C++11 compilers do not support deleting functions. Using
- ``CM_EQ_DELETE`` will delete the functions if the compiler supports it and
- give them no implementation otherwise. Calling such a function will lead
- to compiler errors if the compiler supports *deleted* functions and linker
- errors otherwise.
+ The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable.
diff --git a/Help/envvar/ASM_DIALECT.rst b/Help/envvar/ASM_DIALECT.rst
new file mode 100644
index 0000000..ec48f71
--- /dev/null
+++ b/Help/envvar/ASM_DIALECT.rst
@@ -0,0 +1,11 @@
+ASM<DIALECT>
+------------
+
+Preferred executable for compiling a specific dialect of assembly language
+files. ``ASM<DIALECT>`` can be ``ASM``, ``ASM_NASM``, ``ASM_MASM`` or
+``ASM-ATT``. Will only be used by CMake on the first configuration to determine
+``ASM<DIALECT>`` compiler, after which the value for ``ASM<DIALECT>`` is stored
+in the cache as
+:variable:`CMAKE_ASM<DIALECT>_COMPILER <CMAKE_<LANG>_COMPILER>`. For subsequent
+configuration runs, the environment variable will be ignored in favor of
+:variable:`CMAKE_ASM<DIALECT>_COMPILER <CMAKE_<LANG>_COMPILER>`.
diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst
new file mode 100644
index 0000000..4ed02fe
--- /dev/null
+++ b/Help/envvar/ASM_DIALECTFLAGS.rst
@@ -0,0 +1,11 @@
+ASM<DIALECT>FLAGS
+-----------------
+
+Default compilation flags to be used when compiling a specific dialect of an
+assembly language. ``ASM<DIALECT>FLAGS`` can be ``ASMFLAGS``, ``ASM_NASMFLAGS``,
+``ASM_MASMFLAGS`` or ``ASM-ATTFLAGS``. Will only be used by CMake on the
+first configuration to determine ``ASM<DIALECT>`` default compilation flags, after
+which the value for ``ASM<DIALECT>FLAGS`` is stored in the cache as
+:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/CC.rst b/Help/envvar/CC.rst
new file mode 100644
index 0000000..7e68110
--- /dev/null
+++ b/Help/envvar/CC.rst
@@ -0,0 +1,9 @@
+CC
+--
+
+Preferred executable for compiling ``C`` language files. Will only be used by
+CMake on the first configuration to determine ``C`` compiler, after which the
+value for ``CC`` is stored in the cache as
+:variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration run
+(including the first), the environment variable will be ignored if the
+:variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/CFLAGS.rst b/Help/envvar/CFLAGS.rst
new file mode 100644
index 0000000..60b2cd3
--- /dev/null
+++ b/Help/envvar/CFLAGS.rst
@@ -0,0 +1,9 @@
+CFLAGS
+------
+
+Default compilation flags to be used when compiling ``C`` files. Will only be
+used by CMake on the first configuration to determine ``CC`` default compilation
+flags, after which the value for ``CFLAGS`` is stored in the cache
+as :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run
+(including the first), the environment variable will be ignored if the
+:variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/CMAKE_CONFIG_TYPE.rst b/Help/envvar/CMAKE_CONFIG_TYPE.rst
new file mode 100644
index 0000000..1306b47
--- /dev/null
+++ b/Help/envvar/CMAKE_CONFIG_TYPE.rst
@@ -0,0 +1,5 @@
+CMAKE_CONFIG_TYPE
+-----------------
+
+The default build configuration for :ref:`Build Tool Mode` and
+``ctest`` build handler when there is no explicit configuration given.
diff --git a/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst b/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst
new file mode 100644
index 0000000..54d5f9e
--- /dev/null
+++ b/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst
@@ -0,0 +1,8 @@
+CMAKE_MSVCIDE_RUN_PATH
+----------------------
+
+Extra PATH locations for custom commands when using
+:generator:`Visual Studio 9 2008` (or above) generators.
+
+The ``CMAKE_MSVCIDE_RUN_PATH`` environment variable sets the default value for
+the :variable:`CMAKE_MSVCIDE_RUN_PATH` variable if not already explicitly set.
diff --git a/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst b/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst
new file mode 100644
index 0000000..8bbf993
--- /dev/null
+++ b/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst
@@ -0,0 +1,8 @@
+CMAKE_OSX_ARCHITECTURES
+-----------------------
+
+Target specific architectures for OS X.
+
+The ``CMAKE_OSX_ARCHITECTURES`` environment variable sets the default value for
+the :variable:`CMAKE_OSX_ARCHITECTURES` variable. See
+:prop_tgt:`OSX_ARCHITECTURES` for more information.
diff --git a/Help/envvar/CSFLAGS.rst b/Help/envvar/CSFLAGS.rst
new file mode 100644
index 0000000..251ddc5
--- /dev/null
+++ b/Help/envvar/CSFLAGS.rst
@@ -0,0 +1,9 @@
+CSFLAGS
+-------
+
+Preferred executable for compiling ``CSharp`` language files. Will only be
+used by CMake on the first configuration to determine ``CSharp`` default
+compilation flags, after which the value for ``CSFLAGS`` is stored in the cache
+as :variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst
new file mode 100644
index 0000000..25ed14f
--- /dev/null
+++ b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst
@@ -0,0 +1,5 @@
+CTEST_INTERACTIVE_DEBUG_MODE
+----------------------------
+
+Environment variable that will exist and be set to ``1`` when a test executed
+by CTest is run in interactive mode.
diff --git a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst
new file mode 100644
index 0000000..1fcf42b
--- /dev/null
+++ b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst
@@ -0,0 +1,7 @@
+CTEST_OUTPUT_ON_FAILURE
+-----------------------
+
+Boolean environment variable that controls if the output should be logged for
+failed tests. Set the value to 1, True, or ON to enable output on failure.
+See :manual:`ctest(1)` for more information on controlling output of failed
+tests.
diff --git a/Help/envvar/CTEST_PARALLEL_LEVEL.rst b/Help/envvar/CTEST_PARALLEL_LEVEL.rst
new file mode 100644
index 0000000..c767a01
--- /dev/null
+++ b/Help/envvar/CTEST_PARALLEL_LEVEL.rst
@@ -0,0 +1,5 @@
+CTEST_PARALLEL_LEVEL
+--------------------
+
+Specify the number of tests for CTest to run in parallel. See :manual:`ctest(1)`
+for more information on parallel test execution.
diff --git a/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst b/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst
new file mode 100644
index 0000000..8d8eea5
--- /dev/null
+++ b/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst
@@ -0,0 +1,4 @@
+CTEST_USE_LAUNCHERS_DEFAULT
+---------------------------
+
+Initializes the :variable:`CTEST_USE_LAUNCHERS` variable if not already defined.
diff --git a/Help/envvar/CUDACXX.rst b/Help/envvar/CUDACXX.rst
new file mode 100644
index 0000000..8a5fd4b
--- /dev/null
+++ b/Help/envvar/CUDACXX.rst
@@ -0,0 +1,9 @@
+CUDACXX
+-------
+
+Preferred executable for compiling ``CUDA`` language files. Will only be used by
+CMake on the first configuration to determine ``CUDA`` compiler, after which the
+value for ``CUDA`` is stored in the cache as
+:variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/CUDAFLAGS.rst b/Help/envvar/CUDAFLAGS.rst
new file mode 100644
index 0000000..3dff49f
--- /dev/null
+++ b/Help/envvar/CUDAFLAGS.rst
@@ -0,0 +1,9 @@
+CUDAFLAGS
+---------
+
+Default compilation flags to be used when compiling ``CUDA`` files. Will only be
+used by CMake on the first configuration to determine ``CUDA`` default
+compilation flags, after which the value for ``CUDAFLAGS`` is stored in the
+cache as :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if
+the :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/CUDAHOSTCXX.rst b/Help/envvar/CUDAHOSTCXX.rst
new file mode 100644
index 0000000..f0f94f6
--- /dev/null
+++ b/Help/envvar/CUDAHOSTCXX.rst
@@ -0,0 +1,9 @@
+CUDAHOSTCXX
+-----------
+
+Preferred executable for compiling host code when compiling ``CUDA``
+language files. Will only be used by CMake on the first configuration to
+determine ``CUDA`` host compiler, after which the value for ``CUDAHOSTCXX`` is
+stored in the cache as :variable:`CMAKE_CUDA_HOST_COMPILER`. For any
+configuration run (including the first), the environment variable will be
+ignored if the :variable:`CMAKE_CUDA_HOST_COMPILER` variable is defined.
diff --git a/Help/envvar/CXX.rst b/Help/envvar/CXX.rst
new file mode 100644
index 0000000..3b1e445
--- /dev/null
+++ b/Help/envvar/CXX.rst
@@ -0,0 +1,9 @@
+CXX
+---
+
+Preferred executable for compiling ``CXX`` language files. Will only be used by
+CMake on the first configuration to determine ``CXX`` compiler, after which the
+value for ``CXX`` is stored in the cache as
+:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/CXXFLAGS.rst b/Help/envvar/CXXFLAGS.rst
new file mode 100644
index 0000000..8b58abd
--- /dev/null
+++ b/Help/envvar/CXXFLAGS.rst
@@ -0,0 +1,9 @@
+CXXFLAGS
+--------
+
+Default compilation flags to be used when compiling ``CXX`` (C++) files. Will
+only be used by CMake on the first configuration to determine ``CXX`` default
+compilation flags, after which the value for ``CXXFLAGS`` is stored in the cache
+as :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run (
+including the first), the environment variable will be ignored if
+the :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst
new file mode 100644
index 0000000..fab1c0c
--- /dev/null
+++ b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst
@@ -0,0 +1,5 @@
+DASHBOARD_TEST_FROM_CTEST
+-------------------------
+
+Environment variable that will exist when a test executed by CTest is run
+in non-interactive mode. The value will be equal to :variable:`CMAKE_VERSION`.
diff --git a/Help/envvar/FC.rst b/Help/envvar/FC.rst
new file mode 100644
index 0000000..7d293fd
--- /dev/null
+++ b/Help/envvar/FC.rst
@@ -0,0 +1,10 @@
+FC
+--
+
+Preferred executable for compiling ``Fortran`` language files. Will only be used
+by CMake on the first configuration to determine ``Fortran`` compiler, after
+which the value for ``Fortran`` is stored in the cache as
+:variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>`. For any
+configuration run (including the first), the environment variable will be
+ignored if the :variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>`
+variable is defined.
diff --git a/Help/envvar/FFLAGS.rst b/Help/envvar/FFLAGS.rst
new file mode 100644
index 0000000..19d6169
--- /dev/null
+++ b/Help/envvar/FFLAGS.rst
@@ -0,0 +1,9 @@
+FFLAGS
+------
+
+Default compilation flags to be used when compiling ``Fortran`` files. Will only
+be used by CMake on the first configuration to determine ``Fortran`` default
+compilation flags, after which the value for ``FFLAGS`` is stored in the cache
+as :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if
+the :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/envvar/LDFLAGS.rst b/Help/envvar/LDFLAGS.rst
new file mode 100644
index 0000000..52da99c
--- /dev/null
+++ b/Help/envvar/LDFLAGS.rst
@@ -0,0 +1,10 @@
+LDFLAGS
+-------
+
+Will only be used by CMake on the first configuration to determine the default
+linker flags, after which the value for ``LDFLAGS`` is stored in the cache
+as :variable:`CMAKE_EXE_LINKER_FLAGS_INIT`,
+:variable:`CMAKE_SHARED_LINKER_FLAGS_INIT`, and
+:variable:`CMAKE_MODULE_LINKER_FLAGS_INIT`. For any configuration run
+(including the first), the environment variable will be ignored if the
+equivalent ``CMAKE_<TYPE>_LINKER_FLAGS_INIT`` variable is defined.
diff --git a/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst b/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst
new file mode 100644
index 0000000..e6051b4
--- /dev/null
+++ b/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst
@@ -0,0 +1,8 @@
+MACOSX_DEPLOYMENT_TARGET
+------------------------
+
+Specify the minimum version of OS X on which the target binaries are
+to be deployed.
+
+The ``MACOSX_DEPLOYMENT_TARGET`` environment variable sets the default value for
+the :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` variable.
diff --git a/Help/envvar/RC.rst b/Help/envvar/RC.rst
new file mode 100644
index 0000000..6c2db19
--- /dev/null
+++ b/Help/envvar/RC.rst
@@ -0,0 +1,9 @@
+RC
+--
+
+Preferred executable for compiling ``resource`` files. Will only be used by CMake
+on the first configuration to determine ``resource`` compiler, after which the
+value for ``RC`` is stored in the cache as
+:variable:`CMAKE_RC_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration run
+(including the first), the environment variable will be ignored if the
+:variable:`CMAKE_RC_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/RCFLAGS.rst b/Help/envvar/RCFLAGS.rst
new file mode 100644
index 0000000..4f2f31c
--- /dev/null
+++ b/Help/envvar/RCFLAGS.rst
@@ -0,0 +1,9 @@
+RCFLAGS
+-------
+
+Default compilation flags to be used when compiling ``resource`` files. Will
+only be used by CMake on the first configuration to determine ``resource``
+default compilation flags, after which the value for ``RCFLAGS`` is stored in
+the cache as :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>`. For any
+configuration run (including the first), the environment variable will be ignored
+if the :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
diff --git a/Help/index.rst b/Help/index.rst
index 97cd107..3dccdda 100644
--- a/Help/index.rst
+++ b/Help/index.rst
@@ -40,6 +40,7 @@ Reference Manuals
/manual/cmake-qt.7
/manual/cmake-toolchains.7
/manual/cmake-variables.7
+ /manual/cmake-env-variables.7
.. only:: html or text
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
new file mode 100644
index 0000000..fed129e
--- /dev/null
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -0,0 +1,54 @@
+.. cmake-manual-description: CMake Environment Variables Reference
+
+cmake-env-variables(7)
+**********************
+
+.. only:: html
+
+ .. contents::
+
+Environment Variables that Control the Build
+============================================
+
+.. toctree::
+ :maxdepth: 1
+
+ /envvar/CMAKE_CONFIG_TYPE
+ /envvar/CMAKE_MSVCIDE_RUN_PATH
+ /envvar/CMAKE_OSX_ARCHITECTURES
+ /envvar/LDFLAGS
+ /envvar/MACOSX_DEPLOYMENT_TARGET
+
+Environment Variables for Languages
+===================================
+
+.. toctree::
+ :maxdepth: 1
+
+ /envvar/ASM_DIALECT
+ /envvar/ASM_DIALECTFLAGS
+ /envvar/CC
+ /envvar/CFLAGS
+ /envvar/CSFLAGS
+ /envvar/CUDACXX
+ /envvar/CUDAFLAGS
+ /envvar/CUDAHOSTCXX
+ /envvar/CXX
+ /envvar/CXXFLAGS
+ /envvar/FC
+ /envvar/FFLAGS
+ /envvar/RC
+ /envvar/RCFLAGS
+
+Environment Variables for CTest
+===============================
+
+.. toctree::
+ :maxdepth: 1
+
+ /envvar/CMAKE_CONFIG_TYPE
+ /envvar/CTEST_INTERACTIVE_DEBUG_MODE
+ /envvar/CTEST_OUTPUT_ON_FAILURE
+ /envvar/CTEST_PARALLEL_LEVEL
+ /envvar/CTEST_USE_LAUNCHERS_DEFAULT
+ /envvar/DASHBOARD_TEST_FROM_CTEST
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index fdc3597..8f4b252 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -153,6 +153,7 @@ All Modules
/module/FindMPEG2
/module/FindMPEG
/module/FindMPI
+ /module/FindOpenACC
/module/FindOpenAL
/module/FindOpenCL
/module/FindOpenGL
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index eadd00d..dd59a00 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -122,6 +122,7 @@ Properties on Targets
/prop_tgt/ARCHIVE_OUTPUT_NAME
/prop_tgt/AUTOGEN_BUILD_DIR
/prop_tgt/AUTOGEN_TARGET_DEPENDS
+ /prop_tgt/AUTOMOC_COMPILER_PREDEFINES
/prop_tgt/AUTOMOC_DEPEND_FILTERS
/prop_tgt/AUTOMOC_MACRO_NAMES
/prop_tgt/AUTOMOC_MOC_OPTIONS
@@ -392,7 +393,9 @@ Properties on Source Files
/prop_sf/VS_SHADER_ENTRYPOINT
/prop_sf/VS_SHADER_FLAGS
/prop_sf/VS_SHADER_MODEL
+ /prop_sf/VS_SHADER_OUTPUT_HEADER_FILE
/prop_sf/VS_SHADER_TYPE
+ /prop_sf/VS_SHADER_VARIABLE_NAME
/prop_sf/VS_TOOL_OVERRIDE.rst
/prop_sf/VS_XAML_TYPE
/prop_sf/WRAP_EXCLUDE
diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst
index 7052e0a..cafeae1 100644
--- a/Help/manual/cmake-qt.7.rst
+++ b/Help/manual/cmake-qt.7.rst
@@ -59,9 +59,10 @@ The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)`
inspects the C++ files in the target to determine if they require ``moc`` to
be run, and to create rules to execute ``moc`` at the appropriate time.
-If a ``Q_OBJECT`` or ``Q_GADGET`` macro is found in a header file, ``moc``
-will be run on the file. The result will be put into a file named according
-to ``moc_<basename>.cpp``. If the macro is found in a C++ implementation
+If a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is found in a header file,
+``moc`` will be run on the file. The result will be put into a file named
+according to ``moc_<basename>.cpp``.
+If the macro is found in a C++ implementation
file, the moc output will be put into a file named according to
``<basename>.moc``, following the Qt conventions. The ``<basename>.moc`` must
be included by the user in the C++ implementation file with a preprocessor
@@ -73,8 +74,8 @@ automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
* This differs from CMake 3.7 and below; see their documentation for details.
-* For multi configuration generators, the include directory is
- ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+* For :prop_gbl:`multi configuration generators <GENERATOR_IS_MULTI_CONFIG>`,
+ the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
@@ -95,9 +96,7 @@ following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The
options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS`
variable may be populated to pre-set the options for all following targets.
-The appearance of the strings ``Q_OBJECT`` or ``Q_GADGET`` in a source file
-determines if it needs to be ``moc`` processed. To search for additional
-strings, list them in :prop_tgt:`AUTOMOC_MACRO_NAMES`.
+Additional macro names to search for can be added to :prop_tgt:`AUTOMOC_MACRO_NAMES`.
Additional ``moc`` dependency file names can be extracted from source code
by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`.
@@ -133,8 +132,8 @@ automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
* This differs from CMake 3.7 and below; see their documentation for details.
-* For multi configuration generators, the include directory is
- ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+* For :prop_gbl:`multi configuration generators <GENERATOR_IS_MULTI_CONFIG>`,
+ the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 1b4873d..66d3049 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -270,6 +270,7 @@ Variables that Control the Build
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_AUTOMOC
+ /variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES
/variable/CMAKE_AUTOMOC_DEPEND_FILTERS
/variable/CMAKE_AUTOMOC_MACRO_NAMES
/variable/CMAKE_AUTOMOC_MOC_OPTIONS
@@ -367,6 +368,7 @@ Variables for Languages
/variable/CMAKE_COMPILER_IS_GNUCC
/variable/CMAKE_COMPILER_IS_GNUCXX
/variable/CMAKE_COMPILER_IS_GNUG77
+ /variable/CMAKE_CUDA_HOST_COMPILER
/variable/CMAKE_CUDA_EXTENSIONS
/variable/CMAKE_CUDA_STANDARD
/variable/CMAKE_CUDA_STANDARD_REQUIRED
@@ -397,6 +399,7 @@ Variables for Languages
/variable/CMAKE_LANG_COMPILER_LOADED
/variable/CMAKE_LANG_COMPILER_TARGET
/variable/CMAKE_LANG_COMPILER_VERSION
+ /variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND
/variable/CMAKE_LANG_COMPILE_OBJECT
/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY
/variable/CMAKE_LANG_CREATE_SHARED_MODULE
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 6eef6c6..6a21683 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -138,6 +138,8 @@ Options
.. include:: OPTIONS_HELP.txt
+.. _`Build Tool Mode`:
+
Build Tool Mode
===============
diff --git a/Help/module/FindOpenACC.rst b/Help/module/FindOpenACC.rst
new file mode 100644
index 0000000..dda3308
--- /dev/null
+++ b/Help/module/FindOpenACC.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindOpenACC.cmake
diff --git a/Help/policy/CMP0071.rst b/Help/policy/CMP0071.rst
index 61f14dc..ee33aa1 100644
--- a/Help/policy/CMP0071.rst
+++ b/Help/policy/CMP0071.rst
@@ -4,16 +4,15 @@ CMP0071
Let :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` process
:prop_sf:`GENERATED` files.
-CMake 3.10 and newer process regular *and* :prop_sf:`GENERATED` source files
-in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
-In CMake 3.9 and lower, only regular source files were processed in
-:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`,
-:prop_sf:`GENERATED` source files were ignored.
+Since version 3.10, CMake processes **regular** and :prop_sf:`GENERATED`
+source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
+In earlier CMake versions, only **regular** source files were processed.
+:prop_sf:`GENERATED` source files were ignored silently.
-This policy affects how :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` process
-source files that are :prop_sf:`GENERATED`.
+This policy affects how source files that are :prop_sf:`GENERATED`
+get treated in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
-The ``OLD`` behavior for this policy is to *ignore* :prop_sf:`GENERATED`
+The ``OLD`` behavior for this policy is to ignore :prop_sf:`GENERATED`
source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`.
The ``NEW`` behavior for this policy is to process :prop_sf:`GENERATED`
@@ -21,10 +20,19 @@ source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` just like regular
source files.
.. note::
- To exclude source files from :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`
- processing, the boolean source file properties
- :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` and :prop_sf:`SKIP_AUTOGEN`
- can be set accordingly.
+
+ To silence the CMP0071 warning source files can be excluded from
+ :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` processing by setting the
+ source file properties :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` or
+ :prop_sf:`SKIP_AUTOGEN`.
+
+Source skip example::
+
+ # ...
+ set_property(SOURCE /path/to/file1.h PROPERTY SKIP_AUTOMOC ON)
+ set_property(SOURCE /path/to/file2.h PROPERTY SKIP_AUTOUIC ON)
+ set_property(SOURCE /path/to/file3.h PROPERTY SKIP_AUTOGEN ON)
+ # ...
This policy was introduced in CMake version 3.10. CMake version
|release| warns when the policy is not set and uses ``OLD`` behavior.
diff --git a/Help/prop_sf/SKIP_AUTOGEN.rst b/Help/prop_sf/SKIP_AUTOGEN.rst
index 6bf2409..f31185a 100644
--- a/Help/prop_sf/SKIP_AUTOGEN.rst
+++ b/Help/prop_sf/SKIP_AUTOGEN.rst
@@ -4,5 +4,14 @@ SKIP_AUTOGEN
Exclude the source file from :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and
:prop_tgt:`AUTORCC` processing (for Qt projects).
-For finer control see :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` and
-:prop_sf:`SKIP_AUTORCC`.
+For finer exclusion control see :prop_sf:`SKIP_AUTOMOC`,
+:prop_sf:`SKIP_AUTOUIC` and :prop_sf:`SKIP_AUTORCC`.
+
+EXAMPLE
+^^^^^^^
+
+.. code-block:: cmake
+
+ # ...
+ set_property(SOURCE file.h PROPERTY SKIP_AUTOGEN ON)
+ # ...
diff --git a/Help/prop_sf/SKIP_AUTOMOC.rst b/Help/prop_sf/SKIP_AUTOMOC.rst
index 2245ca6..a929448 100644
--- a/Help/prop_sf/SKIP_AUTOMOC.rst
+++ b/Help/prop_sf/SKIP_AUTOMOC.rst
@@ -3,4 +3,13 @@ SKIP_AUTOMOC
Exclude the source file from :prop_tgt:`AUTOMOC` processing (for Qt projects).
-For broader control see :prop_sf:`SKIP_AUTOGEN`
+For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`.
+
+EXAMPLE
+^^^^^^^
+
+.. code-block:: cmake
+
+ # ...
+ set_property(SOURCE file.h PROPERTY SKIP_AUTOMOC ON)
+ # ...
diff --git a/Help/prop_sf/SKIP_AUTORCC.rst b/Help/prop_sf/SKIP_AUTORCC.rst
index 394d8f8..bccccfc 100644
--- a/Help/prop_sf/SKIP_AUTORCC.rst
+++ b/Help/prop_sf/SKIP_AUTORCC.rst
@@ -3,4 +3,13 @@ SKIP_AUTORCC
Exclude the source file from :prop_tgt:`AUTORCC` processing (for Qt projects).
-For broader control see :prop_sf:`SKIP_AUTOGEN`
+For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`.
+
+EXAMPLE
+^^^^^^^
+
+.. code-block:: cmake
+
+ # ...
+ set_property(SOURCE file.qrc PROPERTY SKIP_AUTORCC ON)
+ # ...
diff --git a/Help/prop_sf/SKIP_AUTOUIC.rst b/Help/prop_sf/SKIP_AUTOUIC.rst
index 50f78ef..4eda726 100644
--- a/Help/prop_sf/SKIP_AUTOUIC.rst
+++ b/Help/prop_sf/SKIP_AUTOUIC.rst
@@ -3,4 +3,13 @@ SKIP_AUTOUIC
Exclude the source file from :prop_tgt:`AUTOUIC` processing (for Qt projects).
-For broader control see :prop_sf:`SKIP_AUTOGEN`
+For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`.
+
+EXAMPLE
+^^^^^^^
+
+.. code-block:: cmake
+
+ # ...
+ set_property(SOURCE file.h PROPERTY SKIP_AUTOUIC ON)
+ # ...
diff --git a/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst b/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst
new file mode 100644
index 0000000..e6763d3
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst
@@ -0,0 +1,5 @@
+VS_SHADER_OUTPUT_HEADER_FILE
+----------------------------
+
+Set filename for output header file containing object code of a ``.hlsl``
+source file.
diff --git a/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst b/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst
new file mode 100644
index 0000000..1a5e369
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst
@@ -0,0 +1,5 @@
+VS_SHADER_VARIABLE_NAME
+-----------------------
+
+Set name of variable in header file containing object code of a ``.hlsl``
+source file.
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index 61813be68..9e5261f 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -12,25 +12,26 @@ When this property is set ``ON``, CMake will scan the header and
source files at build time and invoke moc accordingly.
* If an ``#include`` statement like ``#include "moc_<basename>.cpp"`` is found,
- the ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in an otherwise empty
- line of the ``<basename>.h(xx)`` header file. ``moc`` is run on the header
+ a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is expected to appear in the
+ ``<basename>.h(xx)`` header file. ``moc`` is run on the header
file to generate ``moc_<basename>.cpp`` in the
``<AUTOGEN_BUILD_DIR>/include`` directory which is automatically added
to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
This allows the compiler to find the included ``moc_<basename>.cpp`` file
regardless of the location the original source.
- * For multi configuration generators, the include directory is
- ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+ * For :prop_gbl:`multi configuration generators <GENERATOR_IS_MULTI_CONFIG>`,
+ the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
* If an ``#include`` statement like ``#include "<basename>.moc"`` is found,
- then ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in the current source
- file and ``moc`` is run on the source file itself.
+ a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is expected to appear in the
+ source file and ``moc`` is run on the source file itself.
* Header files that are not included by an ``#include "moc_<basename>.cpp"``
- statement are nonetheless scanned for ``Q_OBJECT`` or ``Q_GADGET`` macros.
+ statement are nonetheless scanned for a macro out of
+ :prop_tgt:`AUTOMOC_MACRO_NAMES`.
The resulting ``moc_<basename>.cpp`` files are generated in custom
directories and automatically included in a generated
``<AUTOGEN_BUILD_DIR>/mocs_compilation.cpp`` file,
@@ -44,8 +45,9 @@ source files at build time and invoke moc accordingly.
* Additionally, header files with the same base name as a source file,
(like ``<basename>.h``) or ``_p`` appended to the base name (like
- ``<basename>_p.h``), are parsed for ``Q_OBJECT`` or ``Q_GADGET`` macros,
- and if found, ``moc`` is also executed on those files.
+ ``<basename>_p.h``), are scanned for a macro out of
+ :prop_tgt:`AUTOMOC_MACRO_NAMES`, and if found, ``moc``
+ is also executed on those files.
* ``AUTOMOC`` always checks multiple header alternative extensions,
such as ``hpp``, ``hxx``, etc. when searching for headers.
@@ -69,13 +71,14 @@ automoc targets together in an IDE, e.g. in MSVS.
The global property :prop_gbl:`AUTOGEN_SOURCE_GROUP` can be used to group
files generated by :prop_tgt:`AUTOMOC` together in an IDE, e.g. in MSVS.
-The appearance of the strings ``Q_OBJECT`` or ``Q_GADGET`` in a source file
-determines if it needs to be ``moc`` processed. To search for additional
-strings, list them in :prop_tgt:`AUTOMOC_MACRO_NAMES`.
+Additional macro names to search for can be added to :prop_tgt:`AUTOMOC_MACRO_NAMES`.
Additional ``moc`` dependency file names can be extracted from source code
by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`.
+Compiler pre definitions for ``moc`` are written to a ``moc_predefs.h`` file
+which is controlled by :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES`.
+
Source C++ files can be excluded from :prop_tgt:`AUTOMOC` processing by
enabling :prop_sf:`SKIP_AUTOMOC` or the broader :prop_sf:`SKIP_AUTOGEN`.
diff --git a/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst b/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst
new file mode 100644
index 0000000..57a647f
--- /dev/null
+++ b/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst
@@ -0,0 +1,24 @@
+AUTOMOC_COMPILER_PREDEFINES
+---------------------------
+
+Boolean value used by :prop_tgt:`AUTOMOC` to determine if the
+compiler pre definitions file ``moc_predefs.h`` should be generated.
+
+CMake generates a ``moc_predefs.h`` file with compiler pre definitions
+from the output of the command defined in
+:variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>`
+when
+
+- :prop_tgt:`AUTOMOC` is enabled,
+- :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` is enabled,
+- :variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>` isn't empty and
+- the Qt version is greater or equal 5.8.
+
+The ``moc_predefs.h`` file, which is generated in :prop_tgt:`AUTOGEN_BUILD_DIR`,
+is passed to ``moc`` as the argument to the ``--include`` option.
+
+By default :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` is initialized from
+:variable:`CMAKE_AUTOMOC_COMPILER_PREDEFINES`, which is ON by default.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
diff --git a/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst
index 0639bc8..0535fde 100644
--- a/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst
+++ b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst
@@ -1,20 +1,23 @@
AUTOMOC_MACRO_NAMES
-------------------
-Additional macro names used by :prop_tgt:`AUTOMOC`
-to determine if a C++ file needs to be processed by ``moc``.
+A :ref:`;-list <CMake Language Lists>` list of macro names used by
+:prop_tgt:`AUTOMOC` to determine if a C++ file needs to be processed by ``moc``.
This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
for this target.
-CMake searches for the strings ``Q_OBJECT`` and ``Q_GADGET`` to
-determine if a file needs to be processed by ``moc``.
-:prop_tgt:`AUTOMOC_MACRO_NAMES` allows to add additional strings to the
-search list. This is useful for cases where the ``Q_OBJECT`` or ``Q_GADGET``
-macro is hidden inside another macro.
+When running :prop_tgt:`AUTOMOC`, CMake searches for the strings listed in
+:prop_tgt:`AUTOMOC_MACRO_NAMES` in C++ source and header files.
+If any of the strings is found
+
+- as the first non space string on a new line or
+- as the first non space string after a ``{`` on a new line,
+
+then the file will be processed by ``moc``.
By default :prop_tgt:`AUTOMOC_MACRO_NAMES` is initialized from
-:variable:`CMAKE_AUTOMOC_MACRO_NAMES`, which is empty by default.
+:variable:`CMAKE_AUTOMOC_MACRO_NAMES`.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
@@ -25,4 +28,4 @@ In this case the the ``Q_OBJECT`` macro is hidden inside an other macro
called ``CUSTOM_MACRO``. To let CMake know that source files, that contain
``CUSTOM_MACRO``, need to be ``moc`` processed, we call::
- set_property(TARGET tgt PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
+ set_property(TARGET tgt APPEND PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index 2fc2167..1791384 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -17,8 +17,8 @@ optional :prop_tgt:`AUTOUIC_SEARCH_PATHS` of the target.
``<AUTOGEN_BUILD_DIR>/include``,
which is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
-* For multi configuration generators, the include directory is
- ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+* For :prop_gbl:`multi configuration generators <GENERATOR_IS_MULTI_CONFIG>`,
+ the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst
index b262814..a3a2f56 100644
--- a/Help/prop_tgt/CUDA_STANDARD.rst
+++ b/Help/prop_tgt/CUDA_STANDARD.rst
@@ -7,7 +7,7 @@ This property specifies the CUDA/C++ standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu++11`` to the compile line.
-Supported values are ``98``, ``11``.
+Supported values are ``98``, ``11``, ``14``.
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/release/dev/FindOpenACC.rst b/Help/release/dev/FindOpenACC.rst
new file mode 100644
index 0000000..f6acbdf
--- /dev/null
+++ b/Help/release/dev/FindOpenACC.rst
@@ -0,0 +1,5 @@
+FindOpenACC
+-----------
+
+* A :module:`FindOpenACC` module was added to detect compiler support
+ for OpenACC. Currently only supports PGI, GNU and Cray compilers.
diff --git a/Help/release/dev/FindOpenGL-glvnd.rst b/Help/release/dev/FindOpenGL-glvnd.rst
new file mode 100644
index 0000000..b3c8d53
--- /dev/null
+++ b/Help/release/dev/FindOpenGL-glvnd.rst
@@ -0,0 +1,4 @@
+FindOpenGL-glvnd
+----------------
+
+* The :module:`FindOpenGL` module gained support for GLVND on Linux.
diff --git a/Help/release/dev/add-vs-shader-properties.rst b/Help/release/dev/add-vs-shader-properties.rst
new file mode 100644
index 0000000..c48b984
--- /dev/null
+++ b/Help/release/dev/add-vs-shader-properties.rst
@@ -0,0 +1,6 @@
+add-vs-shader-properties
+------------------------
+
+* Source file properties :prop_sf:`VS_SHADER_OUTPUT_HEADER_FILE` and
+ :prop_sf:`VS_SHADER_VARIABLE_NAME` have been added to specify more
+ details of ``.hlsl`` sources with :ref:`Visual Studio Generators`.
diff --git a/Help/release/dev/autogen-macro-names.rst b/Help/release/dev/autogen-macro-names.rst
index 736dd3a..6471295 100644
--- a/Help/release/dev/autogen-macro-names.rst
+++ b/Help/release/dev/autogen-macro-names.rst
@@ -1,12 +1,14 @@
autogen-macro-names
-------------------
-* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``
- and ``Q_OBJECT`` in a source file to determine if it needs to be ``moc``
- processed. The new variable :variable:`CMAKE_AUTOMOC_MACRO_NAMES` allows to
- register additional strings (macro names) so search for.
+* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``,
+ ``Q_GADGET`` or ``Q_NAMESPACE`` in a source file to determine if it needs
+ to be ``moc`` processed. The new variable
+ :variable:`CMAKE_AUTOMOC_MACRO_NAMES` allows to register additional
+ strings (macro names) so search for.
-* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``
- and ``Q_OBJECT`` in a source file to determine if it needs to be ``moc``
- processed. The new target property :prop_tgt:`AUTOMOC_MACRO_NAMES` allows to
- register additional strings (macro names) so search for.
+* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``,
+ ``Q_GADGET`` or ``Q_NAMESPACE`` in a source file to determine if it needs
+ to be ``moc`` processed. The new target property
+ :prop_tgt:`AUTOMOC_MACRO_NAMES` allows to register additional strings
+ (macro names) so search for.
diff --git a/Help/release/dev/autogen-predefs.rst b/Help/release/dev/autogen-predefs.rst
new file mode 100644
index 0000000..c390e2a
--- /dev/null
+++ b/Help/release/dev/autogen-predefs.rst
@@ -0,0 +1,11 @@
+autogen-predefs
+---------------
+
+* When using :prop_tgt:`AUTOMOC`, the new variable
+ :variable:`CMAKE_AUTOMOC_COMPILER_PREDEFINES` allows to default
+ enable or disable the generation of the compiler pre definitions file
+ ``moc_predefs.h``.
+
+* When using :prop_tgt:`AUTOMOC`, the new boolean target property
+ :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` allows to enable or disable the
+ generation of the compiler pre definitions file ``moc_predefs.h``.
diff --git a/Help/release/dev/cpack-rpm-deb-version.rst b/Help/release/dev/cpack-rpm-deb-version.rst
new file mode 100644
index 0000000..a64e8bd
--- /dev/null
+++ b/Help/release/dev/cpack-rpm-deb-version.rst
@@ -0,0 +1,14 @@
+cpack-rpm-deb-version
+---------------------
+
+* Modules :module:`CPackRPM` and :module:`CPackDeb` learned to set package epoch
+ version.
+ See :variable:`CPACK_RPM_PACKAGE_EPOCH` and
+ :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables.
+
+* The :module:`CPackDeb` module learned to set package release version in
+ `Version` info property.
+ See :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` variable.
+
+* The :module:`CPackDeb` module learned more strict package version checking
+ that complies with Debian rules.
diff --git a/Help/release/dev/cpackifw-options.rst b/Help/release/dev/cpackifw-options.rst
new file mode 100644
index 0000000..7c471f4
--- /dev/null
+++ b/Help/release/dev/cpackifw-options.rst
@@ -0,0 +1,6 @@
+cpackifw-options
+----------------
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
+ :command:`cpack_ifw_configure_component_group` commands gained a new
+ ``REPLACES`` and ``CHECKABLE`` options.
diff --git a/Help/release/dev/graphviz-line-styles.rst b/Help/release/dev/graphviz-line-styles.rst
new file mode 100644
index 0000000..d24f236
--- /dev/null
+++ b/Help/release/dev/graphviz-line-styles.rst
@@ -0,0 +1,6 @@
+graphviz-line-styles
+-------------------------
+
+* The graphviz output now distinguishes between the different dependency types
+ ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` and represents them in the output graph
+ as solid, dashed and dotted edges.
diff --git a/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst b/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst
new file mode 100644
index 0000000..7e1c53d
--- /dev/null
+++ b/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst
@@ -0,0 +1,8 @@
+CMAKE_AUTOMOC_COMPILER_PREDEFINES
+---------------------------------
+
+This variable is used to initialize the :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES`
+property on all the targets. See that target property for additional
+information.
+
+By default it is ON.
diff --git a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
index 7ed3445..5b79c40 100644
--- a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
+++ b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst
@@ -1,14 +1,15 @@
CMAKE_AUTOMOC_MACRO_NAMES
----------------------------
-Additional macro names used by :variable:`CMAKE_AUTOMOC`
-to determine if a C++ file needs to be processed by ``moc``.
+A :ref:`;-list <CMake Language Lists>` list of macro names used by
+:variable:`CMAKE_AUTOMOC` to determine if a C++ file needs to be
+processed by ``moc``.
This variable is used to initialize the :prop_tgt:`AUTOMOC_MACRO_NAMES`
property on all the targets. See that target property for additional
information.
-By default it is empty.
+The default value is ``Q_OBJECT;Q_GADGET;Q_NAMESPACE``.
Example
-------
@@ -16,4 +17,4 @@ Let CMake know that source files that contain ``CUSTOM_MACRO`` must be ``moc``
processed as well::
set(CMAKE_AUTOMOC ON)
- set(CMAKE_AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
+ list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")
diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst
new file mode 100644
index 0000000..72e8e66
--- /dev/null
+++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst
@@ -0,0 +1,7 @@
+CMAKE_CUDA_HOST_COMPILER
+------------------------
+
+Executable to use when compiling host code when compiling ``CUDA`` language
+files. Maps to the nvcc -ccbin option. Will only be used by CMake on the first
+configuration to determine a valid host compiler for ``CUDA``. After a valid
+host compiler has been found, this value is read-only.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst b/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst
new file mode 100644
index 0000000..e050f43
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst
@@ -0,0 +1,8 @@
+CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND
+----------------------------------------
+
+Command that outputs the compiler pre definitions.
+
+See :prop_tgt:`AUTOMOC` which uses
+:variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>`
+to generate the :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES`.
diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst
index 8932147..0a3a7a6 100644
--- a/Help/variable/MSVC_VERSION.rst
+++ b/Help/variable/MSVC_VERSION.rst
@@ -5,13 +5,15 @@ The version of Microsoft Visual C/C++ being used if any.
Known version numbers are::
- 1200 = VS 6.0
- 1300 = VS 7.0
- 1310 = VS 7.1
- 1400 = VS 8.0
- 1500 = VS 9.0
- 1600 = VS 10.0
- 1700 = VS 11.0
- 1800 = VS 12.0
- 1900 = VS 14.0
- 1910 = VS 15.0
+ 1200 = VS 6.0
+ 1300 = VS 7.0
+ 1310 = VS 7.1
+ 1400 = VS 8.0 (v80 toolset)
+ 1500 = VS 9.0 (v90 toolset)
+ 1600 = VS 10.0 (v100 toolset)
+ 1700 = VS 11.0 (v110 toolset)
+ 1800 = VS 12.0 (v120 toolset)
+ 1900 = VS 14.0 (v140 toolset)
+ 1910-1919 = VS 15.0 (v141 toolset)
+
+See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 484dc93..7f4b398 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,3 +1,5 @@
+# Meta
+set(AM_MULTI_CONFIG @_multi_config@)
# Directories and files
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
@@ -16,7 +18,7 @@ set(AM_QT_RCC_EXECUTABLE @_qt_rcc_executable@)
# MOC settings
set(AM_MOC_SKIP @_moc_skip@)
set(AM_MOC_DEFINITIONS @_moc_compile_defs@)
-set(AM_MOC_INCLUDES @_moc_incs@)
+set(AM_MOC_INCLUDES @_moc_include_dirs@)
set(AM_MOC_OPTIONS @_moc_options@)
set(AM_MOC_RELAXED_MODE @_moc_relaxed_mode@)
set(AM_MOC_MACRO_NAMES @_moc_macro_names@)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 0a93e5f..cddc966 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -321,12 +321,19 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_product_type "com.apple.product-type.tool")
if(CMAKE_OSX_SYSROOT)
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
- if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]")
+ if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
+ CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
set(id_product_type "com.apple.product-type.bundle.unit-test")
endif()
else()
set(id_sdkroot "")
endif()
+ if(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
+ set(id_development_team
+ "DEVELOPMENT_TEAM = \"${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}\";")
+ else()
+ set(id_development_team "")
+ endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 9c38f6e..324a279 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -23,6 +23,8 @@ set(CMAKE_DL_LIBS "dl")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
+set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
# basically all general purpose OSs support shared libs
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index 3976581..0d7f1d9 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -20,6 +20,9 @@
# * a ``foo.dot.<target>`` file for each target, file showing on which other targets the respective target depends
# * a ``foo.dot.<target>.dependers`` file, showing which other targets depend on the respective target
#
+# The different dependency types ``PUBLIC``, ``PRIVATE`` and ``INTERFACE``
+# are represented as solid, dashed and dotted edges.
+#
# This can result in huge graphs. Using the file
# ``CMakeGraphVizOptions.cmake`` the look and content of the generated
# graphs can be influenced. This file is searched first in
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 85d564e..337bec8 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -88,6 +88,16 @@
# get overwritten and it is up to the packager to set the variables in a
# manner that will prevent such errors.
#
+# .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH
+#
+# The Debian package epoch
+#
+# * Mandatory : No
+# * Default : -
+#
+# Optional number that should be incremented when changing versioning schemas
+# or fixing mistakes in the version numbers of older packages.
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
#
# The Debian package version
@@ -95,12 +105,17 @@
# * Mandatory : YES
# * Default : :variable:`CPACK_PACKAGE_VERSION`
#
+# This variable may contain only alphanumerics (A-Za-z0-9) and the characters
+# . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
+# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
+# allowed.
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
#
# The Debian package release - Debian revision number.
#
-# * Mandatory : YES
-# * Default : 1
+# * Mandatory : No
+# * Default : -
#
# This is the numbering of the DEB package itself, i.e. the version of the
# packaging and not the version of the content (see
@@ -738,6 +753,32 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
endif()
+ if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+-~]*$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+-~]*$\" regex!")
+ endif()
+
+ if(CPACK_DEBIAN_PACKAGE_RELEASE)
+ if(NOT CPACK_DEBIAN_PACKAGE_RELEASE MATCHES "^[A-Za-z0-9.+~]+$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package release must confirm to \"^[A-Za-z0-9.+~]+$\" regex!")
+ endif()
+ string(APPEND CPACK_DEBIAN_PACKAGE_VERSION
+ "-${CPACK_DEBIAN_PACKAGE_RELEASE}")
+ elseif(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!")
+ endif()
+
+ if(CPACK_DEBIAN_PACKAGE_EPOCH)
+ if(NOT CPACK_DEBIAN_PACKAGE_EPOCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR
+ "CPackDeb: Debian package epoch must confirm to \"^[0-9]+$\" regex!")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_VERSION
+ "${CPACK_DEBIAN_PACKAGE_EPOCH}:${CPACK_DEBIAN_PACKAGE_VERSION}")
+ endif()
+
# Architecture: (mandatory)
if(CPACK_DEB_PACKAGE_COMPONENT AND CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE}")
@@ -961,11 +1002,6 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_GENERATE_POSTRM 0)
endif()
- if(NOT CPACK_DEBIAN_PACKAGE_RELEASE)
- set(CPACK_DEBIAN_PACKAGE_RELEASE 1)
- endif()
-
-
cpack_deb_variable_fallback("CPACK_DEBIAN_FILE_NAME"
"CPACK_DEBIAN_${_local_component_name}_FILE_NAME"
"CPACK_DEBIAN_FILE_NAME")
@@ -974,7 +1010,7 @@ function(cpack_deb_prepare_package_vars)
# Patch package file name to be in corrent debian format:
# <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
set(CPACK_OUTPUT_FILE_NAME
- "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
+ "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
else()
cmake_policy(PUSH)
cmake_policy(SET CMP0010 NEW)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 0b42c83..8d8b070 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -323,7 +323,9 @@
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
# [USER_INTERFACES <file_path> <file_path> ...]
-# [TRANSLATIONS <file_path> <file_path> ...])
+# [TRANSLATIONS <file_path> <file_path> ...]
+# [REPLACES <comp_id> ...]
+# [CHECKABLE <value>])
#
# This command should be called after :command:`cpack_add_component` command.
#
@@ -404,6 +406,15 @@
# ``TRANSLATIONS``
# is a list of <file_path> ('.qm' files) representing translations to load.
#
+# ``REPLACES``
+# list of identifiers of component or component group to replace.
+#
+# ``CHECKABLE``
+# Possible values are: TRUE, FALSE.
+# Set to FALSE if you want to hide the checkbox for an item.
+# This is useful when only a few subcomponents should be selected
+# instead of all.
+#
#
# .. command:: cpack_ifw_configure_component_group
#
@@ -426,7 +437,9 @@
# [LICENSES <display_name> <file_path> ...]
# [DEFAULT <value>]
# [USER_INTERFACES <file_path> <file_path> ...]
-# [TRANSLATIONS <file_path> <file_path> ...])
+# [TRANSLATIONS <file_path> <file_path> ...]
+# [REPLACES <comp_id> ...]
+# [CHECKABLE <value>])
#
# This command should be called after :command:`cpack_add_component_group`
# command.
@@ -499,6 +512,15 @@
# ``TRANSLATIONS``
# is a list of <file_path> ('.qm' files) representing translations to load.
#
+# ``REPLACES``
+# list of identifiers of component or component group to replace.
+#
+# ``CHECKABLE``
+# Possible values are: TRUE, FALSE.
+# Set to FALSE if you want to hide the checkbox for an item.
+# This is useful when only a few subcomponents should be selected
+# instead of all.
+#
#
# .. command:: cpack_ifw_add_repository
#
@@ -882,8 +904,8 @@ macro(cpack_ifw_configure_component compname)
string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
- set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
- set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
+ set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
+ set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
@@ -923,8 +945,8 @@ macro(cpack_ifw_configure_component_group grpname)
string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
- set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
- set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
+ set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
+ set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 3913494..9f77ec3 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -106,6 +106,16 @@
# group rpm package is generated without component suffix in filename and
# package name.
#
+# .. variable:: CPACK_RPM_PACKAGE_EPOCH
+#
+# The RPM package epoch
+#
+# * Mandatory : No
+# * Default : -
+#
+# Optional number that should be incremented when changing versioning schemas
+# or fixing mistakes in the version numbers of older packages.
+#
# .. variable:: CPACK_RPM_PACKAGE_VERSION
#
# The RPM package version.
@@ -530,7 +540,9 @@
# list of path to be excluded.
#
# * Mandatory : NO
-# * Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include
+# * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib
+# /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal
+# /usr/share/doc
#
# May be used to exclude path (directories or files) from the auto-generated
# list of paths discovered by CPack RPM. The defaut value contains a
@@ -1083,7 +1095,9 @@ function(cpack_rpm_prepare_content_list)
endif()
if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/libx32 /usr/include)
+ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/bin
+ /usr/include /usr/lib /usr/libx32 /usr/lib64
+ /usr/share /usr/share/aclocal /usr/share/doc )
if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
@@ -1891,11 +1905,16 @@ function(cpack_rpm_generate_package)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}")
+ if(CPACK_RPM_PACKAGE_EPOCH)
+ set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}")
+ endif()
+
# Check if additional fields for RPM spec header are given
# There may be some COMPONENT specific variables as well
# If component specific var is not provided we use the global one
# for each component
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
+
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
endif()
@@ -2501,6 +2520,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
\@TMP_RPM_PREFIXES\@
+\@TMP_RPM_EPOCH\@
%description -n \@CPACK_RPM_PACKAGE_NAME\@
\@CPACK_RPM_PACKAGE_DESCRIPTION\@
@@ -2560,6 +2580,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
\@TMP_RPM_PREFIXES\@
+\@TMP_RPM_EPOCH\@
\@TMP_RPM_DEBUGINFO\@
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 785e269..1c91654 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -26,6 +26,8 @@ else()
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
+ set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "-std=c++03")
+ set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "-std=c++03")
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
endif()
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 84f48ae..1cbaa57 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -72,6 +72,7 @@
1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
+ @id_development_team@
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 912c5ac..76f5080 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1923,6 +1923,15 @@ function(_ep_get_step_stampfile name step stampfile_var)
endfunction()
+function(_ep_get_complete_stampfile name stampfile_var)
+ set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+ set(stampfile "${cmf_dir}${cfgdir}/${name}-complete")
+
+ set(${stampfile_var} ${stampfile} PARENT_SCOPE)
+endfunction()
+
+
function(ExternalProject_Add_StepTargets name)
set(steps ${ARGN})
if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS")
@@ -1952,10 +1961,7 @@ endfunction()
function(ExternalProject_Add_Step name step)
- set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
- _ep_get_configuration_subdir_suffix(cfgdir)
-
- set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+ _ep_get_complete_stampfile(${name} complete_stamp_file)
_ep_get_step_stampfile(${name} ${step} stamp_file)
_ep_parse_arguments(ExternalProject_Add_Step
@@ -2958,7 +2964,7 @@ function(ExternalProject_Add name)
# Add a custom target for the external project.
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
- set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+ _ep_get_complete_stampfile(${name} complete_stamp_file)
# The "ALL" option to add_custom_target just tells it to not set the
# EXCLUDE_FROM_ALL target property. Later, if the EXCLUDE_FROM_ALL
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 6d1514d..88d14ab 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -245,10 +245,9 @@ if (NOT Boost_NO_BOOST_CMAKE)
# If we found boost-cmake, then we're done. Print out what we found.
# Otherwise let the rest of the module try to find it.
if (Boost_FOUND)
- message("Boost ${Boost_FIND_VERSION} found.")
+ message(STATUS "Boost ${Boost_FIND_VERSION} found.")
if (Boost_FIND_COMPONENTS)
- message("Found Boost components:")
- message(" ${Boost_FIND_COMPONENTS}")
+ message(STATUS "Found Boost components:\n ${Boost_FIND_COMPONENTS}")
endif()
# Restore project's policies
cmake_policy(POP)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 7493281..d287688 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -681,12 +681,12 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans)
string(
- REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*([0-9]+(\\.[0-9]+)?)"
+ REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*'?([0-9]+(\\.[0-9]+)?)"
matlab_versions_regex
${substring_ans})
foreach(match IN LISTS matlab_versions_regex)
string(
- REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)"
+ REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*'?(([0-9]+)(\\.([0-9]+))?)"
current_match ${match})
list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1})
diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake
new file mode 100644
index 0000000..775cc18
--- /dev/null
+++ b/Modules/FindOpenACC.cmake
@@ -0,0 +1,252 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindOpenACC
+-----------
+
+Detect OpenACC support by the compiler.
+
+This module can be used to detect OpenACC support in a compiler.
+If the compiler supports OpenACC, the flags required to compile with
+OpenACC support are returned in variables for the different languages.
+Currently, only PGI, GNU and Cray compilers are supported.
+
+Variables
+^^^^^^^^^
+
+This module will set the following variables per language in your
+project, where ``<lang>`` is one of C, CXX, or Fortran:
+
+``OpenACC_<lang>_FOUND``
+ Variable indicating if OpenACC support for ``<lang>`` was detected.
+``OpenACC_<lang>_FLAGS``
+ OpenACC compiler flags for ``<lang>``, separated by spaces.
+
+The module will also try to provide the OpenACC version variables:
+
+``OpenACC_<lang>_SPEC_DATE``
+ Date of the OpenACC specification implemented by the ``<lang>`` compiler.
+``OpenACC_<lang>_VERSION_MAJOR``
+ Major version of OpenACC implemented by the ``<lang>`` compiler.
+``OpenACC_<lang>_VERSION_MINOR``
+ Minor version of OpenACC implemented by the ``<lang>`` compiler.
+``OpenACC_<lang>_VERSION``
+ OpenACC version implemented by the ``<lang>`` compiler.
+
+The specification date is formatted as given in the OpenACC standard:
+``yyyymm`` where ``yyyy`` and ``mm`` represents the year and month of
+the OpenACC specification implemented by the ``<lang>`` compiler.
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+``OpenACC_ACCEL_TARGET=<target>``
+If set, will the correct target accelerator flag set to the <target> will
+be returned with OpenACC_<lang>_FLAGS.
+#]=======================================================================]
+
+set(OpenACC_C_CXX_TEST_SOURCE
+"
+int main(){
+#ifndef _OPENACC
+ breaks_on_purpose
+#endif
+}
+"
+)
+set(OpenACC_Fortran_TEST_SOURCE
+"
+program test
+#ifndef _OPENACC
+ breaks_on_purpose
+#endif
+endprogram test
+"
+)
+set(OpenACC_C_CXX_CHECK_VERSION_SOURCE
+"
+#include <stdio.h>
+const char accver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'A',
+ 'C', 'C', '-', 'd', 'a', 't', 'e', '[',
+ ('0' + ((_OPENACC/100000)%10)),
+ ('0' + ((_OPENACC/10000)%10)),
+ ('0' + ((_OPENACC/1000)%10)),
+ ('0' + ((_OPENACC/100)%10)),
+ ('0' + ((_OPENACC/10)%10)),
+ ('0' + ((_OPENACC/1)%10)),
+ ']', '\\0' };
+int main()
+{
+ puts(accver_str);
+}
+")
+set(OpenACC_Fortran_CHECK_VERSION_SOURCE
+"
+ program acc_ver
+ implicit none
+ integer, parameter :: zero = ichar('0')
+ character, dimension(25), parameter :: accver_str =&
+ (/ 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'A', 'C', 'C', '-',&
+ 'd', 'a', 't', 'e', '[',&
+ char(zero + mod(_OPENACC/100000, 10)),&
+ char(zero + mod(_OPENACC/10000, 10)),&
+ char(zero + mod(_OPENACC/1000, 10)),&
+ char(zero + mod(_OPENACC/100, 10)),&
+ char(zero + mod(_OPENACC/10, 10)),&
+ char(zero + mod(_OPENACC/1, 10)), ']' /)
+ print *, accver_str
+ end program acc_ver
+"
+)
+
+
+function(_OPENACC_WRITE_SOURCE_FILE LANG SRC_FILE_CONTENT_VAR SRC_FILE_NAME SRC_FILE_FULLPATH)
+ set(WORK_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenACC)
+ if("${LANG}" STREQUAL "C")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.c")
+ file(WRITE "${SRC_FILE}" "${OpenACC_C_CXX_${SRC_FILE_CONTENT_VAR}}")
+ elseif("${LANG}" STREQUAL "CXX")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.cpp")
+ file(WRITE "${SRC_FILE}" "${OpenACC_C_CXX_${SRC_FILE_CONTENT_VAR}}")
+ elseif("${LANG}" STREQUAL "Fortran")
+ set(SRC_FILE "${WORK_DIR}/${SRC_FILE_NAME}.F90")
+ file(WRITE "${SRC_FILE}_in" "${OpenACC_Fortran_${SRC_FILE_CONTENT_VAR}}")
+ configure_file("${SRC_FILE}_in" "${SRC_FILE}" @ONLY)
+ endif()
+ set(${SRC_FILE_FULLPATH} "${SRC_FILE}" PARENT_SCOPE)
+endfunction()
+
+
+function(_OPENACC_GET_FLAGS_CANDIDATE LANG FLAG_VAR)
+ set(ACC_FLAG_PGI "-acc")
+ set(ACC_FLAG_GNU "-fopenacc")
+ set(ACC_FLAG_Cray "-h acc")
+
+ if(DEFINED ACC_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ set("${FLAG_VAR}" "${ACC_FLAG_${CMAKE_${LANG}_COMPILER_ID}}" PARENT_SCOPE)
+ else()
+ # Fall back to a few common flags.
+ set("${FLAG_VAR}" ${ACC_FLAG_GNU} ${ACC_FLAG_PGI})
+ endif()
+
+endfunction()
+
+
+function(_OPENACC_GET_ACCEL_TARGET_FLAG LANG TARGET FLAG_VAR)
+ # Find target accelerator flags.
+ set(ACC_TARGET_FLAG_PGI "-ta")
+ if(DEFINED ACC_TARGET_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ set("${FLAG_VAR}" "${ACC_TARGET_FLAG_${CMAKE_${LANG}_COMPILER_ID}}=${TARGET}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+function(_OPENACC_GET_VERBOSE_FLAG LANG FLAG_VAR)
+ # Find compiler's verbose flag for OpenACC.
+ set(ACC_VERBOSE_FLAG_PGI "-Minfo=accel")
+ if(DEFINED ACC_VERBOSE_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ set("${FLAG_VAR}" "${ACC_VERBOSE_FLAG_${CMAKE_${LANG}_COMPILER_ID}}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+function(_OPENACC_GET_FLAGS LANG FLAG_VAR)
+ set(FLAG_CANDIDATES "")
+ _OPENACC_GET_FLAGS_CANDIDATE("${LANG}" FLAG_CANDIDATES)
+ _OPENACC_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenACCTryFlag _OPENACC_TEST_SRC)
+
+ foreach(FLAG IN LISTS FLAG_CANDIDATES)
+ try_compile(OpenACC_FLAG_TEST_RESULT ${CMAKE_BINARY_DIR} ${_OPENACC_TEST_SRC}
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${FLAG}"
+ OUTPUT_VARIABLE OpenACC_TRY_COMPILE_OUTPUT
+ )
+ if(OpenACC_FLAG_TEST_RESULT)
+ set("${FLAG_VAR}" "${FLAG}")
+ if(DEFINED OpenACC_ACCEL_TARGET)
+ _OPENACC_GET_ACCEL_TARGET_FLAG("${LANG}" "${OpenACC_ACCEL_TARGET}" TARGET_FLAG)
+ string(APPEND "${FLAG_VAR}" " ${TARGET_FLAG}")
+ endif()
+
+ if(CMAKE_VERBOSE_MAKEFILE)
+ # -Minfo=accel prints out OpenACC's messages on optimizations.
+ _OPENACC_GET_VERBOSE_FLAG("${LANG}" OpenACC_VERBOSE_FLAG)
+ string(APPEND "${FLAG_VAR}" " ${OpenACC_VERBOSE_FLAG}")
+ endif()
+ set("${FLAG_VAR}" "${${FLAG_VAR}}" PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+
+endfunction()
+
+
+function(_OPENACC_GET_SPEC_DATE LANG SPEC_DATE)
+ _OPENACC_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenACCCheckVersion _OPENACC_TEST_SRC)
+
+ set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenACC/accver_${LANG}.bin")
+ try_compile(OpenACC_SPECTEST_${LANG} "${CMAKE_BINARY_DIR}" "${_OPENACC_TEST_SRC}"
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenACC_${LANG}_FLAGS}"
+ COPY_FILE ${BIN_FILE}
+ OUTPUT_VARIABLE OUTPUT)
+
+ if(${OpenACC_SPECTEST_${LANG}})
+ file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenACC-date")
+ set(regex_spec_date ".*INFO:OpenACC-date\\[0*([^]]*)\\].*")
+ if("${specstr}" MATCHES "${regex_spec_date}")
+ set(${SPEC_DATE} "${CMAKE_MATCH_1}" PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
+
+
+macro(_OPENACC_SET_VERSION_BY_SPEC_DATE LANG)
+ set(OpenACC_SPEC_DATE_MAP
+ # Combined versions, 2.5 onwards
+ "201510=2.5"
+ # 2013 08 is the corrected version.
+ "201308=2.0"
+ "201306=2.0"
+ "201111=1.0"
+ )
+
+ string(REGEX MATCHALL "${OpenACC_${LANG}_SPEC_DATE}=([0-9]+)\\.([0-9]+)" _version_match "${OpenACC_SPEC_DATE_MAP}")
+ if(NOT _version_match STREQUAL "")
+ set(OpenACC_${LANG}_VERSION_MAJOR ${CMAKE_MATCH_1})
+ set(OpenACC_${LANG}_VERSION_MINOR ${CMAKE_MATCH_2})
+ set(OpenACC_${LANG}_VERSION "${OpenACC_${LANG}_VERSION_MAJOR}.${OpenACC_${LANG}_VERSION_MINOR}")
+ else()
+ unset(OpenACC_${LANG}_VERSION_MAJOR)
+ unset(OpenACC_${LANG}_VERSION_MINOR)
+ unset(OpenACC_${LANG}_VERSION)
+ endif()
+ unset(_version_match)
+ unset(OpenACC_SPEC_DATE_MAP)
+endmacro()
+
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+foreach (LANG IN ITEMS C CXX Fortran)
+ if(CMAKE_${LANG}_COMPILER_LOADED)
+ set(OpenACC_${LANG}_FIND_QUIETLY ${OpenACC_FIND_QUIETLY})
+ set(OpenACC_${LANG}_FIND_REQUIRED ${OpenACC_FIND_REQUIRED})
+ set(OpenACC_${LANG}_FIND_VERSION ${OpenACC_FIND_VERSION})
+ set(OpenACC_${LANG}_FIND_VERSION_EXACT ${OpenACC_FIND_VERSION_EXACT})
+
+ if(NOT DEFINED OpenACC_${LANG}_FLAGS)
+ _OPENACC_GET_FLAGS("${LANG}" OpenACC_${LANG}_FLAGS)
+ endif()
+ _OPENACC_GET_SPEC_DATE("${LANG}" OpenACC_${LANG}_SPEC_DATE)
+ _OPENACC_SET_VERSION_BY_SPEC_DATE("${LANG}")
+
+ find_package_handle_standard_args(OpenACC_${LANG}
+ REQUIRED_VARS OpenACC_${LANG}_FLAGS
+ VERSION_VAR OpenACC_${LANG}_VERSION
+ )
+ endif()
+endforeach()
+
+unset(OpenACC_C_CXX_TEST_SOURCE)
+unset(OpenACC_Fortran_TEST_SOURCE)
+unset(OpenACC_C_CXX_CHECK_VERSION_SOURCE)
+unset(OpenACC_Fortran_CHECK_VERSION_SOURCE)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index af83fb7..59bee41 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -7,15 +7,28 @@
#
# FindModule for OpenGL and GLU.
#
+# Optional COMPONENTS
+# ^^^^^^^^^^^^^^^^^^^
+#
+# This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and
+# ``OpenGL``. There are corresponding import targets for each of these flags.
+#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines the :prop_tgt:`IMPORTED` targets:
#
# ``OpenGL::GL``
-# Defined if the system has OpenGL.
+# Defined to the platform-specific OpenGL libraries if the system has OpenGL.
+# ``OpenGL::OpenGL``
+# Defined to libOpenGL if the system is GLVND-based.
+# ``OpenGL::GL``
# ``OpenGL::GLU``
# Defined if the system has GLU.
+# ``OpenGL::GLX``
+# Defined if the system has GLX.
+# ``OpenGL::EGL``
+# Defined if the system has EGL.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
@@ -23,40 +36,87 @@
# This module sets the following variables:
#
# ``OPENGL_FOUND``
-# True, if the system has OpenGL.
+# True, if the system has OpenGL and all components are found.
# ``OPENGL_XMESA_FOUND``
# True, if the system has XMESA.
# ``OPENGL_GLU_FOUND``
# True, if the system has GLU.
+# ``OpenGL_OpenGL_FOUND``
+# True, if the system has an OpenGL library.
+# ``OpenGL_GLX_FOUND``
+# True, if the system has GLX.
+# ``OpenGL_EGL_FOUND``
+# True, if the system has EGL.
# ``OPENGL_INCLUDE_DIR``
# Path to the OpenGL include directory.
+# ``OPENGL_EGL_INCLUDE_DIRS``
+# Path to the EGL include directory.
# ``OPENGL_LIBRARIES``
-# Paths to the OpenGL and GLU libraries.
+# Paths to the OpenGL library, windowing system libraries, and GLU libraries.
+# On Linux, this assumes glX and is never correct for EGL-based targets.
+# Clients are encouraged to use the ``OpenGL::*`` import targets instead.
#
-# If you want to use just GL you can use these values:
+# Cache variables
+# ^^^^^^^^^^^^^^^
#
-# ``OPENGL_gl_LIBRARY``
-# Path to the OpenGL library.
+# The following cache variables may also be set:
+#
+# ``OPENGL_egl_LIBRARY``
+# Path to the EGL library.
# ``OPENGL_glu_LIBRARY``
# Path to the GLU library.
+# ``OPENGL_glx_LIBRARY``
+# Path to the GLVND 'GLX' library.
+# ``OPENGL_opengl_LIBRARY``
+# Path to the GLVND 'OpenGL' library
+# ``OPENGL_gl_LIBRARY``
+# Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import
+# targets.
+#
+# Linux-specific
+# ^^^^^^^^^^^^^^
#
-# OSX Specific
-# ^^^^^^^^^^^^
+# Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates
+# context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and
+# contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way
+# to get OpenGL 3+ functionality via EGL in a manner portable across vendors.
#
-# On OSX default to using the framework version of OpenGL. People will
-# have to change the cache values of OPENGL_glu_LIBRARY and
+# On Linux systems FindOpenGL defaults to using GLVND if available. Users can
+# utilize GLVND explicitly with targets ``OpenGL::OpenGL``, ``OpenGL::GLX``, and
+# ``OpenGL::EGL``. Additionally, when GLVND is available the ``OpenGL::GL``
+# target is equivalent to ``OpenGL::OpenGL OpenGL::GLX``. When the system is
+# not GLVND-based, ``OpenGL::GL`` expands to libGL as it has historically done.
+# Thus, for non-EGL-based Linux targets, the ``OpenGL::GL`` target is most
+# portable.
+#
+# For EGL targets the client must rely on GLVND support on the user's system.
+# Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES*
+# libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this
+# module does not currently support that; contributions welcome.
+#
+# ``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of
+# GLVND. For non-GLVND Linux and other systems these are left undefined.
+#
+# macOS-Specific
+# ^^^^^^^^^^^^^^
+#
+# On OSX FindOpenGL defaults to using the framework version of OpenGL. People
+# will have to change the cache values of OPENGL_glu_LIBRARY and
# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
-
set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)
-if (CYGWIN)
+# Provide OPENGL_USE_<C> variables for each component.
+foreach(component ${OpenGL_FIND_COMPONENTS})
+ string(TOUPPER ${component} _COMPONENT)
+ set(OPENGL_USE_${_COMPONENT} 1)
+endforeach()
+if (CYGWIN)
find_path(OPENGL_INCLUDE_DIR GL/gl.h )
list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
find_library(OPENGL_gl_LIBRARY opengl32 )
-
find_library(OPENGL_glu_LIBRARY glu32 )
elseif (WIN32)
@@ -70,7 +130,6 @@ elseif (WIN32)
endif()
elseif (APPLE)
-
# The OpenGL.framework provides both gl and glu
find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
find_library(OPENGL_glu_LIBRARY OpenGL DOC
@@ -104,15 +163,14 @@ else()
# fail since the compiler finds the Mesa headers but NVidia's library.
# Make sure the NVIDIA directory comes BEFORE the others.
# - Atanas Georgiev <atanas@cs.columbia.edu>
-
find_path(OPENGL_INCLUDE_DIR GL/gl.h
/usr/share/doc/NVIDIA_GLX-1.0/include
/usr/openwin/share/include
/opt/graphics/OpenGL/include /usr/X11R6/include
${_OPENGL_INCLUDE_PATH}
)
- list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
-
+ find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH})
+ find_path(OPENGL_EGL_INCLUDE_DIR EGL/egl.h ${_OPENGL_INCLUDE_PATH})
find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
/usr/share/doc/NVIDIA_GLX-1.0/include
/usr/openwin/share/include
@@ -126,6 +184,90 @@ else()
/usr/shlib /usr/X11R6/lib
${_OPENGL_LIB_PATH}
)
+ # Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll
+ # take into account the COMPONENTS logic later.
+ find_library(OPENGL_opengl_LIBRARY
+ NAMES OpenGL
+ PATHS /usr/X11R6/lib
+ ${_OPENGL_LIB_PATH}
+ )
+
+ find_library(OPENGL_glx_LIBRARY
+ NAMES GLX
+ PATHS /usr/X11R6/lib
+ ${_OPENGL_LIB_PATH}
+ )
+
+ find_library(OPENGL_egl_LIBRARY
+ NAMES EGL
+ PATHS ${_OPENGL_LIB_PATH}
+ )
+
+ find_library(OPENGL_glu_LIBRARY
+ NAMES GLU MesaGLU
+ PATHS ${OPENGL_gl_LIBRARY}
+ /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ )
+
+ # FPHSA cannot handle "this OR that is required", so we conditionally set what
+ # it must look for. First clear any previous config we might have done:
+ set(_OpenGL_REQUIRED_VARS)
+
+ # now we append the libraries as appropriate. The complicated logic
+ # basically comes down to "use libOpenGL when we can, and add in specific
+ # context mechanisms when requested, or we need them to preserve the previous
+ # default where glx is always available."
+ if((NOT OPENGL_USE_EGL AND
+ NOT OPENGL_opengl_LIBRARY AND
+ OPENGL_glx_LIBRARY AND
+ NOT OPENGL_gl_LIBRARY) OR
+ (NOT OPENGL_USE_EGL AND
+ NOT OPENGL_glx_LIBRARY AND
+ NOT OPENGL_gl_LIBRARY) OR
+ (NOT OPENGL_USE_EGL AND
+ OPENGL_opengl_LIBRARY AND
+ OPENGL_glx_LIBRARY) OR
+ ( OPENGL_USE_EGL))
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_opengl_LIBRARY)
+ endif()
+
+ # GLVND GLX library. Preferred when available.
+ if((NOT OPENGL_USE_OPENGL AND
+ NOT OPENGL_USE_GLX AND
+ NOT OPENGL_USE_EGL AND
+ NOT OPENGL_glx_LIBRARY AND
+ NOT OPENGL_gl_LIBRARY) OR
+ ( OPENGL_USE_GLX AND
+ NOT OPENGL_USE_EGL AND
+ NOT OPENGL_glx_LIBRARY AND
+ NOT OPENGL_gl_LIBRARY) OR
+ (NOT OPENGL_USE_EGL AND
+ OPENGL_opengl_LIBRARY AND
+ OPENGL_glx_LIBRARY) OR
+ (OPENGL_USE_GLX AND OPENGL_USE_EGL))
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_glx_LIBRARY)
+ endif()
+
+ # GLVND EGL library.
+ if(OPENGL_USE_EGL)
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_egl_LIBRARY)
+ endif()
+
+ # Old-style "libGL" library: used as a fallback when GLVND isn't available.
+ if((NOT OPENGL_USE_EGL AND
+ NOT OPENGL_opengl_LIBRARY AND
+ OPENGL_glx_LIBRARY AND
+ OPENGL_gl_LIBRARY) OR
+ (NOT OPENGL_USE_EGL AND
+ NOT OPENGL_glx_LIBRARY AND
+ OPENGL_gl_LIBRARY))
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)
+ endif()
+
+ # We always need the 'gl.h' include dir.
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
unset(_OPENGL_INCLUDE_PATH)
unset(_OPENGL_LIB_PATH)
@@ -137,42 +279,99 @@ else()
/usr/openwin/lib
/usr/shlib /usr/X11R6/lib
)
-
endif ()
-if(OPENGL_gl_LIBRARY)
+if(OPENGL_xmesa_INCLUDE_DIR)
+ set( OPENGL_XMESA_FOUND "YES" )
+else()
+ set( OPENGL_XMESA_FOUND "NO" )
+endif()
- if(OPENGL_xmesa_INCLUDE_DIR)
- set( OPENGL_XMESA_FOUND "YES" )
- else()
- set( OPENGL_XMESA_FOUND "NO" )
- endif()
+if(OPENGL_glu_LIBRARY)
+ set( OPENGL_GLU_FOUND "YES" )
+else()
+ set( OPENGL_GLU_FOUND "NO" )
+endif()
- set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
- if(OPENGL_glu_LIBRARY)
- set( OPENGL_GLU_FOUND "YES" )
- if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}")
- set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
- endif()
- else()
- set( OPENGL_GLU_FOUND "NO" )
- endif()
+# OpenGL_OpenGL_FOUND is a bit unique in that it is okay if /either/ libOpenGL
+# or libGL is found.
+# Using libGL with libEGL is never okay, though; we handle that case later.
+if(NOT OPENGL_opengl_LIBRARY AND NOT OPENGL_gl_LIBRARY)
+ set(OpenGL_OpenGL_FOUND FALSE)
+else()
+ set(OpenGL_OpenGL_FOUND TRUE)
+endif()
- # This deprecated setting is for backward compatibility with CMake1.4
- set (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+if(OPENGL_glx_LIBRARY AND OPENGL_GLX_INCLUDE_DIR)
+ set(OpenGL_GLX_FOUND TRUE)
+else()
+ set(OpenGL_GLX_FOUND FALSE)
+endif()
+if(OPENGL_egl_LIBRARY AND OPENGL_EGL_INCLUDE_DIR)
+ set(OpenGL_EGL_FOUND TRUE)
+else()
+ set(OpenGL_EGL_FOUND FALSE)
endif()
-# This deprecated setting is for backward compatibility with CMake1.4
-set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+# User-visible names should be plural.
+if(OPENGL_EGL_INCLUDE_DIR)
+ set(OPENGL_EGL_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR})
+endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}
+ HANDLE_COMPONENTS)
unset(_OpenGL_REQUIRED_VARS)
# OpenGL:: targets
if(OPENGL_FOUND)
- if(NOT TARGET OpenGL::GL)
+ # ::OpenGL is a GLVND library, and thus Linux-only: we don't bother checking
+ # for a framework version of this library.
+ if(OPENGL_opengl_LIBRARY AND NOT TARGET OpenGL::OpenGL)
+ if(IS_ABSOLUTE "${OPENGL_opengl_LIBRARY}")
+ add_library(OpenGL::OpenGL UNKNOWN IMPORTED)
+ set_target_properties(OpenGL::OpenGL PROPERTIES IMPORTED_LOCATION
+ "${OPENGL_opengl_LIBRARY}")
+ else()
+ add_library(OpenGL::OpenGL INTERFACE IMPORTED)
+ set_target_properties(OpenGL::OpenGL PROPERTIES IMPORTED_LIBNAME
+ "${OPENGL_opengl_LIBRARY}")
+ endif()
+ set_target_properties(OpenGL::OpenGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ "${OPENGL_INCLUDE_DIR}")
+ endif()
+
+ # ::GLX is a GLVND library, and thus Linux-only: we don't bother checking
+ # for a framework version of this library.
+ if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX)
+ if(IS_ABSOLUTE "${OPENGL_glx_LIBRARY}")
+ add_library(OpenGL::GLX UNKNOWN IMPORTED)
+ set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LOCATION
+ "${OPENGL_glx_LIBRARY}")
+ else()
+ add_library(OpenGL::GLX INTERFACE IMPORTED)
+ set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LIBNAME
+ "${OPENGL_glx_LIBRARY}")
+ endif()
+ set_target_properties(OpenGL::GLX PROPERTIES INTERFACE_LINK_LIBRARIES
+ OpenGL::OpenGL)
+ set_target_properties(OpenGL::GLX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ "${OPENGL_GLX_INCLUDE_DIR}")
+ endif()
+
+ if(TARGET OpenGL::OpenGL AND TARGET OpenGL::GLX AND NOT TARGET OpenGL::GL)
+ # if GLVND with GLX is available, make ::GL a synonym for 'OpenGL::OpenGL
+ # OpenGL::GLX'.
+ add_library(OpenGL::GL INTERFACE IMPORTED)
+ set_target_properties(OpenGL::GL PROPERTIES INTERFACE_LINK_LIBRARIES
+ OpenGL::OpenGL)
+ set_property(TARGET OpenGL::GL APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+ OpenGL::GLX)
+ set_target_properties(OpenGL::GL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ "${OPENGL_INCLUDE_DIR}")
+
+ elseif(NOT TARGET OpenGL::GL)
if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}")
add_library(OpenGL::GL UNKNOWN IMPORTED)
if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
@@ -195,6 +394,28 @@ if(OPENGL_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}")
endif()
+ # ::EGL is a GLVND library, and thus Linux-only: we don't bother checking
+ # for a framework version of this library.
+ # Note we test for OpenGL::OpenGL as a target. When this module is updated to
+ # support GLES, we would additionally want to check for the hypothetical GLES
+ # target and enable EGL if either ::GLES or ::OpenGL is created.
+ if(TARGET OpenGL::OpenGL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL)
+ if(IS_ABSOLUTE "${OPENGL_egl_LIBRARY}")
+ add_library(OpenGL::EGL UNKNOWN IMPORTED)
+ set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LOCATION
+ "${OPENGL_egl_LIBRARY}")
+ else()
+ add_library(OpenGL::EGL INTERFACE IMPORTED)
+ set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LIBNAME
+ "${OPENGL_egl_LIBRARY}")
+ endif()
+ set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_LINK_LIBRARIES
+ OpenGL::OpenGL)
+ # Note that EGL's include directory is different from OpenGL/GLX's!
+ set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ "${OPENGL_EGL_INCLUDE_DIR}")
+ endif()
+
if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)
if(IS_ABSOLUTE "${OPENGL_glu_LIBRARY}")
add_library(OpenGL::GLU UNKNOWN IMPORTED)
@@ -217,11 +438,31 @@ if(OPENGL_FOUND)
set_target_properties(OpenGL::GLU PROPERTIES
INTERFACE_LINK_LIBRARIES OpenGL::GL)
endif()
+
+ # OPENGL_LIBRARIES mirrors OpenGL::GL's logic ...
+ set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY})
+ if(TARGET OpenGL::GLX AND TARGET OpenGL::OpenGL)
+ set(OPENGL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY})
+ endif()
+ # ... and also includes GLU, if available.
+ if(TARGET OpenGL::GLU)
+ list(APPEND OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY})
+ endif()
endif()
+# This deprecated setting is for backward compatibility with CMake1.4
+set(OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+# This deprecated setting is for backward compatibility with CMake1.4
+set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+
mark_as_advanced(
OPENGL_INCLUDE_DIR
OPENGL_xmesa_INCLUDE_DIR
+ OPENGL_egl_LIBRARY
OPENGL_glu_LIBRARY
+ OPENGL_glx_LIBRARY
OPENGL_gl_LIBRARY
+ OPENGL_opengl_LIBRARY
+ OPENGL_EGL_INCLUDE_DIR
+ OPENGL_GLX_INCLUDE_DIR
)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 4a3edf9..595b0b3 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -75,6 +75,7 @@
# the OpenMP specification implemented by the ``<lang>`` compiler.
cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if IN_LIST
function(_OPENMP_FLAG_CANDIDATES LANG)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 4e52cb3..b81dd76 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -659,7 +659,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT EXISTS "${target}")
message("warning: target '${target}' does not exist...")
- set(${prerequisites_var} "" PARENT_SCOPE)
return()
endif()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 9cd7b84..a4dd918 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -587,7 +587,6 @@ set(SRCS
cmWriteFileCommand.cxx
cmWriteFileCommand.h
- cm_auto_ptr.hxx
cm_get_date.h
cm_get_date.c
cm_utf8.h
@@ -780,6 +779,8 @@ if(WIN32 AND NOT UNIX)
target_link_libraries(CMakeLib rpcrt4 crypt32)
endif()
+target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS})
+
#
# CTestLib
#
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index b2916b4..d5efe8c 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 9)
-set(CMake_VERSION_PATCH 20170921)
+set(CMake_VERSION_PATCH 20171003)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 7b23005..d3ce15c 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -482,6 +482,15 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->ForcedInstallation = "false";
}
+ // Replaces
+ option = prefix + "REPLACES";
+ if (this->IsSetToEmpty(option)) {
+ this->Replaces.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->Replaces.clear();
+ cmSystemTools::ExpandListArgument(value, this->Replaces);
+ }
+
// Requires admin rights
option = prefix + "REQUIRES_ADMIN_RIGHTS";
if (this->IsSetToEmpty(option)) {
@@ -492,6 +501,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->RequiresAdminRights = "false";
}
+ // Checkable
+ option = prefix + "CHECKABLE";
+ if (this->IsSetToEmpty(option)) {
+ this->Checkable.clear();
+ } else if (this->IsOn(option)) {
+ this->Checkable = "true";
+ } else if (this->IsSetToOff(option)) {
+ this->Checkable = "false";
+ }
+
return 1;
}
@@ -652,6 +671,19 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("ForcedInstallation", this->ForcedInstallation);
}
+ // Replaces
+ if (!this->Replaces.empty()) {
+ std::ostringstream replaces;
+ std::vector<std::string>::iterator it = this->Replaces.begin();
+ replaces << *it;
+ ++it;
+ while (it != this->Replaces.end()) {
+ replaces << "," << *it;
+ ++it;
+ }
+ xout.Element("Replaces", replaces.str());
+ }
+
if (!this->RequiresAdminRights.empty()) {
xout.Element("RequiresAdminRights", this->RequiresAdminRights);
}
@@ -672,6 +704,11 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("SortingPriority", this->SortingPriority);
}
+ // Checkable
+ if (!this->Checkable.empty()) {
+ xout.Element("Checkable", this->Checkable);
+ }
+
xout.EndElement();
xout.EndDocument();
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index cec59b0..ae41146 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -114,9 +114,15 @@ public:
/// Determines that the package must always be installed
std::string ForcedInstallation;
+ /// List of components to replace
+ std::vector<std::string> Replaces;
+
/// Package needs to be installed with elevated permissions
std::string RequiresAdminRights;
+ /// Set to false if you want to hide the checkbox for an item
+ std::string Checkable;
+
public:
// Internal implementation
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 87e7089..a01fc4e 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -162,7 +162,7 @@ protected:
void CharacterDataHandler(const char* data, int length) override
{
std::string content(data, data + length);
- if (content == "" || content == " " || content == " " ||
+ if (content.empty() || content == " " || content == " " ||
content == "\n") {
return;
}
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index bbf2a50..f47ca7a 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -213,8 +213,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
cmSystemTools::ExpandListArgument(sign_files, relFiles);
// sign the files supplied by the user, ie. frameworks.
- for (std::vector<std::string>::iterator it = relFiles.begin();
- it != relFiles.end(); ++it) {
+ for (auto const& file : relFiles) {
std::ostringstream temp_sign_file_cmd;
temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
temp_sign_file_cmd << " " << sign_parameter << " -s \""
@@ -223,11 +222,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID");
temp_sign_file_cmd << " \"";
temp_sign_file_cmd << bundle_path;
- temp_sign_file_cmd << *it << "\"";
+ temp_sign_file_cmd << file << "\"";
if (!this->RunCommand(temp_sign_file_cmd, &output)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Error signing file:" << bundle_path << *it << std::endl
+ "Error signing file:" << bundle_path << file << std::endl
<< output << std::endl);
return 0;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 88204c8..1e1543f 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -136,17 +136,17 @@ int cmCPackDragNDropGenerator::InitializeInternal()
"CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl);
return 0;
}
- for (size_t i = 0; i < languages.size(); ++i) {
- std::string license = slaDirectory + "/" + languages[i] + ".license.txt";
+ for (auto const& language : languages) {
+ std::string license = slaDirectory + "/" + language + ".license.txt";
if (!singleLicense && !cmSystemTools::FileExists(license)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing license file "
- << languages[i] << ".license.txt" << std::endl);
+ << language << ".license.txt" << std::endl);
return 0;
}
- std::string menu = slaDirectory + "/" + languages[i] + ".menu.txt";
+ std::string menu = slaDirectory + "/" + language + ".menu.txt";
if (!cmSystemTools::FileExists(menu)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing menu file "
- << languages[i] << ".menu.txt" << std::endl);
+ << language << ".menu.txt" << std::endl);
return 0;
}
}
@@ -185,19 +185,19 @@ int cmCPackDragNDropGenerator::PackageFiles()
// loop to create dmg files
packageFileNames.clear();
- for (size_t i = 0; i < package_files.size(); i++) {
+ for (auto const& package_file : package_files) {
std::string full_package_name = std::string(toplevel) + std::string("/");
- if (package_files[i] == "ALL_IN_ONE") {
+ if (package_file == "ALL_IN_ONE") {
full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME");
} else {
- full_package_name += package_files[i];
+ full_package_name += package_file;
}
full_package_name += std::string(GetOutputExtension());
packageFileNames.push_back(full_package_name);
std::string src_dir = toplevel;
src_dir += "/";
- src_dir += package_files[i];
+ src_dir += package_file;
if (0 == this->CreateDMG(src_dir, full_package_name)) {
return 0;
@@ -226,14 +226,14 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target,
cmsys::ofstream fout(target.str().c_str(), std::ios::out | std::ios::binary);
if (!fout) {
return false;
- } else {
- // Seek to desired size - 1 byte
- fout.seekp(size - 1, std::ios::beg);
- char byte = 0;
- // Write one byte to ensure file grows
- fout.write(&byte, 1);
}
+ // Seek to desired size - 1 byte
+ fout.seekp(size - 1, std::ios::beg);
+ char byte = 0;
+ // Write one byte to ensure file grows
+ fout.write(&byte, 1);
+
return true;
}
@@ -417,6 +417,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
temp_image_command << " -ov";
temp_image_command << " -srcfolder \"" << staging.str() << "\"";
temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\"";
+ temp_image_command << " -fs HFS+";
temp_image_command << " -format " << temp_image_format;
temp_image_command << " \"" << temp_image << "\"";
@@ -561,8 +562,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
cmCPackLogger(cmCPackLog::LOG_ERROR, languages[i]
<< " is not a recognized language" << std::endl);
}
- char* iso_language_cstr = (char*)malloc(65);
- CFStringGetCString(iso_language, iso_language_cstr, 64,
+ char iso_language_cstr[65];
+ CFStringGetCString(iso_language, iso_language_cstr,
+ sizeof(iso_language_cstr) - 1,
kCFStringEncodingMacRoman);
LangCode lang = 0;
RegionCode region = 0;
@@ -575,11 +577,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
cmCPackLogger(cmCPackLog::LOG_ERROR,
"No language/region code available for "
<< iso_language_cstr << std::endl);
- free(iso_language_cstr);
return 0;
}
#ifdef HAVE_CoreServices
- free(iso_language_cstr);
header_data.push_back(region);
header_data.push_back(i);
header_data.push_back(0);
@@ -769,7 +769,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
bool cmCPackDragNDropGenerator::WriteLicense(
cmGeneratedFileStream& outputStream, int licenseNumber,
- std::string licenseLanguage, std::string licenseFile, std::string* error)
+ std::string licenseLanguage, const std::string& licenseFile,
+ std::string* error)
{
if (!licenseFile.empty() && !singleLicense) {
licenseNumber = 5002;
@@ -795,8 +796,8 @@ bool cmCPackDragNDropGenerator::WriteLicense(
if (!this->BreakLongLine(line, lines, error)) {
return false;
}
- for (size_t i = 0; i < lines.size(); ++i) {
- outputStream << " \"" << lines[i] << "\"\n";
+ for (auto const& l : lines) {
+ outputStream << " \"" << l << "\"\n";
}
}
outputStream << " \"\\n\"\n";
@@ -865,10 +866,11 @@ bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line,
size_t line_length = max_line_length;
if (i + line_length > line.size()) {
line_length = line.size() - i;
- } else
+ } else {
while (line_length > 0 && line[i + line_length - 1] != ' ') {
line_length = line_length - 1;
}
+ }
if (line_length == 0) {
*error = "Please make sure there are no words "
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 8565c68..d8c5c83 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -45,8 +45,8 @@ private:
bool singleLicense;
bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber,
- std::string licenseLanguage, std::string licenseFile,
- std::string* error);
+ std::string licenseLanguage,
+ const std::string& licenseFile, std::string* error);
bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
std::string* error);
void EscapeQuotesAndBackslashes(std::string& line);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index f56b5fa..ecb5adb 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -6,6 +6,7 @@
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
+#include <memory> // IWYU pragma: keep
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -17,7 +18,6 @@
#include "cmStateSnapshot.h"
#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(__HAIKU__)
@@ -156,7 +156,7 @@ int cmCPackGenerator::PrepareNames()
}
const char* algoSignature = this->GetOption("CPACK_PACKAGE_CHECKSUM");
if (algoSignature) {
- if (cmCryptoHash::New(algoSignature).get() == nullptr) {
+ if (!cmCryptoHash::New(algoSignature)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot recognize algorithm: "
<< algoSignature << std::endl);
return 0;
@@ -610,8 +610,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
- CM_AUTO_PTR<cmMakefile> mf(
- new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
if (!installSubDirectory.empty() && installSubDirectory != "/" &&
installSubDirectory != ".") {
tempInstallDirectory += installSubDirectory;
@@ -657,11 +656,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
if (this->GetOption("CPACK_INSTALL_PREFIX")) {
dir += this->GetOption("CPACK_INSTALL_PREFIX");
}
- mf->AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
cmCPackLogger(
cmCPackLog::LOG_DEBUG,
- "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)"
+ "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)"
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'"
@@ -698,8 +697,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
return 0;
}
} else {
- mf->AddDefinition("CMAKE_INSTALL_PREFIX",
- tempInstallDirectory.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX",
+ tempInstallDirectory.c_str());
if (!cmsys::SystemTools::MakeDirectory(
tempInstallDirectory.c_str())) {
@@ -710,7 +709,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Using non-DESTDIR install... (mf->AddDefinition)"
+ "- Using non-DESTDIR install... (mf.AddDefinition)"
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Setting CMAKE_INSTALL_PREFIX to '"
@@ -718,19 +717,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
if (!buildConfig.empty()) {
- mf->AddDefinition("BUILD_TYPE", buildConfig.c_str());
+ mf.AddDefinition("BUILD_TYPE", buildConfig.c_str());
}
std::string installComponentLowerCase =
cmSystemTools::LowerCase(installComponent);
if (installComponentLowerCase != "all") {
- mf->AddDefinition("CMAKE_INSTALL_COMPONENT",
- installComponent.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_COMPONENT",
+ installComponent.c_str());
}
// strip on TRUE, ON, 1, one or several file names, but not on
// FALSE, OFF, 0 and an empty string
if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) {
- mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
+ mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
}
// Remember the list of files before installation
// of the current component (if we are in component install)
@@ -750,7 +749,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION
// then forward request to cmake_install.cmake script
if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) {
- mf->AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
+ mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
}
// If current CPack generator does support
// ABSOLUTE INSTALL DESTINATION or CPack has been asked for
@@ -758,18 +757,17 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// as soon as it occurs (before installing file)
if (!SupportsAbsoluteDestination() ||
this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) {
- mf->AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION",
- "1");
+ mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
}
// do installation
- int res = mf->ReadListFile(installFile.c_str());
+ int res = mf.ReadListFile(installFile.c_str());
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
// to CPack (may be used by generators like CPack RPM or DEB)
// in order to transparently handle ABSOLUTE PATH
- if (mf->GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
- mf->AddDefinition(
+ if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
+ mf.AddDefinition(
"CPACK_ABSOLUTE_DESTINATION_FILES",
- mf->GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
+ mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
}
// Now rebuild the list of files after installation
@@ -803,12 +801,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
}
- if (nullptr != mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (!absoluteDestFiles.empty()) {
absoluteDestFiles += ";";
}
absoluteDestFiles +=
- mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Got some ABSOLUTE DESTINATION FILES: "
<< absoluteDestFiles << std::endl);
@@ -822,13 +820,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
this->GetOption(absoluteDestFileComponent);
absoluteDestFilesListComponent += ";";
absoluteDestFilesListComponent +=
- mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
this->SetOption(absoluteDestFileComponent,
absoluteDestFilesListComponent.c_str());
} else {
this->SetOption(
absoluteDestFileComponent,
- mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
+ mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
}
}
}
@@ -964,7 +962,7 @@ int cmCPackGenerator::DoPackage()
/* Prepare checksum algorithm*/
const char* algo = this->GetOption("CPACK_PACKAGE_CHECKSUM");
- CM_AUTO_PTR<cmCryptoHash> crypto = cmCryptoHash::New(algo ? algo : "");
+ std::unique_ptr<cmCryptoHash> crypto = cmCryptoHash::New(algo ? algo : "");
/*
* Copy the generated packages to final destination
@@ -997,7 +995,7 @@ int cmCPackGenerator::DoPackage()
<< packageFileName << " generated." << std::endl);
/* Generate checksum file */
- if (crypto.get() != nullptr) {
+ if (crypto) {
std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
hashFile += "/" + filename;
hashFile += "." + cmSystemTools::LowerCase(algo);
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index e75061e..8d3c40c 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -144,8 +144,8 @@ int cmCPackOSXX11Generator::PackageFiles()
tmpFile += "/hdiutilOutput.log";
std::ostringstream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
- << "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory
- << "\" \"" << packageFileNames[0] << "\"";
+ << "\" create -ov -fs HFS+ -format UDZO -srcfolder \""
+ << diskImageDirectory << "\" \"" << packageFileNames[0] << "\"";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: "
<< dmgCmd.str() << std::endl);
// since we get random dashboard failures with this one
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 321b6a7..4f5b2a0 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -42,9 +42,9 @@ std::string cmCPackPKGGenerator::GetPackageName(
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-"
<< component.Name << ".pkg";
return out.str();
- } else {
- return component.ArchiveFile + ".pkg";
}
+
+ return component.ArchiveFile + ".pkg";
}
void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 6624b16..0299279 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -275,8 +275,9 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (this->PackageMakerVersion > 2.0) {
pkgCmd << " -v";
}
- if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str()))
+ if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) {
return 0;
+ }
} else {
// We have built the package in place. Generate the
// distribution.dist file to describe it for the installer.
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index ed4463c..6a6dc82 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -190,7 +190,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating installer directory: " << scriptDir
<< std::endl);
- return 0;
+ return false;
}
// if preflight, postflight, or postupgrade are set
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index cc51c60..addb54e 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -5,6 +5,7 @@
#include "cmsys/Encoding.hxx"
#include <iostream>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stddef.h>
#include <string>
@@ -24,7 +25,6 @@
#include "cmMakefile.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
static const char* cmDocumentationName[][2] = {
@@ -192,10 +192,9 @@ int main(int argc, char const* const* argv)
cminst.SetHomeOutputDirectory("");
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator cmgg(&cminst);
- CM_AUTO_PTR<cmMakefile> globalMF(
- new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
+ cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot());
#if defined(__CYGWIN__)
- globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
+ globalMF.AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
bool cpackConfigFileSpecified = true;
@@ -225,16 +224,16 @@ int main(int argc, char const* const* argv)
// find out which system cpack is running on, so it can setup the search
// paths, so FIND_XXX() commands can be used in scripts
std::string systemFile =
- globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
- if (!globalMF->ReadListFile(systemFile.c_str())) {
+ globalMF.GetModulesFile("CMakeDetermineSystem.cmake");
+ if (!globalMF.ReadListFile(systemFile.c_str())) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Error reading CMakeDetermineSystem.cmake" << std::endl);
return 1;
}
systemFile =
- globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake");
- if (!globalMF->ReadListFile(systemFile.c_str())) {
+ globalMF.GetModulesFile("CMakeSystemSpecificInformation.cmake");
+ if (!globalMF.ReadListFile(systemFile.c_str())) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Error reading CMakeSystemSpecificInformation.cmake"
<< std::endl);
@@ -242,7 +241,7 @@ int main(int argc, char const* const* argv)
}
if (!cpackBuildConfig.empty()) {
- globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
+ globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
}
if (cmSystemTools::FileExists(cpackConfigFile.c_str())) {
@@ -250,7 +249,7 @@ int main(int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack configuration file: " << cpackConfigFile
<< std::endl);
- if (!globalMF->ReadListFile(cpackConfigFile.c_str())) {
+ if (!globalMF.ReadListFile(cpackConfigFile.c_str())) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Problem reading CPack config file: \""
<< cpackConfigFile << "\"" << std::endl);
@@ -264,45 +263,44 @@ int main(int argc, char const* const* argv)
}
if (!generator.empty()) {
- globalMF->AddDefinition("CPACK_GENERATOR", generator.c_str());
+ globalMF.AddDefinition("CPACK_GENERATOR", generator.c_str());
}
if (!cpackProjectName.empty()) {
- globalMF->AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName.c_str());
}
if (!cpackProjectVersion.empty()) {
- globalMF->AddDefinition("CPACK_PACKAGE_VERSION",
- cpackProjectVersion.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VERSION",
+ cpackProjectVersion.c_str());
}
if (!cpackProjectVendor.empty()) {
- globalMF->AddDefinition("CPACK_PACKAGE_VENDOR",
- cpackProjectVendor.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VENDOR",
+ cpackProjectVendor.c_str());
}
// if this is not empty it has been set on the command line
// go for it. Command line override values set in config file.
if (!cpackProjectDirectory.empty()) {
- globalMF->AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
+ cpackProjectDirectory.c_str());
}
// The value has not been set on the command line
else {
// get a default value (current working directory)
cpackProjectDirectory = cmsys::SystemTools::GetCurrentWorkingDirectory();
// use default value iff no value has been provided by the config file
- if (!globalMF->IsSet("CPACK_PACKAGE_DIRECTORY")) {
- globalMF->AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) {
+ globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
+ cpackProjectDirectory.c_str());
}
}
for (auto const& cd : definitions.Map) {
- globalMF->AddDefinition(cd.first, cd.second.c_str());
+ globalMF.AddDefinition(cd.first, cd.second.c_str());
}
- const char* cpackModulesPath =
- globalMF->GetDefinition("CPACK_MODULE_PATH");
+ const char* cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
if (cpackModulesPath) {
- globalMF->AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath);
+ globalMF.AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath);
}
- const char* genList = globalMF->GetDefinition("CPACK_GENERATOR");
+ const char* genList = globalMF.GetDefinition("CPACK_GENERATOR");
if (!genList) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "CPack generator not specified"
<< std::endl);
@@ -310,8 +308,8 @@ int main(int argc, char const* const* argv)
std::vector<std::string> generatorsVector;
cmSystemTools::ExpandListArgument(genList, generatorsVector);
for (std::string const& gen : generatorsVector) {
- cmMakefile::ScopePushPop raii(globalMF.get());
- cmMakefile* mf = globalMF.get();
+ cmMakefile::ScopePushPop raii(&globalMF);
+ cmMakefile* mf = &globalMF;
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Specified generator: " << gen << std::endl);
if (parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME")) {
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 28fc113..f4fc769 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -260,11 +260,11 @@ std::string cmCTestBuildHandler::GetMakeCommand()
"MakeCommand:" << makeCommand << "\n", this->Quiet);
std::string configType = this->CTest->GetConfigType();
- if (configType == "") {
+ if (configType.empty()) {
configType =
this->CTest->GetCTestConfiguration("DefaultCTestConfigurationType");
}
- if (configType == "") {
+ if (configType.empty()) {
configType = "Release";
}
@@ -769,6 +769,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
}
std::vector<const char*> argv;
+ argv.reserve(args.size() + 1);
for (std::string const& arg : args) {
argv.push_back(arg.c_str());
}
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 7fe74af..8cb795e 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -214,6 +214,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom)
std::vector<std::string> git_custom_command;
cmSystemTools::ExpandListArgument(custom, git_custom_command, true);
std::vector<char const*> git_custom;
+ git_custom.reserve(git_custom_command.size() + 1);
for (std::string const& i : git_custom_command) {
git_custom.push_back(i.c_str());
}
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 453ae99..a1249f5 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -6,6 +6,7 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include <iostream>
+#include <memory> // IWYU pragma: keep
#include <stdlib.h>
#include <string.h>
@@ -17,7 +18,6 @@
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#ifdef _WIN32
@@ -626,12 +626,12 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if (cmSystemTools::FileExists(fname.c_str()) &&
- mf->ReadListFile(fname.c_str())) {
- this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
+ mf.ReadListFile(fname.c_str())) {
+ this->SourceDir = mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
}
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index c853373..6a7bdc0 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -491,7 +491,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
}
// Next part of the file is the failed tests
while (std::getline(fin, line)) {
- if (line != "") {
+ if (!line.empty()) {
this->LastTestsFailed.push_back(line);
}
}
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 11f6a00..fdf8932 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -464,6 +464,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom)
cmSystemTools::ExpandListArgument(custom, p4_custom_command, true);
std::vector<char const*> p4_custom;
+ p4_custom.reserve(p4_custom_command.size() + 1);
for (std::string const& i : p4_custom_command) {
p4_custom.push_back(i.c_str());
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 56a9cb8..abdb643 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -494,7 +494,7 @@ bool cmCTestRunTest::StartTest(size_t total)
}
}
// log and return if we did not find the executable
- if (this->ActualCommand == "") {
+ if (this->ActualCommand.empty()) {
// if the command was not found create a TestResult object
// that has that information
this->TestProcess = new cmProcess;
@@ -595,7 +595,7 @@ double cmCTestRunTest::ResolveTimeout()
{
double timeout = this->TestProperties->Timeout;
- if (this->CTest->GetStopTime() == "") {
+ if (this->CTest->GetStopTime().empty()) {
return timeout;
}
struct tm* lctime;
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 087eb38..ce96224 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -410,7 +410,7 @@ void cmCTestSVN::DoRevisionSVN(Revision const& revision,
// Ignore changes in the old revision for external repositories
if (revision.Rev == revision.SVNInfo->OldRevision &&
- revision.SVNInfo->LocalPath != "") {
+ !revision.SVNInfo->LocalPath.empty()) {
return;
}
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 137cea9..e51e168 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -496,11 +496,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
? ""
: this->GetOption("RetryCount");
- int delay = retryDelay == ""
+ int delay = retryDelay.empty()
? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryDelay")
.c_str())
: atoi(retryDelay.c_str());
- int count = retryCount == ""
+ int count = retryCount.empty()
? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryCount")
.c_str())
: atoi(retryCount.c_str());
@@ -1032,14 +1032,14 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
? ""
: this->GetOption("RetryCount");
unsigned long retryDelay = 0;
- if (retryDelayString != "") {
+ if (!retryDelayString.empty()) {
if (!cmSystemTools::StringToULong(retryDelayString.c_str(), &retryDelay)) {
cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : "
<< retryDelayString << std::endl);
}
}
unsigned long retryCount = 0;
- if (retryCountString != "") {
+ if (!retryCountString.empty()) {
if (!cmSystemTools::StringToULong(retryCountString.c_str(), &retryCount)) {
cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : "
<< retryCountString << std::endl);
@@ -1361,7 +1361,7 @@ int cmCTestSubmitHandler::ProcessHandler()
std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
- if (dropMethod == "" || dropMethod == "ftp") {
+ if (dropMethod.empty() || dropMethod == "ftp") {
ofs << "Using drop method: FTP" << std::endl;
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Using FTP submit method" << std::endl
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index f3404a5..c7ed927 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -8,6 +8,7 @@
#include <functional>
#include <iomanip>
#include <iterator>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <stdio.h>
@@ -28,7 +29,6 @@
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
#include "cmXMLWriter.h"
-#include "cm_auto_ptr.hxx"
#include "cm_utf8.h"
#include "cmake.h"
#include "cmsys/FStream.hxx"
@@ -1596,7 +1596,7 @@ std::string cmCTestTestHandler::FindExecutable(
// wasn't specified
if (fullPath.empty() && filepath.empty()) {
std::string const path = cmSystemTools::FindProgram(filename.c_str());
- if (path != "") {
+ if (!path.empty()) {
resultingConfig.clear();
return path;
}
@@ -1636,9 +1636,9 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
- this->CTest->GetConfigType().c_str());
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
+ mf.AddDefinition("CTEST_CONFIGURATION_TYPE",
+ this->CTest->GetConfigType().c_str());
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
@@ -1678,7 +1678,7 @@ void cmCTestTestHandler::GetListOfTests()
return;
}
- if (!mf->ReadListFile(testFilename)) {
+ if (!mf.ReadListFile(testFilename)) {
return;
}
if (cmSystemTools::GetErrorOccuredFlag()) {
@@ -1802,7 +1802,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
if (fileNameSubstring != pattern) {
continue;
}
- if (logName == "") {
+ if (logName.empty()) {
logName = fileName;
} else {
// if multiple matching logs were found we use the most recently
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 7173439..786ed5e 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestUpdateHandler.h"
+#include "cmAlgorithms.h"
#include "cmCLocaleEnvironmentScope.h"
#include "cmCTest.h"
#include "cmCTestBZR.h"
@@ -16,7 +17,7 @@
#include "cmVersion.h"
#include "cmXMLWriter.h"
-#include "cm_auto_ptr.hxx"
+#include <memory> // IWYU pragma: keep
#include <sstream>
static const char* cmCTestUpdateHandlerUpdateStrings[] = {
@@ -134,28 +135,28 @@ int cmCTestUpdateHandler::ProcessHandler()
, this->Quiet);
// Create an object to interact with the VCS tool.
- CM_AUTO_PTR<cmCTestVC> vc;
+ std::unique_ptr<cmCTestVC> vc;
switch (this->UpdateType) {
case e_CVS:
- vc.reset(new cmCTestCVS(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestCVS>(this->CTest, ofs);
break;
case e_SVN:
- vc.reset(new cmCTestSVN(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestSVN>(this->CTest, ofs);
break;
case e_BZR:
- vc.reset(new cmCTestBZR(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestBZR>(this->CTest, ofs);
break;
case e_GIT:
- vc.reset(new cmCTestGIT(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestGIT>(this->CTest, ofs);
break;
case e_HG:
- vc.reset(new cmCTestHG(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestHG>(this->CTest, ofs);
break;
case e_P4:
- vc.reset(new cmCTestP4(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestP4>(this->CTest, ofs);
break;
default:
- vc.reset(new cmCTestVC(this->CTest, ofs));
+ vc = cm::make_unique<cmCTestVC>(this->CTest, ofs);
break;
}
vc->SetCommandLineTool(this->UpdateCommand);
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index 7e09ef0..fd7f37a 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -56,6 +56,7 @@ bool cmCTestVC::InitialCheckout(const char* command)
// Construct the initial checkout command line.
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
std::vector<char const*> vc_co;
+ vc_co.reserve(args.size() + 1);
for (std::string const& arg : args) {
vc_co.push_back(arg.c_str());
}
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 3e85339..61ce7d4 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -78,7 +78,7 @@ protected:
}
}
- if (this->CurFileName == "") {
+ if (this->CurFileName.empty()) {
// Check if this is a path that is relative to our source or
// binary directories.
for (std::string const& filePath : FilePaths) {
@@ -91,7 +91,7 @@ protected:
}
cmsys::ifstream fin(this->CurFileName.c_str());
- if (this->CurFileName == "" || !fin) {
+ if (this->CurFileName.empty() || !fin) {
this->CurFileName =
this->Coverage.BinaryDir + "/" + atts[tagCount + 1];
fin.open(this->CurFileName.c_str());
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 4b781a6..6d82cb2 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -71,7 +71,8 @@ public:
}
}
// Based up what was found, add a line to the coverageVector
- if (!beginSet.empty() && line != "" && !blockComFlag && !lineComFlag) {
+ if (!beginSet.empty() && !line.empty() && !blockComFlag &&
+ !lineComFlag) {
coverageVector.push_back(0);
} else {
coverageVector.push_back(-1);
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 56d07e7..7acb5ca 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -36,7 +36,7 @@ protected:
} else if (name == "sourcefile") {
std::string fileName = atts[1];
- if (this->PackagePath == "") {
+ if (this->PackagePath.empty()) {
if (!this->FindPackagePath(fileName)) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: "
<< this->PackageName << "/" << fileName << std::endl);
diff --git a/Source/Checks/cm_cxx_auto_ptr.cxx b/Source/Checks/cm_cxx_auto_ptr.cxx
deleted file mode 100644
index d3100fd..0000000
--- a/Source/Checks/cm_cxx_auto_ptr.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <memory>
-
-std::auto_ptr<int> get_auto_ptr()
-{
- std::auto_ptr<int> ptr;
- ptr = std::auto_ptr<int>(new int(0));
- return ptr;
-}
-
-int use_auto_ptr(std::auto_ptr<int> ptr)
-{
- return *ptr;
-}
-
-int main()
-{
- return use_auto_ptr(get_auto_ptr());
-}
diff --git a/Source/Checks/cm_cxx_eq_delete.cxx b/Source/Checks/cm_cxx_eq_delete.cxx
deleted file mode 100644
index 809e4cf..0000000
--- a/Source/Checks/cm_cxx_eq_delete.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-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 2c39cbe..a30a5e6 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -41,8 +41,6 @@ function(cm_check_cxx_feature name)
endif()
endfunction()
-cm_check_cxx_feature(auto_ptr)
-cm_check_cxx_feature(eq_delete)
cm_check_cxx_feature(fallthrough)
if(NOT CMake_HAVE_CXX_FALLTHROUGH)
cm_check_cxx_feature(gnu_fallthrough)
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index f79e72a..dbd024d 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -17,6 +17,7 @@
#include "cmVersion.h"
#include "cmake.h"
+#include <algorithm>
#include <stdio.h>
#include <string.h>
@@ -353,11 +354,9 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
char secondLine[512] = "";
char thirdLine[512] = "";
if (process) {
- const char* clearLine =
- " ";
- strcpy(firstLine, clearLine);
- strcpy(secondLine, clearLine);
- strcpy(thirdLine, clearLine);
+ memset(firstLine, ' ', 68);
+ memset(secondLine, ' ', 68);
+ memset(thirdLine, ' ', 68);
} else {
if (this->OkToGenerate) {
sprintf(firstLine,
@@ -380,7 +379,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
char fmt[512] =
"Press [enter] to edit option Press [d] to delete an entry";
if (process) {
- strcpy(fmt, " ");
+ memset(fmt, ' ', 27);
}
printw(fmt_s, fmt);
curses_move(y - 3, 0);
@@ -456,41 +455,27 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Join the key, help string and pad with spaces
// (or truncate) as necessary
char bar[cmCursesMainForm::MAX_WIDTH];
- size_t i, curFieldLen = strlen(curField);
+ size_t curFieldLen = strlen(curField);
size_t helpLen = strlen(help);
- size_t width;
- if (x < cmCursesMainForm::MAX_WIDTH) {
- width = x;
- } else {
- width = cmCursesMainForm::MAX_WIDTH;
- }
+ size_t width = std::min<size_t>(x, cmCursesMainForm::MAX_WIDTH);
if (message) {
curField = message;
curFieldLen = strlen(message);
+ strncpy(bar, curField, width);
if (curFieldLen < width) {
- strcpy(bar, curField);
- for (i = curFieldLen; i < width; ++i) {
- bar[i] = ' ';
- }
- } else {
- strncpy(bar, curField, width);
+ memset(bar + curFieldLen, ' ', width - curFieldLen);
}
} else {
- if (curFieldLen >= width) {
- strncpy(bar, curField, width);
- } else {
- strcpy(bar, curField);
+ strncpy(bar, curField, width);
+ if (curFieldLen < width) {
bar[curFieldLen] = ':';
bar[curFieldLen + 1] = ' ';
- if (curFieldLen + helpLen + 2 >= width) {
- strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
- } else {
- strcpy(bar + curFieldLen + 2, help);
- for (i = curFieldLen + helpLen + 2; i < width; ++i) {
- bar[i] = ' ';
- }
+ strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
+ if (curFieldLen + helpLen + 2 < width) {
+ memset(bar + curFieldLen + helpLen + 2, ' ',
+ width - curFieldLen + helpLen + 2);
}
}
}
@@ -503,9 +488,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
char vertmp[128];
sprintf(vertmp, "CMake Version %s", cmVersion::GetCMakeVersion());
size_t sideSpace = (width - strlen(vertmp));
- for (i = 0; i < sideSpace; i++) {
- version[i] = ' ';
- }
+ memset(version, ' ', sideSpace);
sprintf(version + sideSpace, "%s", vertmp);
version[width] = '\0';
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index b6ea75a..69d0ed6 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -370,8 +370,7 @@ std::string cmWrap(char prefix, Range const& r, char suffix,
template <typename Range, typename T>
typename Range::const_iterator cmFindNot(Range const& r, T const& t)
{
- return std::find_if(r.begin(), r.end(),
- std::bind1st(std::not_equal_to<T>(), t));
+ return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; });
}
template <typename Range>
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index e259f4d..e1e11af 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -405,14 +405,8 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source,
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::string barf = source;
- std::string result = mf->ExpandVariablesInString(
- barf, (escapeQuotes ? true : false), (atOnly ? true : false));
- char* res = static_cast<char*>(malloc(result.size() + 1));
- if (!result.empty()) {
- strcpy(res, result.c_str());
- }
- res[result.size()] = '\0';
- return res;
+ std::string result = mf->ExpandVariablesInString(barf, escapeQuotes, atOnly);
+ return strdup(result.c_str());
}
int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
@@ -460,9 +454,7 @@ void CCONV cmFreeArguments(int argc, char** argv)
for (i = 0; i < argc; ++i) {
free(argv[i]);
}
- if (argv) {
- free(argv);
- }
+ free(argv);
}
int CCONV cmGetTotalArgumentSize(int argc, char** argv)
@@ -513,13 +505,12 @@ cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
void* CCONV cmCreateSourceFile(void)
{
- return (void*)new cmCPluginAPISourceFile;
+ return new cmCPluginAPISourceFile;
}
void* CCONV cmCreateNewSourceFile(void*)
{
- cmCPluginAPISourceFile* sf = new cmCPluginAPISourceFile;
- return (void*)sf;
+ return new cmCPluginAPISourceFile;
}
void CCONV cmDestroySourceFile(void* arg)
@@ -552,7 +543,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
cmCPluginAPISourceFileMap::value_type entry(rsf, sf);
i = cmCPluginAPISourceFiles.insert(entry).first;
}
- return (void*)i->second;
+ return i->second;
}
return nullptr;
}
@@ -581,7 +572,7 @@ void* CCONV cmAddSource(void* arg, void* arg2)
// Store the proxy in the map so it can be re-used and deleted later.
cmCPluginAPISourceFiles[rsf] = sf;
- return (void*)sf;
+ return sf;
}
const char* CCONV cmSourceFileGetSourceName(void* arg)
@@ -762,25 +753,19 @@ void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
char* CCONV cmGetFilenameWithoutExtension(const char* name)
{
std::string sres = cmSystemTools::GetFilenameWithoutExtension(name);
- char* result = (char*)malloc(sres.size() + 1);
- strcpy(result, sres.c_str());
- return result;
+ return strdup(sres.c_str());
}
char* CCONV cmGetFilenamePath(const char* name)
{
std::string sres = cmSystemTools::GetFilenamePath(name);
- char* result = (char*)malloc(sres.size() + 1);
- strcpy(result, sres.c_str());
- return result;
+ return strdup(sres.c_str());
}
char* CCONV cmCapitalized(const char* name)
{
std::string sres = cmSystemTools::Capitalized(name);
- char* result = (char*)malloc(sres.size() + 1);
- strcpy(result, sres.c_str());
- return result;
+ return strdup(sres.c_str());
}
void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d60ce55..4ea1493 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -15,6 +15,7 @@
#include <ctype.h>
#include <iostream>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -50,7 +51,6 @@
#include "cmVersion.h"
#include "cmVersionConfig.h"
#include "cmXMLWriter.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(__BEOS__) || defined(__HAIKU__)
@@ -147,7 +147,7 @@ std::string cmCTest::CurrentTime()
std::string cmCTest::GetCostDataFile()
{
std::string fname = this->GetCTestConfiguration("CostDataFile");
- if (fname == "") {
+ if (fname.empty()) {
fname = this->GetBinaryDir() + "/Testing/Temporary/CTestCostData.txt";
}
return fname;
@@ -421,9 +421,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
- mf.get())) {
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
+ if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), &mf)) {
cmCTestOptionalLog(
this, DEBUG, "Cannot find custom configuration file tree" << std::endl,
quiet);
@@ -970,6 +969,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
}
std::vector<const char*> argv;
+ argv.reserve(args.size() + 1);
for (std::string const& a : args) {
argv.push_back(a.c_str());
}
@@ -1123,9 +1123,9 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
*log << "* Run internal CTest" << std::endl;
}
- CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
+ std::unique_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) {
- saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
+ saveEnv = cm::make_unique<cmSystemTools::SaveRestoreEnvironment>();
cmSystemTools::AppendEnv(*environment);
}
@@ -1150,9 +1150,9 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
output->clear();
}
- CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
+ std::unique_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) {
- saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
+ saveEnv = cm::make_unique<cmSystemTools::SaveRestoreEnvironment>();
cmSystemTools::AppendEnv(*environment);
}
@@ -1235,7 +1235,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
{
std::string safevalue(value);
- if (safevalue != "") {
+ if (!safevalue.empty()) {
// Disallow non-filename and non-space whitespace characters.
// If they occur, replace them with ""
//
@@ -1254,7 +1254,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
}
}
- if (safevalue == "") {
+ if (safevalue.empty()) {
safevalue = "(empty)";
}
@@ -2570,6 +2570,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args,
const char* dir, double timeout, Encoding encoding)
{
std::vector<const char*> argv;
+ argv.reserve(args.size() + 1);
for (std::string const& a : args) {
argv.push_back(a.c_str());
}
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index bd4077f..1189606 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -194,6 +194,7 @@ std::string cmCommonTargetGenerator::GetManifests()
this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName);
std::vector<std::string> manifests;
+ manifests.reserve(manifest_srcs.size());
for (cmSourceFile const* manifest_src : manifest_srcs) {
manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat(
this->LocalCommonGenerator->ConvertToRelativePath(
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 9d11fff..9a78aca 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -19,22 +19,13 @@
#cmakedefine HAVE_UNSETENV
#cmakedefine CMAKE_USE_ELF_PARSER
#cmakedefine CMAKE_USE_MACH_PARSER
-#cmakedefine CMake_HAVE_CXX_AUTO_PTR
-#cmakedefine CMake_HAVE_CXX_EQ_DELETE
#cmakedefine CMake_HAVE_CXX_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_GNU_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
-#cmakedefine CMake_HAVE_CXX_UNIQUE_PTR
#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
-
#if defined(CMake_HAVE_CXX_FALLTHROUGH)
#define CM_FALLTHROUGH [[fallthrough]]
#elif defined(CMake_HAVE_CXX_GNU_FALLTHROUGH)
@@ -46,7 +37,7 @@
#endif
#define CM_DISABLE_COPY(Class) \
- Class(Class const&) CM_EQ_DELETE; \
- Class& operator=(Class const&) CM_EQ_DELETE;
+ Class(Class const&) = delete; \
+ Class& operator=(Class const&) = delete;
#endif
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 965f55b..d914eb1 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -2,11 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCryptoHash.h"
+#include "cmAlgorithms.h"
#include "cm_kwiml.h"
#include "cm_rhash.h"
#include "cmsys/FStream.hxx"
#include <string.h>
+#include <memory> // IWYU pragma: keep
+
static unsigned int const cmCryptoHashAlgoToId[] = {
/* clang-format needs this comment to break after the opening brace */
RHASH_MD5, //
@@ -43,39 +46,39 @@ cmCryptoHash::~cmCryptoHash()
rhash_free(this->CTX);
}
-CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo)
+std::unique_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
{
if (strcmp(algo, "MD5") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoMD5));
+ return cm::make_unique<cmCryptoHash>(AlgoMD5);
}
if (strcmp(algo, "SHA1") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA1));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA1);
}
if (strcmp(algo, "SHA224") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA224));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA224);
}
if (strcmp(algo, "SHA256") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA256));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA256);
}
if (strcmp(algo, "SHA384") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA384));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA384);
}
if (strcmp(algo, "SHA512") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA512));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA512);
}
if (strcmp(algo, "SHA3_224") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_224));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA3_224);
}
if (strcmp(algo, "SHA3_256") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_256));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA3_256);
}
if (strcmp(algo, "SHA3_384") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_384));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA3_384);
}
if (strcmp(algo, "SHA3_512") == 0) {
- return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_512));
+ return cm::make_unique<cmCryptoHash>(AlgoSHA3_512);
}
- return CM_AUTO_PTR<cmCryptoHash>(nullptr);
+ return std::unique_ptr<cmCryptoHash>(nullptr);
}
bool cmCryptoHash::IntFromHexDigit(char input, char& output)
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 9c13968..1f2a1b5 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -5,12 +5,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory> // IWYU pragma: keep
#include <stddef.h>
#include <string>
#include <vector>
-#include "cm_auto_ptr.hxx"
-
/**
* @brief Abstract base class for cryptographic hash generators
*/
@@ -42,7 +41,7 @@ public:
/// SHA3_224, SHA3_256, SHA3_384, SHA3_512
/// @return A valid auto pointer if algo is supported or
/// an invalid/NULL pointer otherwise
- static CM_AUTO_PTR<cmCryptoHash> New(const char* algo);
+ static std::unique_ptr<cmCryptoHash> New(const char* algo);
/// @brief Converts a hex character to its binary value (4 bits)
/// @arg input Hex character [0-9a-fA-F].
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index ff62a60..3d816d5 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -11,8 +11,8 @@
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
+#include <memory> // IWYU pragma: keep
#include <stddef.h>
cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
@@ -29,7 +29,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
for (cmCustomCommandLine const& cmdline : cmdlines) {
cmCustomCommandLine argv;
for (std::string const& clarg : cmdline) {
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(clarg);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ this->GE->Parse(clarg);
std::string parsed_arg = cge->Evaluate(this->LG, this->Config);
if (this->CC.GetCommandExpandLists()) {
std::vector<std::string> ExpandedArg;
@@ -44,7 +45,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
std::vector<std::string> depends = this->CC.GetDepends();
for (std::string const& d : depends) {
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
std::vector<std::string> result;
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
result);
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 85dfc7d..f227cf2 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -310,7 +310,7 @@ void cmDependsJavaParserHelper::Error(const char* str)
void cmDependsJavaParserHelper::UpdateCombine(const char* str1,
const char* str2)
{
- if (this->CurrentCombine == "" && str1 != nullptr) {
+ if (this->CurrentCombine.empty() && str1 != nullptr) {
this->CurrentCombine = str1;
}
this->CurrentCombine += ".";
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 2d6d8f9..76374b2 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmELF.h"
-#include "cm_auto_ptr.hxx"
#include "cm_kwiml.h"
#include "cmsys/FStream.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stddef.h>
#include <utility>
@@ -108,7 +108,7 @@ public:
};
// Construct and take ownership of the file stream object.
- cmELFInternal(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
+ cmELFInternal(cmELF* external, std::unique_ptr<cmsys::ifstream>& fin,
ByteOrderType order)
: External(external)
, Stream(*fin.release())
@@ -231,7 +231,7 @@ public:
typedef typename Types::tagtype tagtype;
// Construct with a stream and byte swap indicator.
- cmELFInternalImpl(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
+ cmELFInternalImpl(cmELF* external, std::unique_ptr<cmsys::ifstream>& fin,
ByteOrderType order);
// Return the number of sections as specified by the ELF header.
@@ -424,9 +424,8 @@ private:
};
template <class Types>
-cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
- CM_AUTO_PTR<cmsys::ifstream>& fin,
- ByteOrderType order)
+cmELFInternalImpl<Types>::cmELFInternalImpl(
+ cmELF* external, std::unique_ptr<cmsys::ifstream>& fin, ByteOrderType order)
: cmELFInternal(external, fin, order)
{
// Read the main header.
@@ -682,7 +681,7 @@ cmELF::cmELF(const char* fname)
: Internal(nullptr)
{
// Try to open the file.
- CM_AUTO_PTR<cmsys::ifstream> fin(new cmsys::ifstream(fname));
+ std::unique_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened.
if (!fin.get() || !*fin) {
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index b5b7214..5e2cd53 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -3,6 +3,7 @@
#include "cmExportBuildAndroidMKGenerator.h"
#include <algorithm>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <utility>
@@ -15,7 +16,6 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator()
@@ -126,7 +126,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
// evaluate any generator expressions with the current
// build type of the makefile
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(lib);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(lib);
std::string evaluated =
cge->Evaluate(target->GetLocalGenerator(), config);
bool relpath = false;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index e729632..7f0cb97 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -17,9 +17,9 @@
#include "cmTargetExport.h"
#include "cmake.h"
-#include "cm_auto_ptr.hxx"
#include "cmsys/FStream.hxx"
#include <assert.h>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <string.h>
#include <utility>
@@ -65,18 +65,17 @@ const char* cmExportFileGenerator::GetMainExportFileName() const
bool cmExportFileGenerator::GenerateImportFile()
{
// Open the output file to generate it.
- CM_AUTO_PTR<cmsys::ofstream> foutPtr;
+ std::unique_ptr<cmsys::ofstream> foutPtr;
if (this->AppendMode) {
// Open for append.
- CM_AUTO_PTR<cmsys::ofstream> ap(
- new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
- foutPtr = ap;
+ foutPtr = cm::make_unique<cmsys::ofstream>(this->MainImportFile.c_str(),
+ std::ios::app);
} else {
// Generate atomically and with copy-if-different.
- CM_AUTO_PTR<cmGeneratedFileStream> ap(
+ std::unique_ptr<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->MainImportFile.c_str(), true));
ap->SetCopyIfDifferent(true);
- foutPtr = ap;
+ foutPtr = std::move(ap);
}
if (!foutPtr.get() || !*foutPtr) {
std::string se = cmSystemTools::GetLastSystemError();
@@ -372,7 +371,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories, preprocessRule, true);
this->ReplaceInstallPrefix(dirs);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs =
cge->Evaluate(target->GetLocalGenerator(), "", false, target);
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index cf12d33..50f8cb0 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -4,8 +4,10 @@
#include "cmsys/FStream.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <utility>
+#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -13,7 +15,6 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
class cmExecutionStatus;
@@ -47,16 +48,15 @@ void cmExportLibraryDependenciesCommand::FinalPass()
void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
// Use copy-if-different if not appending.
- CM_AUTO_PTR<cmsys::ofstream> foutPtr;
+ std::unique_ptr<cmsys::ofstream> foutPtr;
if (this->Append) {
- CM_AUTO_PTR<cmsys::ofstream> ap(
- new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
- foutPtr = ap;
+ foutPtr =
+ cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), std::ios::app);
} else {
- CM_AUTO_PTR<cmGeneratedFileStream> ap(
+ std::unique_ptr<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->Filename.c_str(), true));
ap->SetCopyIfDifferent(true);
- foutPtr = ap;
+ foutPtr = std::move(ap);
}
std::ostream& fout = *foutPtr;
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 3e3fea1..1fb9cf8 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -11,9 +11,9 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <utility>
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
@@ -65,7 +65,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, nullptr,
nullptr);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
cmTarget::VisibilityNormal, tgt->Target->GetMakefile());
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 98c5733..fdd5f0c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,6 +10,7 @@
#include "cmsys/String.hxx"
#include <algorithm>
#include <assert.h>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -30,7 +31,6 @@
#include "cmPolicies.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
-#include "cm_auto_ptr.hxx"
#include "cm_sys_stat.h"
#include "cmake.h"
@@ -368,8 +368,8 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
return false;
}
- CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
- if (hash.get()) {
+ std::unique_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ if (hash) {
std::string out = hash->HashFile(args[1]);
if (!out.empty()) {
this->Makefile->AddDefinition(args[2], out.c_str());
@@ -2294,10 +2294,9 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
if (errorArg.GetString().empty()) {
this->SetError(error);
return false;
- } else {
- this->Makefile->AddDefinition(errorArg.GetString(), error.c_str());
- return true;
}
+ this->Makefile->AddDefinition(errorArg.GetString(), error.c_str());
+ return true;
#endif
}
@@ -2629,7 +2628,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO");
std::string expectedHash;
std::string hashMatchMSG;
- CM_AUTO_PTR<cmCryptoHash> hash;
+ std::unique_ptr<cmCryptoHash> hash;
bool showProgress = false;
std::string userpwd;
@@ -2688,8 +2687,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false;
}
- hash =
- CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(cmCryptoHash::AlgoMD5));
+ hash = cm::make_unique<cmCryptoHash>(cmCryptoHash::AlgoMD5);
hashMatchMSG = "MD5 sum";
expectedHash = cmSystemTools::LowerCase(*i);
} else if (*i == "SHOW_PROGRESS") {
@@ -2710,7 +2708,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
std::string algo = i->substr(0, pos);
expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1));
- hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
+ hash = std::unique_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
if (!hash.get()) {
std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: ";
err += algo;
@@ -2906,7 +2904,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
// Verify MD5 sum if requested:
//
- if (hash.get()) {
+ if (hash) {
std::string actualHash = hash->HashFile(file);
if (actualHash.empty()) {
this->SetError("DOWNLOAD cannot compute hash on downloaded file");
@@ -3195,15 +3193,15 @@ void cmFileCommand::AddEvaluationFile(const std::string& inputName,
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression outputGe(lfbt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> outputCge =
+ std::unique_ptr<cmCompiledGeneratorExpression> outputCge =
outputGe.Parse(outputExpr);
cmGeneratorExpression conditionGe(lfbt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> conditionCge =
+ std::unique_ptr<cmCompiledGeneratorExpression> conditionCge =
conditionGe.Parse(condition);
- this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge,
- inputIsContent);
+ this->Makefile->AddEvaluationFile(inputName, std::move(outputCge),
+ std::move(conditionCge), inputIsContent);
}
bool cmFileCommand::HandleGenerateCommand(std::vector<std::string> const& args)
diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx
index 62f52e5..f9afeef 100644
--- a/Source/cmFilePathChecksum.cxx
+++ b/Source/cmFilePathChecksum.cxx
@@ -13,10 +13,10 @@ cmFilePathChecksum::cmFilePathChecksum()
{
}
-cmFilePathChecksum::cmFilePathChecksum(const std::string& currentSrcDir,
- const std::string& currentBinDir,
- const std::string& projectSrcDir,
- const std::string& projectBinDir)
+cmFilePathChecksum::cmFilePathChecksum(std::string const& currentSrcDir,
+ std::string const& currentBinDir,
+ std::string const& projectSrcDir,
+ std::string const& projectBinDir)
{
setupParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
}
@@ -29,36 +29,35 @@ cmFilePathChecksum::cmFilePathChecksum(cmMakefile* makefile)
makefile->GetHomeOutputDirectory());
}
-void cmFilePathChecksum::setupParentDirs(const std::string& currentSrcDir,
- const std::string& currentBinDir,
- const std::string& projectSrcDir,
- const std::string& projectBinDir)
+void cmFilePathChecksum::setupParentDirs(std::string const& currentSrcDir,
+ std::string const& currentBinDir,
+ std::string const& projectSrcDir,
+ std::string const& projectBinDir)
{
- parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
- parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
- parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
- parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
+ this->parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
+ this->parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
+ this->parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
+ this->parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
- parentDirs[0].second = "CurrentSource";
- parentDirs[1].second = "CurrentBinary";
- parentDirs[2].second = "ProjectSource";
- parentDirs[3].second = "ProjectBinary";
+ this->parentDirs[0].second = "CurrentSource";
+ this->parentDirs[1].second = "CurrentBinary";
+ this->parentDirs[2].second = "ProjectSource";
+ this->parentDirs[3].second = "ProjectBinary";
}
-std::string cmFilePathChecksum::get(const std::string& filePath) const
+std::string cmFilePathChecksum::get(std::string const& filePath) const
{
std::string relPath;
std::string relSeed;
{
- const std::string fileReal = cmsys::SystemTools::GetRealPath(filePath);
+ std::string const fileReal = cmsys::SystemTools::GetRealPath(filePath);
std::string parentDir;
// Find closest project parent directory
- for (size_t ii = 0; ii != numParentDirs; ++ii) {
- const std::string& pDir = parentDirs[ii].first;
- if (!pDir.empty() &&
- cmsys::SystemTools::IsSubDirectory(fileReal, pDir)) {
- relSeed = parentDirs[ii].second;
- parentDir = pDir;
+ for (auto const& pDir : this->parentDirs) {
+ if (!pDir.first.empty() &&
+ cmsys::SystemTools::IsSubDirectory(fileReal, pDir.first)) {
+ parentDir = pDir.first;
+ relSeed = pDir.second;
break;
}
}
@@ -77,11 +76,11 @@ std::string cmFilePathChecksum::get(const std::string& filePath) const
cmCryptoHash(cmCryptoHash::AlgoSHA256).ByteHashString(relSeed + relPath);
// Convert binary checksum to string
- return cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(),
+ return cmBase32Encoder().encodeString(&hashBytes.front(), hashBytes.size(),
false);
}
-std::string cmFilePathChecksum::getPart(const std::string& filePath,
+std::string cmFilePathChecksum::getPart(std::string const& filePath,
size_t length) const
{
return get(filePath).substr(0, length);
diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h
index 9d570eb..48b5da0 100644
--- a/Source/cmFilePathChecksum.h
+++ b/Source/cmFilePathChecksum.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <array>
#include <stddef.h>
#include <string>
#include <utility>
@@ -29,37 +30,35 @@ public:
cmFilePathChecksum();
/// @brief Initilizes the parent directories manually
- cmFilePathChecksum(const std::string& currentSrcDir,
- const std::string& currentBinDir,
- const std::string& projectSrcDir,
- const std::string& projectBinDir);
+ cmFilePathChecksum(std::string const& currentSrcDir,
+ std::string const& currentBinDir,
+ std::string const& projectSrcDir,
+ std::string const& projectBinDir);
/// @brief Initilizes the parent directories from a makefile
cmFilePathChecksum(cmMakefile* makefile);
/// @brief Allows parent directories setup after construction
///
- void setupParentDirs(const std::string& currentSrcDir,
- const std::string& currentBinDir,
- const std::string& projectSrcDir,
- const std::string& projectBinDir);
+ void setupParentDirs(std::string const& currentSrcDir,
+ std::string const& currentBinDir,
+ std::string const& projectSrcDir,
+ std::string const& projectBinDir);
/* @brief Calculates the path checksum for the parent directory of a file
*
*/
- std::string get(const std::string& filePath) const;
+ std::string get(std::string const& filePath) const;
/* @brief Same as get() but returns only the first length characters
*
*/
- std::string getPart(const std::string& filePath,
+ std::string getPart(std::string const& filePath,
size_t length = partLengthDefault) const;
private:
- /// Size of the parent directory list
- static const size_t numParentDirs = 4;
/// List of (directory name, seed name) pairs
- std::pair<std::string, std::string> parentDirs[numParentDirs];
+ std::array<std::pair<std::string, std::string>, 4> parentDirs;
};
#endif
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 61e419c..622c15e 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -116,18 +116,22 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1,
// Compare using nanosecond resolution.
if (s1->st_mtimespec.tv_sec < s2->st_mtimespec.tv_sec) {
return -1;
- } else if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) {
+ }
+ if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) {
return 1;
- } else if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) {
+ }
+ if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) {
return -1;
- } else if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) {
+ }
+ if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) {
return 1;
}
#else
// Compare using 1 second resolution.
if (s1->st_mtime < s2->st_mtime) {
return -1;
- } else if (s1->st_mtime > s2->st_mtime) {
+ }
+ if (s1->st_mtime > s2->st_mtime) {
return 1;
}
#endif
@@ -162,20 +166,20 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1,
long long t2 = s2->st_mtimespec.tv_sec * bil + s2->st_mtimespec.tv_nsec;
if (t1 < t2) {
return (t2 - t1) >= bil;
- } else if (t2 < t1) {
+ }
+ if (t2 < t1) {
return (t1 - t2) >= bil;
- } else {
- return false;
}
+ return false;
#else
// Times are integers in units of 1s.
if (s1->st_mtime < s2->st_mtime) {
return (s2->st_mtime - s1->st_mtime) >= 1;
- } else if (s1->st_mtime > s2->st_mtime) {
+ }
+ if (s1->st_mtime > s2->st_mtime) {
return (s1->st_mtime - s2->st_mtime) >= 1;
- } else {
- return false;
}
+ return false;
#endif
#else
// Times are integers in units of 100ns.
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 09a9648..758da2c 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -68,8 +68,8 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
this->AddArchitecturePaths("x32");
}
- std::string library = this->FindLibrary();
- if (library != "") {
+ std::string const library = this->FindLibrary();
+ if (!library.empty()) {
// Save the value in the cache
this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(),
this->VariableDocumentation.c_str(),
@@ -260,7 +260,7 @@ void cmFindLibraryHelper::RegexFromLiteral(std::string& out,
out += "\\";
}
#if defined(_WIN32) || defined(__APPLE__)
- out += tolower(ch);
+ out += static_cast<char>(tolower(ch));
#else
out += ch;
#endif
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index cd55e89..5a72655 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -13,6 +13,7 @@
#include <deque>
#include <functional>
#include <iterator>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <string.h>
@@ -24,7 +25,6 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmVersion.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(__HAIKU__)
@@ -1611,10 +1611,10 @@ protected:
private:
bool Search(cmFileList&);
virtual bool Search(std::string const& parent, cmFileList&) = 0;
- virtual CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const = 0;
+ virtual std::unique_ptr<cmFileListGeneratorBase> Clone() const = 0;
friend class cmFileList;
cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next);
- CM_AUTO_PTR<cmFileListGeneratorBase> Next;
+ std::unique_ptr<cmFileListGeneratorBase> Next;
};
class cmFileList
@@ -1638,7 +1638,7 @@ public:
}
bool Search()
{
- if (this->First.get()) {
+ if (this->First) {
return this->First->Search(*this);
}
return false;
@@ -1647,7 +1647,7 @@ public:
private:
virtual bool Visit(std::string const& fullPath) = 0;
friend class cmFileListGeneratorBase;
- CM_AUTO_PTR<cmFileListGeneratorBase> First;
+ std::unique_ptr<cmFileListGeneratorBase> First;
cmFileListGeneratorBase* Last;
};
@@ -1688,7 +1688,7 @@ cmFileListGeneratorBase* cmFileListGeneratorBase::SetNext(
bool cmFileListGeneratorBase::Consider(std::string const& fullPath,
cmFileList& listing)
{
- if (this->Next.get()) {
+ if (this->Next) {
return this->Next->Search(fullPath + "/", listing);
}
return listing.Visit(fullPath + "/");
@@ -1715,9 +1715,9 @@ private:
std::string fullPath = parent + this->String;
return this->Consider(fullPath, lister);
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(
+ std::unique_ptr<cmFileListGeneratorBase> g(
new cmFileListGeneratorFixed(*this));
return g;
}
@@ -1748,9 +1748,9 @@ private:
}
return false;
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(
+ std::unique_ptr<cmFileListGeneratorBase> g(
new cmFileListGeneratorEnumerate(*this));
return g;
}
@@ -1820,9 +1820,9 @@ private:
}
return false;
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(
+ std::unique_ptr<cmFileListGeneratorBase> g(
new cmFileListGeneratorProject(*this));
return g;
}
@@ -1874,9 +1874,9 @@ private:
}
return false;
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(
+ std::unique_ptr<cmFileListGeneratorBase> g(
new cmFileListGeneratorMacProject(*this));
return g;
}
@@ -1918,9 +1918,9 @@ private:
}
return false;
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(
+ std::unique_ptr<cmFileListGeneratorBase> g(
new cmFileListGeneratorCaseInsensitive(*this));
return g;
}
@@ -1963,10 +1963,9 @@ private:
}
return false;
}
- CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const override
+ std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
- CM_AUTO_PTR<cmFileListGeneratorBase> g(new cmFileListGeneratorGlob(*this));
- return g;
+ return cm::make_unique<cmFileListGeneratorGlob>(*this);
}
};
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index a5dc1c6..2059b3d 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -97,8 +97,8 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
return true;
}
- std::string result = FindProgram();
- if (result != "") {
+ std::string const result = FindProgram();
+ if (!result.empty()) {
// Save the value in the cache
this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(),
this->VariableDocumentation.c_str(),
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 37387b0..542a860 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmForEachCommand.h"
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -9,7 +10,6 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
@@ -35,7 +35,8 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endofreach for this statement
if (!this->Depth) {
// Remove the function blocker for this scope or bail.
- CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
+ std::unique_ptr<cmFunctionBlocker> fb(
+ mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
@@ -181,7 +182,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
{
- CM_AUTO_PTR<cmForEachFunctionBlocker> f(
+ std::unique_ptr<cmForEachFunctionBlocker> f(
new cmForEachFunctionBlocker(this->Makefile));
f->Args.push_back(args[0]);
@@ -213,7 +214,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
}
}
- this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass auto_ptr
+ this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass unique_ptr
return true;
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index d4b501f..86991c1 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -3,6 +3,7 @@
#include "cmGeneratorExpression.h"
#include "cmsys/RegularExpression.hxx"
+#include <memory> // IWYU pragma: keep
#include <utility>
#include "assert.h"
@@ -12,7 +13,6 @@
#include "cmGeneratorExpressionLexer.h"
#include "cmGeneratorExpressionParser.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
cmGeneratorExpression::cmGeneratorExpression(
const cmListFileBacktrace& backtrace)
@@ -20,14 +20,14 @@ cmGeneratorExpression::cmGeneratorExpression(
{
}
-CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
+std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
std::string const& input)
{
- return CM_AUTO_PTR<cmCompiledGeneratorExpression>(
+ return std::unique_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(this->Backtrace, input));
}
-CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
+std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
const char* input)
{
return this->Parse(std::string(input ? input : ""));
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index d22a191..cface0d 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -7,8 +7,8 @@
#include "cmListFileCache.h"
-#include "cm_auto_ptr.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <string>
#include <vector>
@@ -39,8 +39,9 @@ public:
cmListFileBacktrace const& backtrace = cmListFileBacktrace());
~cmGeneratorExpression();
- CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(std::string const& input);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(const char* input);
+ std::unique_ptr<cmCompiledGeneratorExpression> Parse(
+ std::string const& input);
+ std::unique_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
enum PreprocessContext
{
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index ace9609..87b6b34 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -3,6 +3,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmsys/FStream.hxx"
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <utility>
@@ -13,17 +14,16 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
const std::string& input,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent,
- cmPolicies::PolicyStatus policyStatusCMP0070)
+ std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
+ std::unique_ptr<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070)
: Input(input)
- , OutputFileExpr(outputFileExpr)
- , Condition(condition)
+ , OutputFileExpr(std::move(outputFileExpr))
+ , Condition(std::move(condition))
, InputIsContent(inputIsContent)
, PolicyStatusCMP0070(policyStatusCMP0070)
{
@@ -144,7 +144,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace();
cmGeneratorExpression contentGE(lfbt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> inputExpression =
+ std::unique_ptr<cmCompiledGeneratorExpression> inputExpression =
contentGE.Parse(inputContent);
std::map<std::string, std::string> outputFiles;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index ecf919d..2a79069 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -6,12 +6,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
+#include <memory> // IWYU pragma: keep
#include <string>
#include <vector>
#include "cmGeneratorExpression.h"
#include "cmPolicies.h"
-#include "cm_auto_ptr.hxx"
#include "cm_sys_stat.h"
class cmLocalGenerator;
@@ -21,9 +21,9 @@ class cmGeneratorExpressionEvaluationFile
public:
cmGeneratorExpressionEvaluationFile(
const std::string& input,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent,
- cmPolicies::PolicyStatus policyStatusCMP0070);
+ std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
+ std::unique_ptr<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070);
void Generate(cmLocalGenerator* lg);
@@ -47,8 +47,8 @@ private:
private:
const std::string Input;
- const CM_AUTO_PTR<cmCompiledGeneratorExpression> OutputFileExpr;
- const CM_AUTO_PTR<cmCompiledGeneratorExpression> Condition;
+ const std::unique_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
+ const std::unique_ptr<cmCompiledGeneratorExpression> Condition;
std::vector<std::string> Files;
const bool InputIsContent;
cmPolicies::PolicyStatus PolicyStatusCMP0070;
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 8f32410..fea20ba 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -17,7 +17,6 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#include "cmsys/RegularExpression.hxx"
@@ -26,6 +25,7 @@
#include <assert.h>
#include <errno.h>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <stdlib.h>
@@ -39,7 +39,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
cmGeneratorExpressionDAGChecker* dagChecker)
{
cmGeneratorExpression ge(context->Backtrace);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
std::string result =
cge->Evaluate(lg, context->Config, context->Quiet, headTarget,
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 28b43e7..ea41204e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -7,6 +7,7 @@
#include <assert.h>
#include <errno.h>
#include <iterator>
+#include <memory> // IWYU pragma: keep
#include <queue>
#include <sstream>
#include <stdio.h>
@@ -32,7 +33,6 @@
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
#include "cmTargetPropertyComputer.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
class cmMessenger;
@@ -64,13 +64,13 @@ class cmGeneratorTarget::TargetPropertyEntry
static cmLinkImplItem NoLinkImplItem;
public:
- TargetPropertyEntry(CM_AUTO_PTR<cmCompiledGeneratorExpression> cge,
+ TargetPropertyEntry(std::unique_ptr<cmCompiledGeneratorExpression> cge,
cmLinkImplItem const& item = NoLinkImplItem)
- : ge(cge)
+ : ge(std::move(cge))
, LinkImplItem(item)
{
}
- const CM_AUTO_PTR<cmCompiledGeneratorExpression> ge;
+ const std::unique_ptr<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem;
};
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
@@ -84,9 +84,10 @@ void CreatePropertyGeneratorExpressions(
for (std::vector<std::string>::const_iterator it = entries.begin();
it != entries.end(); ++it, ++btIt) {
cmGeneratorExpression ge(*btIt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
- items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
+ items.push_back(
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
}
}
@@ -309,7 +310,7 @@ std::string cmGeneratorTarget::GetOutputName(
// Now evaluate genex and update the previously-prepared map entry.
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
i->second = cge->Evaluate(this->LocalGenerator, config);
} else if (i->second.empty()) {
// An empty map entry indicates we have been called recursively
@@ -333,9 +334,9 @@ void cmGeneratorTarget::AddSourceCommon(const std::string& src)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true);
- this->SourceEntries.push_back(new TargetPropertyEntry(cge));
+ this->SourceEntries.push_back(new TargetPropertyEntry(std::move(cge)));
this->ClearSourcesCache();
}
@@ -359,13 +360,14 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
this->Target->InsertInclude(src, this->Makefile->GetBacktrace(), before);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true);
// Insert before begin/end
std::vector<TargetPropertyEntry*>::iterator pos = before
? this->IncludeDirectoriesEntries.begin()
: this->IncludeDirectoriesEntries.end();
- this->IncludeDirectoriesEntries.insert(pos, new TargetPropertyEntry(cge));
+ this->IncludeDirectoriesEntries.insert(
+ pos, new TargetPropertyEntry(std::move(cge)));
}
std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
@@ -795,10 +797,10 @@ static void AddInterfaceEntries(
if (lib.Target) {
std::string genex = "$<TARGET_PROPERTY:" + lib + "," + prop + ">";
cmGeneratorExpression ge(lib.Backtrace);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
cge->SetEvaluateForBuildsystem(true);
entries.push_back(
- new cmGeneratorTarget::TargetPropertyEntry(cge, lib));
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge), lib));
}
}
}
@@ -2285,7 +2287,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for target references in generator expressions.
for (std::string const& cl : cCmdLine) {
- const CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cl);
+ const std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cl);
cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true);
std::set<cmGeneratorTarget*> geTargets = cge->GetTargets();
targets.insert(geTargets.begin(), geTargets.end());
@@ -2570,10 +2572,10 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
libDir = frameworkCheck.match(1);
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
linkInterfaceIncludeDirectoriesEntries.push_back(
- new cmGeneratorTarget::TargetPropertyEntry(cge));
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
}
}
@@ -2781,10 +2783,10 @@ void cmGeneratorTarget::GetCompileDefinitions(
}
case cmPolicies::OLD: {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp);
linkInterfaceCompileDefinitionsEntries.push_back(
- new cmGeneratorTarget::TargetPropertyEntry(cge));
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
} break;
case cmPolicies::NEW:
case cmPolicies::REQUIRED_ALWAYS:
@@ -4214,7 +4216,7 @@ void cmGeneratorTarget::ExpandLinkItems(
dagChecker.SetTransitivePropertiesOnly();
}
std::vector<std::string> libs;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
false, headTarget, this,
&dagChecker),
@@ -4484,7 +4486,8 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory.
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(config_outdir);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(config_outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory.
@@ -4492,7 +4495,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
} else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory.
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a
@@ -5222,7 +5225,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "LINK_LIBRARIES", nullptr, nullptr);
cmGeneratorExpression ge(*btIt);
- CM_AUTO_PTR<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
+ std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
std::string const evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 4f799ba..a31e415 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -363,7 +363,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
this->GeneratorTarget->GetCreateRuleVariable(language, config);
bool useWatcomQuote =
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->GetGlobalGenerator()->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 958aa05..05efff3 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -447,15 +447,6 @@ void cmGlobalGenerator::EnableLanguage(
"Platform information initialized", cmStateEnums::INTERNAL);
}
- // find and make sure CMAKE_MAKE_PROGRAM is defined
- if (!this->FindMakeProgram(mf)) {
- return;
- }
-
- if (!this->CheckLanguages(languages, mf)) {
- return;
- }
-
// try and load the CMakeSystem.cmake if it is there
std::string fpath = rootBin;
bool const readCMakeSystem = !mf->GetDefinition("CMAKE_SYSTEM_LOADED");
@@ -500,6 +491,11 @@ void cmGlobalGenerator::EnableLanguage(
}
if (readCMakeSystem) {
+ // Find the native build tool for this generator.
+ if (!this->FindMakeProgram(mf)) {
+ return;
+ }
+
// Tell the generator about the target system.
std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if (!this->SetSystemName(system, mf)) {
@@ -522,6 +518,12 @@ void cmGlobalGenerator::EnableLanguage(
}
}
+ // Check that the languages are supported by the generator and its
+ // native build tool found above.
+ if (!this->CheckLanguages(languages, mf)) {
+ return;
+ }
+
// **** Load the system specific initialization if not yet loaded
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) {
fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake");
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3e9e995..d5531cb 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -10,6 +10,7 @@
#include <ctype.h>
#include <functional>
#include <iterator>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
@@ -32,7 +33,6 @@
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmVersion.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
class cmLinkLineComputer;
@@ -1692,9 +1692,10 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
snapshot.GetDirectory().SetRelativePathTopSource(dir_top_src.c_str());
snapshot.GetDirectory().SetRelativePathTopBinary(dir_top_bld.c_str());
- CM_AUTO_PTR<cmMakefile> mfd(new cmMakefile(this, snapshot));
- CM_AUTO_PTR<cmLocalNinjaGenerator> lgd(static_cast<cmLocalNinjaGenerator*>(
- this->CreateLocalGenerator(mfd.get())));
+ auto mfd = cm::make_unique<cmMakefile>(this, snapshot);
+ std::unique_ptr<cmLocalNinjaGenerator> lgd(
+ static_cast<cmLocalNinjaGenerator*>(
+ this->CreateLocalGenerator(mfd.get())));
this->Makefiles.push_back(mfd.release());
this->LocalGenerators.push_back(lgd.release());
}
@@ -1869,7 +1870,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cmake cm(cmake::RoleInternal);
cm.SetHomeDirectory(dir_top_src);
cm.SetHomeOutputDirectory(dir_top_bld);
- CM_AUTO_PTR<cmGlobalNinjaGenerator> ggd(
+ std::unique_ptr<cmGlobalNinjaGenerator> ggd(
static_cast<cmGlobalNinjaGenerator*>(cm.CreateGlobalGenerator("Ninja")));
if (!ggd.get() ||
!ggd->WriteDyndepFile(dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld,
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 15ddeff..be40126 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -230,7 +230,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
// The all and preinstall rules might never have any dependencies
// added to them.
- if (this->EmptyRuleHackDepends != "") {
+ if (!this->EmptyRuleHackDepends.empty()) {
depends.push_back(this->EmptyRuleHackDepends);
}
@@ -438,7 +438,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
// Work-around for makes that drop rules that have no dependencies
// or commands.
- if (depends.empty() && this->EmptyRuleHackDepends != "") {
+ if (depends.empty() && !this->EmptyRuleHackDepends.empty()) {
depends.push_back(this->EmptyRuleHackDepends);
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 8c1111e..a14b5f7 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -708,7 +708,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
const char* propertyValue =
target->Target->GetMakefile()->GetDefinition(propertyName);
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(propertyValue);
if (cmSystemTools::IsOn(
cge->Evaluate(target->GetLocalGenerator(), *i))) {
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index ece2a77..0651536 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -150,7 +150,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
{
std::string dir = this->GetUserMacrosDirectory();
- if (dir != "") {
+ if (!dir.empty()) {
std::string src = cmSystemTools::GetCMakeRoot();
src += "/Templates/" CMAKE_VSMACROS_FILENAME;
@@ -190,7 +190,7 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro(
// - the CMake vsmacros file is registered
// - there were .sln/.vcproj files changed during generation
//
- if (dir != "") {
+ if (!dir.empty()) {
std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
std::string nextSubkeyName;
if (cmSystemTools::FileExists(macrosFile.c_str()) &&
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2a05d4e..304a188 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -5,10 +5,12 @@
#include "cmsys/RegularExpression.hxx"
#include <assert.h>
#include <iomanip>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <string.h>
+#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
#include "cmDocumentationEntry.h"
@@ -29,7 +31,6 @@
#include "cmXCode21Object.h"
#include "cmXCodeObject.h"
#include "cmXCodeScheme.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
struct cmLinkImplementation;
@@ -46,8 +47,11 @@ public:
: Version("1.5")
{
}
- void StartElement(const std::string&, const char**) { this->Data = ""; }
- void EndElement(const std::string& name)
+ void StartElement(const std::string&, const char**) override
+ {
+ this->Data = "";
+ }
+ void EndElement(const std::string& name) override
{
if (name == "key") {
this->Key = this->Data;
@@ -57,7 +61,7 @@ public:
}
}
}
- void CharacterDataHandler(const char* data, int length)
+ void CharacterDataHandler(const char* data, int length) override
{
this->Data.append(data, length);
}
@@ -107,9 +111,8 @@ public:
{
if (this->Group) {
return this->Group;
- } else {
- return this->Generator->CreateString(this->String);
}
+ return this->Generator->CreateString(this->String);
}
};
@@ -160,8 +163,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
const std::string& name, cmake* cm) const
{
- if (name != GetActualName())
+ if (name != GetActualName()) {
return nullptr;
+ }
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser;
std::string versionFile;
@@ -197,8 +201,8 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
return nullptr;
}
- CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
- new cmGlobalXCodeGenerator(cm, version_string, version_number));
+ auto gg = cm::make_unique<cmGlobalXCodeGenerator>(cm, version_string,
+ version_number);
return gg.release();
#else
std::cerr << "CMake should be built with cmake to use Xcode, "
@@ -236,10 +240,9 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
makeProgram = "xcodebuild";
}
return makeProgram;
- } else {
- // Use cmakexbuild wrapper to suppress environment dump from output.
- return cmSystemTools::GetCMakeCommand() + "xbuild";
}
+ // Use cmakexbuild wrapper to suppress environment dump from output.
+ return cmSystemTools::GetCMakeCommand() + "xbuild";
}
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
@@ -434,18 +437,13 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// now make the allbuild depend on all the non-utility targets
// in the project
- for (std::vector<cmLocalGenerator*>::iterator i = gens.begin();
- i != gens.end(); ++i) {
- cmLocalGenerator* lg = *i;
- if (this->IsExcluded(root, *i)) {
+ for (auto& gen : gens) {
+ if (this->IsExcluded(root, gen)) {
continue;
}
- const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
- l != tgts.end(); l++) {
- cmGeneratorTarget* target = *l;
-
+ const std::vector<cmGeneratorTarget*>& tgts = gen->GetGeneratorTargets();
+ for (auto target : tgts) {
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
@@ -471,7 +469,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
cmCustomCommandLines commandLines;
commandLines.push_back(makeHelper);
std::vector<std::string> no_byproducts;
- lg->GetMakefile()->AddCustomCommandToTarget(
+ gen->GetMakefile()->AddCustomCommandToTarget(
target->GetName(), no_byproducts, no_depends, commandLines,
cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true,
false, "", false, cmMakefile::AcceptObjectLibraryCommands);
@@ -483,7 +481,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
}
// Refer to the build configuration file for easy editing.
- listfile = lg->GetCurrentSourceDirectory();
+ listfile = gen->GetCurrentSourceDirectory();
listfile += "/";
listfile += "CMakeLists.txt";
target->AddSource(listfile);
@@ -495,9 +493,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens)
{
std::vector<std::string> lfiles;
- for (std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin();
- gi != gens.end(); ++gi) {
- std::vector<std::string> const& lf = (*gi)->GetMakefile()->GetListFiles();
+ for (auto gen : gens) {
+ std::vector<std::string> const& lf = gen->GetMakefile()->GetListFiles();
lfiles.insert(lfiles.end(), lf.begin(), lf.end());
}
@@ -557,8 +554,8 @@ void cmGlobalXCodeGenerator::SortXCodeObjects()
void cmGlobalXCodeGenerator::ClearXCodeObjects()
{
this->TargetDoneSet.clear();
- for (unsigned int i = 0; i < this->XCodeObjects.size(); ++i) {
- delete this->XCodeObjects[i];
+ for (auto& obj : this->XCodeObjects) {
+ delete obj;
}
this->XCodeObjects.clear();
this->XCodeObjectIDs.clear();
@@ -572,7 +569,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj)
{
if (obj->GetType() == cmXCodeObject::OBJECT) {
- std::string id = obj->GetId();
+ const std::string& id = obj->GetId();
// If this is a duplicate id, it's an error:
//
@@ -669,7 +666,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
if (const char* cflags = sf->GetProperty("COMPILE_FLAGS")) {
cmGeneratorExpression ge;
std::string configName = "NO-PER-CONFIG-SUPPORT-IN-XCODE";
- CM_AUTO_PTR<cmCompiledGeneratorExpression> compiledExpr = ge.Parse(cflags);
+ std::unique_ptr<cmCompiledGeneratorExpression> compiledExpr =
+ ge.Parse(cflags);
const char* processed = compiledExpr->Evaluate(lg, configName);
if (compiledExpr->GetHadContextSensitiveCondition()) {
std::ostringstream e;
@@ -931,13 +929,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
cmSortedTargets;
cmSortedTargets sortedTargets;
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
- l != tgts.end(); l++) {
- sortedTargets[(*l)->GetName()] = *l;
+ for (auto tgt : tgts) {
+ sortedTargets[tgt->GetName()] = tgt;
}
- for (cmSortedTargets::iterator l = sortedTargets.begin();
- l != sortedTargets.end(); l++) {
- cmGeneratorTarget* gtgt = l->second;
+ for (auto& sortedTarget : sortedTargets) {
+ cmGeneratorTarget* gtgt = sortedTarget.second;
std::string targetName = gtgt->GetName();
@@ -1040,9 +1036,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
sourceBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (std::vector<cmXCodeObject*>::iterator i = sourceFiles.begin();
- i != sourceFiles.end(); ++i) {
- buildFiles->AddObject(*i);
+ for (auto& sourceFile : sourceFiles) {
+ buildFiles->AddObject(sourceFile);
}
sourceBuildPhase->AddAttribute("files", buildFiles);
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
@@ -1058,9 +1053,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
headerBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (std::vector<cmXCodeObject*>::iterator i = headerFiles.begin();
- i != headerFiles.end(); ++i) {
- buildFiles->AddObject(*i);
+ for (auto& headerFile : headerFiles) {
+ buildFiles->AddObject(headerFile);
}
headerBuildPhase->AddAttribute("files", buildFiles);
headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
@@ -1077,9 +1071,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
resourceBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (std::vector<cmXCodeObject*>::iterator i = resourceFiles.begin();
- i != resourceFiles.end(); ++i) {
- buildFiles->AddObject(*i);
+ for (auto& resourceFile : resourceFiles) {
+ buildFiles->AddObject(resourceFile);
}
resourceBuildPhase->AddAttribute("files", buildFiles);
resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
@@ -1187,9 +1180,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
this->CreateString("2147483647"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
frameworkBuildPhase->AddAttribute("files", buildFiles);
- for (std::vector<cmXCodeObject*>::iterator i = externalObjFiles.begin();
- i != externalObjFiles.end(); ++i) {
- buildFiles->AddObject(*i);
+ for (auto& externalObjFile : externalObjFiles) {
+ buildFiles->AddObject(externalObjFile);
}
frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0"));
@@ -1210,14 +1202,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
{
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
+ for (auto& localGenerator : this->LocalGenerators) {
const std::vector<cmGeneratorTarget*>& tgts =
- this->LocalGenerators[i]->GetGeneratorTargets();
+ localGenerator->GetGeneratorTargets();
// All targets depend on the build-system check target.
- for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
- ti != tgts.end(); ++ti) {
+ for (auto tgt : tgts) {
// This makes sure all targets link using the proper language.
- this->ForceLinkerLanguage(*ti);
+ this->ForceLinkerLanguage(tgt);
}
}
}
@@ -1238,9 +1229,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
// If the language is compiled as a source trust Xcode to link with it.
cmLinkImplementation const* impl = gtgt->GetLinkImplementation("NOCONFIG");
- for (std::vector<std::string>::const_iterator li = impl->Languages.begin();
- li != impl->Languages.end(); ++li) {
- if (*li == llang) {
+ for (auto const& Language : impl->Languages) {
+ if (Language == llang) {
return;
}
}
@@ -1278,7 +1268,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase(
const char* name, const char* name2, cmGeneratorTarget* target,
const std::vector<cmCustomCommand>& commands)
{
- if (commands.size() == 0 && strcmp(name, "CMake ReRun") != 0) {
+ if (commands.empty() && strcmp(name, "CMake ReRun") != 0) {
return nullptr;
}
cmXCodeObject* buildPhase =
@@ -1466,7 +1456,7 @@ void cmGlobalXCodeGenerator::FilterConfigurationAttribute(
return;
}
- std::string::size_type endVariant = attribute.find("]", beginVariant + 9);
+ std::string::size_type endVariant = attribute.find(']', beginVariant + 9);
if (endVariant == std::string::npos) {
// There is no terminating bracket.
return;
@@ -1542,16 +1532,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
makefileStream << "all: ";
std::map<const cmCustomCommand*, std::string> tname;
int count = 0;
- for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
- i != commands.end(); ++i) {
- cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
+ for (auto const& command : commands) {
+ cmCustomCommandGenerator ccg(command, configName,
+ this->CurrentLocalGenerator);
if (ccg.GetNumberOfCommands() > 0) {
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
- for (std::vector<std::string>::const_iterator o = outputs.begin();
- o != outputs.end(); ++o) {
+ for (auto const& output : outputs) {
makefileStream << "\\\n\t"
- << this->ConvertToRelativeForMake(o->c_str());
+ << this->ConvertToRelativeForMake(output.c_str());
}
} else {
std::ostringstream str;
@@ -1562,18 +1551,18 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
}
}
makefileStream << "\n\n";
- for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
- i != commands.end(); ++i) {
- cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
+ for (auto const& command : commands) {
+ cmCustomCommandGenerator ccg(command, configName,
+ this->CurrentLocalGenerator);
if (ccg.GetNumberOfCommands() > 0) {
makefileStream << "\n";
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
// There is at least one output, start the rule for it
const char* sep = "";
- for (std::vector<std::string>::const_iterator oi = outputs.begin();
- oi != outputs.end(); ++oi) {
- makefileStream << sep << this->ConvertToRelativeForMake(oi->c_str());
+ for (auto const& output : outputs) {
+ makefileStream << sep
+ << this->ConvertToRelativeForMake(output.c_str());
sep = " ";
}
makefileStream << ": ";
@@ -1581,11 +1570,9 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
// There are no outputs. Use the generated force rule name.
makefileStream << tname[&ccg.GetCC()] << ": ";
}
- for (std::vector<std::string>::const_iterator d =
- ccg.GetDepends().begin();
- d != ccg.GetDepends().end(); ++d) {
+ for (auto const& d : ccg.GetDepends()) {
std::string dep;
- if (this->CurrentLocalGenerator->GetRealDependency(*d, configName,
+ if (this->CurrentLocalGenerator->GetRealDependency(d, configName,
dep)) {
makefileStream << "\\\n"
<< this->ConvertToRelativeForMake(dep.c_str());
@@ -1640,9 +1627,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::set<std::string> languages;
gtgt->GetLanguages(languages, configName);
std::map<std::string, std::string> cflags;
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
- std::string const& lang = *li;
+ for (auto const& lang : languages) {
std::string& flags = cflags[lang];
// Add language-specific flags.
@@ -1738,9 +1723,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
} else {
cmXCodeObject* archObjects =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (std::vector<std::string>::iterator i = archs.begin();
- i != archs.end(); i++) {
- archObjects->AddObject(this->CreateString(*i));
+ for (auto& arch : archs) {
+ archObjects->AddObject(this->CreateString(arch));
}
buildSettings->AddAttribute("ARCHS", archObjects);
}
@@ -1965,10 +1949,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks");
- for (std::vector<std::string>::iterator i = includes.begin();
- i != includes.end(); ++i) {
- if (this->NameResolvesToFramework(*i)) {
- std::string frameworkDir = *i;
+ for (auto& include : includes) {
+ if (this->NameResolvesToFramework(include)) {
+ std::string frameworkDir = include;
frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
if (emitted.insert(frameworkDir).second) {
@@ -1981,9 +1964,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
}
} else {
- std::string incpath = this->XCodeEscapePath(*i);
+ std::string incpath = this->XCodeEscapePath(include);
if (emitSystemIncludes &&
- gtgt->IsSystemIncludeDirectory(*i, configName)) {
+ gtgt->IsSystemIncludeDirectory(include, configName)) {
sysdirs.Add(incpath);
} else {
dirs.Add(incpath);
@@ -1993,12 +1976,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add framework search paths needed for linking.
if (cmComputeLinkInformation* cli = gtgt->GetLinkInformation(configName)) {
std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths();
- for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
- fdi != fwDirs.end(); ++fdi) {
- if (emitted.insert(*fdi).second) {
- std::string incpath = this->XCodeEscapePath(*fdi);
+ for (auto const& fwDir : fwDirs) {
+ if (emitted.insert(fwDir).second) {
+ std::string incpath = this->XCodeEscapePath(fwDir);
if (emitSystemIncludes &&
- gtgt->IsSystemIncludeDirectory(*fdi, configName)) {
+ gtgt->IsSystemIncludeDirectory(fwDir, configName)) {
sysfdirs.Add(incpath);
} else {
fdirs.Add(incpath);
@@ -2026,13 +2008,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// system include directory awareness. We need to also keep on setting
// HEADER_SEARCH_PATHS to work around a missing compile options flag for
// GNU assembly files (#16449)
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
+ for (auto const& language : languages) {
std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
- includes, gtgt, *li, true, false, configName);
+ includes, gtgt, language, true, false, configName);
if (!includeFlags.empty()) {
- cflags[*li] += " " + includeFlags;
+ cflags[language] += " " + includeFlags;
}
}
}
@@ -2043,10 +2024,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string optLevel = "0";
// Minimal map of flags to build settings.
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
- std::string& flags = cflags[*li];
- std::string& gflag = gflags[*li];
+ for (auto const& language : languages) {
+ std::string& flags = cflags[language];
+ std::string& gflag = gflags[language];
std::string oflag =
this->ExtractFlagRegex("(^| )(-Ofast|-Os|-O[0-9]*)( |$)", 2, flags);
if (oflag.size() == 2) {
@@ -2071,10 +2051,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (!same_gflags) {
// We can't set the Xcode flag differently depending on the language,
// so put them back in this case.
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
- cflags[*li] += " ";
- cflags[*li] += gflags[*li];
+ for (auto const& language : languages) {
+ cflags[language] += " ";
+ cflags[language] += gflags[language];
}
debugStr = "NO";
} else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) {
@@ -2091,18 +2070,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
- std::string flags = cflags[*li] + " " + defFlags;
- if (*li == "CXX") {
+ for (auto const& language : languages) {
+ std::string flags = cflags[language] + " " + defFlags;
+ if (language == "CXX") {
buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
this->CreateString(flags));
- } else if (*li == "Fortran") {
+ } else if (language == "Fortran") {
buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
this->CreateString(flags));
- } else if (*li == "C") {
+ } else if (language == "C") {
buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
- } else if (*li == "Swift") {
+ } else if (language == "Swift") {
buildSettings->AddAttribute("OTHER_SWIFT_FLAGS",
this->CreateString(flags));
}
@@ -2226,15 +2204,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Convert "XCODE_ATTRIBUTE_*" properties directly.
{
std::vector<std::string> const& props = gtgt->GetPropertyKeys();
- for (std::vector<std::string>::const_iterator i = props.begin();
- i != props.end(); ++i) {
- if (i->find("XCODE_ATTRIBUTE_") == 0) {
- std::string attribute = i->substr(16);
+ for (auto const& prop : props) {
+ if (prop.find("XCODE_ATTRIBUTE_") == 0) {
+ std::string attribute = prop.substr(16);
this->FilterConfigurationAttribute(configName, attribute);
if (!attribute.empty()) {
cmGeneratorExpression ge;
std::string processed =
- ge.Parse(gtgt->GetProperty(*i))
+ ge.Parse(gtgt->GetProperty(prop))
->Evaluate(this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute,
this->CreateString(processed));
@@ -2322,15 +2299,15 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
configlist->SetComment(comment);
target->AddAttribute("buildConfigurationList",
this->CreateObjectReference(configlist));
- for (unsigned int i = 0; i < configVector.size(); ++i) {
+ for (auto const& i : configVector) {
cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
buildConfigurations->AddObject(config);
cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- this->CreateBuildSettings(gtgt, buildSettings, configVector[i]);
- config->AddAttribute("name", this->CreateString(configVector[i]));
- config->SetComment(configVector[i]);
+ this->CreateBuildSettings(gtgt, buildSettings, i);
+ config->AddAttribute("name", this->CreateString(i));
+ config->SetComment(i);
config->AddAttribute("buildSettings", buildSettings);
}
if (!configVector.empty()) {
@@ -2350,9 +2327,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
(target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
return "OTHER_LIBTOOLFLAGS";
- } else {
- return "OTHER_LDFLAGS";
}
+ return "OTHER_LDFLAGS";
}
const char* cmGlobalXCodeGenerator::GetTargetFileType(
@@ -2369,12 +2345,13 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework"
: "archive.ar");
case cmStateEnums::MODULE_LIBRARY:
- if (target->IsXCTestOnApple())
+ if (target->IsXCTestOnApple()) {
return "wrapper.cfbundle";
- else if (target->IsCFBundleOnApple())
+ }
+ if (target->IsCFBundleOnApple()) {
return "wrapper.plug-in";
- else
- return "compiled.mach-o.executable";
+ }
+ return "compiled.mach-o.executable";
case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework"
@@ -2402,12 +2379,13 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
? "com.apple.product-type.framework"
: "com.apple.product-type.library.static");
case cmStateEnums::MODULE_LIBRARY:
- if (target->IsXCTestOnApple())
+ if (target->IsXCTestOnApple()) {
return "com.apple.product-type.bundle.unit-test";
- else if (target->IsCFBundleOnApple())
+ } else if (target->IsCFBundleOnApple()) {
return "com.apple.product-type.bundle";
- else
+ } else {
return "com.apple.product-type.tool";
+ }
case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework"
@@ -2561,15 +2539,14 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
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) {
+ for (auto& i : list) {
if (!configName.empty()) {
- if ((*i)->GetObject("name")->GetString() == configName) {
- cmXCodeObject* settings = (*i)->GetObject("buildSettings");
+ if (i->GetObject("name")->GetString() == configName) {
+ cmXCodeObject* settings = i->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
}
} else {
- cmXCodeObject* settings = (*i)->GetObject("buildSettings");
+ cmXCodeObject* settings = i->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
}
}
@@ -2588,20 +2565,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// Add dependencies on other CMake targets.
TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
- for (TargetDependSet::const_iterator i = deps.begin(); i != deps.end();
- ++i) {
- if (cmXCodeObject* dptarget = this->FindXCodeTarget(*i)) {
+ for (auto dep : deps) {
+ if (cmXCodeObject* dptarget = this->FindXCodeTarget(dep)) {
this->AddDependTarget(target, dptarget);
}
}
// Loop over configuration types and set per-configuration info.
- for (std::vector<std::string>::iterator i =
- this->CurrentConfigurationTypes.begin();
- i != this->CurrentConfigurationTypes.end(); ++i) {
+ for (auto const& configName : this->CurrentConfigurationTypes) {
// Get the current configuration name.
- std::string configName = *i;
-
if (this->XcodeVersion >= 50) {
// Add object library contents as link flags.
std::string linkObjs;
@@ -2637,9 +2609,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// Add dependencies directly on library files.
{
std::vector<std::string> const& libDeps = cli.GetDepends();
- for (std::vector<std::string>::const_iterator j = libDeps.begin();
- j != libDeps.end(); ++j) {
- target->AddDependLibrary(configName, *j);
+ for (auto const& libDep : libDeps) {
+ target->AddDependLibrary(configName, libDep);
}
}
@@ -2647,16 +2618,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
{
std::vector<std::string> const& libDirs = cli.GetDirectories();
std::string linkDirs;
- for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
- libDir != libDirs.end(); ++libDir) {
- if (libDir->size() && *libDir != "/usr/lib") {
+ for (auto const& libDir : libDirs) {
+ if (!libDir.empty() && libDir != "/usr/lib") {
// Now add the same one but append
// $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
linkDirs += " ";
linkDirs += this->XCodeEscapePath(
- *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
linkDirs += " ";
- linkDirs += this->XCodeEscapePath(*libDir);
+ linkDirs += this->XCodeEscapePath(libDir);
}
}
this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS",
@@ -2669,18 +2639,18 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
const char* sep = "";
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector const& libNames = cli.GetItems();
- for (ItemVector::const_iterator li = libNames.begin();
- li != libNames.end(); ++li) {
+ for (auto const& libName : libNames) {
linkLibs += sep;
sep = " ";
- if (li->IsPath) {
- linkLibs += this->XCodeEscapePath(li->Value);
- } else if (!li->Target ||
- li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
- linkLibs += li->Value;
+ if (libName.IsPath) {
+ linkLibs += this->XCodeEscapePath(libName.Value);
+ } else if (!libName.Target ||
+ libName.Target->GetType() !=
+ cmStateEnums::INTERFACE_LIBRARY) {
+ linkLibs += libName.Value;
}
- if (li->Target && !li->Target->IsImported()) {
- target->AddDependTarget(configName, li->Target->GetName());
+ if (libName.Target && !libName.Target->IsImported()) {
+ target->AddDependTarget(configName, libName.Target->GetName());
}
}
this->AppendBuildSettingAttribute(
@@ -2692,15 +2662,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
bool cmGlobalXCodeGenerator::CreateGroups(
std::vector<cmLocalGenerator*>& generators)
{
- for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
- i != generators.end(); ++i) {
- cmMakefile* mf = (*i)->GetMakefile();
+ for (auto& generator : generators) {
+ cmMakefile* mf = generator->GetMakefile();
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
- const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
- l != tgts.end(); l++) {
- cmGeneratorTarget* gtgt = *l;
-
+ const std::vector<cmGeneratorTarget*>& tgts =
+ generator->GetGeneratorTargets();
+ for (auto gtgt : tgts) {
// Same skipping logic here as in CreateXCodeTargets so that we do not
// end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
// groups:
@@ -2724,10 +2691,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(
gtgt->GetAllConfigSources();
// Put cmSourceFile instances in proper groups:
- for (std::vector<cmGeneratorTarget::AllConfigSource>::const_iterator si =
- sources.begin();
- si != sources.end(); ++si) {
- cmSourceFile const* sf = si->Source;
+ for (auto const& si : sources) {
+ cmSourceFile const* sf = si.Source;
if (this->XcodeVersion >= 50 && !sf->GetObjectLibrary().empty()) {
// Object library files go on the link line instead.
continue;
@@ -2746,19 +2711,21 @@ bool cmGlobalXCodeGenerator::CreateGroups(
}
cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent,
- std::string name)
+ const std::string& name)
{
cmXCodeObject* parentChildren = nullptr;
- if (parent)
+ if (parent) {
parentChildren = parent->GetObject("children");
+ }
cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup);
cmXCodeObject* groupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
group->AddAttribute("name", this->CreateString(name));
group->AddAttribute("children", groupChildren);
group->AddAttribute("sourceTree", this->CreateString("<group>"));
- if (parentChildren)
+ if (parentChildren) {
parentChildren->AddObject(group);
+ }
return group;
}
@@ -2812,7 +2779,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
// If it's the default source group (empty name) then put the source file
// directly in the tgroup...
//
- if (std::string(sg->GetFullName()) == "") {
+ if (std::string(sg->GetFullName()).empty()) {
this->GroupNameMap[s] = tgroup;
return tgroup;
}
@@ -2823,13 +2790,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
cmSystemTools::tokenize(sg->GetFullName(), "\\");
std::string curr_folder = target;
curr_folder += "/";
- for (std::vector<std::string>::size_type i = 0; i < folders.size(); i++) {
- curr_folder += folders[i];
+ for (auto const& folder : folders) {
+ curr_folder += folder;
std::map<std::string, cmXCodeObject*>::iterator i_folder =
this->GroupNameMap.find(curr_folder);
// Create new folder
if (i_folder == this->GroupNameMap.end()) {
- cmXCodeObject* group = this->CreatePBXGroup(tgroup, folders[i]);
+ cmXCodeObject* group = this->CreatePBXGroup(tgroup, folder);
this->GroupNameMap[curr_folder] = group;
tgroup = group;
} else {
@@ -2853,10 +2820,10 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
+ for (auto& CurrentConfigurationType : this->CurrentConfigurationTypes) {
cmXCodeObject* buildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
- const char* name = this->CurrentConfigurationTypes[i].c_str();
+ const char* name = CurrentConfigurationType.c_str();
buildStyle->AddAttribute("name", this->CreateString(name));
buildStyle->SetComment(name);
cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
@@ -2889,7 +2856,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
std::string project_id = "PROJECT_";
project_id += root->GetProjectName();
this->RootObject->SetId(
- this->GetOrCreateId(project_id.c_str(), this->RootObject->GetId()));
+ this->GetOrCreateId(project_id, this->RootObject->GetId()));
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
this->RootObject->AddAttribute("mainGroup",
@@ -2905,15 +2872,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
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)
+ if (this->XcodeVersion >= 32) {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.2"));
- else if (this->XcodeVersion >= 31)
+ } else if (this->XcodeVersion >= 31) {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.1"));
- else
+ } else {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.0"));
+ }
// Point Xcode at the top of the source tree.
{
std::string pdir =
@@ -2938,8 +2906,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
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);
+ for (auto& config : configs) {
+ buildConfigurations->AddObject(config.second);
}
configlist->AddAttribute("buildConfigurations", buildConfigurations);
@@ -2997,7 +2965,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
symroot += "/build";
buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot));
- for (Configs::iterator i = configs.begin(); i != configs.end(); ++i) {
+ for (auto& config : configs) {
cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings);
// Put this last so it can override existing settings
@@ -3007,43 +2975,38 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
d != vars.end(); ++d) {
if (d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) {
std::string attribute = d->substr(22);
- this->FilterConfigurationAttribute(i->first, attribute);
+ this->FilterConfigurationAttribute(config.first, attribute);
if (!attribute.empty()) {
cmGeneratorExpression ge;
std::string processed =
ge.Parse(this->CurrentMakefile->GetDefinition(*d))
- ->Evaluate(this->CurrentLocalGenerator, i->first);
+ ->Evaluate(this->CurrentLocalGenerator, config.first);
buildSettingsForCfg->AddAttribute(attribute,
this->CreateString(processed));
}
}
}
// store per-config buildSettings into configuration object
- i->second->AddAttribute("buildSettings", buildSettingsForCfg);
+ config.second->AddAttribute("buildSettings", buildSettingsForCfg);
}
this->RootObject->AddAttribute("buildConfigurationList",
this->CreateObjectReference(configlist));
std::vector<cmXCodeObject*> targets;
- for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
- i != generators.end(); ++i) {
- if (!this->CreateXCodeTargets(*i, targets)) {
+ for (auto& generator : generators) {
+ if (!this->CreateXCodeTargets(generator, targets)) {
return false;
}
}
// loop over all targets and add link and depend info
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
- i != targets.end(); ++i) {
- cmXCodeObject* t = *i;
+ for (auto t : targets) {
this->AddDependAndLinkInformation(t);
}
this->CreateXCodeDependHackTarget(targets);
// now add all targets to the root object
cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
- i != targets.end(); ++i) {
- cmXCodeObject* t = *i;
+ for (auto t : targets) {
allTargets->AddObject(t);
cmXCodeObject* productRef = t->GetObject("productReference");
if (productRef) {
@@ -3136,9 +3099,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
this->CurrentConfigurationTypes.begin();
ct != this->CurrentConfigurationTypes.end(); ++ct) {
std::string configName = *ct;
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
- i != targets.end(); ++i) {
- cmXCodeObject* target = *i;
+ for (auto target : targets) {
cmGeneratorTarget* gt = target->GetTarget();
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
@@ -3163,9 +3124,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
target->GetDependTargets().find(*ct);
if (y != target->GetDependTargets().end()) {
std::vector<std::string> const& deptgts = y->second;
- for (std::vector<std::string>::const_iterator d = deptgts.begin();
- d != deptgts.end(); ++d) {
- makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": "
+ for (auto const& deptgt : deptgts) {
+ makefileStream << this->PostBuildMakeTarget(deptgt, *ct) << ": "
<< trel << "\n";
}
}
@@ -3187,9 +3147,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
target->GetDependLibraries().find(*ct);
if (x != target->GetDependLibraries().end()) {
std::vector<std::string> const& deplibs = x->second;
- for (std::vector<std::string>::const_iterator d = deplibs.begin();
- d != deplibs.end(); ++d) {
- std::string file = this->ConvertToRelativeForMake(d->c_str());
+ for (auto const& deplib : deplibs) {
+ std::string file = this->ConvertToRelativeForMake(deplib.c_str());
makefileStream << "\\\n\t" << file;
dummyRules.insert(file);
}
@@ -3221,11 +3180,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
if (this->Architectures.size() > 1) {
std::string universal = this->GetObjectsNormalDirectory(
this->CurrentProject, configName, gt);
- for (std::vector<std::string>::iterator arch =
- this->Architectures.begin();
- arch != this->Architectures.end(); ++arch) {
+ for (auto& architecture : this->Architectures) {
std::string universalFile = universal;
- universalFile += *arch;
+ universalFile += architecture;
universalFile += "/";
universalFile += gt->GetFullName(configName);
makefileStream << "\t/bin/rm -f "
@@ -3242,22 +3199,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream << "\n\n"
<< "# For each target create a dummy rule"
<< "so the target does not have to exist\n";
- for (std::set<std::string>::const_iterator it = dummyRules.begin();
- it != dummyRules.end(); ++it) {
- makefileStream << *it << ":\n";
+ for (auto const& dummyRule : dummyRules) {
+ makefileStream << dummyRule << ":\n";
}
}
void cmGlobalXCodeGenerator::OutputXCodeProject(
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
{
- if (generators.size() == 0) {
+ if (generators.empty()) {
return;
}
// Skip local generators that are excluded from this project.
- for (std::vector<cmLocalGenerator*>::iterator g = generators.begin();
- g != generators.end(); ++g) {
- if (this->IsExcluded(root, *g)) {
+ for (auto& generator : generators) {
+ if (this->IsExcluded(root, generator)) {
continue;
}
}
@@ -3385,12 +3340,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout);
fout << "};\n";
cmXCodeObject::Indent(1, fout);
- if (this->XcodeVersion >= 32)
+ if (this->XcodeVersion >= 32) {
fout << "objectVersion = 46;\n";
- else if (this->XcodeVersion >= 31)
+ } else if (this->XcodeVersion >= 31) {
fout << "objectVersion = 45;\n";
- else
+ } else {
fout << "objectVersion = 44;\n";
+ }
cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId()
@@ -3510,11 +3466,10 @@ void cmGlobalXCodeGenerator::AppendDefines(
{
// GCC_PREPROCESSOR_DEFINITIONS is a space-separated list of definitions.
std::string def;
- for (std::vector<std::string>::const_iterator di = defines.begin();
- di != defines.end(); ++di) {
+ for (auto const& define : defines) {
// Start with -D if requested.
def = dflag ? "-D" : "";
- def += *di;
+ def += define;
// Append the flag with needed escapes.
std::string tmp;
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 81d1bd0..e9ca91c 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -106,7 +106,8 @@ protected:
private:
cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
cmSourceGroup* sg);
- cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, std::string name);
+ cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent,
+ const std::string& name);
bool CreateGroups(std::vector<cmLocalGenerator*>& generators);
std::string XCodeEscapePath(const std::string& p);
std::string RelativeToSource(const char* p);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 967fd2e..dd2993d 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -2,7 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGraphVizWriter.h"
+#include <cstddef>
#include <iostream>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <utility>
@@ -14,10 +16,20 @@
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
-static const char* getShapeForTarget(const cmGeneratorTarget* target)
+namespace {
+enum LinkLibraryScopeType
+{
+ LLT_SCOPE_PUBLIC,
+ LLT_SCOPE_PRIVATE,
+ LLT_SCOPE_INTERFACE
+};
+
+const char* const GRAPHVIZ_PRIVATE_EDEGE_STYLE = "dashed";
+const char* const GRAPHVIZ_INTERFACE_EDEGE_STYLE = "dotted";
+
+const char* getShapeForTarget(const cmGeneratorTarget* target)
{
if (!target) {
return "ellipse";
@@ -39,6 +51,76 @@ static const char* getShapeForTarget(const cmGeneratorTarget* target)
return "box";
}
+std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget(
+ cmTarget* Target)
+{
+ char sep = ';';
+ std::map<std::string, LinkLibraryScopeType> tokens;
+ size_t start = 0, end = 0;
+
+ const char* pInterfaceLinkLibraries =
+ Target->GetProperty("INTERFACE_LINK_LIBRARIES");
+ const char* pLinkLibraries = Target->GetProperty("LINK_LIBRARIES");
+
+ if (!pInterfaceLinkLibraries && !pLinkLibraries) {
+ return tokens; // target is not linked against any other libraries
+ }
+
+ // make sure we don't touch a null-ptr
+ auto interfaceLinkLibraries =
+ std::string(pInterfaceLinkLibraries ? pInterfaceLinkLibraries : "");
+ auto linkLibraries = std::string(pLinkLibraries ? pLinkLibraries : "");
+
+ // first extract interfaceLinkLibraries
+ while (start < interfaceLinkLibraries.length()) {
+
+ if ((end = interfaceLinkLibraries.find(sep, start)) == std::string::npos) {
+ end = interfaceLinkLibraries.length();
+ }
+
+ std::string element = interfaceLinkLibraries.substr(start, end - start);
+ if (std::string::npos == element.find("$<LINK_ONLY:", 0)) {
+ // we assume first, that this library is an interface library.
+ // if we find it again in the linklibraries property, we promote it to an
+ // public library.
+ tokens[element] = LLT_SCOPE_INTERFACE;
+ } else {
+ // this is an private linked static library.
+ // we take care of this case in the second iterator.
+ }
+ start = end + 1;
+ }
+
+ // second extract linkLibraries
+ start = 0;
+ while (start < linkLibraries.length()) {
+
+ if ((end = linkLibraries.find(sep, start)) == std::string::npos) {
+ end = linkLibraries.length();
+ }
+
+ std::string element = linkLibraries.substr(start, end - start);
+
+ if (tokens.find(element) == tokens.end()) {
+ // this library is not found in interfaceLinkLibraries but in
+ // linkLibraries.
+ // this results in a private linked library.
+ tokens[element] = LLT_SCOPE_PRIVATE;
+ } else if (LLT_SCOPE_INTERFACE == tokens[element]) {
+ // this library is found in interfaceLinkLibraries and linkLibraries.
+ // this results in a public linked library.
+ tokens[element] = LLT_SCOPE_PUBLIC;
+ } else {
+ // private and public linked libraries should not be changed anymore.
+ }
+
+ start = end + 1;
+ }
+
+ return tokens;
+}
+}
+
cmGraphVizWriter::cmGraphVizWriter(
const std::vector<cmLocalGenerator*>& localGenerators)
: GraphType("digraph")
@@ -65,8 +147,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator ggi(&cm);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
- CM_AUTO_PTR<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
+ cmMakefile mf(&ggi, cm.GetCurrentSnapshot());
+ std::unique_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(&mf));
const char* inFileName = settingsFileName;
@@ -77,7 +159,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
}
}
- if (!mf->ReadListFile(inFileName)) {
+ if (!mf.ReadListFile(inFileName)) {
cmSystemTools::Error("Problem opening GraphViz options file: ",
inFileName);
return;
@@ -87,7 +169,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
#define __set_if_set(var, cmakeDefinition) \
{ \
- const char* value = mf->GetDefinition(cmakeDefinition); \
+ const char* value = mf.GetDefinition(cmakeDefinition); \
if (value) { \
(var) = value; \
} \
@@ -100,9 +182,9 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
#define __set_bool_if_set(var, cmakeDefinition) \
{ \
- const char* value = mf->GetDefinition(cmakeDefinition); \
+ const char* value = mf.GetDefinition(cmakeDefinition); \
if (value) { \
- (var) = mf->IsOn(cmakeDefinition); \
+ (var) = mf.IsOn(cmakeDefinition); \
} \
}
@@ -273,11 +355,10 @@ void cmGraphVizWriter::WriteConnections(
}
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
+ std::map<std::string, LinkLibraryScopeType> ll =
+ getScopedLinkLibrariesFromTarget(targetPtrIt->second->Target);
- const cmTarget::LinkLibraryVectorType* ll =
- &(targetPtrIt->second->Target->GetOriginalLinkLibraries());
-
- for (auto const& llit : *ll) {
+ for (auto const& llit : ll) {
const char* libName = llit.first.c_str();
std::map<std::string, std::string>::const_iterator libNameIt =
this->TargetNamesNodes.find(libName);
@@ -297,6 +378,18 @@ void cmGraphVizWriter::WriteConnections(
insertedNodes, str);
str << " \"" << myNodeName << "\" -> \"" << libNameIt->second << "\"";
+
+ switch (llit.second) {
+ case LLT_SCOPE_PRIVATE:
+ str << "[style = " << GRAPHVIZ_PRIVATE_EDEGE_STYLE << "]";
+ break;
+ case LLT_SCOPE_INTERFACE:
+ str << "[style = " << GRAPHVIZ_INTERFACE_EDEGE_STYLE << "]";
+ break;
+ default:
+ break;
+ }
+
str << " // " << targetName << " -> " << libName << std::endl;
this->WriteConnections(libName, insertedNodes, insertedConnections, str);
}
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 1a01854..4926f22 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -8,9 +8,10 @@
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
+#include <memory> // IWYU pragma: keep
+
static std::string cmIfCommandError(
std::vector<cmExpandedCommandArgument> const& args)
{
@@ -36,7 +37,8 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endif for this if statement, then start executing
if (!this->ScopeDepth) {
// Remove the function blocker for this scope or bail.
- CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
+ std::unique_ptr<cmFunctionBlocker> fb(
+ mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 49e57b1..e4209bd 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -7,7 +7,8 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
+
+#include <memory> // IWYU pragma: keep
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, const char* dest,
@@ -63,7 +64,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
std::vector<std::string> dirs;
cmGeneratorExpression ge;
for (std::string const& d : this->Directories) {
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(d);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(d);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), dirs);
}
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 0e79563..68e3f86 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -5,7 +5,8 @@
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
+
+#include <memory> // IWYU pragma: keep
class cmLocalGenerator;
@@ -82,7 +83,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(
std::vector<std::string> files;
cmGeneratorExpression ge;
for (std::string const& f : this->Files) {
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(f);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(f);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), files);
}
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index c8144aa..3ffeabd 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -16,9 +16,7 @@ cmInstalledFile::cmInstalledFile()
cmInstalledFile::~cmInstalledFile()
{
- if (NameExpression) {
- delete NameExpression;
- }
+ delete NameExpression;
}
cmInstalledFile::Property::Property()
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index fbf754f..47a4959 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -6,9 +6,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmGeneratorExpression.h"
-#include "cm_auto_ptr.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <string>
#include <vector>
@@ -22,7 +22,7 @@ class cmMakefile;
class cmInstalledFile
{
public:
- typedef CM_AUTO_PTR<cmCompiledGeneratorExpression>
+ typedef std::unique_ptr<cmCompiledGeneratorExpression>
CompiledGeneratorExpressionPtrType;
typedef std::vector<cmCompiledGeneratorExpression*> ExpressionVectorType;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 2850032..6bfac17 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -197,7 +197,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
// Try to find the program.
std::string fullPath = cmSystemTools::FindFile(moduleName, path);
- if (fullPath == "") {
+ if (fullPath.empty()) {
std::ostringstream e;
e << "Attempt to load command failed from file \"" << moduleName << "\"";
this->SetError(e.str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e1662ac..1a088ea 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1410,7 +1410,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// If the input name is the empty string, there is no real
// dependency. Short-circuit the other checks:
- if (name == "") {
+ if (name.empty()) {
return false;
}
@@ -2096,7 +2096,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
}
// Install this target if a destination is given.
- if (l->Target->GetInstallPath() != "") {
+ if (!l->Target->GetInstallPath().empty()) {
// Compute the full install destination. Note that converting
// to unix slashes also removes any trailing slash.
// We also skip over the leading slash given by the user.
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 73f5a16..477ce51 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -5,6 +5,7 @@
#include <algorithm>
#include <assert.h>
#include <iterator>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <utility>
@@ -22,7 +23,6 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
@@ -505,7 +505,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
std::string launcher = property_value;
launcher += " ";
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->CreateRulePlaceholderExpander());
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index df02f84..e26182a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -5,7 +5,7 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Terminal.h"
#include <algorithm>
-#include <functional>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <utility>
@@ -29,7 +29,6 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
// Include dependency scanners for supported languages. Only the
@@ -122,9 +121,9 @@ void cmLocalUnixMakefileGenerator3::Generate()
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
- CM_AUTO_PTR<cmMakefileTargetGenerator> tg(
+ std::unique_ptr<cmMakefileTargetGenerator> tg(
cmMakefileTargetGenerator::New(target));
- if (tg.get()) {
+ if (tg) {
tg->WriteRuleFiles();
gg->RecordTargetProgress(tg.get());
}
@@ -931,7 +930,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
*content << dir;
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->CreateRulePlaceholderExpander());
// Add each command line to the set of commands.
@@ -2073,7 +2072,7 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir);
std::string prefix = cd_cmd + outputForExisting + " && ";
std::transform(commands.begin(), commands.end(), commands.begin(),
- std::bind1st(std::plus<std::string>(), prefix));
+ [&prefix](std::string const& s) { return prefix + s; });
}
}
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index db1776a..5e81514 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -17,7 +17,12 @@ public:
virtual void CharacterDataHandler(const char* data, int length)
{
if (this->DoGUID) {
- this->GUID.assign(data + 1, length - 2);
+ if (data[0] == '{') {
+ // remove surrounding curly brackets
+ this->GUID.assign(data + 1, length - 2);
+ } else {
+ this->GUID.assign(data, length);
+ }
this->DoGUID = false;
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index c978936..8027191 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1453,7 +1453,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
}
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
fc.CompileFlags = cge->Evaluate(lg, *i);
needfc = true;
}
@@ -1591,7 +1591,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
// If the group has a name, write the header.
std::string name = sg->GetName();
- if (name != "") {
+ if (!name.empty()) {
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
@@ -1709,7 +1709,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
}
// If the group has a name, write the footer.
- if (name != "") {
+ if (!name.empty()) {
this->WriteVCProjEndGroup(fout);
}
@@ -1849,7 +1849,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
if (!addedPrelink) {
event.Write(target->GetPreLinkCommands());
}
- CM_AUTO_PTR<cmCustomCommand> pcc(
+ std::unique_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject));
if (pcc.get()) {
event.Write(*pcc);
@@ -2006,7 +2006,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
i != props.end(); ++i) {
if (i->find("VS_GLOBAL_") == 0) {
std::string name = i->substr(10);
- if (name != "") {
+ if (!name.empty()) {
/* clang-format off */
fout << "\t\t<Global\n"
<< "\t\t\tName=\"" << name << "\"\n"
@@ -2079,7 +2079,10 @@ public:
if (strcmp(atts[i], "ProjectGUID") == 0) {
if (atts[i + 1]) {
this->GUID = atts[i + 1];
- this->GUID = this->GUID.substr(1, this->GUID.size() - 2);
+ if (this->GUID[0] == '{') {
+ // remove surrounding curly brackets
+ this->GUID = this->GUID.substr(1, this->GUID.size() - 2);
+ }
} else {
this->GUID.clear();
}
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 718c8cd..bbb91e0 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -78,12 +78,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
}
}
-CM_AUTO_PTR<cmCustomCommand>
+std::unique_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
const std::string& config,
bool isFortran)
{
- CM_AUTO_PTR<cmCustomCommand> pcc;
+ std::unique_ptr<cmCustomCommand> pcc;
// If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory.
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index c47db4f..cba24fe 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -6,12 +6,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
-#include <memory>
+#include <memory> // IWYU pragma: keep
#include <string>
#include "cmGlobalVisualStudioGenerator.h"
#include "cmLocalGenerator.h"
-#include "cm_auto_ptr.hxx"
class cmCustomCommand;
class cmCustomCommandGenerator;
@@ -56,9 +55,8 @@ protected:
virtual bool CustomCommandUseLocal() const { return false; }
/** Construct a custom command to make exe import lib dir. */
- CM_AUTO_PTR<cmCustomCommand> MaybeCreateImplibDir(cmGeneratorTarget* target,
- const std::string& config,
- bool isFortran);
+ std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir(
+ cmGeneratorTarget* target, const std::string& config, bool isFortran);
};
#endif
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 355c394..853e66c 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -43,9 +43,8 @@ void cmLocalXCodeGenerator::Generate()
cmLocalGenerator::Generate();
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
- iter != targets.end(); ++iter) {
- (*iter)->HasMacOSXRpathInstallNameDir("");
+ for (auto target : targets) {
+ target->HasMacOSXRpathInstallNameDir("");
}
}
@@ -54,9 +53,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
cmLocalGenerator::GenerateInstallRules();
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
- iter != targets.end(); ++iter) {
- (*iter)->HasMacOSXRpathInstallNameDir("");
+ for (auto target : targets) {
+ target->HasMacOSXRpathInstallNameDir("");
}
}
@@ -69,10 +67,8 @@ void cmLocalXCodeGenerator::ComputeObjectFilenames(
// to avoid exact duplicate file names. Note that Mac file names are not
// typically case sensitive, hence the LowerCase.
std::map<std::string, int> counts;
- for (std::map<cmSourceFile const*, std::string>::iterator si =
- mapping.begin();
- si != mapping.end(); ++si) {
- cmSourceFile const* sf = si->first;
+ for (auto& si : mapping) {
+ cmSourceFile const* sf = si.first;
std::string objectName =
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
objectName += ".o";
@@ -82,6 +78,6 @@ void cmLocalXCodeGenerator::ComputeObjectFilenames(
if (2 == counts[objectNameLower]) {
// TODO: emit warning about duplicate name?
}
- si->second = objectName;
+ si.second = objectName;
}
}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index b05eab7..8c9596f 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -27,16 +27,16 @@ public:
///! Set cache only and recurse to false by default.
cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
- virtual ~cmLocalXCodeGenerator();
- virtual std::string GetTargetDirectory(
- cmGeneratorTarget const* target) const;
- virtual void AppendFlagEscape(std::string& flags,
- const std::string& rawFlag);
- virtual void Generate();
+ ~cmLocalXCodeGenerator() override;
+ std::string GetTargetDirectory(
+ cmGeneratorTarget const* target) const override;
+ void AppendFlagEscape(std::string& flags,
+ const std::string& rawFlag) override;
+ void Generate() override;
virtual void GenerateInstallRules();
- virtual void ComputeObjectFilenames(
+ void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
- cmGeneratorTarget const* gt = nullptr);
+ cmGeneratorTarget const* gt = nullptr) override;
private:
};
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index 3706dd3..7294c1c 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -134,7 +134,7 @@ public:
: cmMachOHeaderAndLoadCommands(_swap)
{
}
- bool read_mach_o(cmsys::ifstream& fin)
+ bool read_mach_o(cmsys::ifstream& fin) override
{
if (!read(fin, this->Header)) {
return false;
@@ -251,8 +251,7 @@ cmMachOInternal::cmMachOInternal(const char* fname)
}
// parse each Mach-O file
- for (size_t i = 0; i < this->FatArchs.size(); i++) {
- const fat_arch& arch = this->FatArchs[i];
+ for (const auto& arch : this->FatArchs) {
if (!this->read_mach_o(OSSwapBigToHostInt32(arch.offset))) {
return;
}
@@ -265,8 +264,8 @@ cmMachOInternal::cmMachOInternal(const char* fname)
cmMachOInternal::~cmMachOInternal()
{
- for (size_t i = 0; i < this->MachOList.size(); i++) {
- delete this->MachOList[i];
+ for (auto& i : this->MachOList) {
+ delete i;
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e51cfcc..5643c97 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -7,6 +7,7 @@
#include <algorithm>
#include <assert.h>
#include <ctype.h>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +38,6 @@
#include "cmTestGenerator.h" // IWYU pragma: keep
#include "cmVersion.h"
#include "cmWorkingDirectory.h"
-#include "cm_auto_ptr.hxx"
#include "cm_sys_stat.h"
#include "cmake.h"
@@ -264,7 +264,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Lookup the command prototype.
if (cmCommand* proto = this->GetState()->GetCommand(name)) {
// Clone the prototype.
- CM_AUTO_PTR<cmCommand> pcmd(proto->Clone());
+ std::unique_ptr<cmCommand> pcmd(proto->Clone());
pcmd->SetMakefile(this);
// Decide whether to invoke the command.
@@ -584,11 +584,12 @@ void cmMakefile::EnforceDirectoryLevelRules() const
void cmMakefile::AddEvaluationFile(
const std::string& inputFile,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent)
+ std::unique_ptr<cmCompiledGeneratorExpression> outputName,
+ std::unique_ptr<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent)
{
this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile(
- inputFile, outputName, condition, inputIsContent,
+ inputFile, std::move(outputName), std::move(condition), inputIsContent,
this->GetPolicyStatus(cmPolicies::CMP0070)));
}
@@ -2874,7 +2875,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
FunctionBlockersType::size_type barrier =
this->FunctionBlockerBarriers.back();
while (this->FunctionBlockers.size() > barrier) {
- CM_AUTO_PTR<cmFunctionBlocker> fb(this->FunctionBlockers.back());
+ std::unique_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back());
this->FunctionBlockers.pop_back();
if (reportError) {
// Report the context in which the unclosed block was opened.
@@ -3009,7 +3010,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
this->FunctionBlockers.push_back(fb);
}
-CM_AUTO_PTR<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
+std::unique_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff)
{
// Find the function blocker stack barrier for the current scope.
@@ -3042,11 +3043,11 @@ CM_AUTO_PTR<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
}
cmFunctionBlocker* b = *pos;
this->FunctionBlockers.erase(pos);
- return CM_AUTO_PTR<cmFunctionBlocker>(b);
+ return std::unique_ptr<cmFunctionBlocker>(b);
}
}
- return CM_AUTO_PTR<cmFunctionBlocker>();
+ return std::unique_ptr<cmFunctionBlocker>();
}
const char* cmMakefile::GetHomeDirectory() const
@@ -3185,8 +3186,8 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// do a configure
cm.SetHomeDirectory(srcdir);
cm.SetHomeOutputDirectory(bindir);
- cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform());
- cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset());
+ cm.SetGeneratorPlatform(this->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM"));
+ cm.SetGeneratorToolset(this->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"));
cm.LoadCache();
if (!gg->IsMultiConfig()) {
if (const char* config =
@@ -3703,7 +3704,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
bool global)
{
// Create the target.
- CM_AUTO_PTR<cmTarget> target(
+ std::unique_ptr<cmTarget> target(
new cmTarget(name, type, global ? cmTarget::VisibilityImportedGlobally
: cmTarget::VisibilityImported,
this));
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 398604d..0273f5b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -8,6 +8,7 @@
#include "cmsys/RegularExpression.hxx"
#include <deque>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <stack>
#include <stddef.h>
@@ -22,7 +23,6 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -92,7 +92,7 @@ public:
* Remove the function blocker whose scope ends with the given command.
* This returns ownership of the function blocker object.
*/
- CM_AUTO_PTR<cmFunctionBlocker> RemoveFunctionBlocker(
+ std::unique_ptr<cmFunctionBlocker> RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff);
/**
@@ -623,7 +623,6 @@ public:
{
return this->SourceFiles;
}
- std::vector<cmSourceFile*>& GetSourceFiles() { return this->SourceFiles; }
/**
* Is there a source file that has the provided source file as an output?
@@ -782,10 +781,11 @@ public:
void EnforceDirectoryLevelRules() const;
- void AddEvaluationFile(const std::string& inputFile,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
- CM_AUTO_PTR<cmCompiledGeneratorExpression> condition,
- bool inputIsContent);
+ void AddEvaluationFile(
+ const std::string& inputFile,
+ std::unique_ptr<cmCompiledGeneratorExpression> outputName,
+ std::unique_ptr<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent);
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators()
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index ebc8e30..801f72a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -3,6 +3,7 @@
#include "cmMakefileExecutableTargetGenerator.h"
#include <algorithm>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <string>
#include <vector>
@@ -23,7 +24,6 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
@@ -193,7 +193,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
new cmLinkLineDeviceComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -251,7 +251,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->LocalGenerator->CreateRulePlaceholderExpander());
// Expand placeholders in the commands.
@@ -448,7 +448,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
{
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -538,7 +538,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -632,7 +632,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->LocalGenerator->CreateRulePlaceholderExpander());
// Expand placeholders in the commands.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 68d73d4..80c62d1 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -3,6 +3,7 @@
#include "cmMakefileLibraryTargetGenerator.h"
#include <algorithm>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <vector>
@@ -22,7 +23,6 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
@@ -199,7 +199,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -248,7 +248,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -348,7 +348,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
std::string linkLibs;
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
new cmLinkLineDeviceComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -410,7 +410,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->LocalGenerator->CreateRulePlaceholderExpander());
// Construct the main link rule and expand placeholders.
@@ -754,7 +754,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string linkLibs;
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
@@ -873,7 +873,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->LocalGenerator->CreateRulePlaceholderExpander());
// Construct the main link rule and expand placeholders.
rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d0aad30..7db010c 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileTargetGenerator.h"
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <utility>
@@ -27,7 +28,6 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
@@ -134,7 +134,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
if (const char* additional_clean_files =
this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(additional_clean_files);
cmSystemTools::ExpandListArgument(
@@ -434,7 +434,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Add flags from source file properties.
if (const char* cflags = source.GetProperty("COMPILE_FLAGS")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
const char* evaluatedFlags = cge->Evaluate(this->LocalGenerator, config,
false, this->GeneratorTarget);
this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
@@ -570,7 +570,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->LocalGenerator->CreateRulePlaceholderExpander());
// Construct the compile rules.
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index e0844e8..e0cc35a 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -6,6 +6,7 @@
#include <assert.h>
#include <iterator>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
@@ -29,7 +30,6 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
class cmCustomCommand;
@@ -241,7 +241,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->GetLocalGenerator()->CreateRulePlaceholderExpander());
// Rule for linking library/executable.
@@ -365,7 +365,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
launcher += " ";
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->GetLocalGenerator()->CreateRulePlaceholderExpander());
// Rule for linking library/executable.
@@ -636,7 +636,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
new cmNinjaLinkLineDeviceComputer(
this->GetLocalGenerator(),
this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(),
@@ -839,7 +839,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->GetGlobalGenerator()->CreateLinkLineComputer(
this->GetLocalGenerator(),
this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index a464d6e..5805259 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -8,6 +8,7 @@
#include <assert.h>
#include <iterator>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <string.h>
@@ -29,7 +30,6 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
@@ -138,7 +138,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
if (const char* cflags = source->GetProperty("COMPILE_FLAGS")) {
std::string config = this->LocalGenerator->GetConfigName();
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
const char* evaluatedFlags = cge->Evaluate(this->LocalGenerator, config,
false, this->GeneratorTarget);
this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
@@ -438,7 +438,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
: mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
cldeps = "\"";
cldeps += cmSystemTools::GetCMClDepsCommand();
- cldeps += "\" " + lang + " " + vars.Source + " \"$DEP_FILE\" $out \"";
+ cldeps += "\" " + lang + " " + vars.Source + " $DEP_FILE $out \"";
cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
cldeps += "\" \"" + cl + "\" ";
}
@@ -463,7 +463,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.Flags = flags.c_str();
vars.DependencyFile = depfile.c_str();
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->GetLocalGenerator()->CreateRulePlaceholderExpander());
std::string const tdi = this->GetLocalGenerator()->ConvertToOutputFormat(
@@ -1077,7 +1077,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
}
- CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->GetLocalGenerator()->CreateRulePlaceholderExpander());
for (std::string& i : compileCmds) {
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index c430298..cde9037 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -510,7 +510,7 @@ void cmOutputRequiredFilesCommand::ListDependencies(
// now recurse with info's dependencies
for (cmDependInformation* d : info->DependencySet) {
if (visited->find(d) == visited->end()) {
- if (info->FullPath != "") {
+ if (!info->FullPath.empty()) {
std::string tmp = d->FullPath;
std::string::size_type pos = tmp.rfind('.');
if (pos != std::string::npos && (tmp.substr(pos) != ".h")) {
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index a1f346a..e7d1b72 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -140,7 +140,7 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
*defaultSetting = cmPolicies::NEW;
} else if (defaultValue == "OLD") {
*defaultSetting = cmPolicies::OLD;
- } else if (defaultValue == "") {
+ } else if (defaultValue.empty()) {
*defaultSetting = cmPolicies::WARN;
} else {
std::ostringstream e;
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 95cd122..5e89978 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGen.h"
#include "cmAlgorithms.h"
+#include "cmProcessOutput.h"
#include "cmSystemTools.h"
#include "cmsys/FStream.hxx"
@@ -13,18 +14,22 @@
// - Static variables
-const std::string genNameGen = "AutoGen";
-const std::string genNameMoc = "AutoMoc";
-const std::string genNameUic = "AutoUic";
-const std::string genNameRcc = "AutoRcc";
+std::string const genNameGen = "AutoGen";
+std::string const genNameMoc = "AutoMoc";
+std::string const genNameUic = "AutoUic";
+std::string const genNameRcc = "AutoRcc";
+
+std::string const mcNameSingle = "SINGLE";
+std::string const mcNameWrap = "WRAP";
+std::string const mcNameFull = "FULL";
// - Static functions
/// @brief Merges newOpts into baseOpts
/// @arg valueOpts list of options that accept a value
void MergeOptions(std::vector<std::string>& baseOpts,
- const std::vector<std::string>& newOpts,
- const std::vector<std::string>& valueOpts, bool isQt5)
+ std::vector<std::string> const& newOpts,
+ std::vector<std::string> const& valueOpts, bool isQt5)
{
typedef std::vector<std::string>::iterator Iter;
typedef std::vector<std::string>::const_iterator CIter;
@@ -39,7 +44,7 @@ void MergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> extraOpts;
for (CIter fit = newOpts.begin(), fitEnd = newOpts.end(); fit != fitEnd;
++fit) {
- const std::string& newOpt = *fit;
+ std::string const& newOpt = *fit;
Iter existIt = std::find(baseOpts.begin(), baseOpts.end(), newOpt);
if (existIt != baseOpts.end()) {
if (newOpt.size() >= 2) {
@@ -86,7 +91,7 @@ static std::string utilStripCR(std::string const& line)
/// @brief Reads the resource files list from from a .qrc file - Qt4 version
/// @return True if the .qrc file was successfully parsed
-static bool RccListInputsQt4(const std::string& fileName,
+static bool RccListInputsQt4(std::string const& fileName,
std::vector<std::string>& files,
std::string* errorMessage)
{
@@ -139,8 +144,8 @@ static bool RccListInputsQt4(const std::string& fileName,
/// @brief Reads the resource files list from from a .qrc file - Qt5 version
/// @return True if the .qrc file was successfully parsed
-static bool RccListInputsQt5(const std::string& rccCommand,
- const std::string& fileName,
+static bool RccListInputsQt5(std::string const& rccCommand,
+ std::string const& fileName,
std::vector<std::string>& files,
std::string* errorMessage)
{
@@ -158,15 +163,18 @@ static bool RccListInputsQt5(const std::string& rccCommand,
std::string rccStdOut;
std::string rccStdErr;
int retVal = 0;
- bool result =
- cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
- nullptr, cmSystemTools::OUTPUT_NONE);
+ bool result = cmSystemTools::RunSingleCommand(
+ command, &rccStdOut, &rccStdErr, &retVal, nullptr,
+ cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
if (result && retVal == 0 &&
rccStdOut.find("--list") != std::string::npos) {
hasDashDashList = true;
}
}
+ std::string const fileDir = cmSystemTools::GetFilenamePath(fileName);
+ std::string const fileNameName = cmSystemTools::GetFilenameName(fileName);
+
// Run rcc list command
bool result = false;
int retVal = 0;
@@ -176,16 +184,16 @@ static bool RccListInputsQt5(const std::string& rccCommand,
std::vector<std::string> command;
command.push_back(rccCommand);
command.push_back(hasDashDashList ? "--list" : "-list");
- command.push_back(fileName);
- result =
- cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
- nullptr, cmSystemTools::OUTPUT_NONE);
+ command.push_back(fileNameName);
+ result = cmSystemTools::RunSingleCommand(
+ command, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
+ cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
}
if (!result || retVal) {
if (errorMessage != nullptr) {
std::ostringstream ost;
- ost << "rcc list process for " << cmQtAutoGen::Quoted(fileName)
- << " failed:\n"
+ ost << "rcc list process failed for\n " << cmQtAutoGen::Quoted(fileName)
+ << "\n"
<< rccStdOut << "\n"
<< rccStdErr << "\n";
*errorMessage = ost.str();
@@ -230,34 +238,63 @@ static bool RccListInputsQt5(const std::string& rccCommand,
}
}
+ // Convert relative paths to absolute paths
+ for (std::string& resFile : files) {
+ resFile = cmSystemTools::CollapseCombinedPath(fileDir, resFile);
+ }
+
return true;
}
// - Class definitions
-const std::string cmQtAutoGen::listSep = "@LSEP@";
+std::string const cmQtAutoGen::listSep = "@LSEP@";
-const std::string& cmQtAutoGen::GeneratorName(GeneratorType type)
+std::string const& cmQtAutoGen::GeneratorName(Generator type)
{
switch (type) {
- case GeneratorType::GEN:
+ case Generator::GEN:
return genNameGen;
- case GeneratorType::MOC:
+ case Generator::MOC:
return genNameMoc;
- case GeneratorType::UIC:
+ case Generator::UIC:
return genNameUic;
- case GeneratorType::RCC:
+ case Generator::RCC:
return genNameRcc;
}
return genNameGen;
}
-std::string cmQtAutoGen::GeneratorNameUpper(GeneratorType genType)
+std::string cmQtAutoGen::GeneratorNameUpper(Generator genType)
{
return cmSystemTools::UpperCase(cmQtAutoGen::GeneratorName(genType));
}
-std::string cmQtAutoGen::Quoted(const std::string& text)
+std::string const& cmQtAutoGen::MultiConfigName(MultiConfig config)
+{
+ switch (config) {
+ case MultiConfig::SINGLE:
+ return mcNameSingle;
+ case MultiConfig::WRAP:
+ return mcNameWrap;
+ case MultiConfig::FULL:
+ return mcNameFull;
+ }
+ return mcNameWrap;
+}
+
+cmQtAutoGen::MultiConfig cmQtAutoGen::MultiConfigType(std::string const& name)
+{
+ if (name == mcNameSingle) {
+ return MultiConfig::SINGLE;
+ }
+ if (name == mcNameFull) {
+ return MultiConfig::FULL;
+ }
+ return MultiConfig::WRAP;
+}
+
+std::string cmQtAutoGen::Quoted(std::string const& text)
{
static const char* rep[18] = { "\\", "\\\\", "\"", "\\\"", "\a", "\\a",
"\b", "\\b", "\f", "\\f", "\n", "\\n",
@@ -273,11 +310,28 @@ std::string cmQtAutoGen::Quoted(const std::string& text)
return res;
}
+std::string cmQtAutoGen::AppendFilenameSuffix(std::string const& filename,
+ std::string const& suffix)
+{
+ std::string res;
+ auto pos = filename.rfind('.');
+ if (pos != std::string::npos) {
+ const auto it_dot = filename.begin() + pos;
+ res.assign(filename.begin(), it_dot);
+ res.append(suffix);
+ res.append(it_dot, filename.end());
+ } else {
+ res = filename;
+ res.append(suffix);
+ }
+ return res;
+}
+
void cmQtAutoGen::UicMergeOptions(std::vector<std::string>& baseOpts,
- const std::vector<std::string>& newOpts,
+ std::vector<std::string> const& newOpts,
bool isQt5)
{
- static const std::vector<std::string> valueOpts = {
+ static std::vector<std::string> const valueOpts = {
"tr", "translate", "postfix", "generator",
"include", // Since Qt 5.3
"g"
@@ -286,18 +340,18 @@ void cmQtAutoGen::UicMergeOptions(std::vector<std::string>& baseOpts,
}
void cmQtAutoGen::RccMergeOptions(std::vector<std::string>& baseOpts,
- const std::vector<std::string>& newOpts,
+ std::vector<std::string> const& newOpts,
bool isQt5)
{
- static const std::vector<std::string> valueOpts = { "name", "root",
+ static std::vector<std::string> const valueOpts = { "name", "root",
"compress",
"threshold" };
MergeOptions(baseOpts, newOpts, valueOpts, isQt5);
}
-bool cmQtAutoGen::RccListInputs(const std::string& qtMajorVersion,
- const std::string& rccCommand,
- const std::string& fileName,
+bool cmQtAutoGen::RccListInputs(std::string const& qtMajorVersion,
+ std::string const& rccCommand,
+ std::string const& fileName,
std::vector<std::string>& files,
std::string* errorMessage)
{
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index 4cd5e32..acc092f 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -14,9 +14,9 @@
class cmQtAutoGen
{
public:
- static const std::string listSep;
+ static std::string const listSep;
- enum GeneratorType
+ enum Generator
{
GEN, // General
MOC,
@@ -24,32 +24,47 @@ public:
RCC
};
+ enum MultiConfig
+ {
+ SINGLE, // Single configuration
+ WRAP, // Multi configuration using wrapper files
+ FULL // Full multi configuration using per config sources
+ };
+
public:
/// @brief Returns the generator name
- static const std::string& GeneratorName(GeneratorType genType);
+ static std::string const& GeneratorName(Generator genType);
/// @brief Returns the generator name in upper case
- static std::string GeneratorNameUpper(GeneratorType genType);
+ static std::string GeneratorNameUpper(Generator genType);
+
+ /// @brief Returns the multi configuration name string
+ static std::string const& MultiConfigName(MultiConfig config);
+ /// @brief Returns the multi configuration type
+ static MultiConfig MultiConfigType(std::string const& name);
/// @brief Returns a the string escaped and enclosed in quotes
- ///
- static std::string Quoted(const std::string& text);
+ static std::string Quoted(std::string const& text);
+
+ /// @brief Appends the suffix to the filename before the last dot
+ static std::string AppendFilenameSuffix(std::string const& filename,
+ std::string const& suffix);
/// @brief Merges newOpts into baseOpts
static void UicMergeOptions(std::vector<std::string>& baseOpts,
- const std::vector<std::string>& newOpts,
+ std::vector<std::string> const& newOpts,
bool isQt5);
/// @brief Merges newOpts into baseOpts
static void RccMergeOptions(std::vector<std::string>& baseOpts,
- const std::vector<std::string>& newOpts,
+ std::vector<std::string> const& newOpts,
bool isQt5);
/// @brief Reads the resource files list from from a .qrc file
/// @arg fileName Must be the absolute path of the .qrc file
/// @return True if the rcc file was successfully parsed
- static bool RccListInputs(const std::string& qtMajorVersion,
- const std::string& rccCommand,
- const std::string& fileName,
+ static bool RccListInputs(std::string const& qtMajorVersion,
+ std::string const& rccCommand,
+ std::string const& fileName,
std::vector<std::string>& files,
std::string* errorMessage = nullptr);
};
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 69f8b8f..217865b 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -48,9 +48,26 @@ inline static std::string GetSafeProperty(cmSourceFile const* sf,
return std::string(SafeString(sf->GetProperty(key)));
}
-inline static bool AutogenMultiConfig(cmGlobalGenerator* globalGen)
+static cmQtAutoGen::MultiConfig AutogenMultiConfig(
+ cmGlobalGenerator* globalGen)
{
- return globalGen->IsMultiConfig();
+ if (!globalGen->IsMultiConfig()) {
+ return cmQtAutoGen::SINGLE;
+ }
+
+ // FIXME: Xcode does not support per-config sources, yet.
+ // (EXCLUDED_SOURCE_FILE_NAMES)
+ // if (globalGen->GetName().find("Xcode") != std::string::npos) {
+ // return cmQtAutoGen::FULL;
+ //}
+
+ // FIXME: Visual Studio does not support per-config sources, yet.
+ // (EXCLUDED_SOURCE_FILE_NAMES)
+ // if (globalGen->GetName().find("Visual Studio") != std::string::npos) {
+ // return cmQtAutoGen::FULL;
+ //}
+
+ return cmQtAutoGen::WRAP;
}
static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
@@ -100,7 +117,7 @@ std::string cmQtAutoGeneratorInitializer::GetQtMajorVersion(
}
std::string cmQtAutoGeneratorInitializer::GetQtMinorVersion(
- cmGeneratorTarget const* target, const std::string& qtVersionMajor)
+ cmGeneratorTarget const* target, std::string const& qtVersionMajor)
{
cmMakefile* makefile = target->Target->GetMakefile();
std::string qtMinor;
@@ -119,8 +136,8 @@ std::string cmQtAutoGeneratorInitializer::GetQtMinorVersion(
return qtMinor;
}
-static bool QtVersionGreaterOrEqual(const std::string& major,
- const std::string& minor,
+static bool QtVersionGreaterOrEqual(std::string const& major,
+ std::string const& minor,
unsigned long requestMajor,
unsigned long requestMinor)
{
@@ -134,40 +151,17 @@ static bool QtVersionGreaterOrEqual(const std::string& major,
return false;
}
-static std::vector<std::string> GetConfigurations(
- cmMakefile* makefile, std::string* config = nullptr)
-{
- std::vector<std::string> configs;
- {
- std::string cfg = makefile->GetConfigurations(configs);
- if (config != nullptr) {
- *config = cfg;
- }
- }
- // Add empty configuration on demand
- if (configs.empty()) {
- configs.push_back("");
- }
- return configs;
-}
-
-static std::vector<std::string> GetConfigurationSuffixes(cmMakefile* makefile)
+static void GetConfigs(cmMakefile* makefile, std::string& configDefault,
+ std::vector<std::string>& configsList)
{
- std::vector<std::string> suffixes;
- if (AutogenMultiConfig(makefile->GetGlobalGenerator())) {
- makefile->GetConfigurations(suffixes);
- for (std::string& suffix : suffixes) {
- suffix.insert(0, "_");
- }
+ configDefault = makefile->GetConfigurations(configsList);
+ if (configsList.empty()) {
+ configsList.push_back("");
}
- if (suffixes.empty()) {
- suffixes.push_back("");
- }
- return suffixes;
}
static void AddDefinitionEscaped(cmMakefile* makefile, const char* key,
- const std::string& value)
+ std::string const& value)
{
makefile->AddDefinition(key,
cmOutputConverter::EscapeForCMake(value).c_str());
@@ -203,8 +197,8 @@ static void AddDefinitionEscaped(
.c_str());
}
-static bool AddToSourceGroup(cmMakefile* makefile, const std::string& fileName,
- cmQtAutoGen::GeneratorType genType)
+static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
+ cmQtAutoGen::Generator genType)
{
cmSourceGroup* sourceGroup = nullptr;
// Acquire source group
@@ -255,25 +249,54 @@ static bool AddToSourceGroup(cmMakefile* makefile, const std::string& fileName,
return true;
}
-static void AddCleanFile(cmMakefile* makefile, const std::string& fileName)
+static void AddCleanFile(cmMakefile* makefile, std::string const& fileName)
{
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fileName.c_str(),
false);
}
-static void AddGeneratedSource(cmGeneratorTarget* target,
- const std::string& filename,
- cmQtAutoGen::GeneratorType genType)
+static std::vector<std::string> AddGeneratedSource(
+ cmGeneratorTarget* target, std::string const& filename,
+ cmQtAutoGen::MultiConfig multiConfig,
+ const std::vector<std::string>& configsList, cmQtAutoGen::Generator genType)
{
- cmMakefile* makefile = target->Target->GetMakefile();
+ std::vector<std::string> genFiles;
+ // Register source file in makefile and source group
+ if (multiConfig != cmQtAutoGen::FULL) {
+ genFiles.push_back(filename);
+ } else {
+ for (std::string const& cfg : configsList) {
+ genFiles.push_back(
+ cmQtAutoGen::AppendFilenameSuffix(filename, "_" + cfg));
+ }
+ }
{
- cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
- gFile->SetProperty("GENERATED", "1");
- gFile->SetProperty("SKIP_AUTOGEN", "On");
+ cmMakefile* makefile = target->Target->GetMakefile();
+ for (std::string const& genFile : genFiles) {
+ {
+ cmSourceFile* gFile = makefile->GetOrCreateSource(genFile, true);
+ gFile->SetProperty("GENERATED", "1");
+ gFile->SetProperty("SKIP_AUTOGEN", "On");
+ }
+ AddToSourceGroup(makefile, genFile, genType);
+ }
}
- target->AddSource(filename);
- AddToSourceGroup(makefile, filename, genType);
+ // Add source file to target
+ if (multiConfig != cmQtAutoGen::FULL) {
+ target->AddSource(filename);
+ } else {
+ for (std::string const& cfg : configsList) {
+ std::string src = "$<$<CONFIG:";
+ src += cfg;
+ src += ">:";
+ src += cmQtAutoGen::AppendFilenameSuffix(filename, "_" + cfg);
+ src += ">";
+ target->AddSource(src);
+ }
+ }
+
+ return genFiles;
}
struct cmQtAutoGenSetup
@@ -295,8 +318,8 @@ static void SetupAcquireSkipFiles(cmQtAutoGenDigest const& digest,
digest.Target->Makefile->GetSourceFiles();
for (cmSourceFile* sf : allSources) {
// sf->GetExtension() is only valid after sf->GetFullPath() ...
- const std::string& fPath = sf->GetFullPath();
- const cmSystemTools::FileFormat fileType =
+ std::string const& fPath = sf->GetFullPath();
+ cmSystemTools::FileFormat const fileType =
cmSystemTools::GetFileFormat(sf->GetExtension().c_str());
if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) &&
!(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
@@ -308,7 +331,7 @@ static void SetupAcquireSkipFiles(cmQtAutoGenDigest const& digest,
const bool uicSkip = digest.UicEnabled &&
(skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC"));
if (mocSkip || uicSkip) {
- const std::string absFile = cmSystemTools::GetRealPath(fPath);
+ std::string const absFile = cmSystemTools::GetRealPath(fPath);
if (mocSkip) {
setup.MocSkip.insert(absFile);
}
@@ -320,9 +343,9 @@ static void SetupAcquireSkipFiles(cmQtAutoGenDigest const& digest,
}
}
-static void SetupAutoTargetMoc(const cmQtAutoGenDigest& digest,
- std::string const& config,
- std::vector<std::string> const& configs,
+static void SetupAutoTargetMoc(cmQtAutoGenDigest const& digest,
+ std::string const& configDefault,
+ std::vector<std::string> const& configsList,
cmQtAutoGenSetup& setup)
{
cmGeneratorTarget const* target = digest.Target;
@@ -340,51 +363,53 @@ static void SetupAutoTargetMoc(const cmQtAutoGenDigest& digest,
AddDefinitionEscaped(makefile, "_moc_depend_filters",
GetSafeProperty(target, "AUTOMOC_DEPEND_FILTERS"));
- if (QtVersionGreaterOrEqual(digest.QtVersionMajor, digest.QtVersionMinor, 5,
- 8)) {
- AddDefinitionEscaped(
- makefile, "_moc_predefs_cmd",
- makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"));
+ // Compiler predefines
+ if (target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES")) {
+ if (QtVersionGreaterOrEqual(digest.QtVersionMajor, digest.QtVersionMinor,
+ 5, 8)) {
+ AddDefinitionEscaped(
+ makefile, "_moc_predefs_cmd",
+ makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"));
+ }
}
// Moc includes and compile definitions
{
- auto GetCompileDefinitionsAndDirectories = [target, localGen](
- const std::string& cfg, std::string& incs, std::string& defs) {
- {
- std::vector<std::string> includeDirs;
- // Get the include dirs for this target, without stripping the implicit
- // include dirs off, see
- // https://gitlab.kitware.com/cmake/cmake/issues/13667
- localGen->GetIncludeDirectories(includeDirs, target, "CXX", cfg,
- false);
- incs = cmJoin(includeDirs, ";");
- }
- {
- std::set<std::string> defines;
- localGen->AddCompileDefinitions(defines, target, cfg, "CXX");
- defs += cmJoin(defines, ";");
- }
+ auto GetIncludeDirs = [target,
+ localGen](std::string const& cfg) -> std::string {
+ // Get the include dirs for this target, without stripping the implicit
+ // include dirs off, see
+ // https://gitlab.kitware.com/cmake/cmake/issues/13667
+ std::vector<std::string> includeDirs;
+ localGen->GetIncludeDirectories(includeDirs, target, "CXX", cfg, false);
+ return cmJoin(includeDirs, ";");
+ };
+ auto GetCompileDefinitions =
+ [target, localGen](std::string const& cfg) -> std::string {
+ std::set<std::string> defines;
+ localGen->AddCompileDefinitions(defines, target, cfg, "CXX");
+ return cmJoin(defines, ";");
};
- // Default settings
- std::string incs;
- std::string compileDefs;
- GetCompileDefinitionsAndDirectories(config, incs, compileDefs);
- AddDefinitionEscaped(makefile, "_moc_incs", incs);
- AddDefinitionEscaped(makefile, "_moc_compile_defs", compileDefs);
-
- // Configuration specific settings
- for (std::string const& cfg : configs) {
- std::string configIncs;
- std::string configCompileDefs;
- GetCompileDefinitionsAndDirectories(cfg, configIncs, configCompileDefs);
- if (configIncs != incs) {
- setup.ConfigMocIncludes[cfg] = configIncs;
+ // Default configuration settings
+ std::string const includeDirs = GetIncludeDirs(configDefault);
+ std::string const compileDefs = GetCompileDefinitions(configDefault);
+ // Other configuration settings
+ for (std::string const& cfg : configsList) {
+ {
+ std::string const configIncludeDirs = GetIncludeDirs(cfg);
+ if (configIncludeDirs != includeDirs) {
+ setup.ConfigMocIncludes[cfg] = configIncludeDirs;
+ }
}
- if (configCompileDefs != compileDefs) {
- setup.ConfigMocDefines[cfg] = configCompileDefs;
+ {
+ std::string const configCompileDefs = GetCompileDefinitions(cfg);
+ if (configCompileDefs != compileDefs) {
+ setup.ConfigMocDefines[cfg] = configCompileDefs;
+ }
}
}
+ AddDefinitionEscaped(makefile, "_moc_include_dirs", includeDirs);
+ AddDefinitionEscaped(makefile, "_moc_compile_defs", compileDefs);
}
// Moc executable
@@ -419,7 +444,7 @@ static void SetupAutoTargetMoc(const cmQtAutoGenDigest& digest,
}
}
-static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest,
+static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest,
std::string const& config,
std::vector<std::string> const& configs,
cmQtAutoGenSetup& setup)
@@ -433,10 +458,10 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest,
{
std::vector<std::string> uicSearchPaths;
{
- const std::string usp = GetSafeProperty(target, "AUTOUIC_SEARCH_PATHS");
+ std::string const usp = GetSafeProperty(target, "AUTOUIC_SEARCH_PATHS");
if (!usp.empty()) {
cmSystemTools::ExpandListArgument(usp, uicSearchPaths);
- const std::string srcDir = makefile->GetCurrentSourceDirectory();
+ std::string const srcDir = makefile->GetCurrentSourceDirectory();
for (std::string& path : uicSearchPaths) {
path = cmSystemTools::CollapseFullPath(path, srcDir);
}
@@ -446,19 +471,19 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest,
}
// Uic target options
{
- auto UicGetOpts = [target](const std::string& cfg) -> std::string {
+ auto UicGetOpts = [target](std::string const& cfg) -> std::string {
std::vector<std::string> opts;
target->GetAutoUicOptions(opts, cfg);
return cmJoin(opts, ";");
};
// Default settings
- const std::string uicOpts = UicGetOpts(config);
+ std::string const uicOpts = UicGetOpts(config);
AddDefinitionEscaped(makefile, "_uic_target_options", uicOpts);
// Configuration specific settings
for (std::string const& cfg : configs) {
- const std::string configUicOpts = UicGetOpts(cfg);
+ std::string const configUicOpts = UicGetOpts(cfg);
if (configUicOpts != uicOpts) {
setup.ConfigUicOptions[cfg] = configUicOpts;
}
@@ -469,16 +494,16 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest,
std::vector<std::string> uiFileFiles;
std::vector<std::vector<std::string>> uiFileOptions;
{
- const std::string uiExt = "ui";
+ std::string const uiExt = "ui";
const std::vector<cmSourceFile*>& srcFiles = makefile->GetSourceFiles();
for (cmSourceFile* sf : srcFiles) {
// sf->GetExtension() is only valid after sf->GetFullPath() ...
- const std::string& fPath = sf->GetFullPath();
+ std::string const& fPath = sf->GetFullPath();
if (sf->GetExtension() == uiExt) {
// Check if the files has uic options
- const std::string uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS");
+ std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS");
if (!uicOpts.empty()) {
- const std::string absFile = cmSystemTools::GetRealPath(fPath);
+ std::string const absFile = cmSystemTools::GetRealPath(fPath);
// Check if file isn't skipped
if (setup.UicSkip.count(absFile) == 0) {
uiFileFiles.push_back(absFile);
@@ -528,7 +553,7 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest,
}
static std::string RccGetExecutable(cmGeneratorTarget const* target,
- const std::string& qtMajorVersion)
+ std::string const& qtMajorVersion)
{
std::string rccExec;
std::string err;
@@ -559,7 +584,7 @@ static std::string RccGetExecutable(cmGeneratorTarget const* target,
return rccExec;
}
-static void SetupAutoTargetRcc(const cmQtAutoGenDigest& digest)
+static void SetupAutoTargetRcc(cmQtAutoGenDigest const& digest)
{
std::vector<std::string> rccFiles;
std::vector<std::string> rccBuilds;
@@ -590,26 +615,36 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmLocalGenerator* localGen = target->GetLocalGenerator();
cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
- // Create a custom target for running generators at buildtime
- const bool multiConfig = AutogenMultiConfig(globalGen);
- const std::string autogenTargetName = GetAutogenTargetName(target);
- const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
- const std::string workingDirectory =
+ std::string const autogenTargetName = GetAutogenTargetName(target);
+ std::string const autogenInfoDir = GetAutogenTargetFilesDir(target);
+ std::string const autogenBuildDir = GetAutogenTargetBuildDir(target);
+ std::string const workingDirectory =
cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
- const std::vector<std::string> suffixes = GetConfigurationSuffixes(makefile);
+
+ cmQtAutoGen::MultiConfig const multiConfig = AutogenMultiConfig(globalGen);
+ std::string configDefault;
+ std::vector<std::string> configsList;
+ GetConfigs(makefile, configDefault, configsList);
+
std::set<std::string> autogenDependFiles;
std::set<std::string> autogenDependTargets;
std::vector<std::string> autogenProvides;
// Remove build directories on cleanup
AddCleanFile(makefile, autogenBuildDir);
-
// Remove old settings on cleanup
{
- std::string base = GetAutogenTargetFilesDir(target);
- base += "/AutogenOldSettings";
- for (std::string const& suffix : suffixes) {
- AddCleanFile(makefile, (base + suffix).append(".cmake"));
+ std::string base = autogenInfoDir + "/AutogenOldSettings";
+ if (multiConfig == cmQtAutoGen::SINGLE) {
+ AddCleanFile(makefile, base.append(".cmake"));
+ } else {
+ for (std::string const& cfg : configsList) {
+ std::string filename = base;
+ filename += "_";
+ filename += cfg;
+ filename += ".cmake";
+ AddCleanFile(makefile, filename);
+ }
}
}
@@ -620,7 +655,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
currentLine.push_back(cmSystemTools::GetCMakeCommand());
currentLine.push_back("-E");
currentLine.push_back("cmake_autogen");
- currentLine.push_back(GetAutogenTargetFilesDir(target));
+ currentLine.push_back(autogenInfoDir);
currentLine.push_back("$<CONFIGURATION>");
commandLines.push_back(currentLine);
}
@@ -630,38 +665,42 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
{
std::vector<std::string> toolNames;
if (digest.MocEnabled) {
- toolNames.push_back("MOC");
+ toolNames.emplace_back("MOC");
}
if (digest.UicEnabled) {
- toolNames.push_back("UIC");
+ toolNames.emplace_back("UIC");
}
if (digest.RccEnabled) {
- toolNames.push_back("RCC");
+ toolNames.emplace_back("RCC");
}
- std::string tools = toolNames[0];
+ std::string tools = toolNames.front();
toolNames.erase(toolNames.begin());
- while (toolNames.size() > 1) {
- tools += ", " + toolNames[0];
- toolNames.erase(toolNames.begin());
- }
- if (toolNames.size() == 1) {
- tools += " and " + toolNames[0];
+ if (!toolNames.empty()) {
+ while (toolNames.size() > 1) {
+ tools += ", ";
+ tools += toolNames.front();
+ toolNames.erase(toolNames.begin());
+ }
+ tools += " and " + toolNames.front();
}
autogenComment = "Automatic " + tools + " for target " + target->GetName();
}
// Add moc compilation to generated files list
if (digest.MocEnabled) {
- const std::string mocsComp = autogenBuildDir + "/mocs_compilation.cpp";
- AddGeneratedSource(target, mocsComp, cmQtAutoGen::MOC);
- autogenProvides.push_back(mocsComp);
+ std::string const mocsComp = autogenBuildDir + "/mocs_compilation.cpp";
+ auto files = AddGeneratedSource(target, mocsComp, multiConfig, configsList,
+ cmQtAutoGen::MOC);
+ for (std::string& file : files) {
+ autogenProvides.push_back(std::move(file));
+ }
}
// Add autogen includes directory to the origin target INCLUDE_DIRECTORIES
if (digest.MocEnabled || digest.UicEnabled) {
std::string includeDir = autogenBuildDir + "/include";
- if (multiConfig) {
+ if (multiConfig != cmQtAutoGen::SINGLE) {
includeDir += "_$<CONFIG>";
}
target->AddIncludeDirectory(includeDir, true);
@@ -671,7 +710,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
std::vector<std::string> generatedSources;
std::vector<std::string> generatedHeaders;
{
- const std::string qrcExt = "qrc";
+ std::string const qrcExt = "qrc";
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
for (cmSourceFile* sf : srcFiles) {
@@ -679,15 +718,15 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
continue;
}
// sf->GetExtension() is only valid after sf->GetFullPath() ...
- const std::string& fPath = sf->GetFullPath();
- const std::string& ext = sf->GetExtension();
+ std::string const& fPath = sf->GetFullPath();
+ std::string const& ext = sf->GetExtension();
// Register generated files that will be scanned by moc or uic
if (digest.MocEnabled || digest.UicEnabled) {
- const cmSystemTools::FileFormat fileType =
+ cmSystemTools::FileFormat const fileType =
cmSystemTools::GetFileFormat(ext.c_str());
if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
- const std::string absPath = cmSystemTools::GetRealPath(fPath);
+ std::string const absPath = cmSystemTools::GetRealPath(fPath);
if ((digest.MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) ||
(digest.UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) {
// Register source
@@ -720,7 +759,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
qrcDigest.Generated = sf->GetPropertyAsBool("GENERATED");
// RCC options
{
- const std::string opts = GetSafeProperty(sf, "AUTORCC_OPTIONS");
+ std::string const opts = GetSafeProperty(sf, "AUTORCC_OPTIONS");
if (!opts.empty()) {
cmSystemTools::ExpandListArgument(opts, qrcDigest.Options);
}
@@ -741,7 +780,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Check status of policy CMP0071
bool policyAccept = false;
bool policyWarn = false;
- const cmPolicies::PolicyStatus CMP0071_status =
+ cmPolicies::PolicyStatus const CMP0071_status =
target->Makefile->GetPolicyStatus(cmPolicies::CMP0071);
switch (CMP0071_status) {
case cmPolicies::WARN:
@@ -774,27 +813,35 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071);
msg += "\n";
std::string tools;
- if (digest.MocEnabled) {
- tools += "AUTOMOC";
+ std::string property;
+ if (digest.MocEnabled && digest.UicEnabled) {
+ tools = "AUTOMOC and AUTOUIC";
+ property = "SKIP_AUTOGEN";
+ } else if (digest.MocEnabled) {
+ tools = "AUTOMOC";
+ property = "SKIP_AUTOMOC";
+ } else if (digest.UicEnabled) {
+ tools = "AUTOUIC";
+ property = "SKIP_AUTOUIC";
}
- if (digest.UicEnabled) {
- if (!tools.empty()) {
- tools += ",";
- }
- tools += "AUTOUIC";
+ msg += "For compatibility, CMake is excluding the GENERATED source "
+ "file(s):\n";
+ for (const std::string& absFile : generatedHeaders) {
+ msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n");
}
- if (!generatedHeaders.empty()) {
- msg.append(tools).append(": Ignoring GENERATED header file(s):\n");
- for (const std::string& absFile : generatedHeaders) {
- msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n");
- }
- }
- if (!generatedSources.empty()) {
- msg.append(tools).append(": Ignoring GENERATED source file(s):\n");
- for (const std::string& absFile : generatedSources) {
- msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n");
- }
+ for (const std::string& absFile : generatedSources) {
+ msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n");
}
+ msg += "from processing by ";
+ msg += tools;
+ msg +=
+ ". If any of the files should be processed, set CMP0071 to NEW. "
+ "If any of the files should not be processed, "
+ "explicitly exclude them by setting the source file property ";
+ msg += property;
+ msg += ":\n set_property(SOURCE file.h PROPERTY ";
+ msg += property;
+ msg += " ON)\n";
makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
}
}
@@ -806,7 +853,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Process qrc files
if (!digest.Qrcs.empty()) {
const bool QtV5 = (digest.QtVersionMajor == "5");
- const std::string rcc = RccGetExecutable(target, digest.QtVersionMajor);
+ std::string const rcc = RccGetExecutable(target, digest.QtVersionMajor);
// Target rcc options
std::vector<std::string> optionsTarget;
cmSystemTools::ExpandListArgument(
@@ -825,7 +872,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
// Path checksum
{
- const cmFilePathChecksum fpathCheckSum(makefile);
+ cmFilePathChecksum const fpathCheckSum(makefile);
for (cmQtAutoGenDigestQrc& qrcDigest : digest.Qrcs) {
qrcDigest.PathChecksum = fpathCheckSum.getPart(qrcDigest.QrcFile);
// RCC output file name
@@ -861,8 +908,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
for (cmQtAutoGenDigestQrc& qrcDigest : digest.Qrcs) {
// Register file at target
- AddGeneratedSource(target, qrcDigest.RccFile, cmQtAutoGen::RCC);
- autogenProvides.push_back(qrcDigest.RccFile);
+ {
+ auto files = AddGeneratedSource(target, qrcDigest.RccFile, multiConfig,
+ configsList, cmQtAutoGen::RCC);
+ for (std::string& file : files) {
+ autogenProvides.push_back(std::move(file));
+ }
+ }
// Dependencies
if (qrcDigest.Generated) {
// Add the GENERATED .qrc file to the dependencies
@@ -889,7 +941,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Add user defined autogen target dependencies
{
- const std::string deps = GetSafeProperty(target, "AUTOGEN_TARGET_DEPENDS");
+ std::string const deps = GetSafeProperty(target, "AUTOGEN_TARGET_DEPENDS");
if (!deps.empty()) {
std::vector<std::string> extraDeps;
cmSystemTools::ExpandListArgument(deps, extraDeps);
@@ -924,7 +976,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Create the autogen target/command
if (usePRE_BUILD) {
// Add additional autogen target dependencies to origin target
- for (const std::string& depTarget : autogenDependTargets) {
+ for (std::string const& depTarget : autogenDependTargets) {
target->Target->AddUtility(depTarget, makefile);
}
@@ -944,7 +996,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
} else {
// Add utility target dependencies to the autogen target dependencies
- for (const std::string& depTarget : target->Target->GetUtilities()) {
+ for (std::string const& depTarget : target->Target->GetUtilities()) {
autogenDependTargets.insert(depTarget);
}
// Add link library target dependencies to the autogen target dependencies
@@ -967,7 +1019,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
new cmGeneratorTarget(autogenTarget, localGen));
// Add additional autogen target dependencies to autogen target
- for (const std::string& depTarget : autogenDependTargets) {
+ for (std::string const& depTarget : autogenDependTargets) {
autogenTarget->AddUtility(depTarget, makefile);
}
@@ -994,45 +1046,51 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
- const cmQtAutoGenDigest& digest)
+ cmQtAutoGenDigest const& digest)
{
cmGeneratorTarget const* target = digest.Target;
cmMakefile* makefile = target->Target->GetMakefile();
+ cmQtAutoGen::MultiConfig const multiConfig =
+ AutogenMultiConfig(target->GetGlobalGenerator());
// forget the variables added here afterwards again:
cmMakefile::ScopePushPop varScope(makefile);
static_cast<void>(varScope);
- // Get configurations
- std::string config;
- const std::vector<std::string> configs(GetConfigurations(makefile, &config));
-
- // Configuration suffixes
- std::map<std::string, std::string> configSuffix;
- if (AutogenMultiConfig(target->GetGlobalGenerator())) {
- for (std::string const& cfg : configs) {
- configSuffix[cfg] = "_" + cfg;
+ // Configurations
+ std::string configDefault;
+ std::vector<std::string> configsList;
+ std::map<std::string, std::string> configSuffixes;
+ {
+ configDefault = makefile->GetConfigurations(configsList);
+ if (configsList.empty()) {
+ configsList.push_back("");
}
}
+ for (std::string const& cfg : configsList) {
+ configSuffixes[cfg] = "_" + cfg;
+ }
// Configurations settings buffers
cmQtAutoGenSetup setup;
// Basic setup
+ AddDefinitionEscaped(makefile, "_multi_config",
+ cmQtAutoGen::MultiConfigName(multiConfig));
AddDefinitionEscaped(makefile, "_build_dir",
GetAutogenTargetBuildDir(target));
- AddDefinitionEscaped(makefile, "_qt_version_major", digest.QtVersionMajor);
- AddDefinitionEscaped(makefile, "_qt_version_minor", digest.QtVersionMinor);
AddDefinitionEscaped(makefile, "_sources", digest.Sources);
AddDefinitionEscaped(makefile, "_headers", digest.Headers);
+ AddDefinitionEscaped(makefile, "_qt_version_major", digest.QtVersionMajor);
+ AddDefinitionEscaped(makefile, "_qt_version_minor", digest.QtVersionMinor);
{
if (digest.MocEnabled || digest.UicEnabled) {
SetupAcquireSkipFiles(digest, setup);
if (digest.MocEnabled) {
- SetupAutoTargetMoc(digest, config, configs, setup);
+ SetupAutoTargetMoc(digest, configDefault, configsList, setup);
}
if (digest.UicEnabled) {
- SetupAutoTargetUic(digest, config, configs, setup);
+ SetupAutoTargetUic(digest, configDefault, configsList, setup);
}
}
if (digest.RccEnabled) {
@@ -1041,17 +1099,23 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
}
// Generate info file
- std::string infoFile = GetAutogenTargetFilesDir(target);
- infoFile += "/AutogenInfo.cmake";
{
- std::string inf = cmSystemTools::GetCMakeRoot();
- inf += "/Modules/AutogenInfo.cmake.in";
- makefile->ConfigureFile(inf.c_str(), infoFile.c_str(), false, true, false);
- }
+ std::string const infoDir = GetAutogenTargetFilesDir(target);
+ if (!cmSystemTools::MakeDirectory(infoDir)) {
+ std::string emsg = ("Could not create directory: ");
+ emsg += cmQtAutoGen::Quoted(infoDir);
+ cmSystemTools::Error(emsg.c_str());
+ }
+ std::string const infoFile = infoDir + "/AutogenInfo.cmake";
+ {
+ std::string infoFileIn = cmSystemTools::GetCMakeRoot();
+ infoFileIn += "/Modules/AutogenInfo.cmake.in";
+ makefile->ConfigureFile(infoFileIn.c_str(), infoFile.c_str(), false,
+ true, false);
+ }
- // Append custom definitions to info file on demand
- if (!configSuffix.empty() || !setup.ConfigMocDefines.empty() ||
- !setup.ConfigMocIncludes.empty() || !setup.ConfigUicOptions.empty()) {
+ // Append custom definitions to info file
+ // --------------------------------------
// Ensure we have write permission in case .in was read-only.
mode_t perm = 0;
@@ -1069,14 +1133,14 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmsys::ofstream ofs(infoFile.c_str(), std::ios::app);
if (ofs) {
auto OfsWriteMap = [&ofs](
- const char* key, const std::map<std::string, std::string>& map) {
+ const char* key, std::map<std::string, std::string> const& map) {
for (auto const& item : map) {
ofs << "set(" << key << "_" << item.first << " "
<< cmOutputConverter::EscapeForCMake(item.second) << ")\n";
}
};
- ofs << "# Configuration specific options\n";
- OfsWriteMap("AM_CONFIG_SUFFIX", configSuffix);
+ ofs << "# Configurations options\n";
+ OfsWriteMap("AM_CONFIG_SUFFIX", configSuffixes);
OfsWriteMap("AM_MOC_DEFINITIONS", setup.ConfigMocDefines);
OfsWriteMap("AM_MOC_INCLUDES", setup.ConfigMocIncludes);
OfsWriteMap("AM_UIC_TARGET_OPTIONS", setup.ConfigUicOptions);
diff --git a/Source/cmQtAutoGeneratorInitializer.h b/Source/cmQtAutoGeneratorInitializer.h
index 1264ca5..b8a5ae4 100644
--- a/Source/cmQtAutoGeneratorInitializer.h
+++ b/Source/cmQtAutoGeneratorInitializer.h
@@ -15,7 +15,7 @@ class cmQtAutoGeneratorInitializer
public:
static std::string GetQtMajorVersion(cmGeneratorTarget const* target);
static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
- const std::string& qtVersionMajor);
+ std::string const& qtVersionMajor);
static void InitializeAutogenTarget(cmQtAutoGenDigest& digest);
static void SetupAutoGenerateTarget(cmQtAutoGenDigest const& digest);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 8c03045..f13312f 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -8,6 +8,7 @@
#include <algorithm>
#include <array>
#include <list>
+#include <memory>
#include <sstream>
#include <string.h>
#include <utility>
@@ -35,14 +36,23 @@ static const char* SettingsKeyRcc = "AM_RCC_SETTINGS_HASH";
// -- Static functions
-static std::string QuotedCommand(const std::vector<std::string>& command)
+static std::string HeadLine(std::string const& title)
+{
+ std::string head = title;
+ head += '\n';
+ head.append(head.size() - 1, '-');
+ head += '\n';
+ return head;
+}
+
+static std::string QuotedCommand(std::vector<std::string> const& command)
{
std::string res;
for (std::string const& item : command) {
if (!res.empty()) {
res.push_back(' ');
}
- const std::string cesc = cmQtAutoGen::Quoted(item);
+ std::string const cesc = cmQtAutoGen::Quoted(item);
if (item.empty() || (cesc.size() > (item.size() + 2)) ||
(cesc.find(' ') != std::string::npos)) {
res += cesc;
@@ -53,7 +63,7 @@ static std::string QuotedCommand(const std::vector<std::string>& command)
return res;
}
-static std::string SubDirPrefix(const std::string& fileName)
+static std::string SubDirPrefix(std::string const& fileName)
{
std::string res(cmSystemTools::GetFilenamePath(fileName));
if (!res.empty()) {
@@ -62,36 +72,58 @@ static std::string SubDirPrefix(const std::string& fileName)
return res;
}
-static bool ReadAll(std::string& content, const std::string& filename)
+static bool ReadFile(std::string& content, std::string const& filename,
+ std::string* error = nullptr)
{
bool success = false;
- {
- cmsys::ifstream ifs(filename.c_str());
+ if (cmSystemTools::FileExists(filename)) {
+ std::size_t const length = cmSystemTools::FileLength(filename);
+ cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary));
if (ifs) {
- std::ostringstream osst;
- osst << ifs.rdbuf();
- content = osst.str();
- success = true;
+ content.resize(length);
+ ifs.read(&content.front(), content.size());
+ if (ifs) {
+ success = true;
+ } else {
+ content.clear();
+ if (error != nullptr) {
+ error->append("Reading from the file failed.");
+ }
+ }
+ } else if (error != nullptr) {
+ error->append("Opening the file for reading failed.");
}
+ } else if (error != nullptr) {
+ error->append("The file does not exist.");
}
return success;
}
/**
- * @brief Tests if buildFile doesn't exist or is older than sourceFile
- * @return True if buildFile doesn't exist or is older than sourceFile
+ * @brief Tests if buildFile is older than sourceFile
+ * @return True if buildFile is older than sourceFile.
+ * False may indicate an error.
*/
-static bool FileAbsentOrOlder(const std::string& buildFile,
- const std::string& sourceFile)
+static bool FileIsOlderThan(std::string const& buildFile,
+ std::string const& sourceFile,
+ std::string* error = nullptr)
{
int result = 0;
- bool success =
- cmSystemTools::FileTimeCompare(buildFile, sourceFile, &result);
- return (!success || (result <= 0));
+ if (cmSystemTools::FileTimeCompare(buildFile, sourceFile, &result)) {
+ return (result < 0);
+ }
+ if (error != nullptr) {
+ error->append(
+ "File modification time comparison failed for the files\n ");
+ error->append(cmQtAutoGen::Quoted(buildFile));
+ error->append("\nand\n ");
+ error->append(cmQtAutoGen::Quoted(sourceFile));
+ }
+ return false;
}
-static bool ListContains(const std::vector<std::string>& list,
- const std::string& entry)
+static bool ListContains(std::vector<std::string> const& list,
+ std::string const& entry)
{
return (std::find(list.begin(), list.end(), entry) != list.end());
}
@@ -99,33 +131,24 @@ static bool ListContains(const std::vector<std::string>& list,
// -- Class methods
cmQtAutoGenerators::cmQtAutoGenerators()
- : Verbose(cmSystemTools::HasEnv("VERBOSE"))
+ : MultiConfig(cmQtAutoGen::WRAP)
+ , IncludeProjectDirsBefore(false)
+ , Verbose(cmSystemTools::HasEnv("VERBOSE"))
, ColorOutput(true)
, MocSettingsChanged(false)
, MocPredefsChanged(false)
- , MocRunFailed(false)
+ , MocRelaxedMode(false)
, UicSettingsChanged(false)
- , UicRunFailed(false)
, RccSettingsChanged(false)
- , RccRunFailed(false)
{
-
- std::string colorEnv;
- cmSystemTools::GetEnv("COLOR", colorEnv);
- if (!colorEnv.empty()) {
- if (cmSystemTools::IsOn(colorEnv.c_str())) {
- this->ColorOutput = true;
- } else {
- this->ColorOutput = false;
+ {
+ std::string colorEnv;
+ cmSystemTools::GetEnv("COLOR", colorEnv);
+ if (!colorEnv.empty()) {
+ this->ColorOutput = cmSystemTools::IsOn(colorEnv.c_str());
}
}
- // Moc macro filters
- this->MocMacroFilters.emplace_back(
- "Q_OBJECT", "[\n][ \t]*{?[ \t]*Q_OBJECT[^a-zA-Z0-9_]");
- this->MocMacroFilters.emplace_back(
- "Q_GADGET", "[\n][ \t]*{?[ \t]*Q_GADGET[^a-zA-Z0-9_]");
-
// Precompile regular expressions
this->MocRegExpInclude.compile(
"[\n][ \t]*#[ \t]*include[ \t]+"
@@ -134,8 +157,8 @@ cmQtAutoGenerators::cmQtAutoGenerators()
"[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
}
-bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
- const std::string& config)
+bool cmQtAutoGenerators::Run(std::string const& targetDirectory,
+ std::string const& config)
{
cmake cm(cmake::RoleScript);
cm.SetHomeOutputDirectory(targetDirectory);
@@ -147,16 +170,14 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
snapshot.GetDirectory().SetCurrentSource(targetDirectory);
- std::unique_ptr<cmMakefile> makefile(new cmMakefile(&gg, snapshot));
+ auto makefile = cm::make_unique<cmMakefile>(&gg, snapshot);
gg.SetCurrentMakefile(makefile.get());
bool success = false;
- if (this->ReadAutogenInfoFile(makefile.get(), targetDirectory, config)) {
- // Read old settings
+ if (this->InitInfoFile(makefile.get(), targetDirectory, config)) {
+ // Read latest settings
this->SettingsFileRead(makefile.get());
- // Init and run
- this->Init(makefile.get());
- if (this->RunAutogen()) {
+ if (this->Process()) {
// Write current settings
if (this->SettingsFileWrite()) {
success = true;
@@ -166,46 +187,14 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
return success;
}
-bool cmQtAutoGenerators::MocDependFilterPush(const std::string& key,
- const std::string& regExp)
+bool cmQtAutoGenerators::InitInfoFile(cmMakefile* makefile,
+ std::string const& targetDirectory,
+ std::string const& config)
{
- std::string error;
- if (!key.empty()) {
- if (!regExp.empty()) {
- KeyRegExp filter;
- filter.Key = key;
- if (filter.RegExp.compile(regExp)) {
- this->MocDependFilters.push_back(std::move(filter));
- } else {
- error = "Regular expression compiling failed";
- }
- } else {
- error = "Regular expression is empty";
- }
- } else {
- error = "Key is empty";
- }
- if (!error.empty()) {
- std::string emsg = "AUTOMOC_DEPEND_FILTERS: ";
- emsg += error;
- emsg += "\n";
- emsg += " Key: ";
- emsg += cmQtAutoGen::Quoted(key);
- emsg += "\n";
- emsg += " RegExp: ";
- emsg += cmQtAutoGen::Quoted(regExp);
- emsg += "\n";
- this->LogError(cmQtAutoGen::MOC, emsg);
- return false;
- }
- return true;
-}
+ // -- Meta
+ this->HeaderExtensions = makefile->GetCMakeInstance()->GetHeaderExtensions();
-bool cmQtAutoGenerators::ReadAutogenInfoFile(
- cmMakefile* makefile, const std::string& targetDirectory,
- const std::string& config)
-{
- // Lambdas
+ // Utility lambdas
auto InfoGet = [makefile](const char* key) {
return makefile->GetSafeDefinition(key);
};
@@ -221,7 +210,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
[makefile](const char* key) -> std::vector<std::vector<std::string>> {
std::vector<std::vector<std::string>> lists;
{
- const std::string value = makefile->GetSafeDefinition(key);
+ std::string const value = makefile->GetSafeDefinition(key);
std::string::size_type pos = 0;
while (pos < value.size()) {
std::string::size_type next = value.find(cmQtAutoGen::listSep, pos);
@@ -248,10 +237,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
const char* valueConf = nullptr;
{
std::string keyConf = key;
- if (!config.empty()) {
- keyConf += '_';
- keyConf += config;
- }
+ keyConf += '_';
+ keyConf += config;
valueConf = makefile->GetDefinition(keyConf);
}
if (valueConf == nullptr) {
@@ -266,25 +253,22 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
return list;
};
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
- cmSystemTools::ConvertToUnixSlashes(filename);
- filename += "/AutogenInfo.cmake";
-
- if (!makefile->ReadListFile(filename.c_str())) {
- this->LogFileError(cmQtAutoGen::GEN, filename, "File processing failed");
+ // -- Read info file
+ this->InfoFile = cmSystemTools::CollapseFullPath(targetDirectory);
+ cmSystemTools::ConvertToUnixSlashes(this->InfoFile);
+ this->InfoFile += "/AutogenInfo.cmake";
+ if (!makefile->ReadListFile(this->InfoFile.c_str())) {
+ this->LogFileError(cmQtAutoGen::GEN, this->InfoFile,
+ "File processing failed");
return false;
}
// -- Meta
+ this->MultiConfig = cmQtAutoGen::MultiConfigType(InfoGet("AM_MULTI_CONFIG"));
this->ConfigSuffix = InfoGetConfig("AM_CONFIG_SUFFIX");
-
- // - Old settings file
- {
- this->SettingsFile = cmSystemTools::CollapseFullPath(targetDirectory);
- cmSystemTools::ConvertToUnixSlashes(this->SettingsFile);
- this->SettingsFile += "/AutogenOldSettings";
- this->SettingsFile += this->ConfigSuffix;
- this->SettingsFile += ".cmake";
+ if (this->ConfigSuffix.empty()) {
+ this->ConfigSuffix = "_";
+ this->ConfigSuffix += config;
}
// - Files and directories
@@ -296,12 +280,10 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
InfoGetBool("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
this->AutogenBuildDir = InfoGet("AM_BUILD_DIR");
if (this->AutogenBuildDir.empty()) {
- this->LogFileError(cmQtAutoGen::GEN, filename,
+ this->LogFileError(cmQtAutoGen::GEN, this->InfoFile,
"Autogen build directory missing");
return false;
}
- this->Sources = InfoGetList("AM_SOURCES");
- this->Headers = InfoGetList("AM_HEADERS");
// - Qt environment
this->QtMajorVersion = InfoGet("AM_QT_VERSION_MAJOR");
@@ -312,7 +294,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
// Check Qt version
if ((this->QtMajorVersion != "4") && (this->QtMajorVersion != "5")) {
- this->LogFileError(cmQtAutoGen::GEN, filename, "Unsupported Qt version: " +
+ this->LogFileError(cmQtAutoGen::GEN, this->InfoFile,
+ "Unsupported Qt version: " +
cmQtAutoGen::Quoted(this->QtMajorVersion));
return false;
}
@@ -323,7 +306,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
this->MocDefinitions = InfoGetConfigList("AM_MOC_DEFINITIONS");
#ifdef _WIN32
{
- const std::string win32("WIN32");
+ std::string const win32("WIN32");
if (!ListContains(this->MocDefinitions, win32)) {
this->MocDefinitions.push_back(win32);
}
@@ -333,15 +316,15 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
this->MocOptions = InfoGetList("AM_MOC_OPTIONS");
this->MocRelaxedMode = InfoGetBool("AM_MOC_RELAXED_MODE");
{
- const std::vector<std::string> MocMacroNames =
+ std::vector<std::string> const MocMacroNames =
InfoGetList("AM_MOC_MACRO_NAMES");
for (std::string const& item : MocMacroNames) {
this->MocMacroFilters.emplace_back(
- item, ("[^a-zA-Z0-9_]" + item).append("[^a-zA-Z0-9_]"));
+ item, ("[\n][ \t]*{?[ \t]*" + item).append("[^a-zA-Z0-9_]"));
}
}
{
- const std::vector<std::string> mocDependFilters =
+ std::vector<std::string> const mocDependFilters =
InfoGetList("AM_MOC_DEPEND_FILTERS");
// Insert Q_PLUGIN_METADATA dependency filter
if (this->QtMajorVersion != "4") {
@@ -361,7 +344,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
}
} else {
this->LogFileError(
- cmQtAutoGen::MOC, filename,
+ cmQtAutoGen::MOC, this->InfoFile,
"AUTOMOC_DEPEND_FILTERS list size is not a multiple of 2");
return false;
}
@@ -378,22 +361,21 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
auto sources = InfoGetList("AM_UIC_OPTIONS_FILES");
auto options = InfoGetLists("AM_UIC_OPTIONS_OPTIONS");
// Compare list sizes
- if (sources.size() == options.size()) {
- auto fitEnd = sources.cend();
- auto fit = sources.begin();
- auto oit = options.begin();
- while (fit != fitEnd) {
- this->UicOptions[*fit] = std::move(*oit);
- ++fit;
- ++oit;
- }
- } else {
+ if (sources.size() != options.size()) {
std::ostringstream ost;
ost << "files/options lists sizes missmatch (" << sources.size() << "/"
<< options.size() << ")";
- this->LogFileError(cmQtAutoGen::UIC, filename, ost.str());
+ this->LogFileError(cmQtAutoGen::UIC, this->InfoFile, ost.str());
return false;
}
+ auto fitEnd = sources.cend();
+ auto fit = sources.begin();
+ auto oit = options.begin();
+ while (fit != fitEnd) {
+ this->UicOptions[*fit] = std::move(*oit);
+ ++fit;
+ ++oit;
+ }
}
}
@@ -409,24 +391,23 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
std::ostringstream ost;
ost << "sources, builds lists sizes missmatch (" << sources.size() << "/"
<< builds.size() << ")";
- this->LogFileError(cmQtAutoGen::RCC, filename, ost.str());
+ this->LogFileError(cmQtAutoGen::RCC, this->InfoFile, ost.str());
return false;
}
if (sources.size() != options.size()) {
std::ostringstream ost;
ost << "sources, options lists sizes missmatch (" << sources.size()
<< "/" << options.size() << ")";
- this->LogFileError(cmQtAutoGen::RCC, filename, ost.str());
+ this->LogFileError(cmQtAutoGen::RCC, this->InfoFile, ost.str());
return false;
}
if (sources.size() != inputs.size()) {
std::ostringstream ost;
ost << "sources, inputs lists sizes missmatch (" << sources.size() << "/"
<< inputs.size() << ")";
- this->LogFileError(cmQtAutoGen::RCC, filename, ost.str());
+ this->LogFileError(cmQtAutoGen::RCC, this->InfoFile, ost.str());
return false;
}
-
{
auto srcItEnd = sources.end();
auto srcIt = sources.begin();
@@ -445,6 +426,176 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
}
}
+ // Initialize source file jobs
+ {
+ // Utility lambdas
+ auto AddJob = [this](std::map<std::string, SourceJob>& jobs,
+ std::string&& sourceFile) {
+ const bool moc = !this->MocSkip(sourceFile);
+ const bool uic = !this->UicSkip(sourceFile);
+ if (moc || uic) {
+ SourceJob& job = jobs[std::move(sourceFile)];
+ job.Moc = moc;
+ job.Uic = uic;
+ }
+ };
+
+ // Add header jobs
+ for (std::string& hdr : InfoGetList("AM_HEADERS")) {
+ AddJob(this->HeaderJobs, std::move(hdr));
+ }
+ // Add source jobs
+ {
+ std::vector<std::string> sources = InfoGetList("AM_SOURCES");
+ // Add header(s) for the source file
+ for (std::string const& src : sources) {
+ const bool srcMoc = !this->MocSkip(src);
+ const bool srcUic = !this->UicSkip(src);
+ if (!srcMoc && !srcUic) {
+ continue;
+ }
+ // Search for the default header file and a private header
+ std::array<std::string, 2> headerBases;
+ headerBases[0] = SubDirPrefix(src);
+ headerBases[0] += cmSystemTools::GetFilenameWithoutLastExtension(src);
+ headerBases[1] = headerBases[0];
+ headerBases[1] += "_p";
+ for (std::string const& headerBase : headerBases) {
+ std::string header;
+ if (this->FindHeader(header, headerBase)) {
+ const bool moc = srcMoc && !this->MocSkip(header);
+ const bool uic = srcUic && !this->UicSkip(header);
+ if (moc || uic) {
+ SourceJob& job = this->HeaderJobs[std::move(header)];
+ job.Moc = moc;
+ job.Uic = uic;
+ }
+ }
+ }
+ }
+ // Add Source jobs
+ for (std::string& src : sources) {
+ AddJob(this->SourceJobs, std::move(src));
+ }
+ }
+ }
+
+ // Init derived information
+ // ------------------------
+
+ // Init file path checksum generator
+ this->FilePathChecksum.setupParentDirs(
+ this->CurrentSourceDir, this->CurrentBinaryDir, this->ProjectSourceDir,
+ this->ProjectBinaryDir);
+
+ // include directory
+ this->AutogenIncludeDir = "include";
+ if (this->MultiConfig != cmQtAutoGen::SINGLE) {
+ this->AutogenIncludeDir += this->ConfigSuffix;
+ }
+ this->AutogenIncludeDir += "/";
+
+ // Moc variables
+ if (this->MocEnabled()) {
+ // Mocs compilation file
+ this->MocCompFileRel = "mocs_compilation";
+ if (this->MultiConfig == cmQtAutoGen::FULL) {
+ this->MocCompFileRel += this->ConfigSuffix;
+ }
+ this->MocCompFileRel += ".cpp";
+ this->MocCompFileAbs = cmSystemTools::CollapseCombinedPath(
+ this->AutogenBuildDir, this->MocCompFileRel);
+
+ // Moc predefs file
+ if (!this->MocPredefsCmd.empty()) {
+ this->MocPredefsFileRel = "moc_predefs";
+ if (this->MultiConfig != cmQtAutoGen::SINGLE) {
+ this->MocPredefsFileRel += this->ConfigSuffix;
+ }
+ this->MocPredefsFileRel += ".h";
+ this->MocPredefsFileAbs = cmSystemTools::CollapseCombinedPath(
+ this->AutogenBuildDir, this->MocPredefsFileRel);
+ }
+
+ // Sort include directories on demand
+ if (this->IncludeProjectDirsBefore) {
+ // Move strings to temporary list
+ std::list<std::string> includes;
+ includes.insert(includes.end(), this->MocIncludePaths.begin(),
+ this->MocIncludePaths.end());
+ this->MocIncludePaths.clear();
+ this->MocIncludePaths.reserve(includes.size());
+ // Append project directories only
+ {
+ std::array<std::string const*, 2> const movePaths = {
+ { &this->ProjectBinaryDir, &this->ProjectSourceDir }
+ };
+ for (std::string const* ppath : movePaths) {
+ std::list<std::string>::iterator it = includes.begin();
+ while (it != includes.end()) {
+ std::string const& path = *it;
+ if (cmSystemTools::StringStartsWith(path, ppath->c_str())) {
+ this->MocIncludePaths.push_back(path);
+ it = includes.erase(it);
+ } else {
+ ++it;
+ }
+ }
+ }
+ }
+ // Append remaining directories
+ this->MocIncludePaths.insert(this->MocIncludePaths.end(),
+ includes.begin(), includes.end());
+ }
+ // Compose moc includes list
+ {
+ std::set<std::string> frameworkPaths;
+ for (std::string const& path : this->MocIncludePaths) {
+ this->MocIncludes.push_back("-I" + path);
+ // Extract framework path
+ if (cmHasLiteralSuffix(path, ".framework/Headers")) {
+ // Go up twice to get to the framework root
+ std::vector<std::string> pathComponents;
+ cmSystemTools::SplitPath(path, pathComponents);
+ std::string frameworkPath = cmSystemTools::JoinPath(
+ pathComponents.begin(), pathComponents.end() - 2);
+ frameworkPaths.insert(frameworkPath);
+ }
+ }
+ // Append framework includes
+ for (std::string const& path : frameworkPaths) {
+ this->MocIncludes.push_back("-F");
+ this->MocIncludes.push_back(path);
+ }
+ }
+ // Setup single list with all options
+ {
+ // Add includes
+ this->MocAllOptions.insert(this->MocAllOptions.end(),
+ this->MocIncludes.begin(),
+ this->MocIncludes.end());
+ // Add definitions
+ for (std::string const& def : this->MocDefinitions) {
+ this->MocAllOptions.push_back("-D" + def);
+ }
+ // Add options
+ this->MocAllOptions.insert(this->MocAllOptions.end(),
+ this->MocOptions.begin(),
+ this->MocOptions.end());
+ }
+ }
+
+ // - Old settings file
+ {
+ this->SettingsFile = cmSystemTools::CollapseFullPath(targetDirectory);
+ cmSystemTools::ConvertToUnixSlashes(this->SettingsFile);
+ this->SettingsFile += "/AutogenOldSettings";
+ if (this->MultiConfig != cmQtAutoGen::SINGLE) {
+ this->SettingsFile += this->ConfigSuffix;
+ }
+ this->SettingsFile += ".cmake";
+ }
+
return true;
}
@@ -453,16 +604,12 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
// Compose current settings strings
{
cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
- const std::string sep(" ~~~ ");
+ std::string const sep(" ~~~ ");
if (this->MocEnabled()) {
std::string str;
str += this->MocExecutable;
str += sep;
- str += cmJoin(this->MocDefinitions, ";");
- str += sep;
- str += cmJoin(this->MocIncludePaths, ";");
- str += sep;
- str += cmJoin(this->MocOptions, ";");
+ str += cmJoin(this->MocAllOptions, ";");
str += sep;
str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
str += sep;
@@ -503,7 +650,7 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
// Read old settings
if (makefile->ReadListFile(this->SettingsFile.c_str())) {
{
- auto SMatch = [makefile](const char* key, const std::string& value) {
+ auto SMatch = [makefile](const char* key, std::string const& value) {
return (value == makefile->GetSafeDefinition(key));
};
if (!SMatch(SettingsKeyMoc, this->SettingsStringMoc)) {
@@ -519,7 +666,7 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
// 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->AnySettingsChanged()) {
+ if (this->SettingsChanged()) {
cmSystemTools::RemoveFile(this->SettingsFile);
}
} else {
@@ -534,7 +681,7 @@ bool cmQtAutoGenerators::SettingsFileWrite()
{
bool success = true;
// Only write if any setting changed
- if (this->AnySettingsChanged()) {
+ if (this->SettingsChanged()) {
if (this->Verbose) {
this->LogInfo(cmQtAutoGen::GEN, "Writing settings file " +
cmQtAutoGen::Quoted(this->SettingsFile));
@@ -543,7 +690,7 @@ bool cmQtAutoGenerators::SettingsFileWrite()
std::string settings;
{
auto SettingAppend = [&settings](const char* key,
- const std::string& value) {
+ std::string const& value) {
settings += "set(";
settings += key;
settings += " ";
@@ -557,7 +704,7 @@ bool cmQtAutoGenerators::SettingsFileWrite()
// Write settings file
if (!this->FileWrite(cmQtAutoGen::GEN, this->SettingsFile, settings)) {
this->LogFileError(cmQtAutoGen::GEN, this->SettingsFile,
- "File writing failed");
+ "Settings file writing failed");
// Remove old settings file to trigger a full rebuild on the next run
cmSystemTools::RemoveFile(this->SettingsFile);
success = false;
@@ -566,89 +713,7 @@ bool cmQtAutoGenerators::SettingsFileWrite()
return success;
}
-void cmQtAutoGenerators::Init(cmMakefile* makefile)
-{
- // Mocs compilation file
- this->MocCompFileRel = "mocs_compilation.cpp";
- this->MocCompFileAbs = cmSystemTools::CollapseCombinedPath(
- this->AutogenBuildDir, this->MocCompFileRel);
-
- // Mocs include directory
- this->AutogenIncludeDir = "include";
- this->AutogenIncludeDir += this->ConfigSuffix;
- this->AutogenIncludeDir += "/";
-
- // Moc predefs file
- if (!this->MocPredefsCmd.empty()) {
- this->MocPredefsFileRel = "moc_predefs";
- this->MocPredefsFileRel += this->ConfigSuffix;
- this->MocPredefsFileRel += ".h";
- this->MocPredefsFileAbs = cmSystemTools::CollapseCombinedPath(
- this->AutogenBuildDir, this->MocPredefsFileRel);
- }
-
- // Init file path checksum generator
- FPathChecksum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
- this->ProjectSourceDir,
- this->ProjectBinaryDir);
-
- // Acquire header extensions
- this->HeaderExtensions = makefile->GetCMakeInstance()->GetHeaderExtensions();
-
- // Sort include directories on demand
- if (this->IncludeProjectDirsBefore) {
- // Move strings to temporary list
- std::list<std::string> includes;
- includes.insert(includes.end(), this->MocIncludePaths.begin(),
- this->MocIncludePaths.end());
- this->MocIncludePaths.clear();
- this->MocIncludePaths.reserve(includes.size());
- // Append project directories only
- {
- const std::array<const std::string*, 2> movePaths = {
- { &this->ProjectBinaryDir, &this->ProjectSourceDir }
- };
- for (const std::string* ppath : movePaths) {
- std::list<std::string>::iterator it = includes.begin();
- while (it != includes.end()) {
- const std::string& path = *it;
- if (cmSystemTools::StringStartsWith(path, ppath->c_str())) {
- this->MocIncludePaths.push_back(path);
- it = includes.erase(it);
- } else {
- ++it;
- }
- }
- }
- }
- // Append remaining directories
- this->MocIncludePaths.insert(this->MocIncludePaths.end(), includes.begin(),
- includes.end());
- }
- // Compose moc includes list
- {
- std::set<std::string> frameworkPaths;
- for (std::string const& path : this->MocIncludePaths) {
- this->MocIncludes.push_back("-I" + path);
- // Extract framework path
- if (cmHasLiteralSuffix(path, ".framework/Headers")) {
- // Go up twice to get to the framework root
- std::vector<std::string> pathComponents;
- cmSystemTools::SplitPath(path, pathComponents);
- std::string frameworkPath = cmSystemTools::JoinPath(
- pathComponents.begin(), pathComponents.end() - 2);
- frameworkPaths.insert(frameworkPath);
- }
- }
- // Append framework includes
- for (std::string const& path : frameworkPaths) {
- this->MocIncludes.push_back("-F");
- this->MocIncludes.push_back(path);
- }
- }
-}
-
-bool cmQtAutoGenerators::RunAutogen()
+bool cmQtAutoGenerators::Process()
{
// the program goes through all .cpp files to see which moc files are
// included. It is not really interesting how the moc file is named, but
@@ -660,7 +725,7 @@ bool cmQtAutoGenerators::RunAutogen()
// Create AUTOGEN include directory
{
- const std::string incDirAbs = cmSystemTools::CollapseCombinedPath(
+ std::string const incDirAbs = cmSystemTools::CollapseCombinedPath(
this->AutogenBuildDir, this->AutogenIncludeDir);
if (!cmSystemTools::MakeDirectory(incDirAbs)) {
this->LogFileError(cmQtAutoGen::GEN, incDirAbs,
@@ -669,45 +734,28 @@ bool cmQtAutoGenerators::RunAutogen()
}
}
- // key = moc source filepath, value = moc output filepath
- std::map<std::string, std::string> mocsIncluded;
- std::map<std::string, std::string> mocsNotIncluded;
- std::map<std::string, std::set<std::string>> mocDepends;
- std::map<std::string, std::vector<std::string>> uisIncluded;
- // collects all headers which may need to be mocced
- std::set<std::string> mocHeaderFiles;
- std::set<std::string> uicHeaderFiles;
-
- // Parse sources
- for (std::string const& src : this->Sources) {
- // Parse source file for MOC/UIC
- if (!this->ParseSourceFile(src, mocsIncluded, mocDepends, uisIncluded,
- this->MocRelaxedMode)) {
+ // Parse source files
+ for (const auto& item : this->SourceJobs) {
+ if (!this->ParseSourceFile(item.first, item.second)) {
return false;
}
- // Find additional headers
- this->SearchHeadersForSourceFile(src, mocHeaderFiles, uicHeaderFiles);
}
-
- // Parse headers
- for (std::string const& hdr : this->Headers) {
- if (!this->MocSkip(hdr)) {
- mocHeaderFiles.insert(hdr);
- }
- if (!this->UicSkip(hdr)) {
- uicHeaderFiles.insert(hdr);
+ // Parse header files
+ for (const auto& item : this->HeaderJobs) {
+ if (!this->ParseHeaderFile(item.first, item.second)) {
+ return false;
}
}
- if (!this->ParseHeaders(mocHeaderFiles, uicHeaderFiles, mocsIncluded,
- mocsNotIncluded, mocDepends, uisIncluded)) {
+ // Read missing dependency information
+ if (!this->ParsePostprocess()) {
return false;
- };
+ }
// Generate files
- if (!this->MocGenerateAll(mocsIncluded, mocsNotIncluded, mocDepends)) {
+ if (!this->MocGenerateAll()) {
return false;
}
- if (!this->UicGenerateAll(uisIncluded)) {
+ if (!this->UicGenerateAll()) {
return false;
}
if (!this->RccGenerateAll()) {
@@ -718,87 +766,100 @@ bool cmQtAutoGenerators::RunAutogen()
}
/**
- * @brief Tests if the C++ content requires moc processing
- * @return True if moc is required
+ * @return True on success
*/
-bool cmQtAutoGenerators::MocRequired(const std::string& contentText,
- std::string* macroName)
+bool cmQtAutoGenerators::ParseSourceFile(std::string const& absFilename,
+ const SourceJob& job)
{
- for (KeyRegExp& filter : this->MocMacroFilters) {
- // Run a simple find string operation before the expensive
- // regular expression check
- if (contentText.find(filter.Key) != std::string::npos) {
- if (filter.RegExp.find(contentText)) {
- // Return macro name on demand
- if (macroName != nullptr) {
- *macroName = filter.Key;
- }
- return true;
+ std::string contentText;
+ std::string error;
+ bool success = ReadFile(contentText, absFilename, &error);
+ if (success) {
+ if (!contentText.empty()) {
+ if (job.Moc) {
+ success = this->MocParseSourceContent(absFilename, contentText);
}
+ if (success && job.Uic) {
+ success = this->UicParseContent(absFilename, contentText);
+ }
+ } else {
+ this->LogFileWarning(cmQtAutoGen::GEN, absFilename,
+ "The source file is empty");
}
+ } else {
+ this->LogFileError(cmQtAutoGen::GEN, absFilename,
+ "Could not read the source file: " + error);
}
- return false;
+ return success;
}
-void cmQtAutoGenerators::MocFindDepends(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::set<std::string>>& mocDepends)
+/**
+ * @return True on success
+ */
+bool cmQtAutoGenerators::ParseHeaderFile(std::string const& absFilename,
+ const SourceJob& job)
{
- for (KeyRegExp& filter : this->MocDependFilters) {
- // Run a simple find string operation before the expensive
- // regular expression check
- if (contentText.find(filter.Key) != std::string::npos) {
- // Run regular expression check loop
- const std::string sourcePath = SubDirPrefix(absFilename);
- const char* contentChars = contentText.c_str();
- while (filter.RegExp.find(contentChars)) {
- // Evaluate match
- const std::string match = filter.RegExp.match(1);
- if (!match.empty()) {
- // Find the dependency file
- std::string incFile;
- if (this->MocFindIncludedFile(incFile, sourcePath, match)) {
- mocDepends[absFilename].insert(incFile);
- if (this->Verbose) {
- this->LogInfo(cmQtAutoGen::MOC, "Found dependency:\n " +
- cmQtAutoGen::Quoted(absFilename) + "\n " +
- cmQtAutoGen::Quoted(incFile));
- }
- } else {
- this->LogFileWarning(cmQtAutoGen::MOC, absFilename,
- "Could not find dependency file " +
- cmQtAutoGen::Quoted(match));
- }
- }
- contentChars += filter.RegExp.end();
+ std::string contentText;
+ std::string error;
+ bool success = ReadFile(contentText, absFilename, &error);
+ if (success) {
+ if (!contentText.empty()) {
+ if (job.Moc) {
+ this->MocParseHeaderContent(absFilename, contentText);
+ }
+ if (job.Uic) {
+ success = this->UicParseContent(absFilename, contentText);
}
+ } else {
+ this->LogFileWarning(cmQtAutoGen::GEN, absFilename,
+ "The header file is empty");
}
+ } else {
+ this->LogFileError(cmQtAutoGen::GEN, absFilename,
+ "Could not read the header file: " + error);
}
+ return success;
}
/**
- * @brief Tests if the file should be ignored for moc scanning
- * @return True if the file should be ignored
+ * @return True on success
*/
-bool cmQtAutoGenerators::MocSkip(const std::string& absFilename) const
+bool cmQtAutoGenerators::ParsePostprocess()
{
- if (this->MocEnabled()) {
- // Test if the file name is on the skip list
- if (!ListContains(this->MocSkipList, absFilename)) {
- return false;
+ bool success = true;
+ // Read missin dependecies
+ for (auto& item : this->MocJobsIncluded) {
+ if (!item->DependsValid) {
+ std::string content;
+ std::string error;
+ if (ReadFile(content, item->SourceFile, &error)) {
+ this->MocFindDepends(item->SourceFile, content, item->Depends);
+ item->DependsValid = true;
+ } else {
+ std::string emsg = "Could not read file\n ";
+ emsg += item->SourceFile;
+ emsg += "\nrequired by moc include \"";
+ emsg += item->IncludeString;
+ emsg += "\".\n";
+ emsg += error;
+ this->LogFileError(cmQtAutoGen::MOC, item->Includer, emsg);
+ success = false;
+ break;
+ }
}
}
- return true;
+ return success;
}
/**
- * @brief Tests if the file name is in the skip list
+ * @brief Tests if the file should be ignored for moc scanning
+ * @return True if the file should be ignored
*/
-bool cmQtAutoGenerators::UicSkip(const std::string& absFilename) const
+bool cmQtAutoGenerators::MocSkip(std::string const& absFilename) const
{
- if (this->UicEnabled()) {
+ if (this->MocEnabled()) {
// Test if the file name is on the skip list
- if (!ListContains(this->UicSkipList, absFilename)) {
+ if (!ListContains(this->MocSkipList, absFilename)) {
return false;
}
}
@@ -806,54 +867,29 @@ bool cmQtAutoGenerators::UicSkip(const std::string& absFilename) const
}
/**
- * @return True on success
+ * @brief Tests if the C++ content requires moc processing
+ * @return True if moc is required
*/
-bool cmQtAutoGenerators::ParseSourceFile(
- const std::string& absFilename,
- std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends,
- std::map<std::string, std::vector<std::string>>& uisIncluded, bool relaxed)
+bool cmQtAutoGenerators::MocRequired(std::string const& contentText,
+ std::string* macroName)
{
- std::string contentText;
- bool success = ReadAll(contentText, absFilename);
- if (success) {
- if (!contentText.empty()) {
- // Parse source contents for MOC
- if (success && !this->MocSkip(absFilename)) {
- success = this->MocParseSourceContent(
- absFilename, contentText, mocsIncluded, mocDepends, relaxed);
- }
- // Parse source contents for UIC
- if (success && !this->UicSkip(absFilename)) {
- this->UicParseContent(absFilename, contentText, uisIncluded);
+ for (KeyRegExp& filter : this->MocMacroFilters) {
+ // Run a simple find string operation before the expensive
+ // regular expression check
+ if (contentText.find(filter.Key) != std::string::npos) {
+ if (filter.RegExp.find(contentText)) {
+ // Return macro name on demand
+ if (macroName != nullptr) {
+ *macroName = filter.Key;
+ }
+ return true;
}
- } else {
- this->LogFileWarning(cmQtAutoGen::GEN, absFilename, "The file is empty");
- }
- } else {
- this->LogFileError(cmQtAutoGen::GEN, absFilename, "Could not read file");
- }
- return success;
-}
-
-void cmQtAutoGenerators::UicParseContent(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::vector<std::string>>& uisIncluded)
-{
- if (this->Verbose) {
- this->LogInfo(cmQtAutoGen::UIC, "Checking " + absFilename);
- }
-
- const char* contentChars = contentText.c_str();
- if (strstr(contentChars, "ui_") != nullptr) {
- while (this->UicRegExpInclude.find(contentChars)) {
- uisIncluded[absFilename].push_back(this->UicRegExpInclude.match(1));
- contentChars += this->UicRegExpInclude.end();
}
}
+ return false;
}
-std::string cmQtAutoGenerators::MocMacroNamesString() const
+std::string cmQtAutoGenerators::MocStringMacros() const
{
std::string res;
const auto itB = this->MocMacroFilters.cbegin();
@@ -875,339 +911,479 @@ std::string cmQtAutoGenerators::MocMacroNamesString() const
return res;
}
-std::string cmQtAutoGenerators::MocHeaderSuffixesString() const
+std::string cmQtAutoGenerators::MocStringHeaders(
+ std::string const& fileBase) const
{
- std::string res = ".{";
+ std::string res = fileBase;
+ res += ".{";
res += cmJoin(this->HeaderExtensions, ",");
res += "}";
return res;
}
+std::string cmQtAutoGenerators::MocFindIncludedHeader(
+ std::string const& sourcePath, std::string const& includeBase) const
+{
+ std::string header;
+ // Search in vicinity of the source
+ if (!this->FindHeader(header, sourcePath + includeBase)) {
+ // Search in include directories
+ for (std::string const& path : this->MocIncludePaths) {
+ std::string fullPath = path;
+ fullPath.push_back('/');
+ fullPath += includeBase;
+ if (this->FindHeader(header, fullPath)) {
+ break;
+ }
+ }
+ }
+ // Sanitize
+ if (!header.empty()) {
+ header = cmSystemTools::GetRealPath(header);
+ }
+ return header;
+}
+
+bool cmQtAutoGenerators::MocFindIncludedFile(
+ std::string& absFile, std::string const& sourcePath,
+ std::string const& includeString) const
+{
+ bool success = false;
+ // Search in vicinity of the source
+ {
+ std::string testPath = sourcePath;
+ testPath += includeString;
+ if (cmSystemTools::FileExists(testPath.c_str())) {
+ absFile = cmSystemTools::GetRealPath(testPath);
+ success = true;
+ }
+ }
+ // Search in include directories
+ if (!success) {
+ for (std::string const& path : this->MocIncludePaths) {
+ std::string fullPath = path;
+ fullPath.push_back('/');
+ fullPath += includeString;
+ if (cmSystemTools::FileExists(fullPath.c_str())) {
+ absFile = cmSystemTools::GetRealPath(fullPath);
+ success = true;
+ break;
+ }
+ }
+ }
+ return success;
+}
+
+bool cmQtAutoGenerators::MocDependFilterPush(std::string const& key,
+ std::string const& regExp)
+{
+ std::string error;
+ if (!key.empty()) {
+ if (!regExp.empty()) {
+ KeyRegExp filter;
+ filter.Key = key;
+ if (filter.RegExp.compile(regExp)) {
+ this->MocDependFilters.push_back(std::move(filter));
+ } else {
+ error = "Regular expression compiling failed";
+ }
+ } else {
+ error = "Regular expression is empty";
+ }
+ } else {
+ error = "Key is empty";
+ }
+ if (!error.empty()) {
+ std::string emsg = "AUTOMOC_DEPEND_FILTERS: ";
+ emsg += error;
+ emsg += "\n";
+ emsg += " Key: ";
+ emsg += cmQtAutoGen::Quoted(key);
+ emsg += "\n";
+ emsg += " RegExp: ";
+ emsg += cmQtAutoGen::Quoted(regExp);
+ emsg += "\n";
+ this->LogError(cmQtAutoGen::MOC, emsg);
+ return false;
+ }
+ return true;
+}
+
+void cmQtAutoGenerators::MocFindDepends(std::string const& absFilename,
+ std::string const& contentText,
+ std::set<std::string>& depends)
+{
+ if (this->MocDependFilters.empty() && contentText.empty()) {
+ return;
+ }
+
+ std::vector<std::string> matches;
+ for (KeyRegExp& filter : this->MocDependFilters) {
+ // Run a simple find string check
+ if (contentText.find(filter.Key) != std::string::npos) {
+ // Run the expensive regular expression check loop
+ const char* contentChars = contentText.c_str();
+ while (filter.RegExp.find(contentChars)) {
+ std::string match = filter.RegExp.match(1);
+ if (!match.empty()) {
+ matches.emplace_back(std::move(match));
+ }
+ contentChars += filter.RegExp.end();
+ }
+ }
+ }
+
+ if (!matches.empty()) {
+ std::string const sourcePath = SubDirPrefix(absFilename);
+ for (std::string const& match : matches) {
+ // Find the dependency file
+ std::string incFile;
+ if (this->MocFindIncludedFile(incFile, sourcePath, match)) {
+ depends.insert(incFile);
+ if (this->Verbose) {
+ this->LogInfo(cmQtAutoGen::MOC, "Found dependency:\n " +
+ cmQtAutoGen::Quoted(absFilename) + "\n " +
+ cmQtAutoGen::Quoted(incFile));
+ }
+ } else {
+ this->LogFileWarning(cmQtAutoGen::MOC, absFilename,
+ "Could not find dependency file " +
+ cmQtAutoGen::Quoted(match));
+ }
+ }
+ }
+}
+
/**
* @return True on success
*/
-bool cmQtAutoGenerators::MocParseSourceContent(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends, bool relaxed)
+bool cmQtAutoGenerators::MocParseSourceContent(std::string const& absFilename,
+ std::string const& contentText)
{
if (this->Verbose) {
- this->LogInfo(cmQtAutoGen::MOC, "Checking " + absFilename);
- }
+ this->LogInfo(cmQtAutoGen::MOC, "Checking: " + absFilename);
+ }
+
+ auto AddJob = [this, &absFilename](std::string const& sourceFile,
+ std::string const& includeString,
+ std::string const* content) {
+ auto job = cm::make_unique<MocJobIncluded>();
+ job->SourceFile = sourceFile;
+ job->BuildFileRel = this->AutogenIncludeDir;
+ job->BuildFileRel += includeString;
+ job->Includer = absFilename;
+ job->IncludeString = includeString;
+ job->DependsValid = (content != nullptr);
+ if (job->DependsValid) {
+ this->MocFindDepends(sourceFile, *content, job->Depends);
+ }
+ this->MocJobsIncluded.push_back(std::move(job));
+ };
- const std::string scanFileDir = SubDirPrefix(absFilename);
- const std::string scanFileBase =
- cmSystemTools::GetFilenameWithoutLastExtension(absFilename);
+ struct MocInc
+ {
+ std::string Inc; // full include string
+ std::string Dir; // include string directory
+ std::string Base; // include string file base
+ };
+
+ // Extract moc includes from file
+ std::vector<MocInc> mocIncsUsc;
+ std::vector<MocInc> mocIncsDot;
+ {
+ const char* contentChars = contentText.c_str();
+ if (strstr(contentChars, "moc") != nullptr) {
+ while (this->MocRegExpInclude.find(contentChars)) {
+ std::string incString = this->MocRegExpInclude.match(1);
+ std::string incDir(SubDirPrefix(incString));
+ std::string incBase =
+ cmSystemTools::GetFilenameWithoutLastExtension(incString);
+ if (cmHasLiteralPrefix(incBase, "moc_")) {
+ // moc_<BASE>.cxx
+ // Remove the moc_ part from the base name
+ mocIncsUsc.push_back(MocInc{ std::move(incString), std::move(incDir),
+ incBase.substr(4) });
+ } else {
+ // <BASE>.moc
+ mocIncsDot.push_back(MocInc{ std::move(incString), std::move(incDir),
+ std::move(incBase) });
+ }
+ // Forward content pointer
+ contentChars += this->MocRegExpInclude.end();
+ }
+ }
+ }
std::string selfMacroName;
const bool selfRequiresMoc = this->MocRequired(contentText, &selfMacroName);
+
+ // Check if there is anything to do
+ if (!selfRequiresMoc && mocIncsUsc.empty() && mocIncsDot.empty()) {
+ return true;
+ }
+
+ // Scan file variables
+ std::string const scanFileDir = SubDirPrefix(absFilename);
+ std::string const scanFileBase =
+ cmSystemTools::GetFilenameWithoutLastExtension(absFilename);
+ // Relaxed mode variables
bool ownDotMocIncluded = false;
- std::string ownMocUnderscoreInclude;
- std::string ownMocUnderscoreHeader;
-
- // first a simple string check for "moc" is *much* faster than the regexp,
- // and if the string search already fails, we don't have to try the
- // expensive regexp
- const char* contentChars = contentText.c_str();
- if (strstr(contentChars, "moc") != nullptr) {
- // Iterate over all included moc files
- while (this->MocRegExpInclude.find(contentChars)) {
- const std::string incString = this->MocRegExpInclude.match(1);
- // Basename of the moc include
- const std::string incDir(SubDirPrefix(incString));
- const std::string incBase =
- cmSystemTools::GetFilenameWithoutLastExtension(incString);
-
- // If the moc include is of the moc_foo.cpp style we expect
- // the Q_OBJECT class declaration in a header file.
- // If the moc include is of the foo.moc style we need to look for
- // a Q_OBJECT macro in the current source file, if it contains the
- // macro we generate the moc file from the source file.
- if (cmHasLiteralPrefix(incBase, "moc_")) {
- // Include: moc_FOO.cxx
- // Remove the moc_ part
- const std::string incRealBase = incBase.substr(4);
- const std::string headerToMoc =
- this->MocFindHeader(scanFileDir, incDir + incRealBase);
- if (!headerToMoc.empty()) {
- if (!this->MocSkip(headerToMoc)) {
- // Register moc job
- mocsIncluded[headerToMoc] = incString;
- this->MocFindDepends(headerToMoc, contentText, mocDepends);
- // Store meta information for relaxed mode
- if (relaxed && (incRealBase == scanFileBase)) {
- ownMocUnderscoreInclude = incString;
- ownMocUnderscoreHeader = headerToMoc;
- }
- }
- } else {
- std::ostringstream ost;
- ost << "The file includes the moc file "
- << cmQtAutoGen::Quoted(incString)
- << ", but could not find header ";
- ost << cmQtAutoGen::Quoted(incRealBase +
- this->MocHeaderSuffixesString());
- this->LogFileError(cmQtAutoGen::MOC, absFilename, ost.str());
- return false;
- }
+ std::string ownMocUscInclude;
+ std::string ownMocUscHeader;
+
+ // Process moc_<BASE>.cxx includes
+ for (const MocInc& mocInc : mocIncsUsc) {
+ std::string const header =
+ this->MocFindIncludedHeader(scanFileDir, mocInc.Dir + mocInc.Base);
+ if (!header.empty()) {
+ // Check if header is skipped
+ if (this->MocSkip(header)) {
+ continue;
+ }
+ // Register moc job
+ AddJob(header, mocInc.Inc, nullptr);
+ // Store meta information for relaxed mode
+ if (this->MocRelaxedMode && (mocInc.Base == scanFileBase)) {
+ ownMocUscInclude = mocInc.Inc;
+ ownMocUscHeader = header;
+ }
+ } else {
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += ", but could not find the header ";
+ emsg += cmQtAutoGen::Quoted(this->MocStringHeaders(mocInc.Base));
+ this->LogFileError(cmQtAutoGen::MOC, absFilename, emsg);
+ return false;
+ }
+ }
+
+ // Process <BASE>.moc includes
+ for (const MocInc& mocInc : mocIncsDot) {
+ const bool ownMoc = (mocInc.Base == scanFileBase);
+ if (this->MocRelaxedMode) {
+ // Relaxed mode
+ if (selfRequiresMoc && ownMoc) {
+ // Add self
+ AddJob(absFilename, mocInc.Inc, &contentText);
+ ownDotMocIncluded = true;
} else {
- // Include: FOO.moc
- bool ownDotMoc = (incBase == scanFileBase);
- std::string fileToMoc;
- if (relaxed) {
- // Mode: Relaxed
- if (selfRequiresMoc && ownDotMoc) {
- // Include self
- fileToMoc = absFilename;
- ownDotMocIncluded = true;
- } else {
- // In relaxed mode try to find a header instead but issue a warning
- const std::string headerToMoc =
- this->MocFindHeader(scanFileDir, incDir + incBase);
- if (!headerToMoc.empty()) {
- if (!this->MocSkip(headerToMoc)) {
- // This is for KDE4 compatibility:
- fileToMoc = headerToMoc;
-
- auto quoted_inc = cmQtAutoGen::Quoted(incString);
- auto quoted_header = cmQtAutoGen::Quoted(headerToMoc);
- auto quoted_base =
- cmQtAutoGen::Quoted("moc_" + incBase + ".cpp");
- if (!selfRequiresMoc) {
- if (ownDotMoc) {
- std::ostringstream ost;
- ost << "The file includes the moc file " << quoted_inc
- << ", but does not contain a "
- << this->MocMacroNamesString() << " macro.\n"
- << "Running moc on\n"
- << " " << quoted_header << "!\n"
- << "Better include " << quoted_base
- << " for a compatibility with strict mode.\n"
- "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
- this->LogFileWarning(cmQtAutoGen::MOC, absFilename,
- ost.str());
- } else if (!ownDotMoc) {
- std::ostringstream ost;
- ost << "The file includes the moc file " << quoted_inc
- << " instead of " << quoted_base << ".\n";
- ost << "Running moc on\n"
- << " " << quoted_header << "!\n"
- << "Better include " << quoted_base
- << " for compatibility with strict mode.\n"
- "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
- this->LogFileWarning(cmQtAutoGen::MOC, absFilename,
- ost.str());
- }
- } else {
- if (!ownDotMoc) {
- // Handled further down
- }
- }
- }
+ // In relaxed mode try to find a header instead but issue a warning.
+ // This is for KDE4 compatibility
+ std::string const header =
+ this->MocFindIncludedHeader(scanFileDir, mocInc.Dir + mocInc.Base);
+ if (!header.empty()) {
+ // Check if header is skipped
+ if (this->MocSkip(header)) {
+ continue;
+ }
+ // Register moc job
+ AddJob(header, mocInc.Inc, nullptr);
+ if (!selfRequiresMoc) {
+ if (ownMoc) {
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += ", but does not contain a ";
+ emsg += this->MocStringMacros();
+ emsg += " macro.\nRunning moc on\n ";
+ emsg += cmQtAutoGen::Quoted(header);
+ emsg += "!\nBetter include ";
+ emsg += cmQtAutoGen::Quoted("moc_" + mocInc.Base + ".cpp");
+ emsg += " for a compatibility with strict mode.\n"
+ "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
+ this->LogFileWarning(cmQtAutoGen::MOC, absFilename, emsg);
} else {
- std::ostringstream ost;
- ost << "The file includes the moc file "
- << cmQtAutoGen::Quoted(incString)
- << ", which seems to be the moc file from a different "
- "source file. CMake also could not find a matching "
- "header.";
- this->LogFileError(cmQtAutoGen::MOC, absFilename, ost.str());
- return false;
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += " instead of ";
+ emsg += cmQtAutoGen::Quoted("moc_" + mocInc.Base + ".cpp");
+ emsg += ".\nRunning moc on\n ";
+ emsg += cmQtAutoGen::Quoted(header);
+ emsg += "!\nBetter include ";
+ emsg += cmQtAutoGen::Quoted("moc_" + mocInc.Base + ".cpp");
+ emsg += " for compatibility with strict mode.\n"
+ "(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
+ this->LogFileWarning(cmQtAutoGen::MOC, absFilename, emsg);
}
}
} else {
- // Mode: Strict
- if (ownDotMoc) {
- // Include self
- fileToMoc = absFilename;
- ownDotMocIncluded = true;
- // Accept but issue a warning if moc isn't required
- if (!selfRequiresMoc) {
- std::ostringstream ost;
- ost << "The file includes the moc file "
- << cmQtAutoGen::Quoted(incString)
- << ", but does not contain a " << this->MocMacroNamesString()
- << " macro.";
- this->LogFileWarning(cmQtAutoGen::MOC, absFilename, ost.str());
- }
- } else {
- // Don't allow FOO.moc include other than self in strict mode
- std::ostringstream ost;
- ost << "The file includes the moc file "
- << cmQtAutoGen::Quoted(incString)
- << ", which seems to be the moc file from a different "
- "source file. This is not supported. Include "
- << cmQtAutoGen::Quoted(scanFileBase + ".moc")
- << " to run moc on this source file.";
- this->LogFileError(cmQtAutoGen::MOC, absFilename, ost.str());
- return false;
- }
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += ", which seems to be the moc file from a different "
+ "source file. CMake also could not find a matching "
+ "header.";
+ this->LogFileError(cmQtAutoGen::MOC, absFilename, emsg);
+ return false;
}
- if (!fileToMoc.empty()) {
- mocsIncluded[fileToMoc] = incString;
- this->MocFindDepends(fileToMoc, contentText, mocDepends);
+ }
+ } else {
+ // Strict mode
+ if (ownMoc) {
+ // Include self
+ AddJob(absFilename, mocInc.Inc, &contentText);
+ ownDotMocIncluded = true;
+ // Accept but issue a warning if moc isn't required
+ if (!selfRequiresMoc) {
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += ", but does not contain a ";
+ emsg += this->MocStringMacros();
+ emsg += " macro.";
+ this->LogFileWarning(cmQtAutoGen::MOC, absFilename, emsg);
}
+ } else {
+ // Don't allow <BASE>.moc include other than self in strict mode
+ std::string emsg = "The file includes the moc file ";
+ emsg += cmQtAutoGen::Quoted(mocInc.Inc);
+ emsg += ", which seems to be the moc file from a different "
+ "source file.\nThis is not supported. Include ";
+ emsg += cmQtAutoGen::Quoted(scanFileBase + ".moc");
+ emsg += " to run moc on this source file.";
+ this->LogFileError(cmQtAutoGen::MOC, absFilename, emsg);
+ return false;
}
- // Forward content pointer
- contentChars += this->MocRegExpInclude.end();
}
}
if (selfRequiresMoc && !ownDotMocIncluded) {
- // In this case, check whether the scanned file itself contains a
- // Q_OBJECT.
+ // In this case, check whether the scanned file itself contains a Q_OBJECT.
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if (relaxed && !ownMocUnderscoreInclude.empty()) {
+ if (this->MocRelaxedMode && !ownMocUscInclude.empty()) {
// This is for KDE4 compatibility:
- std::ostringstream ost;
- ost << "The file contains a " << selfMacroName
- << " macro, but does not include "
- << cmQtAutoGen::Quoted(scanFileBase + ".moc")
- << ". Instead it includes "
- << cmQtAutoGen::Quoted(ownMocUnderscoreInclude) << ".\n"
- << "Running moc on\n"
- << " " << cmQtAutoGen::Quoted(absFilename) << "!\n"
- << "Better include " << cmQtAutoGen::Quoted(scanFileBase + ".moc")
- << " for compatibility with strict mode.\n"
- "(CMAKE_AUTOMOC_RELAXED_MODE warning)";
- this->LogFileWarning(cmQtAutoGen::MOC, absFilename, ost.str());
-
- // Use scanned source file instead of scanned header file as moc source
- mocsIncluded[absFilename] = ownMocUnderscoreInclude;
- this->MocFindDepends(absFilename, contentText, mocDepends);
- // Remove
- mocsIncluded.erase(ownMocUnderscoreHeader);
+ std::string emsg = "The file contains a ";
+ emsg += selfMacroName;
+ emsg += " macro, but does not include ";
+ emsg += cmQtAutoGen::Quoted(scanFileBase + ".moc");
+ emsg += ". Instead it includes ";
+ emsg += cmQtAutoGen::Quoted(ownMocUscInclude);
+ emsg += ".\nRunning moc on\n ";
+ emsg += cmQtAutoGen::Quoted(absFilename);
+ emsg += "!\nBetter include ";
+ emsg += cmQtAutoGen::Quoted(scanFileBase + ".moc");
+ emsg += " for compatibility with strict mode.\n"
+ "(CMAKE_AUTOMOC_RELAXED_MODE warning)";
+ this->LogFileWarning(cmQtAutoGen::MOC, absFilename, emsg);
+
+ // Remove own header job
+ {
+ auto itC = this->MocJobsIncluded.begin();
+ auto itE = this->MocJobsIncluded.end();
+ for (; itC != itE; ++itC) {
+ if ((*itC)->SourceFile == ownMocUscHeader) {
+ if ((*itC)->IncludeString == ownMocUscInclude) {
+ this->MocJobsIncluded.erase(itC);
+ break;
+ }
+ }
+ }
+ }
+ // Add own source job
+ AddJob(absFilename, ownMocUscInclude, &contentText);
} else {
// Otherwise always error out since it will not compile:
- std::ostringstream ost;
- ost << "The file contains a " << selfMacroName
- << " macro, but does not include "
- << cmQtAutoGen::Quoted(scanFileBase + ".moc") << "!\n"
- << "Consider adding the include or enabling SKIP_AUTOMOC for this "
- "file.";
- this->LogFileError(cmQtAutoGen::MOC, absFilename, ost.str());
+ std::string emsg = "The file contains a ";
+ emsg += selfMacroName;
+ emsg += " macro, but does not include ";
+ emsg += cmQtAutoGen::Quoted(scanFileBase + ".moc");
+ emsg += "!\nConsider to\n - add #include \"";
+ emsg += scanFileBase;
+ emsg += ".moc\"\n - enable SKIP_AUTOMOC for this file";
+ this->LogFileError(cmQtAutoGen::MOC, absFilename, emsg);
return false;
}
}
-
return true;
}
-void cmQtAutoGenerators::MocParseHeaderContent(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::string>& mocsNotIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends)
+void cmQtAutoGenerators::MocParseHeaderContent(std::string const& absFilename,
+ std::string const& contentText)
{
- // Log
if (this->Verbose) {
- this->LogInfo(cmQtAutoGen::MOC, "Checking " + absFilename);
- }
- if (this->MocRequired(contentText)) {
- // Register moc job
- mocsNotIncluded[absFilename] =
- this->ChecksumedPath(absFilename, "moc_", this->ConfigSuffix + ".cpp");
- this->MocFindDepends(absFilename, contentText, mocDepends);
- }
-}
-
-void cmQtAutoGenerators::SearchHeadersForSourceFile(
- const std::string& absFilename, std::set<std::string>& mocHeaderFiles,
- std::set<std::string>& uicHeaderFiles) const
-{
- std::array<std::string, 2> basepaths;
- {
- std::string bpath = SubDirPrefix(absFilename);
- bpath += cmSystemTools::GetFilenameWithoutLastExtension(absFilename);
- // search for default header files and private header files
- basepaths[0] = bpath;
- basepaths[1] = bpath;
- basepaths[1] += "_p";
- }
-
- for (const std::string& bPath : basepaths) {
- std::string headerName;
- if (this->FindHeader(headerName, bPath)) {
- // Moc headers
- if (!this->MocSkip(absFilename) && !this->MocSkip(headerName)) {
- mocHeaderFiles.insert(headerName);
- }
- // Uic headers
- if (!this->UicSkip(absFilename) && !this->UicSkip(headerName)) {
- uicHeaderFiles.insert(headerName);
- }
- }
- }
-}
-
-bool cmQtAutoGenerators::ParseHeaders(
- const std::set<std::string>& mocHeaderFiles,
- const std::set<std::string>& uicHeaderFiles,
- const std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::string>& mocsNotIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends,
- std::map<std::string, std::vector<std::string>>& uisIncluded)
-{
- bool success = true;
- // Merged header files list to read files only once
- std::set<std::string> headerFiles;
- headerFiles.insert(mocHeaderFiles.begin(), mocHeaderFiles.end());
- headerFiles.insert(uicHeaderFiles.begin(), uicHeaderFiles.end());
-
- for (std::string const& headerName : headerFiles) {
- std::string contentText;
- if (ReadAll(contentText, headerName)) {
- // Parse header content for MOC
- if ((mocHeaderFiles.find(headerName) != mocHeaderFiles.end()) &&
- (mocsIncluded.find(headerName) == mocsIncluded.end())) {
- this->MocParseHeaderContent(headerName, contentText, mocsNotIncluded,
- mocDepends);
- }
- // Parse header content for UIC
- if (uicHeaderFiles.find(headerName) != uicHeaderFiles.end()) {
- this->UicParseContent(headerName, contentText, uisIncluded);
+ this->LogInfo(cmQtAutoGen::MOC, "Checking: " + absFilename);
+ }
+
+ auto const fit =
+ std::find_if(this->MocJobsIncluded.cbegin(), this->MocJobsIncluded.cend(),
+ [&absFilename](std::unique_ptr<MocJobIncluded> const& job) {
+ return job->SourceFile == absFilename;
+ });
+ if (fit == this->MocJobsIncluded.cend()) {
+ if (this->MocRequired(contentText)) {
+ auto job = cm::make_unique<MocJobAuto>();
+ job->SourceFile = absFilename;
+ {
+ std::string& bld = job->BuildFileRel;
+ bld = this->FilePathChecksum.getPart(absFilename);
+ bld += '/';
+ bld += "moc_";
+ bld += cmSystemTools::GetFilenameWithoutLastExtension(absFilename);
+ if (this->MultiConfig != cmQtAutoGen::SINGLE) {
+ bld += this->ConfigSuffix;
+ }
+ bld += ".cpp";
}
- } else {
- this->LogFileError(cmQtAutoGen::GEN, headerName,
- "Could not read header file");
- success = false;
- break;
+ this->MocFindDepends(absFilename, contentText, job->Depends);
+ this->MocJobsAuto.push_back(std::move(job));
}
}
- return success;
}
-bool cmQtAutoGenerators::MocGenerateAll(
- const std::map<std::string, std::string>& mocsIncluded,
- const std::map<std::string, std::string>& mocsNotIncluded,
- const std::map<std::string, std::set<std::string>>& mocDepends)
+bool cmQtAutoGenerators::MocGenerateAll()
{
if (!this->MocEnabled()) {
return true;
}
- // Look for name collisions
+ // Look for name collisions in included moc files
{
- std::multimap<std::string, std::string> collisions;
- // Test merged map of included and notIncluded
- std::map<std::string, std::string> mergedMocs(mocsIncluded);
- mergedMocs.insert(mocsNotIncluded.begin(), mocsNotIncluded.end());
- if (this->NameCollisionTest(mergedMocs, collisions)) {
- std::string msg = "The same moc file will be generated "
- "from different sources.\n"
- "To avoid this error either\n"
- " - rename the source files or\n"
- " - do not include the (moc_NAME.cpp|NAME.moc) file";
- this->LogNameCollisionError(cmQtAutoGen::MOC, msg, collisions);
+ bool collision = false;
+ std::map<std::string, std::vector<MocJobIncluded const*>> collisions;
+ for (auto const& job : this->MocJobsIncluded) {
+ auto& list = collisions[job->IncludeString];
+ if (!list.empty()) {
+ collision = true;
+ }
+ list.push_back(job.get());
+ }
+ if (collision) {
+ std::string emsg =
+ "Included moc files with the same name will be "
+ "generated from different sources.\n"
+ "Consider to\n"
+ " - not include the \"moc_<NAME>.cpp\" file\n"
+ " - add a directory prefix to a \"<NAME>.moc\" include "
+ "(e.g \"sub/<NAME>.moc\")\n"
+ " - rename the source file(s)\n"
+ "Include conflicts\n"
+ "-----------------\n";
+ const auto& colls = collisions;
+ for (auto const& coll : colls) {
+ if (coll.second.size() > 1) {
+ emsg += cmQtAutoGen::Quoted(coll.first);
+ emsg += " included in\n";
+ for (const MocJobIncluded* job : coll.second) {
+ emsg += " - ";
+ emsg += cmQtAutoGen::Quoted(job->Includer);
+ emsg += "\n";
+ }
+ emsg += "would be generated from\n";
+ for (const MocJobIncluded* job : coll.second) {
+ emsg += " - ";
+ emsg += cmQtAutoGen::Quoted(job->SourceFile);
+ emsg += "\n";
+ }
+ }
+ }
+ this->LogError(cmQtAutoGen::MOC, emsg);
return false;
}
}
- // Generate moc_predefs
+ // (Re)generate moc_predefs.h on demand
if (!this->MocPredefsCmd.empty()) {
if (this->MocSettingsChanged ||
- FileAbsentOrOlder(this->MocPredefsFileAbs, this->SettingsFile)) {
+ !cmSystemTools::FileExists(this->MocPredefsFileAbs)) {
if (this->Verbose) {
this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel);
}
@@ -1216,16 +1392,9 @@ bool cmQtAutoGenerators::MocGenerateAll(
{
// 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::string const& def : this->MocDefinitions) {
- cmd.push_back("-D" + def);
- }
// Add options
- cmd.insert(cmd.end(), this->MocOptions.begin(),
- this->MocOptions.end());
+ cmd.insert(cmd.end(), this->MocAllOptions.begin(),
+ this->MocAllOptions.end());
// Execute command
if (!this->RunCommand(cmd, output)) {
this->LogCommandError(cmQtAutoGen::MOC,
@@ -1240,6 +1409,8 @@ bool cmQtAutoGenerators::MocGenerateAll(
output)) {
this->MocPredefsChanged = true;
} else {
+ this->LogFileError(cmQtAutoGen::MOC, this->MocPredefsFileAbs,
+ "moc_predefs file writing failed");
return false;
}
} else {
@@ -1251,104 +1422,160 @@ bool cmQtAutoGenerators::MocGenerateAll(
cmSystemTools::Touch(this->MocPredefsFileAbs, false);
}
}
+
+ // Add moc_predefs.h to moc file dependecies
+ for (auto const& item : this->MocJobsIncluded) {
+ item->Depends.insert(this->MocPredefsFileAbs);
+ }
+ for (auto const& item : this->MocJobsAuto) {
+ item->Depends.insert(this->MocPredefsFileAbs);
+ }
}
// Generate moc files that are included by source files.
- for (auto const& it : mocsIncluded) {
- if (!this->MocGenerateFile(it.first, it.second, mocDepends, true)) {
- if (this->MocRunFailed) {
- return false;
- }
+ for (auto const& item : this->MocJobsIncluded) {
+ if (!this->MocGenerateFile(*item)) {
+ return false;
}
}
-
// Generate moc files that are _not_ included by source files.
- bool mocCompFileGenerated = false;
- for (auto const& it : mocsNotIncluded) {
- if (this->MocGenerateFile(it.first, it.second, mocDepends, false)) {
- mocCompFileGenerated = true;
- } else {
- if (this->MocRunFailed) {
- return false;
- }
+ bool autoNameGenerated = false;
+ for (auto const& item : this->MocJobsAuto) {
+ if (!this->MocGenerateFile(*item, &autoNameGenerated)) {
+ return false;
}
}
// Compose mocs compilation file content
- std::string automocSource;
{
- std::ostringstream ost;
- ost << "/* This file is autogenerated, do not edit*/\n";
- if (mocsNotIncluded.empty()) {
- // Dummy content
- ost << "enum some_compilers { need_more_than_nothing };\n";
+ std::string mocs =
+ "// This file is autogenerated. Changes will be overwritten.\n";
+ if (this->MocJobsAuto.empty()) {
+ // Placeholder content
+ mocs +=
+ "// No files found that require moc or the moc files are included\n";
+ mocs += "enum some_compilers { need_more_than_nothing };\n";
} else {
// Valid content
- for (auto const& it : mocsNotIncluded) {
- ost << "#include \"" << it.second << "\"\n";
+ for (const auto& item : this->MocJobsAuto) {
+ mocs += "#include \"";
+ mocs += item->BuildFileRel;
+ mocs += "\"\n";
}
}
- automocSource = ost.str();
- }
- if (this->FileDiffers(this->MocCompFileAbs, automocSource)) {
- // Actually write mocs compilation file
- if (this->Verbose) {
- this->LogBold("Generating MOC compilation " + this->MocCompFileRel);
- }
- if (!this->FileWrite(cmQtAutoGen::MOC, this->MocCompFileAbs,
- automocSource)) {
- return false;
- }
- } else if (mocCompFileGenerated) {
- // Only touch mocs compilation file
- if (this->Verbose) {
- this->LogInfo(cmQtAutoGen::MOC,
- "Touching mocs compilation " + this->MocCompFileRel);
+ if (this->FileDiffers(this->MocCompFileAbs, mocs)) {
+ // Actually write mocs compilation file
+ if (this->Verbose) {
+ this->LogBold("Generating MOC compilation " + this->MocCompFileRel);
+ }
+ if (!this->FileWrite(cmQtAutoGen::MOC, this->MocCompFileAbs, mocs)) {
+ this->LogFileError(cmQtAutoGen::MOC, this->MocCompFileAbs,
+ "mocs compilation file writing failed");
+ return false;
+ }
+ } else if (autoNameGenerated) {
+ // Only touch mocs compilation file
+ if (this->Verbose) {
+ this->LogInfo(cmQtAutoGen::MOC,
+ "Touching mocs compilation " + this->MocCompFileRel);
+ }
+ cmSystemTools::Touch(this->MocCompFileAbs, false);
}
- cmSystemTools::Touch(this->MocCompFileAbs, false);
}
return true;
}
/**
- * @return True if a moc file was created. False may indicate an error.
+ * @return True on success
*/
-bool cmQtAutoGenerators::MocGenerateFile(
- const std::string& sourceFile, const std::string& mocFileName,
- const std::map<std::string, std::set<std::string>>& mocDepends,
- bool included)
+bool cmQtAutoGenerators::MocGenerateFile(const MocJobAuto& mocJob,
+ bool* generated)
{
- bool mocGenerated = false;
- bool generateMoc = this->MocSettingsChanged || this->MocPredefsChanged;
-
- const std::string mocFileRel =
- included ? (this->AutogenIncludeDir + mocFileName) : mocFileName;
- const std::string mocFileAbs =
- cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, mocFileRel);
-
- if (!generateMoc) {
- // Test if the source file is newer that the build file
- generateMoc = FileAbsentOrOlder(mocFileAbs, sourceFile);
- if (!generateMoc) {
- // Test if a dependency file changed
- std::map<std::string, std::set<std::string>>::const_iterator dit =
- mocDepends.find(sourceFile);
- if (dit != mocDepends.end()) {
- for (std::string const& fit : dit->second) {
- if (FileAbsentOrOlder(mocFileAbs, fit)) {
- generateMoc = true;
- break;
- }
+ bool success = true;
+
+ std::string const mocFileAbs = cmSystemTools::CollapseCombinedPath(
+ this->AutogenBuildDir, mocJob.BuildFileRel);
+
+ bool generate = false;
+ std::string generateReason;
+ if (!generate && !cmSystemTools::FileExists(mocFileAbs.c_str())) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(mocFileAbs);
+ generateReason += " from its source file ";
+ generateReason += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ generateReason += " because it doesn't exist";
+ }
+ generate = true;
+ }
+ if (!generate && this->MocSettingsChanged) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(mocFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ generateReason += " because the MOC settings changed";
+ }
+ generate = true;
+ }
+ if (!generate && this->MocPredefsChanged) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(mocFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ generateReason += " because moc_predefs.h changed";
+ }
+ generate = true;
+ }
+ if (!generate) {
+ std::string error;
+ if (FileIsOlderThan(mocFileAbs, mocJob.SourceFile, &error)) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(mocFileAbs);
+ generateReason += " because it's older than its source file ";
+ generateReason += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ }
+ generate = true;
+ } else {
+ if (!error.empty()) {
+ this->LogError(cmQtAutoGen::MOC, error);
+ success = false;
+ }
+ }
+ }
+ if (success && !generate) {
+ // Test if a dependency file is newer
+ std::string error;
+ for (std::string const& depFile : mocJob.Depends) {
+ if (FileIsOlderThan(mocFileAbs, depFile, &error)) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(mocFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ generateReason += " because it is older than ";
+ generateReason += cmQtAutoGen::Quoted(depFile);
}
+ generate = true;
+ break;
+ }
+ if (!error.empty()) {
+ this->LogError(cmQtAutoGen::MOC, error);
+ success = false;
+ break;
}
}
}
- if (generateMoc) {
+
+ if (generate) {
// Log
if (this->Verbose) {
- this->LogBold("Generating MOC source " + mocFileRel);
+ this->LogBold("Generating MOC source " + mocJob.BuildFileRel);
+ this->LogInfo(cmQtAutoGen::MOC, generateReason);
}
// Make sure the parent directory exists
@@ -1356,15 +1583,9 @@ bool cmQtAutoGenerators::MocGenerateFile(
// 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
- for (std::string const& def : this->MocDefinitions) {
- cmd.push_back("-D" + def);
- }
// Add options
- cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
+ cmd.insert(cmd.end(), this->MocAllOptions.begin(),
+ this->MocAllOptions.end());
// Add predefs include
if (!this->MocPredefsFileAbs.empty()) {
cmd.push_back("--include");
@@ -1372,37 +1593,111 @@ bool cmQtAutoGenerators::MocGenerateFile(
}
cmd.push_back("-o");
cmd.push_back(mocFileAbs);
- cmd.push_back(sourceFile);
+ cmd.push_back(mocJob.SourceFile);
// Execute moc command
std::string output;
if (this->RunCommand(cmd, output)) {
// Success
- mocGenerated = true;
+ if (generated != nullptr) {
+ *generated = true;
+ }
} else {
- this->LogCommandError(cmQtAutoGen::MOC, "moc failed for\n " +
- cmQtAutoGen::Quoted(sourceFile),
- cmd, output);
+ // Moc command failed
+ {
+ std::string emsg = "moc failed for\n ";
+ emsg += cmQtAutoGen::Quoted(mocJob.SourceFile);
+ this->LogCommandError(cmQtAutoGen::MOC, emsg, cmd, output);
+ }
cmSystemTools::RemoveFile(mocFileAbs);
- this->MocRunFailed = true;
+ success = false;
}
} else {
// Parent directory creation failed
- this->MocRunFailed = true;
+ success = false;
+ }
+ }
+ return success;
+}
+
+/**
+ * @brief Tests if the file name is in the skip list
+ */
+bool cmQtAutoGenerators::UicSkip(std::string const& absFilename) const
+{
+ if (this->UicEnabled()) {
+ // Test if the file name is on the skip list
+ if (!ListContains(this->UicSkipList, absFilename)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool cmQtAutoGenerators::UicParseContent(std::string const& absFilename,
+ std::string const& contentText)
+{
+ if (this->Verbose) {
+ this->LogInfo(cmQtAutoGen::UIC, "Checking: " + absFilename);
+ }
+
+ std::vector<std::string> includes;
+ // Extracte includes
+ {
+ const char* contentChars = contentText.c_str();
+ if (strstr(contentChars, "ui_") != nullptr) {
+ while (this->UicRegExpInclude.find(contentChars)) {
+ includes.push_back(this->UicRegExpInclude.match(1));
+ contentChars += this->UicRegExpInclude.end();
+ }
}
}
- return mocGenerated;
+
+ for (std::string const& includeString : includes) {
+ std::string uiInputFile;
+ if (!UicFindIncludedFile(uiInputFile, absFilename, includeString)) {
+ return false;
+ }
+ // Check if this file should be skipped
+ if (this->UicSkip(uiInputFile)) {
+ continue;
+ }
+ // Check if the job already exists
+ bool jobExists = false;
+ for (const auto& job : this->UicJobs) {
+ if ((job->SourceFile == uiInputFile) &&
+ (job->IncludeString == includeString)) {
+ jobExists = true;
+ break;
+ }
+ }
+ if (!jobExists) {
+ auto job = cm::make_unique<UicJob>();
+ job->SourceFile = uiInputFile;
+ job->BuildFileRel = this->AutogenIncludeDir;
+ job->BuildFileRel += includeString;
+ job->Includer = absFilename;
+ job->IncludeString = includeString;
+ this->UicJobs.push_back(std::move(job));
+ }
+ }
+
+ return true;
}
bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile,
- const std::string& sourceFile,
- const std::string& searchPath,
- const std::string& searchFile)
+ std::string const& sourceFile,
+ std::string const& includeString)
{
bool success = false;
- std::vector<std::string> testFiles;
+ std::string searchFile =
+ cmSystemTools::GetFilenameWithoutLastExtension(includeString).substr(3);
+ searchFile += ".ui";
// Collect search paths list
+ std::vector<std::string> testFiles;
{
+ std::string const searchPath = SubDirPrefix(includeString);
+
std::string searchFileFull;
if (!searchPath.empty()) {
searchFileFull = searchPath;
@@ -1410,7 +1705,7 @@ bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile,
}
// Vicinity of the source
{
- const std::string sourcePath = SubDirPrefix(sourceFile);
+ std::string const sourcePath = SubDirPrefix(sourceFile);
testFiles.push_back(sourcePath + searchFile);
if (!searchPath.empty()) {
testFiles.push_back(sourcePath + searchFileFull);
@@ -1440,76 +1735,75 @@ bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile,
// Log error
if (!success) {
- std::ostringstream ost;
- ost << "Could not find " << cmQtAutoGen::Quoted(searchFile) << " in\n";
+ std::string emsg = "Could not find ";
+ emsg += cmQtAutoGen::Quoted(searchFile);
+ emsg += " in\n";
for (std::string const& testFile : testFiles) {
- ost << " " << cmQtAutoGen::Quoted(testFile) << "\n";
+ emsg += " ";
+ emsg += cmQtAutoGen::Quoted(testFile);
+ emsg += "\n";
}
- this->LogFileError(cmQtAutoGen::UIC, sourceFile, ost.str());
+ this->LogFileError(cmQtAutoGen::UIC, sourceFile, emsg);
}
return success;
}
-bool cmQtAutoGenerators::UicGenerateAll(
- const std::map<std::string, std::vector<std::string>>& uisIncluded)
+bool cmQtAutoGenerators::UicGenerateAll()
{
if (!this->UicEnabled()) {
return true;
}
- // single map with input / output names
- std::map<std::string, std::map<std::string, std::string>> sourceGenMap;
+ // Look for name collisions in included uic files
{
- // Collision lookup map
- std::map<std::string, std::string> testMap;
- // Compile maps
- for (auto const& sit : uisIncluded) {
- const std::string& source(sit.first);
- const std::vector<std::string>& sourceIncs(sit.second);
- // insert new source/destination map
- std::map<std::string, std::string>& uiGenMap = sourceGenMap[source];
- for (std::string const& inc : sourceIncs) {
- // Remove ui_ from the begin filename by substr()
- const std::string uiBasePath = SubDirPrefix(inc);
- const std::string uiBaseName =
- cmSystemTools::GetFilenameWithoutLastExtension(inc).substr(3);
- const std::string uiFileName = uiBaseName + ".ui";
- std::string uiInputFile;
- if (UicFindIncludedFile(uiInputFile, source, uiBasePath, uiFileName)) {
- std::string uiOutputFile = uiBasePath;
- uiOutputFile += "ui_";
- uiOutputFile += uiBaseName;
- uiOutputFile += ".h";
- cmSystemTools::ReplaceString(uiOutputFile, "..", "__");
- uiGenMap[uiInputFile] = uiOutputFile;
- testMap[uiInputFile] = uiOutputFile;
- } else {
- return false;
- }
+ bool collision = false;
+ std::map<std::string, std::vector<UicJob const*>> collisions;
+ for (auto const& job : this->UicJobs) {
+ auto& list = collisions[job->IncludeString];
+ if (!list.empty()) {
+ collision = true;
}
- }
- // look for name collisions
- {
- std::multimap<std::string, std::string> collisions;
- if (this->NameCollisionTest(testMap, collisions)) {
- std::string msg = "The same ui_NAME.h file will be generated "
- "from different sources.\n"
- "To avoid this error rename the source files.\n";
- this->LogNameCollisionError(cmQtAutoGen::UIC, msg, collisions);
- return false;
+ list.push_back(job.get());
+ }
+ if (collision) {
+ std::string emsg =
+ "Included uic files with the same name will be "
+ "generated from different sources.\n"
+ "Consider to\n"
+ " - add a directory prefix to a \"ui_<NAME>.h\" include "
+ "(e.g \"sub/ui_<NAME>.h\")\n"
+ " - rename the <NAME>.ui file(s) and adjust the \"ui_<NAME>.h\" "
+ "include(s)\n"
+ "Include conflicts\n"
+ "-----------------\n";
+ const auto& colls = collisions;
+ for (auto const& coll : colls) {
+ if (coll.second.size() > 1) {
+ emsg += cmQtAutoGen::Quoted(coll.first);
+ emsg += " included in\n";
+ for (const UicJob* job : coll.second) {
+ emsg += " - ";
+ emsg += cmQtAutoGen::Quoted(job->Includer);
+ emsg += "\n";
+ }
+ emsg += "would be generated from\n";
+ for (const UicJob* job : coll.second) {
+ emsg += " - ";
+ emsg += cmQtAutoGen::Quoted(job->SourceFile);
+ emsg += "\n";
+ }
+ }
}
+ this->LogError(cmQtAutoGen::UIC, emsg);
+ return false;
}
}
- // generate ui files
- for (auto const& srcItem : sourceGenMap) {
- for (auto const& item : srcItem.second) {
- if (!this->UicGenerateFile(srcItem.first, item.first, item.second)) {
- if (this->UicRunFailed) {
- return false;
- }
- }
+ // Generate ui header files
+ for (const auto& item : this->UicJobs) {
+ if (!this->UicGenerateFile(*item)) {
+ return false;
}
}
@@ -1517,27 +1811,59 @@ bool cmQtAutoGenerators::UicGenerateAll(
}
/**
- * @return True if a uic file was created. False may indicate an error.
+ * @return True on success
*/
-bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
- const std::string& uiInputFile,
- const std::string& uiOutputFile)
+bool cmQtAutoGenerators::UicGenerateFile(const UicJob& uicJob)
{
- bool uicGenerated = false;
- bool generateUic = this->UicSettingsChanged;
+ bool success = true;
- const std::string uicFileRel = this->AutogenIncludeDir + uiOutputFile;
- const std::string uicFileAbs =
- cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, uicFileRel);
+ std::string const uicFileAbs = cmSystemTools::CollapseCombinedPath(
+ this->AutogenBuildDir, uicJob.BuildFileRel);
- if (!generateUic) {
- // Test if the source file is newer that the build file
- generateUic = FileAbsentOrOlder(uicFileAbs, uiInputFile);
+ bool generate = false;
+ std::string generateReason;
+ if (!generate && !cmSystemTools::FileExists(uicFileAbs.c_str())) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(uicFileAbs);
+ generateReason += " from its source file ";
+ generateReason += cmQtAutoGen::Quoted(uicJob.SourceFile);
+ generateReason += " because it doesn't exist";
+ }
+ generate = true;
+ }
+ if (!generate && this->UicSettingsChanged) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(uicFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(uicJob.SourceFile);
+ generateReason += " because the UIC settings changed";
+ }
+ generate = true;
+ }
+ if (!generate) {
+ std::string error;
+ if (FileIsOlderThan(uicFileAbs, uicJob.SourceFile, &error)) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(uicFileAbs);
+ generateReason += " because it's older than its source file ";
+ generateReason += cmQtAutoGen::Quoted(uicJob.SourceFile);
+ }
+ generate = true;
+ } else {
+ if (!error.empty()) {
+ this->LogError(cmQtAutoGen::UIC, error);
+ success = false;
+ }
+ }
}
- if (generateUic) {
+ if (generate) {
// Log
if (this->Verbose) {
- this->LogBold("Generating UIC header " + uicFileRel);
+ this->LogBold("Generating UIC header " + uicJob.BuildFileRel);
+ this->LogInfo(cmQtAutoGen::UIC, generateReason);
}
// Make sure the parent directory exists
@@ -1547,7 +1873,7 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
cmd.push_back(this->UicExecutable);
{
std::vector<std::string> allOpts = this->UicTargetOptions;
- auto optionIt = this->UicOptions.find(uiInputFile);
+ auto optionIt = this->UicOptions.find(uicJob.SourceFile);
if (optionIt != this->UicOptions.end()) {
cmQtAutoGen::UicMergeOptions(allOpts, optionIt->second,
(this->QtMajorVersion == "5"));
@@ -1556,31 +1882,29 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
}
cmd.push_back("-o");
cmd.push_back(uicFileAbs);
- cmd.push_back(uiInputFile);
+ cmd.push_back(uicJob.SourceFile);
std::string output;
if (this->RunCommand(cmd, output)) {
// Success
- uicGenerated = true;
} else {
// Command failed
{
- std::ostringstream ost;
- ost << "uic failed for\n"
- << " " << cmQtAutoGen::Quoted(uiInputFile) << "\n"
- << "needed by\n"
- << " " << cmQtAutoGen::Quoted(realName);
- this->LogCommandError(cmQtAutoGen::UIC, ost.str(), cmd, output);
+ std::string emsg = "uic failed for\n ";
+ emsg += cmQtAutoGen::Quoted(uicJob.SourceFile);
+ emsg += "\nincluded by\n ";
+ emsg += cmQtAutoGen::Quoted(uicJob.Includer);
+ this->LogCommandError(cmQtAutoGen::UIC, emsg, cmd, output);
}
cmSystemTools::RemoveFile(uicFileAbs);
- this->UicRunFailed = true;
+ success = false;
}
} else {
// Parent directory creation failed
- this->UicRunFailed = true;
+ success = false;
}
}
- return uicGenerated;
+ return success;
}
bool cmQtAutoGenerators::RccGenerateAll()
@@ -1589,75 +1913,138 @@ bool cmQtAutoGenerators::RccGenerateAll()
return true;
}
- // Generate qrc files
- for (RccJob const& rccJob : this->RccJobs) {
+ // Generate rcc files
+ for (const RccJob& rccJob : this->RccJobs) {
if (!this->RccGenerateFile(rccJob)) {
- if (this->RccRunFailed) {
- return false;
- }
+ return false;
}
}
return true;
}
/**
- * @return True if a rcc file was created. False may indicate an error.
+ * @return True on success
*/
bool cmQtAutoGenerators::RccGenerateFile(const RccJob& rccJob)
{
+ bool success = true;
bool rccGenerated = false;
- bool generateRcc = this->RccSettingsChanged;
std::string rccFileAbs;
- if (this->ConfigSuffix.empty()) {
+ if (this->MultiConfig == cmQtAutoGen::SINGLE) {
rccFileAbs = rccJob.RccFile;
} else {
- rccFileAbs = SubDirPrefix(rccJob.RccFile);
- rccFileAbs +=
- cmSystemTools::GetFilenameWithoutLastExtension(rccJob.RccFile);
- rccFileAbs += this->ConfigSuffix;
- rccFileAbs += cmSystemTools::GetFilenameLastExtension(rccJob.RccFile);
+ rccFileAbs =
+ cmQtAutoGen::AppendFilenameSuffix(rccJob.RccFile, this->ConfigSuffix);
}
- const std::string rccFileRel = cmSystemTools::RelativePath(
+ std::string const rccFileRel = cmSystemTools::RelativePath(
this->AutogenBuildDir.c_str(), rccFileAbs.c_str());
// Check if regeneration is required
- if (!generateRcc) {
- // Test if the resources list file is newer than build file
- generateRcc = FileAbsentOrOlder(rccFileAbs, rccJob.QrcFile);
- if (!generateRcc) {
- // Acquire input file list
- std::vector<std::string> readFiles;
- const std::vector<std::string>* files = &rccJob.Inputs;
- if (files->empty()) {
- // Read input file list from qrc file
- std::string error;
- if (cmQtAutoGen::RccListInputs(this->QtMajorVersion,
- this->RccExecutable, rccJob.QrcFile,
- readFiles, &error)) {
- files = &readFiles;
- } else {
- files = nullptr;
- this->LogFileError(cmQtAutoGen::RCC, rccJob.QrcFile, error);
- this->RccRunFailed = true;
- }
+ bool generate = false;
+ std::string generateReason;
+ if (!cmSystemTools::FileExists(rccJob.QrcFile)) {
+ {
+ std::string error = "Could not find the file\n ";
+ error += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ this->LogError(cmQtAutoGen::RCC, error);
+ }
+ success = false;
+ }
+ if (success && !generate && !cmSystemTools::FileExists(rccFileAbs.c_str())) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(rccFileAbs);
+ generateReason += " from its source file ";
+ generateReason += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ generateReason += " because it doesn't exist";
+ }
+ generate = true;
+ }
+ if (success && !generate && this->RccSettingsChanged) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(rccFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ generateReason += " because the RCC settings changed";
+ }
+ generate = true;
+ }
+ if (success && !generate) {
+ std::string error;
+ if (FileIsOlderThan(rccFileAbs, rccJob.QrcFile, &error)) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(rccFileAbs);
+ generateReason += " because it is older than ";
+ generateReason += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ }
+ generate = true;
+ } else {
+ if (!error.empty()) {
+ this->LogError(cmQtAutoGen::RCC, error);
+ success = false;
}
- // Test if any input file is newer than the build file
- if (files != nullptr) {
- for (std::string const& file : *files) {
- if (FileAbsentOrOlder(rccFileAbs, file)) {
- generateRcc = true;
- break;
+ }
+ }
+ if (success && !generate) {
+ // Acquire input file list
+ std::vector<std::string> readFiles;
+ std::vector<std::string> const* files = nullptr;
+ if (!rccJob.Inputs.empty()) {
+ files = &rccJob.Inputs;
+ } else {
+ // Read input file list from qrc file
+ std::string error;
+ if (cmQtAutoGen::RccListInputs(this->QtMajorVersion, this->RccExecutable,
+ rccJob.QrcFile, readFiles, &error)) {
+ files = &readFiles;
+ } else {
+ this->LogFileError(cmQtAutoGen::RCC, rccJob.QrcFile, error);
+ success = false;
+ }
+ }
+ // Test if any input file is newer than the build file
+ if (files != nullptr) {
+ std::string error;
+ for (std::string const& resFile : *files) {
+ if (!cmSystemTools::FileExists(resFile.c_str())) {
+ error = "Could not find the file\n ";
+ error += cmQtAutoGen::Quoted(resFile);
+ error += "\nwhich is listed in\n ";
+ error += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ break;
+ }
+ if (FileIsOlderThan(rccFileAbs, resFile, &error)) {
+ if (this->Verbose) {
+ generateReason = "Generating ";
+ generateReason += cmQtAutoGen::Quoted(rccFileAbs);
+ generateReason += " from ";
+ generateReason += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ generateReason += " because it is older than ";
+ generateReason += cmQtAutoGen::Quoted(resFile);
}
+ generate = true;
+ break;
+ }
+ if (!error.empty()) {
+ break;
}
}
+ // Print error
+ if (!error.empty()) {
+ this->LogError(cmQtAutoGen::RCC, error);
+ success = false;
+ }
}
}
// Regenerate on demand
- if (generateRcc) {
+ if (generate) {
// Log
if (this->Verbose) {
this->LogBold("Generating RCC source " + rccFileRel);
+ this->LogInfo(cmQtAutoGen::RCC, generateReason);
}
// Make sure the parent directory exists
@@ -1675,42 +2062,45 @@ bool cmQtAutoGenerators::RccGenerateFile(const RccJob& rccJob)
// Success
rccGenerated = true;
} else {
- this->LogCommandError(cmQtAutoGen::RCC, "rcc failed for\n " +
- cmQtAutoGen::Quoted(rccJob.QrcFile),
- cmd, output);
+ {
+ std::string emsg = "rcc failed for\n ";
+ emsg += cmQtAutoGen::Quoted(rccJob.QrcFile);
+ this->LogCommandError(cmQtAutoGen::RCC, emsg, cmd, output);
+ }
cmSystemTools::RemoveFile(rccFileAbs);
- this->RccRunFailed = true;
+ success = false;
}
} else {
// Parent directory creation failed
- this->RccRunFailed = true;
+ success = false;
}
}
- // For a multi configuration generator generate a wrapper file
- if (!this->ConfigSuffix.empty() && !this->RccRunFailed) {
+
+ // Generate a wrapper source file on demand
+ if (success && (this->MultiConfig == cmQtAutoGen::WRAP)) {
// Wrapper file name
- const std::string& wrapperFileAbs = rccJob.RccFile;
- const std::string wrapperFileRel = cmSystemTools::RelativePath(
+ std::string const& wrapperFileAbs = rccJob.RccFile;
+ std::string const wrapperFileRel = cmSystemTools::RelativePath(
this->AutogenBuildDir.c_str(), wrapperFileAbs.c_str());
// Wrapper file content
std::string content = "// This is an autogenerated configuration "
- "wrapper file. Do not edit.\n"
+ "wrapper file. Changes will be overwritten.\n"
"#include \"";
content += cmSystemTools::GetFilenameName(rccFileRel);
content += "\"\n";
// Write content to file
if (this->FileDiffers(wrapperFileAbs, content)) {
- // Write new wrapper file if the content differs
+ // Write new wrapper file
if (this->Verbose) {
this->LogBold("Generating RCC wrapper " + wrapperFileRel);
}
if (!this->FileWrite(cmQtAutoGen::RCC, wrapperFileAbs, content)) {
- // Error
- rccGenerated = false;
- this->RccRunFailed = true;
+ this->LogFileError(cmQtAutoGen::RCC, wrapperFileAbs,
+ "rcc wrapper file writing failed");
+ success = false;
}
} else if (rccGenerated) {
- // Only touch wrapper file if the content matches
+ // Just touch the wrapper file
if (this->Verbose) {
this->LogInfo(cmQtAutoGen::RCC,
"Touching RCC wrapper " + wrapperFileRel);
@@ -1719,18 +2109,18 @@ bool cmQtAutoGenerators::RccGenerateFile(const RccJob& rccJob)
}
}
- return rccGenerated;
+ return success;
}
-void cmQtAutoGenerators::LogBold(const std::string& message) const
+void cmQtAutoGenerators::LogBold(std::string const& message) const
{
cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, this->ColorOutput);
}
-void cmQtAutoGenerators::LogInfo(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const
+void cmQtAutoGenerators::LogInfo(cmQtAutoGen::Generator genType,
+ std::string const& message) const
{
std::string msg = cmQtAutoGen::GeneratorName(genType);
msg += ": ";
@@ -1741,8 +2131,8 @@ void cmQtAutoGenerators::LogInfo(cmQtAutoGen::GeneratorType genType,
cmSystemTools::Stdout(msg.c_str(), msg.size());
}
-void cmQtAutoGenerators::LogWarning(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const
+void cmQtAutoGenerators::LogWarning(cmQtAutoGen::Generator genType,
+ std::string const& message) const
{
std::string msg = cmQtAutoGen::GeneratorName(genType);
msg += " warning:";
@@ -1758,197 +2148,118 @@ void cmQtAutoGenerators::LogWarning(cmQtAutoGen::GeneratorType genType,
if (msg.back() != '\n') {
msg.push_back('\n');
}
- msg += "\n";
+ msg.push_back('\n');
cmSystemTools::Stdout(msg.c_str(), msg.size());
}
-void cmQtAutoGenerators::LogFileWarning(cmQtAutoGen::GeneratorType genType,
- const std::string& filename,
- const std::string& message) const
+void cmQtAutoGenerators::LogFileWarning(cmQtAutoGen::Generator genType,
+ std::string const& filename,
+ std::string const& message) const
{
- std::string emsg = " ";
- emsg += cmQtAutoGen::Quoted(filename);
- emsg += "\n";
+ std::string msg = " ";
+ msg += cmQtAutoGen::Quoted(filename);
+ msg.push_back('\n');
// Message
- emsg += message;
- this->LogWarning(genType, emsg);
+ msg += message;
+ this->LogWarning(genType, msg);
}
-void cmQtAutoGenerators::LogError(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const
+void cmQtAutoGenerators::LogError(cmQtAutoGen::Generator genType,
+ std::string const& message) const
{
std::string msg;
msg.push_back('\n');
- msg = cmQtAutoGen::GeneratorName(genType);
- msg += " error:";
- if (message.find('\n') == std::string::npos) {
- // Single line message
- msg.push_back(' ');
- } else {
- // Multi line message
- msg.push_back('\n');
- }
+ msg += HeadLine(cmQtAutoGen::GeneratorName(genType) + " error");
// Message
msg += message;
if (msg.back() != '\n') {
msg.push_back('\n');
}
- msg += "\n";
+ msg.push_back('\n');
cmSystemTools::Stderr(msg.c_str(), msg.size());
}
-void cmQtAutoGenerators::LogFileError(cmQtAutoGen::GeneratorType genType,
- const std::string& filename,
- const std::string& message) const
+void cmQtAutoGenerators::LogFileError(cmQtAutoGen::Generator genType,
+ std::string const& filename,
+ std::string const& message) const
{
std::string emsg = " ";
emsg += cmQtAutoGen::Quoted(filename);
- emsg += "\n";
+ emsg += '\n';
// Message
emsg += message;
this->LogError(genType, emsg);
}
-void cmQtAutoGenerators::LogNameCollisionError(
- cmQtAutoGen::GeneratorType genType, const std::string& message,
- const std::multimap<std::string, std::string>& collisions) const
-{
- std::string emsg;
- // Add message
- if (!message.empty()) {
- emsg += message;
- if (emsg.back() != '\n') {
- emsg.push_back('\n');
- }
- }
- // Append collision list
- for (auto const& item : collisions) {
- emsg += " ";
- emsg += item.first;
- emsg += " -> ";
- emsg += item.second;
- emsg += "\n";
- }
- this->LogError(genType, emsg);
-}
-
void cmQtAutoGenerators::LogCommandError(
- cmQtAutoGen::GeneratorType genType, const std::string& message,
- const std::vector<std::string>& command, const std::string& output) const
+ cmQtAutoGen::Generator genType, std::string const& message,
+ std::vector<std::string> const& command, std::string const& output) const
{
std::string msg;
msg.push_back('\n');
- msg += cmQtAutoGen::GeneratorName(genType);
- msg += " subprocess error: ";
+ msg += HeadLine(cmQtAutoGen::GeneratorName(genType) + " subprocess error");
msg += message;
if (msg.back() != '\n') {
msg.push_back('\n');
}
msg.push_back('\n');
- msg += "Command\n";
- msg += "-------\n";
+ msg += HeadLine("Command");
msg += QuotedCommand(command);
if (msg.back() != '\n') {
msg.push_back('\n');
}
msg.push_back('\n');
- msg += "Output\n";
- msg += "------\n";
+ msg += HeadLine("Output");
msg += output;
if (msg.back() != '\n') {
msg.push_back('\n');
}
- msg += "\n";
+ msg.push_back('\n');
cmSystemTools::Stderr(msg.c_str(), msg.size());
}
/**
- * @brief Collects name collisions as output/input pairs
- * @return True if there were collisions
- */
-bool cmQtAutoGenerators::NameCollisionTest(
- const std::map<std::string, std::string>& genFiles,
- std::multimap<std::string, std::string>& collisions) const
-{
- typedef std::map<std::string, std::string>::const_iterator Iter;
- typedef std::map<std::string, std::string>::value_type VType;
- for (Iter ait = genFiles.begin(); ait != genFiles.end(); ++ait) {
- bool first_match(true);
- for (Iter bit = (++Iter(ait)); bit != genFiles.end(); ++bit) {
- if (ait->second == bit->second) {
- if (first_match) {
- if (collisions.find(ait->second) != collisions.end()) {
- // We already know of this collision from before
- break;
- }
- collisions.insert(VType(ait->second, ait->first));
- first_match = false;
- }
- collisions.insert(VType(bit->second, bit->first));
- }
- }
- }
-
- return !collisions.empty();
-}
-
-/**
- * @brief Generates a file path based on the checksum of the source file path
- * @return The path
- */
-std::string cmQtAutoGenerators::ChecksumedPath(
- const std::string& sourceFile, const std::string& basePrefix,
- const std::string& baseSuffix) const
-{
- std::string res = FPathChecksum.getPart(sourceFile);
- res += "/";
- res += basePrefix;
- res += cmSystemTools::GetFilenameWithoutLastExtension(sourceFile);
- res += baseSuffix;
- return res;
-}
-
-/**
* @brief Generates the parent directory of the given file on demand
* @return True on success
*/
-bool cmQtAutoGenerators::MakeParentDirectory(
- cmQtAutoGen::GeneratorType genType, const std::string& filename) const
+bool cmQtAutoGenerators::MakeParentDirectory(cmQtAutoGen::Generator genType,
+ std::string const& filename) const
{
bool success = true;
- const std::string dirName = cmSystemTools::GetFilenamePath(filename);
+ std::string const dirName = cmSystemTools::GetFilenamePath(filename);
if (!dirName.empty()) {
- success = cmSystemTools::MakeDirectory(dirName);
- if (!success) {
+ if (!cmSystemTools::MakeDirectory(dirName)) {
this->LogFileError(genType, filename,
"Could not create parent directory");
+ success = false;
}
}
return success;
}
-bool cmQtAutoGenerators::FileDiffers(const std::string& filename,
- const std::string& content)
+bool cmQtAutoGenerators::FileDiffers(std::string const& filename,
+ std::string const& content)
{
bool differs = true;
{
std::string oldContents;
- if (ReadAll(oldContents, filename)) {
+ if (ReadFile(oldContents, filename)) {
differs = (oldContents != content);
}
}
return differs;
}
-bool cmQtAutoGenerators::FileWrite(cmQtAutoGen::GeneratorType genType,
- const std::string& filename,
- const std::string& content)
+bool cmQtAutoGenerators::FileWrite(cmQtAutoGen::Generator genType,
+ std::string const& filename,
+ std::string const& content)
{
std::string error;
// Make sure the parent directory exists
if (this->MakeParentDirectory(genType, filename)) {
cmsys::ofstream outfile;
- outfile.open(filename.c_str(), std::ios::trunc);
+ outfile.open(filename.c_str(),
+ (std::ios::out | std::ios::binary | std::ios::trunc));
if (outfile) {
outfile << content;
// Check for write errors
@@ -1970,7 +2281,7 @@ bool cmQtAutoGenerators::FileWrite(cmQtAutoGen::GeneratorType genType,
* @brief Runs a command and returns true on success
* @return True on success
*/
-bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command,
+bool cmQtAutoGenerators::RunCommand(std::vector<std::string> const& command,
std::string& output) const
{
// Log command
@@ -1992,7 +2303,7 @@ bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command,
* @return True on success
*/
bool cmQtAutoGenerators::FindHeader(std::string& header,
- const std::string& testBasePath) const
+ std::string const& testBasePath) const
{
for (std::string const& ext : this->HeaderExtensions) {
std::string testFilePath(testBasePath);
@@ -2005,56 +2316,3 @@ bool cmQtAutoGenerators::FindHeader(std::string& header,
}
return false;
}
-
-std::string cmQtAutoGenerators::MocFindHeader(
- const std::string& sourcePath, const std::string& includeBase) const
-{
- std::string header;
- // Search in vicinity of the source
- if (!this->FindHeader(header, sourcePath + includeBase)) {
- // Search in include directories
- for (std::string const& path : this->MocIncludePaths) {
- std::string fullPath = path;
- fullPath.push_back('/');
- fullPath += includeBase;
- if (FindHeader(header, fullPath)) {
- break;
- }
- }
- }
- // Sanitize
- if (!header.empty()) {
- header = cmSystemTools::GetRealPath(header);
- }
- return header;
-}
-
-bool cmQtAutoGenerators::MocFindIncludedFile(
- std::string& absFile, const std::string& sourcePath,
- const std::string& includeString) const
-{
- bool success = false;
- // Search in vicinity of the source
- {
- std::string testPath = sourcePath;
- testPath += includeString;
- if (cmSystemTools::FileExists(testPath.c_str())) {
- absFile = cmSystemTools::GetRealPath(testPath);
- success = true;
- }
- }
- // Search in include directories
- if (!success) {
- for (std::string const& path : this->MocIncludePaths) {
- std::string fullPath = path;
- fullPath.push_back('/');
- fullPath += includeString;
- if (cmSystemTools::FileExists(fullPath.c_str())) {
- absFile = cmSystemTools::GetRealPath(fullPath);
- success = true;
- break;
- }
- }
- }
- return success;
-}
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 5d3ad74..a7bb538 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -10,6 +10,7 @@
#include "cmsys/RegularExpression.hxx"
#include <map>
+#include <memory> // IWYU pragma: keep
#include <set>
#include <string>
#include <vector>
@@ -21,7 +22,7 @@ class cmQtAutoGenerators
CM_DISABLE_COPY(cmQtAutoGenerators)
public:
cmQtAutoGenerators();
- bool Run(const std::string& targetDirectory, const std::string& config);
+ bool Run(std::string const& targetDirectory, std::string const& config);
private:
// -- Types
@@ -37,7 +38,7 @@ private:
{
}
- KeyRegExp(const std::string& key, const std::string& regExp)
+ KeyRegExp(std::string const& key, std::string const& regExp)
: Key(key)
, RegExp(regExp)
{
@@ -47,6 +48,38 @@ private:
cmsys::RegularExpression RegExp;
};
+ /// @brief Source file job
+ struct SourceJob
+ {
+ bool Moc = false;
+ bool Uic = false;
+ };
+
+ /// @brief MOC job
+ struct MocJobAuto
+ {
+ std::string SourceFile;
+ std::string BuildFileRel;
+ std::set<std::string> Depends;
+ };
+
+ /// @brief MOC job
+ struct MocJobIncluded : MocJobAuto
+ {
+ bool DependsValid = false;
+ std::string Includer;
+ std::string IncludeString;
+ };
+
+ /// @brief UIC job
+ struct UicJob
+ {
+ std::string SourceFile;
+ std::string BuildFileRel;
+ std::string Includer;
+ std::string IncludeString;
+ };
+
/// @brief RCC job
struct RccJob
{
@@ -56,149 +89,111 @@ private:
std::vector<std::string> Inputs;
};
- // -- Configuration
- bool MocDependFilterPush(const std::string& key, const std::string& regExp);
- bool ReadAutogenInfoFile(cmMakefile* makefile,
- const std::string& targetDirectory,
- const std::string& config);
-
- bool MocEnabled() const { return !this->MocExecutable.empty(); }
- bool UicEnabled() const { return !this->UicExecutable.empty(); }
- bool RccEnabled() const { return !this->RccExecutable.empty(); }
+ // -- Initialization
+ bool InitInfoFile(cmMakefile* makefile, std::string const& targetDirectory,
+ std::string const& config);
// -- Settings file
void SettingsFileRead(cmMakefile* makefile);
bool SettingsFileWrite();
-
- bool AnySettingsChanged() const
+ bool SettingsChanged() const
{
return (this->MocSettingsChanged || this->RccSettingsChanged ||
this->UicSettingsChanged);
}
- // -- Init and run
- void Init(cmMakefile* makefile);
- bool RunAutogen();
-
- // -- Content analysis
- bool MocRequired(const std::string& contentText,
- std::string* macroName = nullptr);
- void MocFindDepends(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::set<std::string>>& mocDepends);
-
- bool MocSkip(const std::string& absFilename) const;
- bool UicSkip(const std::string& absFilename) const;
-
- bool ParseSourceFile(
- const std::string& absFilename,
- std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends,
- std::map<std::string, std::vector<std::string>>& includedUis,
- bool relaxed);
-
- void SearchHeadersForSourceFile(const std::string& absFilename,
- std::set<std::string>& mocHeaderFiles,
- std::set<std::string>& uicHeaderFiles) const;
-
- bool ParseHeaders(
- const std::set<std::string>& mocHeaderFiles,
- const std::set<std::string>& uicHeaderFiles,
- const std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::string>& mocsNotIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends,
- std::map<std::string, std::vector<std::string>>& includedUis);
-
- void UicParseContent(
- const std::string& fileName, const std::string& contentText,
- std::map<std::string, std::vector<std::string>>& includedUis);
-
- std::string MocMacroNamesString() const;
- std::string MocHeaderSuffixesString() const;
-
- bool MocParseSourceContent(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::string>& mocsIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends, bool relaxed);
+ // -- Central processing
+ bool Process();
- void MocParseHeaderContent(
- const std::string& absFilename, const std::string& contentText,
- std::map<std::string, std::string>& mocsNotIncluded,
- std::map<std::string, std::set<std::string>>& mocDepends);
+ // -- Source parsing
+ bool ParseSourceFile(std::string const& absFilename, const SourceJob& job);
+ bool ParseHeaderFile(std::string const& absFilename, const SourceJob& job);
+ bool ParsePostprocess();
- // -- Moc file generation
- bool MocGenerateAll(
- const std::map<std::string, std::string>& mocsIncluded,
- const std::map<std::string, std::string>& mocsNotIncluded,
- const std::map<std::string, std::set<std::string>>& mocDepends);
- bool MocGenerateFile(
- const std::string& sourceFile, const std::string& mocFileName,
- const std::map<std::string, std::set<std::string>>& mocDepends,
- bool included);
+ // -- Moc
+ bool MocEnabled() const { return !this->MocExecutable.empty(); }
+ bool MocSkip(std::string const& absFilename) const;
+ bool MocRequired(std::string const& contentText,
+ std::string* macroName = nullptr);
+ // Moc strings
+ std::string MocStringMacros() const;
+ std::string MocStringHeaders(std::string const& fileBase) const;
+ std::string MocFindIncludedHeader(std::string const& sourcePath,
+ std::string const& includeBase) const;
+ bool MocFindIncludedFile(std::string& absFile, std::string const& sourceFile,
+ std::string const& includeString) const;
+ // Moc depends
+ bool MocDependFilterPush(std::string const& key, std::string const& regExp);
+ void MocFindDepends(std::string const& absFilename,
+ std::string const& contentText,
+ std::set<std::string>& depends);
+ // Moc
+ bool MocParseSourceContent(std::string const& absFilename,
+ std::string const& contentText);
+ void MocParseHeaderContent(std::string const& absFilename,
+ std::string const& contentText);
+
+ bool MocGenerateAll();
+ bool MocGenerateFile(const MocJobAuto& mocJob, bool* generated = nullptr);
- // -- Uic file generation
- bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile,
- const std::string& searchPath,
- const std::string& searchFile);
- bool UicGenerateAll(
- const std::map<std::string, std::vector<std::string>>& includedUis);
- bool UicGenerateFile(const std::string& realName,
- const std::string& uiInputFile,
- const std::string& uiOutputFile);
+ // -- Uic
+ bool UicEnabled() const { return !this->UicExecutable.empty(); }
+ bool UicSkip(std::string const& absFilename) const;
+ bool UicParseContent(std::string const& fileName,
+ std::string const& contentText);
+ bool UicFindIncludedFile(std::string& absFile, std::string const& sourceFile,
+ std::string const& includeString);
+ bool UicGenerateAll();
+ bool UicGenerateFile(const UicJob& uicJob);
- // -- Rcc file generation
+ // -- Rcc
+ bool RccEnabled() const { return !this->RccExecutable.empty(); }
bool RccGenerateAll();
bool RccGenerateFile(const RccJob& rccJob);
// -- Log info
- void LogBold(const std::string& message) const;
- void LogInfo(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const;
+ void LogBold(std::string const& message) const;
+ void LogInfo(cmQtAutoGen::Generator genType,
+ std::string const& message) const;
// -- Log warning
- void LogWarning(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const;
- void LogFileWarning(cmQtAutoGen::GeneratorType genType,
- const std::string& filename,
- const std::string& message) const;
+ void LogWarning(cmQtAutoGen::Generator genType,
+ std::string const& message) const;
+ void LogFileWarning(cmQtAutoGen::Generator genType,
+ std::string const& filename,
+ std::string const& message) const;
// -- Log error
- void LogError(cmQtAutoGen::GeneratorType genType,
- const std::string& message) const;
- void LogFileError(cmQtAutoGen::GeneratorType genType,
- const std::string& filename,
- const std::string& message) const;
- void LogCommandError(cmQtAutoGen::GeneratorType genType,
- const std::string& message,
- const std::vector<std::string>& command,
- const std::string& output) const;
- void LogNameCollisionError(
- cmQtAutoGen::GeneratorType genType, const std::string& message,
- const std::multimap<std::string, std::string>& collisions) const;
+ void LogError(cmQtAutoGen::Generator genType,
+ std::string const& message) const;
+ void LogFileError(cmQtAutoGen::Generator genType,
+ std::string const& filename,
+ std::string const& message) const;
+ void LogCommandError(cmQtAutoGen::Generator genType,
+ std::string const& message,
+ std::vector<std::string> const& command,
+ std::string const& output) const;
// -- 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 std::string& basePrefix,
- const std::string& baseSuffix) const;
- bool MakeParentDirectory(cmQtAutoGen::GeneratorType genType,
- const std::string& filename) const;
- bool FileDiffers(const std::string& filename, const std::string& content);
- bool FileWrite(cmQtAutoGen::GeneratorType genType,
- const std::string& filename, const std::string& content);
-
- bool RunCommand(const std::vector<std::string>& command,
+ bool MakeParentDirectory(cmQtAutoGen::Generator genType,
+ std::string const& filename) const;
+ bool FileDiffers(std::string const& filename, std::string const& content);
+ bool FileWrite(cmQtAutoGen::Generator genType, std::string const& filename,
+ std::string const& content);
+ bool FindHeader(std::string& header, std::string const& testBasePath) const;
+ bool RunCommand(std::vector<std::string> const& command,
std::string& output) const;
- bool FindHeader(std::string& header, const std::string& testBasePath) const;
-
- std::string MocFindHeader(const std::string& sourcePath,
- const std::string& includeBase) const;
- bool MocFindIncludedFile(std::string& absFile, const std::string& sourceFile,
- const std::string& includeString) const;
-
// -- Meta
+ std::string InfoFile;
std::string ConfigSuffix;
+ cmQtAutoGen::MultiConfig MultiConfig;
+ // -- Settings
+ bool IncludeProjectDirsBefore;
+ bool Verbose;
+ bool ColorOutput;
+ std::string SettingsFile;
+ std::string SettingsStringMoc;
+ std::string SettingsStringUic;
+ std::string SettingsStringRcc;
// -- Directories
std::string ProjectSourceDir;
std::string ProjectBinaryDir;
@@ -213,23 +208,14 @@ private:
std::string UicExecutable;
std::string RccExecutable;
// -- File lists
- std::vector<std::string> Sources;
- std::vector<std::string> Headers;
+ std::map<std::string, SourceJob> HeaderJobs;
+ std::map<std::string, SourceJob> SourceJobs;
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;
+ cmFilePathChecksum FilePathChecksum;
// -- Moc
bool MocSettingsChanged;
bool MocPredefsChanged;
bool MocRelaxedMode;
- bool MocRunFailed;
std::string MocCompFileRel;
std::string MocCompFileAbs;
std::string MocPredefsFileRel;
@@ -239,21 +225,23 @@ private:
std::vector<std::string> MocIncludes;
std::vector<std::string> MocDefinitions;
std::vector<std::string> MocOptions;
+ std::vector<std::string> MocAllOptions;
std::vector<std::string> MocPredefsCmd;
std::vector<KeyRegExp> MocDependFilters;
std::vector<KeyRegExp> MocMacroFilters;
cmsys::RegularExpression MocRegExpInclude;
+ std::vector<std::unique_ptr<MocJobIncluded>> MocJobsIncluded;
+ std::vector<std::unique_ptr<MocJobAuto>> MocJobsAuto;
// -- Uic
bool UicSettingsChanged;
- bool UicRunFailed;
std::vector<std::string> UicSkipList;
std::vector<std::string> UicTargetOptions;
std::map<std::string, std::vector<std::string>> UicOptions;
std::vector<std::string> UicSearchPaths;
cmsys::RegularExpression UicRegExpInclude;
+ std::vector<std::unique_ptr<UicJob>> UicJobs;
// -- Rcc
bool RccSettingsChanged;
- bool RccRunFailed;
std::vector<RccJob> RccJobs;
};
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 30d0f51..e923c22 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -84,7 +84,7 @@ void cmServer::ProcessRequest(cmConnection* connection,
const cmServerRequest request(this, connection, value[kTYPE_KEY].asString(),
value[kCOOKIE_KEY].asString(), value);
- if (request.Type == "") {
+ if (request.Type.empty()) {
cmServerResponse response(request);
response.SetError("No type given in request.");
this->WriteResponse(connection, response, nullptr);
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 1b47608..e835b7a 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -602,11 +602,12 @@ bool LanguageData::operator==(const LanguageData& other) const
void LanguageData::SetDefines(const std::set<std::string>& defines)
{
std::vector<std::string> result;
+ result.reserve(defines.size());
for (std::string const& i : defines) {
result.push_back(i);
}
std::sort(result.begin(), result.end());
- Defines = result;
+ Defines = std::move(result);
}
namespace std {
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 727adeb..4f337f2 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -28,21 +28,6 @@ cmSourceFileLocation::cmSourceFileLocation(const cmSourceFileLocation& loc)
this->Name = loc.Name;
}
-cmSourceFileLocation& cmSourceFileLocation::operator=(
- const cmSourceFileLocation& loc)
-{
- if (this == &loc) {
- return *this;
- }
- this->Makefile = loc.Makefile;
- this->AmbiguousDirectory = loc.AmbiguousDirectory;
- this->AmbiguousExtension = loc.AmbiguousExtension;
- this->Directory = loc.Directory;
- this->Name = loc.Name;
- this->UpdateExtension(this->Name);
- return *this;
-}
-
cmSourceFileLocation::cmSourceFileLocation(cmMakefile const* mf,
const std::string& name)
: Makefile(mf)
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index 6dbc2da..467682d 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -29,7 +29,6 @@ public:
cmSourceFileLocation(cmMakefile const* mf, const std::string& name);
cmSourceFileLocation();
cmSourceFileLocation(const cmSourceFileLocation& loc);
- cmSourceFileLocation& operator=(const cmSourceFileLocation& loc);
/**
* Return whether the given source file location could refers to the
@@ -79,7 +78,7 @@ public:
*/
cmMakefile const* GetMakefile() const { return this->Makefile; }
private:
- cmMakefile const* Makefile;
+ cmMakefile const* const Makefile;
bool AmbiguousDirectory;
bool AmbiguousExtension;
std::string Directory;
@@ -90,6 +89,8 @@ private:
// Update the location with additional knowledge.
void Update(cmSourceFileLocation const& loc);
void UpdateExtension(const std::string& name);
+
+ cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) = delete;
};
#endif
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 5aa8e5b..85e6366 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -442,6 +442,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
std::vector<std::string> child_dirs;
std::vector<cmStateSnapshot> const& children =
this->DirectoryState->Children;
+ child_dirs.reserve(children.size());
for (cmStateSnapshot const& ci : children) {
child_dirs.push_back(ci.GetDirectory().GetCurrentSource());
}
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 3b6a7ee..55af078 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -4,6 +4,7 @@
#include "cmsys/RegularExpression.hxx"
#include <ctype.h>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -15,7 +16,6 @@
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmUuid.h"
-#include "cm_auto_ptr.hxx"
class cmExecutionStatus;
@@ -108,8 +108,8 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
return false;
}
- CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
- if (hash.get()) {
+ std::unique_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ if (hash) {
std::string out = hash->HashString(args[2]);
this->Makefile->AddDefinition(args[1], out.c_str());
return true;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5f2737d..63c1452 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -700,6 +700,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
double timeout, Encoding encoding)
{
std::vector<const char*> argv;
+ argv.reserve(command.size() + 1);
for (std::string const& cmd : command) {
argv.push_back(cmd.c_str());
}
@@ -803,6 +804,8 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
}
if (captureStdErr) {
captureStdErr->append(exception_str, strlen(exception_str));
+ } else if (captureStdOut) {
+ captureStdOut->append(exception_str, strlen(exception_str));
}
result = false;
} else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Error) {
@@ -812,6 +815,8 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
}
if (captureStdErr) {
captureStdErr->append(error_str, strlen(error_str));
+ } else if (captureStdOut) {
+ captureStdOut->append(error_str, strlen(error_str));
}
result = false;
} else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Expired) {
@@ -1375,7 +1380,7 @@ std::string cmSystemTools::CollapseCombinedPath(std::string const& dir,
if (fileComponents.empty()) {
return dir;
}
- if (fileComponents[0] != "") {
+ if (!fileComponents[0].empty()) {
// File is not a relative path.
return file;
}
@@ -2061,7 +2066,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
#undef CM_EXE_PATH_LOCAL_SIZE
char* exe_path = exe_path_local;
if (_NSGetExecutablePath(exe_path, &exe_path_size) < 0) {
- exe_path = (char*)malloc(exe_path_size);
+ exe_path = static_cast<char*>(malloc(exe_path_size));
_NSGetExecutablePath(exe_path, &exe_path_size);
}
exe_dir =
@@ -2321,12 +2326,12 @@ struct cmSystemToolsRPathInfo
};
#endif
+#if defined(CMAKE_USE_ELF_PARSER)
bool cmSystemTools::ChangeRPath(std::string const& file,
std::string const& oldRPath,
std::string const& newRPath, std::string* emsg,
bool* changed)
{
-#if defined(CMAKE_USE_ELF_PARSER)
if (changed) {
*changed = false;
}
@@ -2492,15 +2497,16 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
*changed = true;
}
return true;
+}
#else
- (void)file;
- (void)oldRPath;
- (void)newRPath;
- (void)emsg;
- (void)changed;
+bool cmSystemTools::ChangeRPath(std::string const& /*file*/,
+ std::string const& /*oldRPath*/,
+ std::string const& /*newRPath*/,
+ std::string* /*emsg*/, bool* /*changed*/)
+{
return false;
-#endif
}
+#endif
bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
const char* lhss, const char* rhss)
@@ -2634,10 +2640,10 @@ int cmSystemTools::strverscmp(std::string const& lhs, std::string const& rhs)
return cm_strverscmp(lhs.c_str(), rhs.c_str());
}
+#if defined(CMAKE_USE_ELF_PARSER)
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
bool* removed)
{
-#if defined(CMAKE_USE_ELF_PARSER)
if (removed) {
*removed = false;
}
@@ -2775,13 +2781,14 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
*removed = true;
}
return true;
+}
#else
- (void)file;
- (void)emsg;
- (void)removed;
+bool cmSystemTools::RemoveRPath(std::string const& /*file*/,
+ std::string* /*emsg*/, bool* /*removed*/)
+{
return false;
-#endif
}
+#endif
bool cmSystemTools::CheckRPath(std::string const& file,
std::string const& newRPath)
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c26d49a..7a3cc76 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -5,6 +5,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <assert.h>
+#include <iterator>
#include <map>
#include <set>
#include <sstream>
@@ -243,6 +244,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("AUTOMOC", nullptr);
this->SetPropertyDefault("AUTOUIC", nullptr);
this->SetPropertyDefault("AUTORCC", nullptr);
+ this->SetPropertyDefault("AUTOMOC_COMPILER_PREDEFINES", nullptr);
this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", nullptr);
this->SetPropertyDefault("AUTOMOC_MACRO_NAMES", nullptr);
this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", nullptr);
@@ -592,8 +594,9 @@ public:
{
std::vector<std::string> files;
cmSystemTools::ExpandListArgument(entry, files);
- std::vector<cmSourceFileLocation> locations(files.size());
- std::transform(files.begin(), files.end(), locations.begin(),
+ std::vector<cmSourceFileLocation> locations;
+ locations.reserve(files.size());
+ std::transform(files.begin(), files.end(), std::back_inserter(locations),
CreateLocation(this->Needle.GetMakefile()));
return std::find_if(locations.begin(), locations.end(),
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 0e072b8..bd5d19c 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -2,11 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVariableWatch.h"
-#include "cmAlgorithms.h"
-
-#include "cm_auto_ptr.hxx"
-#include <algorithm>
+#include <memory>
#include <utility>
+#include <vector>
static const char* const cmVariableWatchAccessStrings[] = {
"READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
@@ -25,35 +23,27 @@ cmVariableWatch::cmVariableWatch()
{
}
-template <typename C>
-void deleteAllSecond(typename C::value_type it)
-{
- cmDeleteAll(it.second);
-}
-
cmVariableWatch::~cmVariableWatch()
{
- std::for_each(this->WatchMap.begin(), this->WatchMap.end(),
- deleteAllSecond<cmVariableWatch::StringToVectorOfPairs>);
}
bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
void* client_data /*=0*/,
DeleteData delete_data /*=0*/)
{
- CM_AUTO_PTR<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
+ auto p = std::make_shared<cmVariableWatch::Pair>();
p->Method = method;
p->ClientData = client_data;
p->DeleteDataCall = delete_data;
cmVariableWatch::VectorOfPairs& vp = this->WatchMap[variable];
- for (cmVariableWatch::Pair* pair : vp) {
+ for (auto& pair : vp) {
if (pair->Method == method && client_data &&
client_data == pair->ClientData) {
// Callback already exists
return false;
}
}
- vp.push_back(p.release());
+ vp.push_back(std::move(p));
return true;
}
@@ -70,7 +60,6 @@ void cmVariableWatch::RemoveWatch(const std::string& variable,
// If client_data is NULL, we want to disconnect all watches against
// the given method; otherwise match ClientData as well.
(!client_data || (client_data == (*it)->ClientData))) {
- delete *it;
vp->erase(it);
return;
}
@@ -84,9 +73,17 @@ bool cmVariableWatch::VariableAccessed(const std::string& variable,
cmVariableWatch::StringToVectorOfPairs::const_iterator mit =
this->WatchMap.find(variable);
if (mit != this->WatchMap.end()) {
- const cmVariableWatch::VectorOfPairs* vp = &mit->second;
- for (cmVariableWatch::Pair* it : *vp) {
- it->Method(variable, access_type, it->ClientData, newValue, mf);
+ // The strategy here is to copy the list of callbacks, and ignore
+ // new callbacks that existing ones may add.
+ std::vector<std::weak_ptr<Pair>> vp(mit->second.begin(),
+ mit->second.end());
+ for (auto& weak_it : vp) {
+ // In the case where a callback was removed, the weak_ptr will not be
+ // lockable, and so this ensures we don't attempt to call into freed
+ // memory
+ if (auto it = weak_it.lock()) {
+ it->Method(variable, access_type, it->ClientData, newValue, mf);
+ }
}
return true;
}
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 05a0a56..27d1b12 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
+#include <memory> // IWYU pragma: keep
#include <string>
#include <vector>
@@ -79,7 +80,7 @@ protected:
}
};
- typedef std::vector<Pair*> VectorOfPairs;
+ typedef std::vector<std::shared_ptr<Pair>> VectorOfPairs;
typedef std::map<std::string, VectorOfPairs> StringToVectorOfPairs;
StringToVectorOfPairs WatchMap;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 99b9bce..6535008 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -15,7 +15,7 @@
#include "cmVisualStudioGeneratorOptions.h"
#include "windows.h"
-#include "cm_auto_ptr.hxx"
+#include <memory> // IWYU pragma: keep
static std::string cmVS10EscapeXML(std::string arg)
{
@@ -407,7 +407,7 @@ void cmVisualStudio10TargetGenerator::Generate()
continue;
std::string globalKey = keyIt->substr(strlen(prefix));
// Skip invalid or separately-handled properties.
- if (globalKey == "" || globalKey == "PROJECT_TYPES" ||
+ if (globalKey.empty() || globalKey == "PROJECT_TYPES" ||
globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") {
continue;
}
@@ -614,7 +614,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
++i) {
if (i->first.find("VS_DOTNET_REFERENCE_") == 0) {
std::string name = i->first.substr(20);
- if (name != "") {
+ if (!name.empty()) {
std::string path = i->second.GetValue();
if (!cmsys::SystemTools::FileIsFullPath(path)) {
path = std::string(this->GeneratorTarget->Target->GetMakefile()
@@ -1592,6 +1592,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
std::string shaderEntryPoint;
std::string shaderModel;
std::string shaderAdditionalFlags;
+ std::string outputHeaderFile;
+ std::string variableName;
std::string settingsGenerator;
std::string settingsLastGenOutput;
std::string sourceLink;
@@ -1641,6 +1643,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
shaderModel = sm;
toolHasSettings = true;
}
+ // Figure out which output header file to use if any
+ if (const char* ohf = sf->GetProperty("VS_SHADER_OUTPUT_HEADER_FILE")) {
+ outputHeaderFile = ohf;
+ toolHasSettings = true;
+ }
+ // Figure out which variable name to use if any
+ if (const char* vn = sf->GetProperty("VS_SHADER_VARIABLE_NAME")) {
+ variableName = vn;
+ toolHasSettings = true;
+ }
// Figure out if there's any additional flags to use
if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS")) {
shaderAdditionalFlags = saf;
@@ -1722,7 +1734,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
if (!deployContent.empty()) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(deployContent);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis
if (!deployLocation.empty()) {
this->WriteString("<Link>", 3);
@@ -1765,6 +1778,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
(*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)
<< "</ShaderModel>\n";
}
+ if (!outputHeaderFile.empty()) {
+ for (size_t i = 0; i != this->Configurations.size(); ++i) {
+ this->WriteString("<HeaderFileOutput Condition=\""
+ "'$(Configuration)|$(Platform)'=='",
+ 3);
+ (*this->BuildFileStream) << this->Configurations[i] << "|"
+ << this->Platform << "'\">"
+ << cmVS10EscapeXML(outputHeaderFile);
+ this->WriteString("</HeaderFileOutput>\n", 0);
+ }
+ }
+ if (!variableName.empty()) {
+ for (size_t i = 0; i != this->Configurations.size(); ++i) {
+ this->WriteString("<VariableName Condition=\""
+ "'$(Configuration)|$(Platform)'=='",
+ 3);
+ (*this->BuildFileStream) << this->Configurations[i] << "|"
+ << this->Platform << "'\">"
+ << cmVS10EscapeXML(variableName);
+ this->WriteString("</VariableName>\n", 0);
+ }
+ }
if (!shaderAdditionalFlags.empty()) {
this->WriteString("<AdditionalOptions>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
@@ -2089,7 +2124,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
if (configDependentFlags) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(flags);
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(flags);
std::string evaluatedFlags =
cge->Evaluate(this->LocalGenerator, *config);
clOptions.Parse(evaluatedFlags.c_str());
@@ -2297,16 +2332,16 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions;
+ std::unique_ptr<Options> pOptions;
switch (this->ProjectType) {
case vcxproj:
- pOptions = CM_AUTO_PTR<Options>(new Options(
- this->LocalGenerator, Options::Compiler, gg->GetClFlagTable()));
+ pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::Compiler, gg->GetClFlagTable());
break;
case csproj:
- pOptions = CM_AUTO_PTR<Options>(new Options(this->LocalGenerator,
- Options::CSharpCompiler,
- gg->GetCSharpFlagTable()));
+ pOptions =
+ cm::make_unique<Options>(this->LocalGenerator, Options::CSharpCompiler,
+ gg->GetCSharpFlagTable());
break;
}
Options& clOptions = *pOptions;
@@ -2520,8 +2555,8 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::ResourceCompiler, gg->GetRcFlagTable()));
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::ResourceCompiler, gg->GetRcFlagTable());
Options& rcOptions = *pOptions;
std::string CONFIG = cmSystemTools::UpperCase(configName);
@@ -2581,8 +2616,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable()));
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable());
Options& cudaOptions = *pOptions;
// Get compile flags for CUDA in this directory.
@@ -2689,8 +2724,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable()));
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable());
Options& cudaLinkOptions = *pOptions;
// Determine if we need to do a device link
@@ -2760,8 +2795,8 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::MasmCompiler, gg->GetMasmFlagTable()));
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::MasmCompiler, gg->GetMasmFlagTable());
Options& masmOptions = *pOptions;
std::string CONFIG = cmSystemTools::UpperCase(configName);
@@ -2818,8 +2853,8 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::NasmCompiler, gg->GetNasmFlagTable()));
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::NasmCompiler, gg->GetNasmFlagTable());
Options& nasmOptions = *pOptions;
std::string CONFIG = cmSystemTools::UpperCase(configName);
@@ -2980,7 +3015,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* nativeLibDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDirectoriesExpression);
std::string nativeLibDirs =
cge->Evaluate(this->LocalGenerator, configName);
@@ -2993,7 +3028,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
this->GeneratorTarget->GetProperty(
"ANDROID_NATIVE_LIB_DEPENDENCIES")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDependenciesExpression);
std::string nativeLibDeps =
cge->Evaluate(this->LocalGenerator, configName);
@@ -3012,7 +3047,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* jarDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) {
cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(jarDirectoriesExpression);
std::string jarDirectories =
cge->Evaluate(this->LocalGenerator, configName);
@@ -3074,8 +3109,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
- CM_AUTO_PTR<Options> pOptions(new Options(
- this->LocalGenerator, Options::Linker, gg->GetLinkFlagTable(), 0, this));
+ auto pOptions =
+ cm::make_unique<Options>(this->LocalGenerator, Options::Linker,
+ gg->GetLinkFlagTable(), nullptr, this);
Options& linkOptions = *pOptions;
cmGeneratorTarget::LinkClosure const* linkClosure =
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 172ac62..a080034 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -7,9 +7,10 @@
#include "cmExpandedCommandArgument.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
+#include <memory> // IWYU pragma: keep
+
cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
: Makefile(mf)
, Depth(0)
@@ -34,7 +35,8 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endwhile for this while loop then execute
if (!this->Depth) {
// Remove the function blocker for this scope or bail.
- CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
+ std::unique_ptr<cmFunctionBlocker> fb(
+ mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) {
return false;
}
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index 719e627..a9bb2ef 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -34,9 +34,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
std::ostream& out, PBXType t)
{
bool hasOne = false;
- for (std::vector<cmXCodeObject*>::const_iterator i = v.begin(); i != v.end();
- ++i) {
- cmXCodeObject* obj = *i;
+ for (auto obj : v) {
if (obj->GetType() == OBJECT && obj->GetIsA() == t) {
hasOne = true;
break;
@@ -46,9 +44,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v,
return;
}
out << "\n/* Begin " << PBXTypeNames[t] << " section */\n";
- for (std::vector<cmXCodeObject*>::const_iterator i = v.begin(); i != v.end();
- ++i) {
- cmXCodeObject* obj = *i;
+ for (auto obj : v) {
if (obj->GetType() == OBJECT && obj->GetIsA() == t) {
obj->Print(out);
}
diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h
index bcd8d93..8e4b80f 100644
--- a/Source/cmXCode21Object.h
+++ b/Source/cmXCode21Object.h
@@ -14,7 +14,7 @@ class cmXCode21Object : public cmXCodeObject
{
public:
cmXCode21Object(PBXType ptype, Type type);
- virtual void PrintComment(std::ostream&);
+ void PrintComment(std::ostream&) override;
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out,
PBXType t);
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out);
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 957adb4..e54f1f3 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -120,8 +120,9 @@ void cmXCodeObject::Print(std::ostream& out)
out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator;
for (i = this->ObjectAttributes.begin(); i != this->ObjectAttributes.end();
++i) {
- if (i->first == "isa")
+ if (i->first == "isa") {
continue;
+ }
PrintAttribute(out, 3, separator, indentFactor, i->first, i->second, this);
}
@@ -129,9 +130,9 @@ void cmXCodeObject::Print(std::ostream& out)
out << "};\n";
}
-void cmXCodeObject::PrintAttribute(std::ostream& out, const int level,
- const std::string separator,
- const int factor, const std::string& name,
+void cmXCodeObject::PrintAttribute(std::ostream& out, int level,
+ const std::string& separator, int factor,
+ const std::string& name,
const cmXCodeObject* object,
const cmXCodeObject* parent)
{
@@ -203,9 +204,9 @@ void cmXCodeObject::PrintList(std::vector<cmXCodeObject*> const& objs,
{
cmXCodeObject::Indent(1, out);
out << "objects = {\n";
- for (unsigned int i = 0; i < objs.size(); ++i) {
- if (objs[i]->TypeValue == OBJECT) {
- objs[i]->Print(out);
+ for (auto obj : objs) {
+ if (obj->TypeValue == OBJECT) {
+ obj->Print(out);
}
}
cmXCodeObject::Indent(1, out);
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index b51aac7..b0f1d31 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -94,8 +94,8 @@ public:
}
static void Indent(int level, std::ostream& out);
void Print(std::ostream& out);
- void PrintAttribute(std::ostream& out, const int level,
- const std::string separator, const int factor,
+ void PrintAttribute(std::ostream& out, int level,
+ const std::string& separator, int factor,
const std::string& name, const cmXCodeObject* object,
const cmXCodeObject* parent);
virtual void PrintComment(std::ostream&) {}
@@ -119,9 +119,7 @@ public:
// search the attribute list for an object of the specified type
cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const
{
- for (std::vector<cmXCodeObject*>::const_iterator i = this->List.begin();
- i != this->List.end(); ++i) {
- cmXCodeObject* o = *i;
+ for (auto o : this->List) {
if (o->IsA == t) {
return o;
}
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index bca39af..f1dce64 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -91,7 +91,7 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
- std::string configuration,
+ const std::string& configuration,
const std::string& container)
{
xout.StartElement("TestAction");
@@ -104,12 +104,11 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
xout.StartElement("Testables");
- for (TestObjects::const_iterator it = this->Tests.begin();
- it != this->Tests.end(); ++it) {
+ for (auto test : this->Tests) {
xout.StartElement("TestableReference");
xout.BreakAttributes();
xout.Attribute("skipped", "NO");
- WriteBuildableReference(xout, *it, container);
+ WriteBuildableReference(xout, test, container);
xout.EndElement(); // TestableReference
}
xout.EndElement();
@@ -127,7 +126,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
- std::string configuration,
+ const std::string& configuration,
const std::string& container)
{
xout.StartElement("LaunchAction");
@@ -164,7 +163,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
- std::string configuration)
+ const std::string& configuration)
{
xout.StartElement("ProfileAction");
xout.BreakAttributes();
@@ -177,7 +176,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout,
- std::string configuration)
+ const std::string& configuration)
{
xout.StartElement("AnalyzeAction");
xout.BreakAttributes();
@@ -186,7 +185,7 @@ void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout,
}
void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout,
- std::string configuration)
+ const std::string& configuration)
{
xout.StartElement("ArchiveAction");
xout.BreakAttributes();
@@ -223,8 +222,9 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name)
//
if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) ==
this->ConfigList.end() &&
- this->ConfigList.size() > 0)
+ !this->ConfigList.empty()) {
return this->ConfigList[0];
+ }
return name;
}
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index def75b1..e5e501a 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -37,13 +37,13 @@ private:
void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
- void WriteTestAction(cmXMLWriter& xout, std::string configuration,
+ void WriteTestAction(cmXMLWriter& xout, const std::string& configuration,
const std::string& container);
- void WriteLaunchAction(cmXMLWriter& xout, std::string configuration,
+ void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration,
const std::string& container);
- void WriteProfileAction(cmXMLWriter& xout, std::string configuration);
- void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration);
- void WriteArchiveAction(cmXMLWriter& xout, std::string configuration);
+ void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration);
+ void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration);
+ void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration);
void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj,
const std::string& container);
diff --git a/Source/cm_auto_ptr.hxx b/Source/cm_auto_ptr.hxx
deleted file mode 100644
index 1ac9220..0000000
--- a/Source/cm_auto_ptr.hxx
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef CM_AUTO_PTR_HXX
-#define CM_AUTO_PTR_HXX
-
-#include "cmConfigure.h"
-
-#ifdef CMake_HAVE_CXX_AUTO_PTR
-
-#include <memory>
-#define CM_AUTO_PTR std::auto_ptr
-
-#else
-
-#define CM_AUTO_PTR cm::auto_ptr
-
-// The HP compiler cannot handle the conversions necessary to use
-// auto_ptr_ref to pass an auto_ptr returned from one function
-// directly to another function as in use_auto_ptr(get_auto_ptr()).
-// We instead use const_cast to achieve the syntax on those platforms.
-// We do not use const_cast on other platforms to maintain the C++
-// standard design and guarantee that if an auto_ptr is bound
-// to a reference-to-const then ownership will be maintained.
-#if defined(__HP_aCC)
-#define cm_AUTO_PTR_REF 0
-#define cm_AUTO_PTR_CONST const
-#define cm_AUTO_PTR_CAST(a) cast(a)
-#else
-#define cm_AUTO_PTR_REF 1
-#define cm_AUTO_PTR_CONST
-#define cm_AUTO_PTR_CAST(a) a
-#endif
-
-// In C++11, clang will warn about using dynamic exception specifications
-// as they are deprecated. But as this class is trying to faithfully
-// mimic std::auto_ptr, we want to keep the 'throw()' decorations below.
-// So we suppress the warning.
-#if defined(__clang__) && defined(__has_warning)
-#if __has_warning("-Wdeprecated")
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated"
-#endif
-#endif
-
-namespace cm {
-
-template <class X>
-class auto_ptr;
-
-#if cm_AUTO_PTR_REF
-namespace detail {
-// The auto_ptr_ref template is supposed to be a private member of
-// auto_ptr but Borland 5.8 cannot handle it. Instead put it in
-// a private namespace.
-template <class Y>
-struct auto_ptr_ref
-{
- Y* p_;
-
- // The extra constructor argument prevents implicit conversion to
- // auto_ptr_ref from auto_ptr through the constructor. Normally
- // this should be done with the explicit keyword but Borland 5.x
- // generates code in the conversion operator to call itself
- // infinately.
- auto_ptr_ref(Y* p, int)
- : p_(p)
- {
- }
-};
-}
-#endif
-
-/** C++98 Standard Section 20.4.5 - Template class auto_ptr. */
-template <class X>
-class auto_ptr
-{
-#if !cm_AUTO_PTR_REF
- template <typename Y>
- static inline auto_ptr<Y>& cast(auto_ptr<Y> const& a)
- {
- return const_cast<auto_ptr<Y>&>(a);
- }
-#endif
-
- /** The pointer to the object held. */
- X* x_;
-
-public:
- /** The type of object held by the auto_ptr. */
- typedef X element_type;
-
- /** Construct from an auto_ptr holding a compatible object. This
- transfers ownership to the newly constructed auto_ptr. */
- template <class Y>
- auto_ptr(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
- : x_(cm_AUTO_PTR_CAST(a).release())
- {
- }
-
- /** 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() // NOLINT
- {
- this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this; // NOLINT
- }
-
- /**
- * Explicitly construct from a raw pointer. This is typically
- * called with the result of operator new. For example:
- *
- * auto_ptr<X> ptr(new X());
- */
- explicit auto_ptr(X* p = nullptr) throw()
- : x_(p)
- {
- }
-
- /** Construct from another auto_ptr holding an object of the same
- type. This transfers ownership to the newly constructed
- auto_ptr. */
- auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw()
- : x_(cm_AUTO_PTR_CAST(a).release())
- {
- }
-
- /** 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() // NOLINT
- {
- this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this; // NOLINT
- }
-
- /** Destruct and delete the object held. */
- ~auto_ptr() throw()
- {
- // Assume object destructor is nothrow.
- delete this->x_;
- }
-
- /** Dereference and return a reference to the object held. */
- X& operator*() const throw() { return *this->x_; }
-
- /** Return a pointer to the object held. */
- X* operator->() const throw() { return this->x_; }
-
- /** Return a pointer to the object held. */
- X* get() const throw() { return this->x_; }
-
- /** Return a pointer to the object held and reset to hold no object.
- This transfers ownership to the caller. */
- X* release() throw()
- {
- X* x = this->x_;
- this->x_ = nullptr;
- return x;
- }
-
- /** Assume ownership of the given object. The object previously
- held is deleted. */
- void reset(X* p = 0) throw()
- {
- if (this->x_ != p) {
- // Assume object destructor is nothrow.
- delete this->x_;
- this->x_ = p;
- }
- }
-
- /** Convert to an auto_ptr holding an object of a compatible type.
- This transfers ownership to the returned auto_ptr. */
- template <class Y>
- operator auto_ptr<Y>() throw()
- {
- return auto_ptr<Y>(this->release());
- }
-
-#if cm_AUTO_PTR_REF
- /** Construct from an auto_ptr_ref. This is used when the
- constructor argument is a call to a function returning an
- auto_ptr. */
- auto_ptr(detail::auto_ptr_ref<X> r) throw()
- : x_(r.p_)
- {
- }
-
- /** Assign from an auto_ptr_ref. This is used when a function
- returning an auto_ptr is passed on the right-hand-side of an
- assignment. */
- auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
- {
- this->reset(r.p_);
- return *this; // NOLINT
- }
-
- /** Convert to an auto_ptr_ref. This is used when a function
- returning an auto_ptr is the argument to the constructor of
- another auto_ptr. */
- template <class Y>
- operator detail::auto_ptr_ref<Y>() throw()
- {
- return detail::auto_ptr_ref<Y>(this->release(), 1);
- }
-#endif
-};
-
-} // namespace cm
-
-// Undo warning suppression.
-#if defined(__clang__) && defined(__has_warning)
-#if __has_warning("-Wdeprecated")
-#pragma clang diagnostic pop
-#endif
-#endif
-
-#endif
-
-#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e61acb1..fd7151f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -24,7 +24,6 @@
#include "cmUtils.hxx"
#include "cmVersionConfig.h"
#include "cmWorkingDirectory.h"
-#include "cm_auto_ptr.hxx"
#include "cm_sys_stat.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -111,6 +110,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <iostream>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -482,15 +482,15 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
snapshot.GetDirectory().SetCurrentSource(
cmSystemTools::GetCurrentWorkingDirectory());
snapshot.SetDefaultDefinitions();
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ cmMakefile mf(gg, snapshot);
if (this->GetWorkingMode() != NORMAL_MODE) {
std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file);
- mf->SetScriptModeFile(file.c_str());
+ mf.SetScriptModeFile(file.c_str());
- mf->SetArgcArgv(args);
+ mf.SetArgcArgv(args);
}
- if (!mf->ReadListFile(path)) {
+ if (!mf.ReadListFile(path)) {
cmSystemTools::Error("Error processing file: ", path);
}
this->SetHomeDirectory(homeDir);
@@ -1328,9 +1328,8 @@ int cmake::ActualConfigure()
if (const char* platformName =
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
- if (this->GeneratorPlatform.empty()) {
- this->GeneratorPlatform = platformName;
- } else if (this->GeneratorPlatform != platformName) {
+ if (!this->GeneratorPlatform.empty() &&
+ this->GeneratorPlatform != platformName) {
std::string message = "Error: generator platform: ";
message += this->GeneratorPlatform;
message += "\nDoes not match the platform used previously: ";
@@ -1348,9 +1347,7 @@ int cmake::ActualConfigure()
if (const char* tsName =
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
- if (this->GeneratorToolset.empty()) {
- this->GeneratorToolset = tsName;
- } else if (this->GeneratorToolset != tsName) {
+ if (!this->GeneratorToolset.empty() && this->GeneratorToolset != tsName) {
std::string message = "Error: generator toolset: ";
message += this->GeneratorToolset;
message += "\nDoes not match the toolset used previously: ";
@@ -1874,8 +1871,8 @@ int cmake::CheckBuildSystem()
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
+ if (!mf.ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag()) {
if (verbose) {
std::ostringstream msg;
@@ -1889,25 +1886,25 @@ int cmake::CheckBuildSystem()
if (this->ClearBuildSystem) {
// Get the generator used for this build system.
- const char* genName = mf->GetDefinition("CMAKE_DEPENDS_GENERATOR");
+ const char* genName = mf.GetDefinition("CMAKE_DEPENDS_GENERATOR");
if (!genName || genName[0] == '\0') {
genName = "Unix Makefiles";
}
// Create the generator and use it to clear the dependencies.
- CM_AUTO_PTR<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName));
- if (ggd.get()) {
+ std::unique_ptr<cmGlobalGenerator> ggd(
+ this->CreateGlobalGenerator(genName));
+ if (ggd) {
cm.GetCurrentSnapshot().SetDefaultDefinitions();
- CM_AUTO_PTR<cmMakefile> mfd(
- new cmMakefile(ggd.get(), cm.GetCurrentSnapshot()));
- CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mfd.get()));
- lgd->ClearDependencies(mfd.get(), verbose);
+ cmMakefile mfd(ggd.get(), cm.GetCurrentSnapshot());
+ std::unique_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(&mfd));
+ lgd->ClearDependencies(&mfd, verbose);
}
}
// If any byproduct of makefile generation is missing we must re-run.
std::vector<std::string> products;
- if (const char* productStr = mf->GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) {
+ if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) {
cmSystemTools::ExpandListArgument(productStr, products);
}
for (std::string const& p : products) {
@@ -1925,8 +1922,8 @@ int cmake::CheckBuildSystem()
// Get the set of dependencies and outputs.
std::vector<std::string> depends;
std::vector<std::string> outputs;
- const char* dependsStr = mf->GetDefinition("CMAKE_MAKEFILE_DEPENDS");
- const char* outputsStr = mf->GetDefinition("CMAKE_MAKEFILE_OUTPUTS");
+ const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS");
+ const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS");
if (dependsStr && outputsStr) {
cmSystemTools::ExpandListArgument(dependsStr, depends);
cmSystemTools::ExpandListArgument(outputsStr, outputs);
@@ -2039,19 +2036,18 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const char* fileName) const
{
#ifdef CMAKE_BUILD_WITH_CMAKE
- CM_AUTO_PTR<cmGraphVizWriter> gvWriter(
- new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
+ cmGraphVizWriter gvWriter(this->GetGlobalGenerator()->GetLocalGenerators());
std::string settingsFile = this->GetHomeOutputDirectory();
settingsFile += "/CMakeGraphVizOptions.cmake";
std::string fallbackSettingsFile = this->GetHomeDirectory();
fallbackSettingsFile += "/CMakeGraphVizOptions.cmake";
- gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str());
+ gvWriter.ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str());
- gvWriter->WritePerTargetFiles(fileName);
- gvWriter->WriteTargetDependersFiles(fileName);
- gvWriter->WriteGlobalFile(fileName);
+ gvWriter.WritePerTargetFiles(fileName);
+ gvWriter.WriteTargetDependersFiles(fileName);
+ gvWriter.WriteGlobalFile(fileName);
#endif
}
@@ -2357,7 +2353,7 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
- CM_AUTO_PTR<cmGlobalGenerator> gen(
+ std::unique_ptr<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(cachedGenerator));
if (!gen.get()) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator
diff --git a/Source/cmake.h b/Source/cmake.h
index a2054ef..b31b6f5 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -209,24 +209,12 @@ public:
this->GeneratorPlatform = ts;
}
- ///! Get the name of the selected generator-specific platform.
- std::string const& GetGeneratorPlatform() const
- {
- return this->GeneratorPlatform;
- }
-
///! Set the name of the selected generator-specific toolset.
void SetGeneratorToolset(std::string const& ts)
{
this->GeneratorToolset = ts;
}
- ///! Get the name of the selected generator-specific toolset.
- std::string const& GetGeneratorToolset() const
- {
- return this->GeneratorToolset;
- }
-
const std::vector<std::string>& GetSourceExtensions() const
{
return this->SourceFileExtensions;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index e152cdb..c0c7d03 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -12,7 +12,6 @@
#include "cmSystemTools.h"
#include "cmUtils.hxx"
#include "cmVersion.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -37,6 +36,7 @@
#include <functional>
#include <iostream>
#include <map>
+#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -348,6 +348,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args)
std::bind(&cmcmd::HandleCppCheck, a1, a2, a3);
// copy the command options to a vector of strings
std::vector<std::string> commandOptions;
+ commandOptions.reserve(coCompileTypes.size());
for (const auto& i : coCompileTypes) {
commandOptions.push_back(i.first);
}
@@ -928,8 +929,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmStateSnapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir);
- CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot));
- CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mf.get()));
+ cmMakefile mf(ggd, snapshot);
+ std::unique_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(&mf));
// Actually scan dependencies.
return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0
@@ -1537,8 +1538,34 @@ int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
return vsLink.Link();
}
+enum NumberFormat
+{
+ FORMAT_DECIMAL,
+ FORMAT_HEX
+};
+struct NumberFormatter
+{
+ NumberFormat Format;
+ int Value;
+ NumberFormatter(NumberFormat format, int value)
+ : Format(format)
+ , Value(value)
+ {
+ }
+};
+std::ostream& operator<<(std::ostream& stream,
+ NumberFormatter const& formatter)
+{
+ if (formatter.Format == FORMAT_DECIMAL) {
+ stream << formatter.Value;
+ } else {
+ stream << "0x" << std::hex << formatter.Value;
+ }
+ return stream;
+}
static bool RunCommand(const char* comment, std::vector<std::string>& command,
- bool verbose, int* retCodeOut = nullptr)
+ bool verbose, NumberFormat exitFormat,
+ int* retCodeOut = nullptr)
{
if (verbose) {
std::cout << comment << ":\n";
@@ -1546,31 +1573,33 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
}
std::string output;
int retCode = 0;
- // use rc command to create .res file
- bool res = cmSystemTools::RunSingleCommand(
+ bool commandResult = cmSystemTools::RunSingleCommand(
command, &output, &output, &retCode, nullptr, cmSystemTools::OUTPUT_NONE);
- // always print the output of the command, unless
- // it is the dumb rc command banner, but if the command
- // returned an error code then print the output anyway as
- // the banner may be mixed with some other important information.
- if (output.find("Resource Compiler Version") == std::string::npos || !res ||
- retCode) {
- std::cout << output;
- }
- if (!res) {
- std::cout << comment << " failed to run." << std::endl;
- return false;
- }
- // if retCodeOut is requested then always return true
- // and set the retCodeOut to retCode
+ bool returnValue;
if (retCodeOut) {
- *retCodeOut = retCode;
- return true;
- }
- if (retCode != 0) {
- std::cout << comment << " failed. with " << retCode << "\n";
- }
- return retCode == 0;
+ if (!commandResult) {
+ *retCodeOut = (retCode == 0) ? -1 : retCode;
+ } else {
+ *retCodeOut = retCode;
+ }
+ returnValue = true; // always return true if retCodeOut is requested
+ } else {
+ returnValue = commandResult && (retCode == 0);
+ }
+ if (!commandResult || retCode) {
+ std::cout << comment << ": command \"" << cmJoin(command, " ")
+ << "\" failed (exit code "
+ << NumberFormatter(exitFormat, retCode)
+ << ") with the following output:\n"
+ << output;
+ } else {
+ // always print the output of the command, unless
+ // it is the dumb rc command banner
+ if (output.find("Resource Compiler Version") == std::string::npos) {
+ std::cout << output;
+ }
+ }
+ return returnValue;
}
bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
@@ -1720,10 +1749,10 @@ int cmVSLink::LinkIncremental()
// Compile the resource file.
std::vector<std::string> rcCommand;
- rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
+ rcCommand.push_back("rc");
rcCommand.push_back("/fo" + this->ManifestFileRes);
rcCommand.push_back(this->ManifestFileRC);
- if (!RunCommand("RC Pass 1", rcCommand, this->Verbose)) {
+ if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) {
return -1;
}
@@ -1731,7 +1760,8 @@ int cmVSLink::LinkIncremental()
this->LinkCommand.push_back(this->ManifestFileRes);
// Run the link command (possibly generates intermediate manifest).
- if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose)) {
+ if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose,
+ FORMAT_DECIMAL)) {
return -1;
}
@@ -1745,12 +1775,13 @@ int cmVSLink::LinkIncremental()
}
// Compile the resource file again.
- if (!RunCommand("RC Pass 2", rcCommand, this->Verbose)) {
+ if (!RunCommand("RC Pass 2", rcCommand, this->Verbose, FORMAT_DECIMAL)) {
return -1;
}
// Link incrementally again to use the updated resource.
- if (!RunCommand("FINAL LINK", this->LinkCommand, this->Verbose)) {
+ if (!RunCommand("FINAL LINK", this->LinkCommand, this->Verbose,
+ FORMAT_DECIMAL)) {
return -1;
}
return 0;
@@ -1759,7 +1790,7 @@ int cmVSLink::LinkIncremental()
int cmVSLink::LinkNonIncremental()
{
// Run the link command (possibly generates intermediate manifest).
- if (!RunCommand("LINK", this->LinkCommand, this->Verbose)) {
+ if (!RunCommand("LINK", this->LinkCommand, this->Verbose, FORMAT_DECIMAL)) {
return -1;
}
@@ -1777,7 +1808,7 @@ int cmVSLink::LinkNonIncremental()
int cmVSLink::RunMT(std::string const& out, bool notify)
{
std::vector<std::string> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
+ mtCommand.push_back("mt");
mtCommand.push_back("/nologo");
mtCommand.push_back("/manifest");
if (this->LinkGeneratesManifest) {
@@ -1792,7 +1823,7 @@ int cmVSLink::RunMT(std::string const& out, bool notify)
mtCommand.push_back("/notify_update");
}
int mtRet = 0;
- if (!RunCommand("MT", mtCommand, this->Verbose, &mtRet)) {
+ if (!RunCommand("MT", mtCommand, this->Verbose, FORMAT_HEX, &mtRet)) {
return -1;
}
return mtRet;
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index fe24a72..f6466fa 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -186,6 +186,7 @@ int main(int argc, char const* const* argv)
// copy the args to a vector
std::vector<std::string> args;
+ args.reserve(argc);
for (int i = 0; i < argc; ++i) {
args.push_back(argv[i]);
}
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 5b8ce00..21568bb 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -1028,7 +1028,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
)
ENDIF()
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
- testIOS
testSystemTools
testCommandLineArguments
testCommandLineArguments1
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 0a22d63..ecfa331 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2371,104 +2371,6 @@ long int SystemTools::CreationTime(const std::string& filename)
return ct;
}
-bool SystemTools::ConvertDateMacroString(const char* str, time_t* tmt)
-{
- if (!str || !tmt || strlen(str) > 11) {
- return false;
- }
-
- struct tm tmt2;
-
- // __DATE__
- // The compilation date of the current source file. The date is a string
- // literal of the form Mmm dd yyyy. The month name Mmm is the same as for
- // dates generated by the library function asctime declared in TIME.H.
-
- // index: 012345678901
- // format: Mmm dd yyyy
- // example: Dec 19 2003
-
- static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
-
- char buffer[12];
- strcpy(buffer, str);
-
- buffer[3] = 0;
- char* ptr = strstr(month_names, buffer);
- if (!ptr) {
- return false;
- }
-
- int month = static_cast<int>((ptr - month_names) / 3);
- int day = atoi(buffer + 4);
- int year = atoi(buffer + 7);
-
- tmt2.tm_isdst = -1;
- tmt2.tm_hour = 0;
- tmt2.tm_min = 0;
- tmt2.tm_sec = 0;
- tmt2.tm_wday = 0;
- tmt2.tm_yday = 0;
- tmt2.tm_mday = day;
- tmt2.tm_mon = month;
- tmt2.tm_year = year - 1900;
-
- *tmt = mktime(&tmt2);
- return true;
-}
-
-bool SystemTools::ConvertTimeStampMacroString(const char* str, time_t* tmt)
-{
- if (!str || !tmt || strlen(str) > 26) {
- return false;
- }
-
- struct tm tmt2;
-
- // __TIMESTAMP__
- // The date and time of the last modification of the current source file,
- // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy,
- /// where Ddd is the abbreviated day of the week and Date is an integer
- // from 1 to 31.
-
- // index: 0123456789
- // 0123456789
- // 0123456789
- // format: Ddd Mmm Date hh:mm:ss yyyy
- // example: Fri Dec 19 14:34:58 2003
-
- static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
-
- char buffer[27];
- strcpy(buffer, str);
-
- buffer[7] = 0;
- char* ptr = strstr(month_names, buffer + 4);
- if (!ptr) {
- return false;
- }
-
- int month = static_cast<int>((ptr - month_names) / 3);
- int day = atoi(buffer + 8);
- int hour = atoi(buffer + 11);
- int min = atoi(buffer + 14);
- int sec = atoi(buffer + 17);
- int year = atoi(buffer + 20);
-
- tmt2.tm_isdst = -1;
- tmt2.tm_hour = hour;
- tmt2.tm_min = min;
- tmt2.tm_sec = sec;
- tmt2.tm_wday = 0;
- tmt2.tm_yday = 0;
- tmt2.tm_mday = day;
- tmt2.tm_mon = month;
- tmt2.tm_year = year - 1900;
-
- *tmt = mktime(&tmt2);
- return true;
-}
-
std::string SystemTools::GetLastSystemError()
{
int e = errno;
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 41a60d3..35bc1b1 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -206,13 +206,6 @@ public:
static int Strucmp(const char* s1, const char* s2);
/**
- * Convert a string in __DATE__ or __TIMESTAMP__ format into a time_t.
- * Return false on error, true on success
- */
- static bool ConvertDateMacroString(const char* str, time_t* tmt);
- static bool ConvertTimeStampMacroString(const char* str, time_t* tmt);
-
- /**
* Split a string on its newlines into multiple lines
* Return false only if the last line stored had no newline
*/
diff --git a/Source/kwsys/testIOS.cxx b/Source/kwsys/testIOS.cxx
deleted file mode 100644
index 3e4c325..0000000
--- a/Source/kwsys/testIOS.cxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Configure.hxx)
-
-#include <fstream>
-#include <iostream>
-#include <sstream>
-#include <string.h> /* strlen */
-#include <vector>
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-#include "Configure.hxx.in"
-#endif
-
-int testIOS(int, char* [])
-{
- std::ostringstream ostr;
- const char hello[] = "hello";
- ostr << hello;
- if (ostr.str() != hello) {
- std::cerr << "failed to write hello to ostr" << std::endl;
- return 1;
- }
- const char world[] = "world";
- std::ostringstream ostr2;
- ostr2.write(hello, strlen(hello)); /* I could do sizeof */
- ostr2.put('\0');
- ostr2.write(world, strlen(world));
- if (ostr2.str().size() != strlen(hello) + 1 + strlen(world)) {
- std::cerr << "failed to write hello to ostr2" << std::endl;
- return 1;
- }
- static const unsigned char array[] = {
- 0xff, 0x4f, 0xff, 0x51, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
- 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x01, 0xff, 0x52, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x04, 0x04, 0x00, 0x01, 0xff,
- 0x5c, 0x00, 0x13, 0x40, 0x40, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0x48,
- 0x48, 0x50, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0xff, 0x64, 0x00, 0x2c,
- 0x00, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79,
- 0x20, 0x49, 0x54, 0x4b, 0x2f, 0x47, 0x44, 0x43, 0x4d, 0x2f, 0x4f, 0x70,
- 0x65, 0x6e, 0x4a, 0x50, 0x45, 0x47, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
- 0x6f, 0x6e, 0x20, 0x31, 0x2e, 0x30, 0xff, 0x90, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x00, 0x06, 0x2c, 0x00, 0x01, 0xff, 0x93, 0xcf, 0xb0, 0x18, 0x08,
- 0x7f, 0xc6, 0x99, 0xbf, 0xff, 0xc0, 0xf8, 0xc1, 0xc1, 0xf3, 0x05, 0x81,
- 0xf2, 0x83, 0x0a, 0xa5, 0xff, 0x10, 0x90, 0xbf, 0x2f, 0xff, 0x04, 0xa8,
- 0x7f, 0xc0, 0xf8, 0xc4, 0xc1, 0xf3, 0x09, 0x81, 0xf3, 0x0c, 0x19, 0x34
- };
- const size_t narray = sizeof(array); // 180
- std::stringstream strstr;
- strstr.write((char*)array, narray);
- // strstr.seekp( narray / 2 ); // set position of put pointer in mid string
- if (strstr.str().size() != narray) {
- std::cerr << "failed to write array to strstr" << std::endl;
- return 1;
- }
-
- std::istringstream istr(" 10 20 str ");
- std::string s;
- int x;
- if (istr >> x) {
- if (x != 10) {
- std::cerr << "x != 10" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read 10 from istr" << std::endl;
- return 1;
- }
- if (istr >> x) {
- if (x != 20) {
- std::cerr << "x != 20" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read 20 from istr" << std::endl;
- return 1;
- }
- if (istr >> s) {
- if (s != "str") {
- std::cerr << "s != \"str\"" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read str from istr" << std::endl;
- return 1;
- }
- if (istr >> s) {
- std::cerr << "Able to read past end of stream" << std::endl;
- return 1;
- } else {
- // Clear the failure.
- istr.clear(istr.rdstate() & ~std::ios::eofbit);
- istr.clear(istr.rdstate() & ~std::ios::failbit);
- }
- istr.str("30");
- if (istr >> x) {
- if (x != 30) {
- std::cerr << "x != 30" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read 30 from istr" << std::endl;
- return 1;
- }
-
- std::stringstream sstr;
- sstr << "40 str2";
- if (sstr >> x) {
- if (x != 40) {
- std::cerr << "x != 40" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read 40 from sstr" << std::endl;
- return 1;
- }
- if (sstr >> s) {
- if (s != "str2") {
- std::cerr << "s != \"str2\"" << std::endl;
- return 1;
- }
- } else {
- std::cerr << "Failed to read str2 from sstr" << std::endl;
- return 1;
- }
-
- // Just try to compile this.
- if (x == 12345) {
- std::ifstream fin("/does_not_exist", std::ios::in | std::ios::binary);
- }
-
- std::cout << "IOS tests passed" << std::endl;
- return 0;
-}
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 1871f5d..768eb4d 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -22,6 +22,7 @@
#include <iostream>
#include <sstream>
+#include <stdlib.h> /* free */
#include <string.h> /* strcmp */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <io.h> /* _umask (MSVC) / umask (Borland) */
@@ -535,15 +536,14 @@ static bool CheckStringOperations()
}
delete[] cres;
- char* cres2 = new char[strlen("Mary Had A Little Lamb.") + 1];
- strcpy(cres2, "Mary Had A Little Lamb.");
+ char* cres2 = strdup("Mary Had A Little Lamb.");
kwsys::SystemTools::ReplaceChars(cres2, "aeiou", 'X');
if (strcmp(cres2, "MXry HXd A LXttlX LXmb.")) {
std::cerr << "Problem with ReplaceChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
}
- delete[] cres2;
+ free(cres2);
if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
"Mary ")) {
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
index 70d6edf..73fd0ab 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
index 415d536..81dbbc5 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
set(config_verbose -V)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
index 337cc16..ad52f56 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
index 35ca74c..af27c51 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
@@ -7,7 +7,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
index f1391cd..1fe9258 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
@@ -5,7 +5,7 @@ endif()
include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# TODO: currently debian doens't produce lower cased names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
index fcfc7ea..e57488c 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
@@ -9,7 +9,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# requirements
# debian now produces lower case names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
index 351bf21..5ee057a 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
set(config_verbose -V)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
index c97ecb0..13a626a 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
@@ -5,7 +5,7 @@ endif()
include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# TODO: currently debian doens't produce lower cased names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2_*.deb")
set(expected_count 1)
set(actual_output)
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index a5b38fd..2c3a849 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -60,7 +60,7 @@ elseif (CPackGen MATCHES "RPM")
set(expected_count 1)
endif ()
elseif (CPackGen MATCHES "DEB")
- set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2-1_*.deb")
+ set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2_*.deb")
if (${CPackComponentWay} STREQUAL "default")
set(expected_count 1)
elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 0bc4e5c..9b82366 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -4,7 +4,11 @@ project (CudaOnlyWithDefs CUDA)
#verify that we can pass explicit cuda arch flags
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
-set(debug_compile_flags --generate-code arch=compute_20,code=sm_20)
+if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
+ set(debug_compile_flags --generate-code arch=compute_32,code=sm_32)
+else()
+ set(debug_compile_flags --generate-code arch=compute_20,code=sm_20)
+endif()
if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC")
list(APPEND debug_compile_flags -Xcompiler=-WX)
else()
diff --git a/Tests/FindOpenGL/CMakeLists.txt b/Tests/FindOpenGL/CMakeLists.txt
index 9aa3aba..97c9e60 100644
--- a/Tests/FindOpenGL/CMakeLists.txt
+++ b/Tests/FindOpenGL/CMakeLists.txt
@@ -1,3 +1,9 @@
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMake_TEST_FindOpenGL_VND)
+ set(_vnd_testing TRUE)
+else()
+ set(_vnd_testing FALSE)
+endif()
+
add_test(NAME FindOpenGL.Test COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -6,5 +12,6 @@ add_test(NAME FindOpenGL.Test COMMAND
${build_generator_args}
--build-project TestFindOpenGL
--build-options ${build_options}
+ -DOpenGL_TEST_VND=${_vnd_testing}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt
index cac3424..3b5ffee 100644
--- a/Tests/FindOpenGL/Test/CMakeLists.txt
+++ b/Tests/FindOpenGL/Test/CMakeLists.txt
@@ -1,14 +1,70 @@
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.9)
project(TestFindOpenGL C)
include(CTest)
find_package(OpenGL REQUIRED)
+# import target for GLU
add_executable(test_tgt main.c)
target_link_libraries(test_tgt OpenGL::GLU)
add_test(NAME test_tgt COMMAND test_tgt)
+# OPENGL_LIBRARIES should be whatever libraries are needed to link.
add_executable(test_var main.c)
target_include_directories(test_var PRIVATE ${OPENGL_INGLUDE_DIRS})
target_link_libraries(test_var PRIVATE ${OPENGL_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
+
+# VND support adds an ::OpenGL import target. This can be used for OpenGL-only
+# code (code that does not manipulate contexts, like our 'main.c'). Without
+# VND, ::GL can be used for both context and non-context OpenGL code.
+if(OpenGL_TEST_VND)
+ add_executable(test_comp_none main.c)
+ target_link_libraries(test_comp_none PRIVATE OpenGL::OpenGL)
+ add_test(NAME test_comp_none COMMAND test_comp_none)
+else()
+ add_executable(test_comp_none main.c)
+ target_link_libraries(test_comp_none PRIVATE OpenGL::GL)
+ add_test(NAME test_comp_none COMMAND test_comp_none)
+endif()
+
+# GLX
+if(OpenGL_TEST_VND)
+ find_package(OpenGL REQUIRED COMPONENTS OpenGL GLX)
+ add_executable(test_comp_glx main.c)
+ target_link_libraries(test_comp_glx PRIVATE OpenGL::OpenGL OpenGL::GLX)
+ add_test(NAME test_comp_glx COMMAND test_comp_glx)
+else()
+ # non-VND systems won't have it, but an optional search for GLX should still
+ # be okay.
+ find_package(OpenGL COMPONENTS GLX)
+ add_executable(test_comp_glx_novnd main.c)
+ target_link_libraries(test_comp_glx_novnd PRIVATE OpenGL::GL)
+ add_test(NAME test_comp_glx_novnd COMMAND test_comp_glx_novnd)
+endif()
+
+# EGL is only available on Linux+GLVND at present.
+if(OpenGL_TEST_VND)
+ find_package(OpenGL COMPONENTS OpenGL EGL)
+ if(OpenGL_EGL_FOUND)
+ add_executable(test_comp_egl main.c)
+ target_link_libraries(test_comp_egl PRIVATE OpenGL::OpenGL OpenGL::EGL)
+ add_test(NAME test_comp_egl COMMAND test_comp_egl)
+ # EGL-only code should not link to GLX.
+ execute_process(COMMAND ldd test_comp_egl
+ OUTPUT_VARIABLE LDD_OUT
+ ERROR_VARIABLE LDD_ERR)
+ if("${LDD_OUT}" MATCHES "GLX")
+ message(FATAL_ERROR "EGL-only code links to GLX!")
+ endif()
+ endif()
+
+ # all three COMPONENTS together.
+ find_package(OpenGL COMPONENTS OpenGL EGL GLX)
+ if(OpenGL_EGL_FOUND AND OpenGL_GLX_FOUND)
+ add_executable(test_comp_both main.c)
+ target_link_libraries(test_comp_both PRIVATE OpenGL::OpenGL OpenGL::EGL
+ OpenGL::GLX)
+ add_test(NAME test_comp_both COMMAND test_comp_both)
+ endif()
+endif()
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 81ab734..ec35b89 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -66,15 +66,6 @@ set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
target_link_libraries(mocOnly ${QT_LIBRARIES})
# -- Test
-# MOC AUTOMOC_MACRO_NAMES
-if (NOT QT_TEST_VERSION STREQUAL 4)
- add_executable(mocMacroName mocMacroName/main.cpp mocMacroName/MacroName.cpp)
- set_property(TARGET mocMacroName PROPERTY AUTOMOC ON)
- set_property(TARGET mocMacroName PROPERTY AUTOMOC_MACRO_NAMES "QO_ALIAS")
- target_link_libraries(mocMacroName ${QT_LIBRARIES})
-endif()
-
-# -- Test
# UIC only
if(ALLOW_WRAP_CPP)
qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
@@ -188,8 +179,10 @@ set_property(TARGET skipRccB PROPERTY AUTOMOC ON)
target_link_libraries(skipRccB ${QT_LIBRARIES})
# -- Test
-# Source files with the same basename in different subdirectories
-add_subdirectory(sameName)
+# MOC AUTOMOC_MACRO_NAMES
+if (NOT QT_TEST_VERSION STREQUAL 4)
+ add_subdirectory(mocMacroName)
+endif()
# -- Test
# Tests AUTOMOC with generated sources
@@ -217,5 +210,9 @@ add_subdirectory(uicInclude)
add_subdirectory(objectLibrary)
# -- Test
+# Source files with the same basename in different subdirectories
+add_subdirectory(sameName)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/mocMacroName/CMakeLists.txt b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
new file mode 100644
index 0000000..08e6803
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.9)
+
+list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
+
+add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp)
+set_property(TARGET mmn PROPERTY AUTOMOC ON)
+set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
+target_link_libraries(mmn ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
new file mode 100644
index 0000000..93e5bfd
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
@@ -0,0 +1,8 @@
+#ifndef CUSTOM_MACROS_HPP
+#define CUSTOM_MACROS_HPP
+
+#include <QObject>
+#define QO1_ALIAS Q_OBJECT
+#define QO2_ALIAS Q_OBJECT
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.cpp b/Tests/QtAutogen/mocMacroName/Gadget.cpp
new file mode 100644
index 0000000..167faeb
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.cpp
@@ -0,0 +1,6 @@
+#include "Gadget.hpp"
+
+Gadget::Gadget()
+ : test(0)
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.hpp b/Tests/QtAutogen/mocMacroName/Gadget.hpp
new file mode 100644
index 0000000..2587ed2
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.hpp
@@ -0,0 +1,15 @@
+#ifndef GADGET_HPP
+#define GADGET_HPP
+
+#include <QMetaType>
+
+class Gadget
+{
+ Q_GADGET
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Gadget();
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp b/Tests/QtAutogen/mocMacroName/MacroAlias.hpp
deleted file mode 100644
index cf06f2a..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MACROALIAS_HPP
-#define MACROALIAS_HPP
-
-#include <QObject>
-#define QO_ALIAS Q_OBJECT
-
-#endif
diff --git a/Tests/QtAutogen/mocMacroName/MacroName.cpp b/Tests/QtAutogen/mocMacroName/MacroName.cpp
deleted file mode 100644
index 78d04a8..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroName.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "MacroName.hpp"
-
-MacroName::MacroName()
-{
-}
-
-void MacroName::aSlot()
-{
-}
diff --git a/Tests/QtAutogen/mocMacroName/MacroName.hpp b/Tests/QtAutogen/mocMacroName/MacroName.hpp
deleted file mode 100644
index b6c7306..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroName.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef MACRONAME_HPP
-#define MACRONAME_HPP
-
-#include "MacroAlias.hpp"
-
-// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
-class MacroName : public QObject
-{
- QO_ALIAS
-public:
- MacroName();
-
-signals:
- void aSignal();
-
-public slots:
- void aSlot();
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object.cpp b/Tests/QtAutogen/mocMacroName/Object.cpp
new file mode 100644
index 0000000..c0b4f33
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.cpp
@@ -0,0 +1,9 @@
+#include "Object.hpp"
+
+Object::Object()
+{
+}
+
+void Object::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object.hpp b/Tests/QtAutogen/mocMacroName/Object.hpp
new file mode 100644
index 0000000..0c40824
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.hpp
@@ -0,0 +1,19 @@
+#ifndef OBJECT_HPP
+#define OBJECT_HPP
+
+#include <QObject>
+
+class Object : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Object();
+
+ Q_SLOT
+ void aSlot();
+
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
new file mode 100644
index 0000000..b8b4806
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object1Aliased.hpp"
+
+Object1Aliased::Object1Aliased()
+{
+}
+
+void Object1Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
new file mode 100644
index 0000000..6c6bb40
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECTALIASED_HPP
+#define OBJECTALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object1Aliased : public QObject
+{
+ QO1_ALIAS
+public:
+ Object1Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
new file mode 100644
index 0000000..4b09dd1
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object2Aliased.hpp"
+
+Object2Aliased::Object2Aliased()
+{
+}
+
+void Object2Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
new file mode 100644
index 0000000..b9bdc12
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECT2ALIASED_HPP
+#define OBJECT2ALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object2Aliased : public QObject
+{
+ QO2_ALIAS
+public:
+ Object2Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/main.cpp b/Tests/QtAutogen/mocMacroName/main.cpp
index 67ee81f..3b45d04 100644
--- a/Tests/QtAutogen/mocMacroName/main.cpp
+++ b/Tests/QtAutogen/mocMacroName/main.cpp
@@ -1,7 +1,13 @@
-#include "MacroName.hpp"
+#include "Gadget.hpp"
+#include "Object.hpp"
+#include "Object1Aliased.hpp"
+#include "Object2Aliased.hpp"
int main(int argv, char** args)
{
- MacroName macroName;
+ Gadget gadget;
+ Object object;
+ Object1Aliased object1Aliased;
+ Object2Aliased object2Aliased;
return 0;
}
diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt
index 4d2dcd9..f695875 100644
--- a/Tests/QtAutogen/sameName/CMakeLists.txt
+++ b/Tests/QtAutogen/sameName/CMakeLists.txt
@@ -17,7 +17,10 @@ add_executable(sameName
main.cpp
)
target_link_libraries(sameName ${QT_LIBRARIES})
-set_target_properties(sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
+set_target_properties(sameName PROPERTIES
+ AUTOMOC TRUE
+ AUTOUIC TRUE
+ AUTORCC TRUE)
# Set different compression levels
if (QT_TEST_VERSION STREQUAL 4)
diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
index 20d0044..850206f 100644
--- a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
@@ -3,8 +3,20 @@
namespace aaa {
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "aaa/bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.cpp b/Tests/QtAutogen/sameName/aaa/item.cpp
index 95dd3b6..e35d3d1 100644
--- a/Tests/QtAutogen/sameName/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/item.cpp
@@ -1,8 +1,22 @@
#include "item.hpp"
+// Include ui_view.h only in header
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewAAA ui;
+ MocLocal obj;
}
}
+
+#include "aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.hpp b/Tests/QtAutogen/sameName/aaa/item.hpp
index b63466f..875f72f 100644
--- a/Tests/QtAutogen/sameName/aaa/item.hpp
+++ b/Tests/QtAutogen/sameName/aaa/item.hpp
@@ -2,6 +2,8 @@
#define AAA_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in header
+#include <aaa/ui_view.h>
namespace aaa {
diff --git a/Tests/QtAutogen/sameName/aaa/view.ui b/Tests/QtAutogen/sameName/aaa/view.ui
new file mode 100644
index 0000000..0f09980
--- /dev/null
+++ b/Tests/QtAutogen/sameName/aaa/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewAAA</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
index ac4b2c2..7ad01c3 100644
--- a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
@@ -3,8 +3,20 @@
namespace bbb {
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "bbb/aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.cpp b/Tests/QtAutogen/sameName/bbb/item.cpp
index f97a143..9ef128e 100644
--- a/Tests/QtAutogen/sameName/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/item.cpp
@@ -1,8 +1,23 @@
#include "item.hpp"
+// Include ui_view.h only in source
+#include <bbb/ui_view.h>
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewBBB ui;
+ MocLocal obj;
}
}
+
+#include "bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.hpp b/Tests/QtAutogen/sameName/bbb/item.hpp
index 5b7f985..d39a9d7 100644
--- a/Tests/QtAutogen/sameName/bbb/item.hpp
+++ b/Tests/QtAutogen/sameName/bbb/item.hpp
@@ -2,6 +2,7 @@
#define BBB_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in source
namespace bbb {
diff --git a/Tests/QtAutogen/sameName/bbb/view.ui b/Tests/QtAutogen/sameName/bbb/view.ui
new file mode 100644
index 0000000..a8f506e
--- /dev/null
+++ b/Tests/QtAutogen/sameName/bbb/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewBBB</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/ccc/item.cpp b/Tests/QtAutogen/sameName/ccc/item.cpp
index d90b2b8..ab8a281 100644
--- a/Tests/QtAutogen/sameName/ccc/item.cpp
+++ b/Tests/QtAutogen/sameName/ccc/item.cpp
@@ -1,23 +1,25 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
-void Item::go()
-{
-}
-
-class MocTest : public QObject
+class MocLocal : public QObject
{
Q_OBJECT;
- Q_SLOT
- void go();
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
};
-void MocTest::go()
+void Item::go()
{
+ Ui_ViewCCC ui;
+ MocLocal obj;
}
}
// Include own moc files
-#include "item.moc"
+#include "ccc/item.moc"
#include "moc_item.cpp"
diff --git a/Tests/QtAutogen/sameName/ccc/item.hpp b/Tests/QtAutogen/sameName/ccc/item.hpp
index 96fcc24..20d9dd9 100644
--- a/Tests/QtAutogen/sameName/ccc/item.hpp
+++ b/Tests/QtAutogen/sameName/ccc/item.hpp
@@ -2,6 +2,8 @@
#define CCC_ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
diff --git a/Tests/QtAutogen/sameName/ccc/view.ui b/Tests/QtAutogen/sameName/ccc/view.ui
new file mode 100644
index 0000000..7989c69
--- /dev/null
+++ b/Tests/QtAutogen/sameName/ccc/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewCCC</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/item.cpp b/Tests/QtAutogen/sameName/item.cpp
index e013cf3..3d1fbe7 100644
--- a/Tests/QtAutogen/sameName/item.cpp
+++ b/Tests/QtAutogen/sameName/item.cpp
@@ -1,5 +1,20 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ui_view.h>
+
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
void Item::go()
{
+ Ui_View ui;
+ MocLocal obj;
}
+
+#include "item.moc"
diff --git a/Tests/QtAutogen/sameName/item.hpp b/Tests/QtAutogen/sameName/item.hpp
index 91bba3b..75e83f4 100644
--- a/Tests/QtAutogen/sameName/item.hpp
+++ b/Tests/QtAutogen/sameName/item.hpp
@@ -2,6 +2,8 @@
#define ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ui_view.h>
class Item : public QObject
{
diff --git a/Tests/QtAutogen/sameName/view.ui b/Tests/QtAutogen/sameName/view.ui
new file mode 100644
index 0000000..2ffe734
--- /dev/null
+++ b/Tests/QtAutogen/sameName/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>View</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt
index 088025f..e72c191 100644
--- a/Tests/QtAutogenRerun/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/CMakeLists.txt
@@ -36,204 +36,17 @@ else()
endif()
-# -- Test
-# Dummy test to generate clean target
+# Dummy executable to generate clean target
add_executable(dummy dummy.cpp)
# -- Test
-# When a file listed in a .qrc file changes the target must be rebuilt
-set(timeformat "%Y%j%H%M%S")
-set(RCC_DEPENDS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
-set(RCC_DEPENDS_BIN "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
-configure_file(${RCC_DEPENDS_SRC}/res1a.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-configure_file(${RCC_DEPENDS_SRC}/res2a.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-try_compile(RCC_DEPENDS
- "${RCC_DEPENDS_BIN}"
- "${RCC_DEPENDS_SRC}"
- rccDepends
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT RCC_DEPENDS)
- message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList ENCODING UTF-8)
-list(GET targetList 0 rccDependsBin)
-file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}")
-# Sleep, touch regular qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Second build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the first step!")
-endif()
-# Sleep, update regular qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res1b.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Third build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep2 "${timeformat}")
-if (NOT timeStep2 GREATER timeStep1)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the second step!")
-endif()
-# Sleep, touch regular qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fourth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep3 "${timeformat}")
-if (NOT timeStep3 GREATER timeStep2)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the third step!")
-endif()
-# Sleep, touch generated qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fifth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep4 "${timeformat}")
-if (NOT timeStep4 GREATER timeStep3)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fourth step!")
-endif()
-# Sleep, update generated qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res2b.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Sixth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep5 "${timeformat}")
-if (NOT timeStep5 GREATER timeStep4)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fitfh step!")
-endif()
-# Sleep, touch generated qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Seventh build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep6 "${timeformat}")
-if (NOT timeStep6 GREATER timeStep5)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the sixth step!")
-endif()
-
-
-# -- Test
-# Ensure a repeated build succeeds when a header containing a QObject changes
-set(timeformat "%Y%j%H%M%S")
-configure_file(mocRerun/test1a.h.in mocRerun/test1.h COPYONLY)
-try_compile(MOC_RERUN
- "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun"
- mocRerun
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT MOC_RERUN)
- message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List ENCODING UTF-8)
-list(GET target1List 0 binFile)
-file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
-# Change file content and rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
-configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- RESULT_VARIABLE mocRerun_result
- )
-if (mocRerun_result)
- message(SEND_ERROR "Second build of mocRerun failed.")
-endif()
-# Compare timestamps
-file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
-endif()
-
+include("mocRerun.cmake")
# -- Test
# Tests Q_PLUGIN_METADATA json file change detection
if (NOT QT_TEST_VERSION STREQUAL 4)
- try_compile(MOC_PLUGIN
- "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin"
- mocPlugin
- CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
- )
- if (NOT MOC_PLUGIN)
- message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
- endif()
-
- set(timeformat "%Y%j%H%M%S")
- set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
- set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
- find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
-
- file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
-
- # Ensure that the timestamp will change and change the json files
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
-
- file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
-
- if (plAAfter GREATER plABefore)
- message(SEND_ERROR "file (${plAFile}) should not have changed!")
- endif()
- if (plBAfter GREATER plBBefore)
- message(SEND_ERROR "file (${plBFile}) should not have changed!")
- endif()
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
-
- # Test custom macro
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
-
+ include("mocPlugin.cmake")
endif()
+
+# -- Test
+include("rccDepends.cmake")
diff --git a/Tests/QtAutogenRerun/mocPlugin.cmake b/Tests/QtAutogenRerun/mocPlugin.cmake
new file mode 100644
index 0000000..7ad5ccb
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin.cmake
@@ -0,0 +1,96 @@
+
+# Utility variables
+set(timeformat "%Y%j%H%M%S")
+set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
+set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
+
+# Initial buid
+try_compile(MOC_PLUGIN
+ "${mocPlugBinDir}"
+ "${mocPlugSrcDir}"
+ mocPlugin
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_PLUGIN)
+ message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
+endif()
+
+find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plEFile "PlugE" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+
+# - Ensure that the timestamp will change.
+# - Change the json files referenced by Q_PLUGIN_METADATA
+# - Rebuild
+file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
+file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
+file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/StyleE.json")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+
+file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
+file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
+file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
+
+if (plAAfter GREATER plABefore)
+ message(SEND_ERROR "file (${plAFile}) should not have changed!")
+endif()
+if (plBAfter GREATER plBBefore)
+ message(SEND_ERROR "file (${plBFile}) should not have changed!")
+endif()
+if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+endif()
+if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+endif()
+if (NOT plEAfter GREATER plEBefore)
+ # There's a bug in Ninja on Windows
+ # https://gitlab.kitware.com/cmake/cmake/issues/16776
+ if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ message(SEND_ERROR "file (${plEFile}) should have changed!")
+ endif()
+endif()
+
+# - Ensure that the timestamp will change.
+# - Change the json files referenced by A_CUSTOM_MACRO
+# - Rebuild
+file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleE_Custom.json")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+
+file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
+
+if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+endif()
+if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+endif()
+if (NOT plEAfter GREATER plEBefore)
+ # There's a bug in Ninja on Windows
+ # https://gitlab.kitware.com/cmake/cmake/issues/16776
+ if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ message(SEND_ERROR "file (${plEFile}) should have changed!")
+ endif()
+endif()
diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
index 9b224fb..b7cc5e9 100644
--- a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
@@ -16,9 +16,11 @@ if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
endif()
configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json)
-configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json)
+configure_file(jsonIn/StyleE.json jsonFiles/StyleE.json)
+configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json)
# Enable automoc
set(CMAKE_AUTOMOC TRUE)
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
index 1b6154d..35158a4 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
@@ -1,13 +1,13 @@
#ifndef STYLEA_HPP
#define STYLEA_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleA : public QStylePlugin
{
Q_OBJECT
- // Json file in local directory
+ // Json file in source local directory
Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg)
public:
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
index 163c9b2..15b79c5 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
@@ -1,13 +1,13 @@
#ifndef STYLEB_HPP
#define STYLEB_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleB : public QStylePlugin
{
Q_OBJECT
- // Json file in local subdirectory
+ // Json file in source local subdirectory
Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg)
public:
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
index 52a887a..b0a4115 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
@@ -1,7 +1,7 @@
#ifndef STYLEC_HPP
#define STYLEC_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleC : public QStylePlugin
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
index df8a439..9696aaa 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
@@ -1,7 +1,7 @@
#ifndef STYLED_HPP
#define STYLED_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleD : public QStylePlugin
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
index 8fc9a7f..3448319 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
@@ -4,3 +4,6 @@ QStyle* StyleE::create(const QString& key)
{
return 0;
}
+
+// AUTOMOC the StyleEInclude.hpp header
+#include "moc_StyleEInclude.cpp"
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
index e7915a8..a069034 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
@@ -1,17 +1,10 @@
#ifndef STYLEE_HPP
#define STYLEE_HPP
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleE : public QStylePlugin
-{
- Q_OBJECT
- // No Json file
- Q_PLUGIN_METADATA(IID "org.styles.E")
- A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
+// The included file is not in the sources list and won't be detected by
+// AUTOMOC source file with the same base name.
+// It is registered to AUTOMOCed via a moc_<NAME>.cpp include in StyleE.cpp
+// though.
+#include "StyleEInclude.hpp"
#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp
new file mode 100644
index 0000000..f9734db
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEE_INCLUDE_HPP
+#define STYLEE_INCLUDE_HPP
+
+#include "UtilityMacros.hpp"
+#include <QStylePlugin>
+
+class StyleE : public QStylePlugin
+{
+ Q_OBJECT
+ // Json files in global root directory
+ Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json")
+ A_CUSTOM_MACRO(SomeArg, "StyleE_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp b/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp
index f1a7ec6..53a4284 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp
@@ -1,5 +1,5 @@
-#ifndef STYLECOMMON_HPP
-#define STYLECOMMON_HPP
+#ifndef UTILITYMACROS_HPP
+#define UTILITYMACROS_HPP
// Empty test macro definition
#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations)
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
index 129cac4..cd155dc 100644
--- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
@@ -1 +1 @@
-{ "Keys": [ "Rocket", "StarbusterB" ] }
+{ "Keys": [ "Red", "Green" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json
new file mode 100644
index 0000000..5412c94
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json
@@ -0,0 +1 @@
+{ "Keys": [ "Floor", "Ceiling" ] }
diff --git a/Tests/QtAutogenRerun/mocRerun.cmake b/Tests/QtAutogenRerun/mocRerun.cmake
new file mode 100644
index 0000000..a92912b
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun.cmake
@@ -0,0 +1,60 @@
+
+set(timeformat "%Y%j%H%M%S")
+set(mocRerunSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun")
+set(mocRerunBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocRerun")
+
+# Initial build
+configure_file("${mocRerunSrcDir}/test1a.h.in" "${mocRerunBinDir}/test1.h" COPYONLY)
+try_compile(MOC_RERUN
+ "${mocRerunBinDir}"
+ "${mocRerunSrcDir}"
+ mocRerun
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
+endif()
+# Get name of the output binary
+file(STRINGS "${mocRerunBinDir}/mocRerun.txt" mocRerunList ENCODING UTF-8)
+list(GET mocRerunList 0 mocRerunBin)
+
+message("Changing the header content for a MOC rerun")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change header file content and rebuild
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocRerunSrcDir}/test1b.h.in" "${mocRerunBinDir}/test1.h" COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result )
+if (result)
+ message(SEND_ERROR "Second build of mocRerun failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT timeAfter GREATER timeBefore)
+ message(SEND_ERROR "File (${mocRerunBin}) should have changed!")
+endif()
+
+
+message("Changing nothing for a MOC rerun")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}")
+# - Ensure that the timestamp would change
+# - Change nothing
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result )
+if (result)
+ message(SEND_ERROR "Third build of mocRerun failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}")
+# - Test if timestamps changed
+if (timeAfter GREATER timeBefore)
+ message(SEND_ERROR "File (${mocRerunBin}) should not have changed!")
+endif()
diff --git a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
index 7380bdd..bafd9cf 100644
--- a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
@@ -19,17 +19,15 @@ set(CMAKE_AUTORCC ON)
# Generated source file
add_custom_command(OUTPUT main.cpp
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- )
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
add_executable(mocRerun
${CMAKE_CURRENT_BINARY_DIR}/test1.h
${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- res1.qrc
- )
+ res1.qrc)
target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(mocRerun ${QT_CORE_TARGET})
# Write target name to text file
add_custom_command(TARGET mocRerun POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > target1.txt)
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > mocRerun.txt)
diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogenRerun/rccDepends.cmake
new file mode 100644
index 0000000..68e1482
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends.cmake
@@ -0,0 +1,131 @@
+# When a .qrc or a file listed in a .qrc file changes,
+# the target must be rebuilt
+set(timeformat "%Y%j%H%M%S")
+set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
+set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
+
+# Initial build
+configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
+configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
+try_compile(RCC_DEPENDS
+ "${rccDepBD}"
+ "${rccDepSD}"
+ rccDepends
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT RCC_DEPENDS)
+ message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
+endif()
+
+# Get name of the output binaries
+file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8)
+file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8)
+list(GET targetListPlain 0 rccDepBinPlain)
+list(GET targetListGen 0 rccDepBinGen)
+message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}")
+message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}")
+
+
+message("Changing a resource files listed in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change a resource files listed in the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Second build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing a the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
+configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Third build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing a newly added resource files listed in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change a newly added resource files listed in the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fourth build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing nothing in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change nothing
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fifth build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!")
+endif()
+if (rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!")
+endif()
diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
index edc0ac3..291592e 100644
--- a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.9)
project(rccDepends CXX)
-set(CMAKE_AUTORCC ON)
-
if (QT_TEST_VERSION STREQUAL 4)
find_package(Qt4 REQUIRED)
set(QT_CORE_TARGET Qt4::QtCore)
@@ -15,21 +13,29 @@ else()
set(QT_CORE_TARGET Qt5::Core)
endif()
-configure_file(res/input1.txt.in res1/input.txt COPYONLY)
-configure_file(res/input1.txt.in res1/inputAdded.txt COPYONLY)
-configure_file(res/input2.txt.in res2/input.txt COPYONLY)
-configure_file(res/input2.txt.in res2/inputAdded.txt COPYONLY)
-# Dependency generated qrc file
-add_custom_command(OUTPUT res2.qrc
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
- )
+# Enable AUTORCC for all targets
+set(CMAKE_AUTORCC ON)
+
+# Initial resource files setup
+configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY)
+configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY)
+configure_file(resGen/input.txt.in resGen/input.txt COPYONLY)
+configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY)
+
+# Generated qrc file with dependency
+add_custom_command(OUTPUT resGen.qrc
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc)
+
+# Target that uses a plain .qrc file
+add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc)
+target_link_libraries(rccDependsPlain ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt)
-add_executable(rccDepends
- main.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
- ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc )
-target_link_libraries(rccDepends ${QT_CORE_TARGET})
-add_custom_command(TARGET rccDepends POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target.txt)
+# Target that uses a GENERATED .qrc file
+add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc )
+target_link_libraries(rccDependsGen ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt)
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
deleted file mode 100644
index da62762..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res1 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
deleted file mode 100644
index 08e14b7..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res2 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
deleted file mode 100644
index d111ffb..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
deleted file mode 100644
index 4cb3f04..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- <file alias="Added">res1/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
deleted file mode 100644
index 19f34ac..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
deleted file mode 100644
index 19e8ba1..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- <file alias="Added">res2/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in
new file mode 100644
index 0000000..4f24589
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in
new file mode 100644
index 0000000..4f24589
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in
new file mode 100644
index 0000000..c131a34
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/TextsGenerated">
+ <file>resGen/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in
new file mode 100644
index 0000000..8c7e643
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsGenerated">
+ <file>resGen/input.txt</file>
+ <file alias="Added">resGen/inputAdded.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in
new file mode 100644
index 0000000..a5e407a
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in
@@ -0,0 +1 @@
+Plaint resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in
new file mode 100644
index 0000000..a5e407a
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in
@@ -0,0 +1 @@
+Plaint resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in
new file mode 100644
index 0000000..c135d85
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/TextsPlain">
+ <file>resPlain/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in
new file mode 100644
index 0000000..186b653
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsPlain">
+ <file>resPlain/input.txt</file>
+ <file alias="Added">resPlain/inputAdded.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 73fa8fb..57cc144 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -141,12 +141,14 @@ add_RunCMake_test(DisallowedCommands)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
+add_RunCMake_test(FindBoost)
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
add_RunCMake_test(GenerateExportHeader)
endif()
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorPlatform)
add_RunCMake_test(GeneratorToolset)
+add_RunCMake_test(GetPrerequisites)
add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test
add_RunCMake_test(TargetPropertyGeneratorExpressions)
@@ -227,20 +229,38 @@ add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
add_RunCMake_test(test_include_dirs)
-foreach(var
- CMAKE_C_COMPILER_ID
- CMAKE_C_COMPILER_VERSION
- CMAKE_C_STANDARD_DEFAULT
- CMAKE_CXX_COMPILER_ID
- CMAKE_CXX_COMPILER_VERSION
- CMAKE_CXX_STANDARD_DEFAULT
- CMake_TEST_CUDA
- )
- if(DEFINED ${var})
- list(APPEND try_compile_ARGS -D${var}=${${var}})
+
+function(add_RunCMake_test_try_compile)
+ if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ # Older CMake versions do not know about MSVC language standards.
+ # Approximate our logic from MSVC-CXX.cmake.
+ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR
+ CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017)
+ set(CMAKE_CXX_STANDARD_DEFAULT 14)
+ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
+ set(CMAKE_CXX_STANDARD_DEFAULT "")
+ else()
+ unset(CMAKE_CXX_STANDARD_DEFAULT)
+ endif()
endif()
-endforeach()
-add_RunCMake_test(try_compile)
+ foreach(var
+ CMAKE_C_COMPILER_ID
+ CMAKE_C_COMPILER_VERSION
+ CMAKE_C_STANDARD_DEFAULT
+ CMAKE_CXX_COMPILER_ID
+ CMAKE_CXX_COMPILER_VERSION
+ CMAKE_CXX_STANDARD_DEFAULT
+ CMake_TEST_CUDA
+ )
+ if(DEFINED ${var})
+ list(APPEND try_compile_ARGS -D${var}=${${var}})
+ endif()
+ endforeach()
+ add_RunCMake_test(try_compile)
+endfunction()
+add_RunCMake_test_try_compile()
+
add_RunCMake_test(try_run)
add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index ad1b47b..6d8e84a 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -23,7 +23,7 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V
endif()
if(GENERATOR_SPECIFIC_FORMAT)
- set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}-${REVISION}_*.deb" PARENT_SCOPE)
+ set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}_*.deb" PARENT_SCOPE)
else()
set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.deb" PARENT_SCOPE)
endif()
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake
index d8012b1..88fc231 100644
--- a/Tests/RunCMake/CPack/RPM/Helpers.cmake
+++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake
@@ -23,6 +23,9 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V
endif()
if(GENERATOR_SPECIFIC_FORMAT)
+ if(NOT REVISION)
+ set(REVISION "1")
+ endif()
set(${RESULT_VAR} "${NAME}${COMPONENT}-${VERSION}-${REVISION}.*.rpm" PARENT_SCOPE)
else()
set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.rpm" PARENT_SCOPE)
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index fb1f476..04ac584 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -10,6 +10,7 @@ run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
run_cpack_test(DIST "RPM" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT")
+run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB" false "COMPONENT")
run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT")
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 470ebf7..1f5ab87 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -8,9 +8,7 @@ function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR)
endif()
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_VERSION)
set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1")
- endif()
- if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_REVISION)
- set(EXPECTED_FILE_${FILE_NO}_REVISION "1")
+ set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1" PARENT_SCOPE)
endif()
getPackageNameGlobexpr("${EXPECTED_FILE_${FILE_NO}_NAME}"
diff --git a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake
new file mode 100644
index 0000000..85c571c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake
@@ -0,0 +1,3 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_1_REVISION "1")
diff --git a/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake
new file mode 100644
index 0000000..eed9696
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake
@@ -0,0 +1,17 @@
+function(checkPackageInfo_ TYPE FILE REGEX)
+ getPackageInfo("${FILE}" "FILE_INFO_")
+ if(NOT FILE_INFO_ MATCHES "${REGEX}")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}' ${EXPECTED_FILE_1_VERSION} ${EXPECTED_FILE_1_REVISION}; file info: '${FILE_INFO_}'")
+ endif()
+endfunction()
+
+set(whitespaces_ "[\t\n\r ]*")
+
+if(GENERATOR_TYPE STREQUAL "RPM")
+ checkPackageInfo_("package version" "${FOUND_FILE_1}" "Version${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_VERSION}")
+ checkPackageInfo_("package revision" "${FOUND_FILE_1}" "Release${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_REVISION}")
+ checkPackageInfo_("epoch version" "${FOUND_FILE_1}" "Epoch${whitespaces_}:${whitespaces_}3")
+else() # DEB
+ checkPackageInfo_("version" "${FOUND_FILE_1}"
+ ".*Version${whitespaces_}:${whitespaces_}3:${EXPECTED_FILE_1_VERSION}-${EXPECTED_FILE_1_REVISION}")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/VERSION/test.cmake b/Tests/RunCMake/CPack/tests/VERSION/test.cmake
new file mode 100644
index 0000000..301ab61
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/test.cmake
@@ -0,0 +1,14 @@
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
+
+if(GENERATOR_TYPE STREQUAL "DEB")
+ set(package_type_ "DEBIAN")
+ set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
+else()
+ set(package_type_ "${GENERATOR_TYPE}")
+endif()
+
+set(CPACK_${package_type_}_PACKAGE_EPOCH "3")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL test)
+endif()
diff --git a/Tests/RunCMake/FindBoost/CMakeLists.txt b/Tests/RunCMake/FindBoost/CMakeLists.txt
new file mode 100644
index 0000000..d3137f6
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.9)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt
new file mode 100644
index 0000000..664e4a5
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt
@@ -0,0 +1,3 @@
+-- Boost 1\.12345 found\.
+-- Found Boost components:
+ date_time
diff --git a/Tests/RunCMake/FindBoost/CMakePackage.cmake b/Tests/RunCMake/FindBoost/CMakePackage.cmake
new file mode 100644
index 0000000..06aeccb
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage.cmake
@@ -0,0 +1,2 @@
+set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage)
+find_package(Boost 1.12345 COMPONENTS date_time)
diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake
diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake
new file mode 100644
index 0000000..8176ced
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 1.12345)
+if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if(PACKAGE_FIND_VERSION_MINOR EQUAL 12345)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
new file mode 100644
index 0000000..a153ae1
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(CMakePackage)
diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
new file mode 100644
index 0000000..3856c54
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
new file mode 100644
index 0000000..cffe5f8
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
@@ -0,0 +1,3 @@
+^warning: target 'does_not_exist' is not absolute\.\.\.
+warning: target 'does_not_exist' does not exist\.\.\.
+result_var='value;before;call'$
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
new file mode 100644
index 0000000..84fd32c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
@@ -0,0 +1,4 @@
+include(GetPrerequisites)
+set(result_var value before call)
+get_prerequisites(does_not_exist result_var 0 0 "" "")
+message("result_var='${result_var}'")
diff --git a/Tests/RunCMake/get_property/source_properties-stderr.txt b/Tests/RunCMake/get_property/source_properties-stderr.txt
index 0a46f96..00a9b82 100644
--- a/Tests/RunCMake/get_property/source_properties-stderr.txt
+++ b/Tests/RunCMake/get_property/source_properties-stderr.txt
@@ -3,4 +3,10 @@ get_property: --><--
get_source_file_property: -->value<--
get_property: -->value<--
get_source_file_property: -->NOTFOUND<--
-get_property: --><--$
+get_property: --><--
+get_source_file_property: -->value<--
+get_property: -->value<--
+get_source_file_property: -->NOTFOUND<--
+get_property: --><--
+get_source_file_property: -->value<--
+get_property: -->value<--$
diff --git a/Tests/RunCMake/get_property/source_properties.cmake b/Tests/RunCMake/get_property/source_properties.cmake
index 263ffe1..12d2d07 100644
--- a/Tests/RunCMake/get_property/source_properties.cmake
+++ b/Tests/RunCMake/get_property/source_properties.cmake
@@ -13,3 +13,13 @@ set_source_files_properties(file.c PROPERTIES empty "" custom value)
check_source_file_property(file.c empty)
check_source_file_property(file.c custom)
check_source_file_property(file.c noexist)
+
+# Test strange legacy behavior in which the order in which source files are
+# first accessed affects how properties are applied without an extension.
+# See also issue #15208.
+get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.c PROPERTY LANGUAGE)
+get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.h PROPERTY LANGUAGE)
+set_property(SOURCE file2 PROPERTY custom value) # set property without extension
+check_source_file_property(file2 custom) # should have property
+check_source_file_property(file2.h custom) # should not have property
+check_source_file_property(file2.c custom) # should have property
diff --git a/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake
new file mode 100644
index 0000000..1dee837
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake
@@ -0,0 +1,17 @@
+function (watch2)
+
+endfunction ()
+
+function (watch1)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+endfunction ()
+
+variable_watch(watched watch1)
+variable_watch(watched watch2)
+
+set(access "${watched}")
diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
index 9becb4c..2fa6275 100644
--- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ include(RunCMake)
run_cmake(ModifiedAccess)
run_cmake(NoWatcher)
run_cmake(WatchTwice)
+run_cmake(ModifyWatchInCallback)
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt
index 718e624..fb47c7e 100644
--- a/Tests/VSResource/CMakeLists.txt
+++ b/Tests/VSResource/CMakeLists.txt
@@ -56,3 +56,10 @@ endif()
set_property(TARGET VSResource
PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")
+
+if(CMAKE_GENERATOR MATCHES "Ninja|Visual Studio")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0037 OLD)
+ add_library("My ResourceLib" lib.cpp lib.rc)
+ cmake_policy(POP)
+endif()
diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt
index 2b0c478..acda117 100644
--- a/Tests/VSWinStorePhone/CMakeLists.txt
+++ b/Tests/VSWinStorePhone/CMakeLists.txt
@@ -116,12 +116,14 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
-set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED")
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h")
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
-set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED")
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h")
source_group("Source Files" FILES ${SOURCE_FILES})
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 349945a..3240edf 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -49,12 +49,6 @@
#{ symbol: [ "std::pair", private, "<map>", public ] },
#{ symbol: [ "std::pair", private, "<set>", public ] },
- # IWYU wrongly suggests to include "cm_auto_ptr.hxx" in some places. This
- # might be a misinterpretation of a template specialization in <utility>.
- # As a workaround, map the symbol auto_ptr to "cmConfigure.h".
- # This will still correctly require "cm_auto_ptr.hxx" for CM_AUTO_PTR.
- { symbol: [ "cm::auto_ptr", private, "\"cmConfigure.h\"", public ] },
-
# __decay_and_strip is used internally in the C++11 standard library.
# IWYU does not classify it as internal and suggests to add <type_traits>.
# To ignore it, we simply map it to a file that is included anyway.
diff --git a/bootstrap b/bootstrap
index f7f45cf..47f7e76 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1270,7 +1270,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
-cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE"
cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"