summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy30
-rw-r--r--Auxiliary/vim/cmake.vim.in48
-rwxr-xr-xAuxiliary/vim/extract-upper-case.pl27
-rw-r--r--Auxiliary/vim/indent/cmake.vim1
-rw-r--r--Auxiliary/vim/syntax/cmake.vim411
-rw-r--r--CMakeLists.txt33
-rw-r--r--CompileFlags.cmake9
-rw-r--r--Help/command/add_executable.rst3
-rw-r--r--Help/command/add_library.rst6
-rw-r--r--Help/command/ctest_memcheck.rst3
-rw-r--r--Help/command/ctest_submit.rst10
-rw-r--r--Help/command/ctest_test.rst17
-rw-r--r--Help/command/separate_arguments.rst9
-rw-r--r--Help/dev/review.rst4
-rw-r--r--Help/manual/cmake-compile-features.7.rst2
-rw-r--r--Help/manual/cmake-modules.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst2
-rw-r--r--Help/manual/ctest.1.rst17
-rw-r--r--Help/module/CPackArchive.rst1
-rw-r--r--Help/prop_sf/HEADER_FILE_ONLY.rst15
-rw-r--r--Help/release/dev/ExtractGTestMacro.rst6
-rw-r--r--Help/release/dev/FindProtobuf-targets.rst5
-rw-r--r--Help/release/dev/cpack-archive-per-component-filename.rst6
-rw-r--r--Help/release/dev/cpackifw-i18n.rst7
-rw-r--r--Help/release/dev/ctest_submit_headers.rst5
-rw-r--r--Help/release/dev/excludeFixtures.rst9
-rw-r--r--Help/release/dev/separgs-native.rst5
-rw-r--r--Help/release/dev/split-sysroot.rst5
-rw-r--r--Help/variable/CMAKE_SYSROOT.rst3
-rw-r--r--Help/variable/CMAKE_SYSROOT_COMPILE.rst9
-rw-r--r--Help/variable/CMAKE_SYSROOT_LINK.rst9
-rw-r--r--Modules/CMakeCSharpInformation.cmake22
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake1
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake8
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake4
-rw-r--r--Modules/CMakeFortranCompilerId.F.in5
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake8
-rw-r--r--Modules/CPackArchive.cmake39
-rw-r--r--Modules/CPackComponent.cmake10
-rw-r--r--Modules/CPackIFW.cmake46
-rw-r--r--Modules/CheckIPOSupported.cmake2
-rw-r--r--Modules/CheckTypeSize.cmake4
-rw-r--r--Modules/Compiler/AppleClang-C.cmake12
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake13
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake62
-rw-r--r--Modules/Compiler/Clang-C.cmake16
-rw-r--r--Modules/Compiler/Clang-CXX.cmake12
-rw-r--r--Modules/Compiler/Clang-FindBinUtils.cmake25
-rw-r--r--Modules/Compiler/Clang.cmake56
-rw-r--r--Modules/Compiler/Cray-C.cmake21
-rw-r--r--Modules/Compiler/Cray-CXX.cmake19
-rw-r--r--Modules/Compiler/Cray.cmake10
-rw-r--r--Modules/Compiler/GNU-C.cmake16
-rw-r--r--Modules/Compiler/GNU-CXX.cmake12
-rw-r--r--Modules/Compiler/GNU-FindBinUtils.cmake12
-rw-r--r--Modules/Compiler/GNU.cmake2
-rw-r--r--Modules/Compiler/Intel-C.cmake18
-rw-r--r--Modules/Compiler/Intel-CXX.cmake15
-rw-r--r--Modules/Compiler/Intel.cmake2
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake6
-rw-r--r--Modules/Compiler/PGI-C.cmake13
-rw-r--r--Modules/Compiler/PGI-CXX.cmake19
-rw-r--r--Modules/Compiler/PGI.cmake2
-rw-r--r--Modules/Compiler/SunPro-C-FeatureTests.cmake14
-rw-r--r--Modules/Compiler/SunPro-C.cmake36
-rw-r--r--Modules/Compiler/SunPro-CXX-FeatureTests.cmake4
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake18
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake4
-rw-r--r--Modules/Compiler/SunPro.cmake10
-rw-r--r--Modules/Compiler/XL-C.cmake39
-rw-r--r--Modules/Compiler/XL-CXX.cmake44
-rw-r--r--Modules/Compiler/XL.cmake2
-rw-r--r--Modules/ExternalData.cmake2
-rw-r--r--Modules/ExternalProject.cmake8
-rw-r--r--Modules/FindBoost.cmake34
-rw-r--r--Modules/FindCUDA.cmake2
-rw-r--r--Modules/FindDevIL.cmake4
-rw-r--r--Modules/FindHDF5.cmake6
-rw-r--r--Modules/FindJava.cmake3
-rw-r--r--Modules/FindMPI.cmake3
-rw-r--r--Modules/FindMatlab.cmake1
-rw-r--r--Modules/FindOpenCL.cmake7
-rw-r--r--Modules/FindOpenGL.cmake4
-rw-r--r--Modules/FindOpenMP.cmake43
-rw-r--r--Modules/FindOpenSSL.cmake4
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake4
-rw-r--r--Modules/FindPkgConfig.cmake4
-rw-r--r--Modules/FindProtobuf.cmake81
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt11
-rw-r--r--Modules/FortranCInterface/Detect.cmake5
-rw-r--r--Modules/FortranCInterface/MYMODULE.c3
-rw-r--r--Modules/FortranCInterface/MY_MODULE.c3
-rw-r--r--Modules/GetPrerequisites.cmake6
-rw-r--r--Modules/GoogleTest.cmake175
-rw-r--r--Modules/Internal/FeatureTesting.cmake10
-rw-r--r--Modules/Platform/AIX-GNU.cmake2
-rw-r--r--Modules/Platform/AIX-XL-C.cmake3
-rw-r--r--Modules/Platform/AIX-XL-CXX.cmake3
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-C.cmake3
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake3
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-C.cmake3
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-CXX.cmake3
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake3
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake3
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-C.cmake3
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-CXX.cmake3
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Darwin-XL-C.cmake3
-rw-r--r--Modules/Platform/Darwin-XL-CXX.cmake3
-rw-r--r--Modules/Platform/HP-UX-GNU.cmake2
-rw-r--r--Modules/Platform/Linux-PGI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake4
-rw-r--r--Modules/UseJava.cmake2
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake6
-rw-r--r--Source/.gitattributes18
-rw-r--r--Source/CMakeLists.txt112
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx137
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.h81
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx336
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h30
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx381
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h17
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx515
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h25
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx220
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h16
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h6
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx57
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h5
-rw-r--r--Source/CPack/cmCPackGenerator.cxx9
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestCurl.cxx25
-rw-r--r--Source/CTest/cmCTestCurl.h5
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h8
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h5
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx1
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h7
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h5
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h5
-rw-r--r--Source/CTest/cmCTestSVN.cxx12
-rw-r--r--Source/CTest/cmCTestSVN.h3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx47
-rw-r--r--Source/CTest/cmCTestScriptHandler.h2
-rw-r--r--Source/CTest/cmCTestSleepCommand.h5
-rw-r--r--Source/CTest/cmCTestStartCommand.h5
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx16
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx12
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h6
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx15
-rw-r--r--Source/CTest/cmCTestTestCommand.h3
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx160
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
-rw-r--r--Source/CursesDialog/ccmake.cxx2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx2
-rw-r--r--Source/LexerParser/.clang-tidy6
-rw-r--r--Source/LexerParser/.gitattributes17
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.cxx (renamed from Source/cmCommandArgumentLexer.cxx)0
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.h (renamed from Source/cmCommandArgumentLexer.h)0
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.in.l (renamed from Source/cmCommandArgumentLexer.in.l)0
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.cxx (renamed from Source/cmCommandArgumentParser.cxx)0
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.y (renamed from Source/cmCommandArgumentParser.y)1
-rw-r--r--Source/LexerParser/cmCommandArgumentParserTokens.h (renamed from Source/cmCommandArgumentParserTokens.h)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.cxx (renamed from Source/cmDependsJavaLexer.cxx)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.h (renamed from Source/cmDependsJavaLexer.h)0
-rw-r--r--Source/LexerParser/cmDependsJavaLexer.in.l (renamed from Source/cmDependsJavaLexer.in.l)0
-rw-r--r--Source/LexerParser/cmDependsJavaParser.cxx (renamed from Source/cmDependsJavaParser.cxx)0
-rw-r--r--Source/LexerParser/cmDependsJavaParser.y (renamed from Source/cmDependsJavaParser.y)3
-rw-r--r--Source/LexerParser/cmDependsJavaParserTokens.h (renamed from Source/cmDependsJavaParserTokens.h)0
-rw-r--r--Source/LexerParser/cmExprLexer.cxx (renamed from Source/cmExprLexer.cxx)0
-rw-r--r--Source/LexerParser/cmExprLexer.h (renamed from Source/cmExprLexer.h)0
-rw-r--r--Source/LexerParser/cmExprLexer.in.l (renamed from Source/cmExprLexer.in.l)0
-rw-r--r--Source/LexerParser/cmExprParser.cxx (renamed from Source/cmExprParser.cxx)1
-rw-r--r--Source/LexerParser/cmExprParser.y (renamed from Source/cmExprParser.y)1
-rw-r--r--Source/LexerParser/cmExprParserTokens.h (renamed from Source/cmExprParserTokens.h)0
-rw-r--r--Source/LexerParser/cmFortranLexer.cxx (renamed from Source/cmFortranLexer.cxx)0
-rw-r--r--Source/LexerParser/cmFortranLexer.h (renamed from Source/cmFortranLexer.h)0
-rw-r--r--Source/LexerParser/cmFortranLexer.in.l (renamed from Source/cmFortranLexer.in.l)0
-rw-r--r--Source/LexerParser/cmFortranParser.cxx (renamed from Source/cmFortranParser.cxx)0
-rw-r--r--Source/LexerParser/cmFortranParser.y (renamed from Source/cmFortranParser.y)0
-rw-r--r--Source/LexerParser/cmFortranParserTokens.h (renamed from Source/cmFortranParserTokens.h)0
-rw-r--r--Source/LexerParser/cmListFileLexer.c (renamed from Source/cmListFileLexer.c)0
-rw-r--r--Source/LexerParser/cmListFileLexer.in.l (renamed from Source/cmListFileLexer.in.l)0
-rw-r--r--Source/QtDialog/CMakeLists.txt19
-rw-r--r--Source/QtDialog/CMakeSetup.cxx2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx15
-rw-r--r--Source/QtDialog/FirstConfigure.cxx2
-rw-r--r--Source/QtDialog/QCMake.cxx6
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx26
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx8
-rw-r--r--Source/bindexplib.cxx33
-rw-r--r--Source/cmAddCompileOptionsCommand.h5
-rw-r--r--Source/cmAddCustomCommandCommand.h5
-rw-r--r--Source/cmAddCustomTargetCommand.h5
-rw-r--r--Source/cmAddDefinitionsCommand.h5
-rw-r--r--Source/cmAddDependenciesCommand.h5
-rw-r--r--Source/cmAddExecutableCommand.h5
-rw-r--r--Source/cmAddLibraryCommand.h5
-rw-r--r--Source/cmAddSubDirectoryCommand.h5
-rw-r--r--Source/cmAddTestCommand.h5
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h5
-rw-r--r--Source/cmBase32.cxx2
-rw-r--r--Source/cmBreakCommand.cxx2
-rw-r--r--Source/cmBreakCommand.h10
-rw-r--r--Source/cmBuildCommand.h5
-rw-r--r--Source/cmBuildNameCommand.h2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h13
-rw-r--r--Source/cmCMakeMinimumRequired.h10
-rw-r--r--Source/cmCMakePolicyCommand.h10
-rw-r--r--Source/cmCTest.cxx30
-rw-r--r--Source/cmCommand.h16
-rw-r--r--Source/cmCommands.cxx345
-rw-r--r--Source/cmCommands.h1
-rw-r--r--Source/cmCommonTargetGenerator.cxx11
-rw-r--r--Source/cmCommonTargetGenerator.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx8
-rw-r--r--Source/cmConfigureFileCommand.h10
-rw-r--r--Source/cmContinueCommand.cxx2
-rw-r--r--Source/cmContinueCommand.h10
-rw-r--r--Source/cmCoreTryCompile.cxx4
-rw-r--r--Source/cmCreateTestSourceList.h5
-rw-r--r--Source/cmDefinePropertyCommand.h5
-rw-r--r--Source/cmDisallowedCommand.h7
-rw-r--r--Source/cmEnableLanguageCommand.h5
-rw-r--r--Source/cmEnableTestingCommand.h5
-rw-r--r--Source/cmExecProgramCommand.h10
-rw-r--r--Source/cmExecuteProcessCommand.h10
-rw-r--r--Source/cmExecutionStatus.h31
-rw-r--r--Source/cmExportCommand.h5
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h4
-rw-r--r--Source/cmFLTKWrapUICommand.h5
-rw-r--r--Source/cmFileCommand.cxx14
-rw-r--r--Source/cmFileCommand.h10
-rw-r--r--Source/cmFileLockPool.h6
-rw-r--r--Source/cmFileMonitor.cxx16
-rw-r--r--Source/cmFileMonitor.h4
-rw-r--r--Source/cmFindCommon.cxx26
-rw-r--r--Source/cmFindCommon.h3
-rw-r--r--Source/cmFindFileCommand.h3
-rw-r--r--Source/cmFindLibraryCommand.h10
-rw-r--r--Source/cmFindPackageCommand.h10
-rw-r--r--Source/cmFindPathCommand.h10
-rw-r--r--Source/cmFindProgramCommand.h10
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmForEachCommand.h10
-rw-r--r--Source/cmFunctionCommand.cxx23
-rw-r--r--Source/cmFunctionCommand.h10
-rw-r--r--Source/cmGeneratorTarget.cxx17
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGetCMakePropertyCommand.h10
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h10
-rw-r--r--Source/cmGetFilenameComponentCommand.h10
-rw-r--r--Source/cmGetPropertyCommand.h10
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h8
-rw-r--r--Source/cmGetTargetPropertyCommand.h5
-rw-r--r--Source/cmGetTestPropertyCommand.h5
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx8
-rw-r--r--Source/cmGlobalGenerator.cxx12
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx56
-rw-r--r--Source/cmGlobalXCodeGenerator.h4
-rw-r--r--Source/cmGraphVizWriter.cxx2
-rw-r--r--Source/cmIfCommand.cxx6
-rw-r--r--Source/cmIfCommand.h10
-rw-r--r--Source/cmIncludeCommand.h10
-rw-r--r--Source/cmIncludeDirectoryCommand.h5
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h8
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h8
-rw-r--r--Source/cmInstallCommand.h5
-rw-r--r--Source/cmInstallFilesCommand.h5
-rw-r--r--Source/cmInstallProgramsCommand.h5
-rw-r--r--Source/cmInstallTargetsCommand.h5
-rw-r--r--Source/cmInstalledFile.h2
-rw-r--r--Source/cmLinkDirectoriesCommand.h5
-rw-r--r--Source/cmLinkLibrariesCommand.h5
-rw-r--r--Source/cmListCommand.h10
-rw-r--r--Source/cmLoadCacheCommand.h5
-rw-r--r--Source/cmLoadCommandCommand.cxx7
-rw-r--r--Source/cmLoadCommandCommand.h1
-rw-r--r--Source/cmLocalCommonGenerator.cxx12
-rw-r--r--Source/cmLocalCommonGenerator.h1
-rw-r--r--Source/cmLocalGenerator.cxx134
-rw-r--r--Source/cmLocalGenerator.h14
-rw-r--r--Source/cmLocalNinjaGenerator.cxx15
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmMacroCommand.cxx26
-rw-r--r--Source/cmMacroCommand.h10
-rw-r--r--Source/cmMakeDirectoryCommand.h10
-rw-r--r--Source/cmMakefile.cxx19
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx9
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx12
-rw-r--r--Source/cmMarkAsAdvancedCommand.h13
-rw-r--r--Source/cmMathCommand.h10
-rw-r--r--Source/cmMessageCommand.h10
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
-rw-r--r--Source/cmOptionCommand.h10
-rw-r--r--Source/cmOutputRequiredFilesCommand.h1
-rw-r--r--Source/cmParseArgumentsCommand.h10
-rw-r--r--Source/cmProjectCommand.h5
-rw-r--r--Source/cmQTWrapCPPCommand.h5
-rw-r--r--Source/cmQTWrapUICommand.h5
-rw-r--r--Source/cmQtAutoGenerators.cxx39
-rw-r--r--Source/cmRemoveCommand.h10
-rw-r--r--Source/cmRemoveDefinitionsCommand.h5
-rw-r--r--Source/cmReturnCommand.cxx2
-rw-r--r--Source/cmReturnCommand.h10
-rw-r--r--Source/cmRulePlaceholderExpander.cxx16
-rw-r--r--Source/cmRulePlaceholderExpander.h3
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx7
-rw-r--r--Source/cmSeparateArgumentsCommand.h10
-rw-r--r--Source/cmServer.cxx19
-rw-r--r--Source/cmServer.h7
-rw-r--r--Source/cmServerConnection.cxx3
-rw-r--r--Source/cmServerConnection.h14
-rw-r--r--Source/cmServerProtocol.cxx23
-rw-r--r--Source/cmServerProtocol.h16
-rw-r--r--Source/cmSetCommand.h10
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h13
-rw-r--r--Source/cmSetPropertyCommand.h10
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h8
-rw-r--r--Source/cmSetTargetPropertiesCommand.h5
-rw-r--r--Source/cmSetTestsPropertiesCommand.h5
-rw-r--r--Source/cmSiteNameCommand.h10
-rw-r--r--Source/cmSourceGroupCommand.cxx32
-rw-r--r--Source/cmSourceGroupCommand.h5
-rw-r--r--Source/cmState.cxx126
-rw-r--r--Source/cmState.h12
-rw-r--r--Source/cmStringCommand.h10
-rw-r--r--Source/cmSubdirCommand.h5
-rw-r--r--Source/cmSubdirDependsCommand.h1
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h8
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h5
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h8
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h5
-rw-r--r--Source/cmTargetSourcesCommand.h5
-rw-r--r--Source/cmTryCompileCommand.h5
-rw-r--r--Source/cmTryRunCommand.h5
-rw-r--r--Source/cmUnexpectedCommand.h4
-rw-r--r--Source/cmUnsetCommand.h10
-rw-r--r--Source/cmUseMangledMesaCommand.h3
-rw-r--r--Source/cmUtilitySourceCommand.h1
-rw-r--r--Source/cmVS10MASMFlagTable.h76
-rw-r--r--Source/cmVS11MASMFlagTable.h76
-rw-r--r--Source/cmVS12MASMFlagTable.h76
-rw-r--r--Source/cmVS14MASMFlagTable.h76
-rw-r--r--Source/cmVariableRequiresCommand.h1
-rw-r--r--Source/cmVariableWatchCommand.h10
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx21
-rw-r--r--Source/cmWhileCommand.cxx2
-rw-r--r--Source/cmWhileCommand.h10
-rw-r--r--Source/cmWriteFileCommand.h10
-rw-r--r--Source/cm_auto_ptr.hxx10
-rw-r--r--Source/cmake.cxx17
-rw-r--r--Source/cmake.h9
-rw-r--r--Source/cmakemain.cxx10
-rw-r--r--Source/cmcmd.cxx4
-rw-r--r--Source/ctest.cxx18
-rw-r--r--Source/kwsys/Base64.c10
-rw-r--r--Source/kwsys/CMakeLists.txt12
-rw-r--r--Source/kwsys/CommandLineArguments.cxx88
-rw-r--r--Source/kwsys/Directory.cxx7
-rw-r--r--Source/kwsys/DynamicLoader.cxx34
-rw-r--r--Source/kwsys/Glob.cxx12
-rw-r--r--Source/kwsys/MD5.c10
-rw-r--r--Source/kwsys/Process.h.in73
-rw-r--r--Source/kwsys/ProcessUNIX.c233
-rw-r--r--Source/kwsys/ProcessWin32.c253
-rw-r--r--Source/kwsys/SharedForward.h.in18
-rw-r--r--Source/kwsys/System.c4
-rw-r--r--Source/kwsys/SystemInformation.cxx8
-rw-r--r--Source/kwsys/SystemTools.cxx31
-rw-r--r--Source/kwsys/Terminal.c10
-rw-r--r--Source/kwsys/kwsysPlatformTestsC.c3
-rw-r--r--Source/kwsys/testConsoleBuf.cxx13
-rw-r--r--Source/kwsys/testConsoleBufChild.cxx1
-rw-r--r--Source/kwsys/testEncoding.cxx3
-rw-r--r--Source/kwsys/testFStream.cxx3
-rw-r--r--Source/kwsys/testSystemTools.cxx7
-rw-r--r--Templates/TestDriver.cxx.in2
-rw-r--r--Tests/CMakeLists.txt5
-rw-r--r--Tests/CMakeTests/CMakeLists.txt1
-rw-r--r--Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in60
-rw-r--r--Tests/CMakeTests/SeparateArgumentsTest.cmake.in25
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt10
-rw-r--r--Tests/CompileFeatures/default_dialect.c3
-rw-r--r--Tests/FindGTest/Test/CMakeLists.txt3
-rw-r--r--Tests/FindMPI/Test/CMakeLists.txt2
-rw-r--r--Tests/FindOpenMP/Test/CMakeLists.txt8
-rw-r--r--Tests/FindProtobuf/CMakeLists.txt10
-rw-r--r--Tests/FindProtobuf/Test/CMakeLists.txt32
-rw-r--r--Tests/FindProtobuf/Test/main-protoc.cxx8
-rw-r--r--Tests/FindProtobuf/Test/main.cxx8
-rw-r--r--Tests/FindTIFF/Test/CMakeLists.txt3
-rw-r--r--Tests/FindXalanC/Test/CMakeLists.txt3
-rw-r--r--Tests/FindXercesC/Test/CMakeLists.txt3
-rw-r--r--Tests/GoogleTest/CMakeLists.txt10
-rw-r--r--Tests/GoogleTest/Test/CMakeLists.txt82
-rw-r--r--Tests/GoogleTest/Test/main1.cxx30
-rw-r--r--Tests/GoogleTest/Test/main2.cxx1
-rw-r--r--Tests/GoogleTest/Test/main2.h6
-rw-r--r--Tests/GoogleTest/Test/main3.cxx11
-rw-r--r--Tests/GoogleTest/Test/main4.cxx1
-rw-r--r--Tests/GoogleTest/Test/main4.h6
-rw-r--r--Tests/RunCMake/AutoExportDll/foo.c2
-rw-r--r--Tests/RunCMake/AutoExportDll/say.cxx10
-rw-r--r--Tests/RunCMake/CMP0069/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CPack/STGZ/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake5
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake26
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake14
-rw-r--r--Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt4
-rw-r--r--Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt3
-rw-r--r--Tests/RunCMake/Ninja/CommandConcat.cmake14
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake50
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_any_bar-stdout.txt15
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_any_foo-stdout.txt13
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_any_foobar-stdout.txt9
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_cleanup_bar-stdout.txt15
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_cleanup_foo-stdout.txt15
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_setup_bar-stdout.txt17
-rw-r--r--Tests/RunCMake/ctest_fixtures/exclude_setup_foo-stdout.txt15
-rw-r--r--Tests/RunCMake/ctest_fixtures/test.cmake.in2
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt3
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/separate_arguments/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/separate_arguments/EmptyCommand.cmake6
-rw-r--r--Tests/RunCMake/separate_arguments/NativeCommand.cmake19
-rw-r--r--Tests/RunCMake/separate_arguments/PlainCommand.cmake8
-rw-r--r--Tests/RunCMake/separate_arguments/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/separate_arguments/UnixCommand.cmake8
-rw-r--r--Tests/RunCMake/separate_arguments/WindowsCommand.cmake8
-rw-r--r--Tests/Server/cmakelib.py5
-rw-r--r--Tests/Server/server-test.py1
-rw-r--r--Tests/SourceGroups/CMakeLists.txt9
-rw-r--r--Tests/SourceGroups/main.c9
-rw-r--r--Tests/SourceGroups/tree_foo.c4
-rw-r--r--Tests/SourceGroups/tree_prefix_bar.c4
-rw-r--r--Tests/SourceGroups/tree_prefix_foo.c4
-rw-r--r--Utilities/.clang-tidy6
-rw-r--r--Utilities/CMakeLists.txt3
-rw-r--r--Utilities/IWYU/mapping.imp11
-rw-r--r--Utilities/Release/osx_release.cmake2
-rwxr-xr-xUtilities/Scripts/update-curl.bash3
-rw-r--r--Utilities/Sphinx/CMakeLists.txt26
-rw-r--r--Utilities/cmcurl/CMake/CurlTests.c16
-rw-r--r--Utilities/cmcurl/CMake/FindGSS.cmake2
-rw-r--r--Utilities/cmcurl/CMake/FindMbedTLS.cmake13
-rw-r--r--Utilities/cmcurl/CMake/Utilities.cmake13
-rw-r--r--Utilities/cmcurl/CMakeLists.txt215
-rw-r--r--Utilities/cmcurl/COPYING2
-rw-r--r--Utilities/cmcurl/include/curl/curl.h32
-rw-r--r--Utilities/cmcurl/include/curl/curlrules.h25
-rw-r--r--Utilities/cmcurl/include/curl/curlver.h12
-rw-r--r--Utilities/cmcurl/include/curl/system.h484
-rw-r--r--Utilities/cmcurl/include/curl/typecheck-gcc.h3
-rw-r--r--Utilities/cmcurl/lib/asyn-ares.c31
-rw-r--r--Utilities/cmcurl/lib/conncache.c55
-rw-r--r--Utilities/cmcurl/lib/conncache.h4
-rw-r--r--Utilities/cmcurl/lib/connect.c5
-rw-r--r--Utilities/cmcurl/lib/connect.h6
-rw-r--r--Utilities/cmcurl/lib/content_encoding.c5
-rw-r--r--Utilities/cmcurl/lib/cookie.c50
-rw-r--r--Utilities/cmcurl/lib/curl_addrinfo.c32
-rw-r--r--Utilities/cmcurl/lib/curl_addrinfo.h2
-rw-r--r--Utilities/cmcurl/lib/curl_config.h.cmake12
-rw-r--r--Utilities/cmcurl/lib/curl_des.c2
-rw-r--r--Utilities/cmcurl/lib/curl_fnmatch.c8
-rw-r--r--Utilities/cmcurl/lib/curl_memory.h4
-rw-r--r--Utilities/cmcurl/lib/curl_ntlm_core.c12
-rw-r--r--Utilities/cmcurl/lib/curl_ntlm_core.h27
-rw-r--r--Utilities/cmcurl/lib/curl_ntlm_wb.c2
-rw-r--r--Utilities/cmcurl/lib/curl_sasl.c2
-rw-r--r--Utilities/cmcurl/lib/curl_setup.h13
-rw-r--r--Utilities/cmcurl/lib/dict.c2
-rw-r--r--Utilities/cmcurl/lib/easy.c58
-rw-r--r--Utilities/cmcurl/lib/escape.c4
-rw-r--r--Utilities/cmcurl/lib/file.c8
-rw-r--r--Utilities/cmcurl/lib/formdata.c120
-rw-r--r--Utilities/cmcurl/lib/ftp.c112
-rw-r--r--Utilities/cmcurl/lib/ftplistparser.c10
-rw-r--r--Utilities/cmcurl/lib/gopher.c6
-rw-r--r--Utilities/cmcurl/lib/hash.c68
-rw-r--r--Utilities/cmcurl/lib/hash.h6
-rw-r--r--Utilities/cmcurl/lib/hostcheck.c2
-rw-r--r--Utilities/cmcurl/lib/hostip.c6
-rw-r--r--Utilities/cmcurl/lib/hostip.h4
-rw-r--r--Utilities/cmcurl/lib/http.c123
-rw-r--r--Utilities/cmcurl/lib/http.h4
-rw-r--r--Utilities/cmcurl/lib/http2.c98
-rw-r--r--Utilities/cmcurl/lib/http_ntlm.c2
-rw-r--r--Utilities/cmcurl/lib/http_proxy.c97
-rw-r--r--Utilities/cmcurl/lib/imap.c9
-rw-r--r--Utilities/cmcurl/lib/libcurl.rc4
-rw-r--r--Utilities/cmcurl/lib/llist.c22
-rw-r--r--Utilities/cmcurl/lib/llist.h4
-rw-r--r--Utilities/cmcurl/lib/memdebug.c4
-rw-r--r--Utilities/cmcurl/lib/mprintf.c6
-rw-r--r--Utilities/cmcurl/lib/multi.c257
-rw-r--r--Utilities/cmcurl/lib/multihandle.h16
-rw-r--r--Utilities/cmcurl/lib/nonblock.c3
-rw-r--r--Utilities/cmcurl/lib/pingpong.c6
-rw-r--r--Utilities/cmcurl/lib/pingpong.h6
-rw-r--r--Utilities/cmcurl/lib/pipeline.c81
-rw-r--r--Utilities/cmcurl/lib/pipeline.h6
-rw-r--r--Utilities/cmcurl/lib/pop3.c9
-rw-r--r--Utilities/cmcurl/lib/progress.c24
-rw-r--r--Utilities/cmcurl/lib/rand.c6
-rw-r--r--Utilities/cmcurl/lib/rtsp.c70
-rw-r--r--Utilities/cmcurl/lib/security.c4
-rw-r--r--Utilities/cmcurl/lib/select.c8
-rw-r--r--Utilities/cmcurl/lib/select.h6
-rw-r--r--Utilities/cmcurl/lib/sendf.c99
-rw-r--r--Utilities/cmcurl/lib/smb.c41
-rw-r--r--Utilities/cmcurl/lib/smtp.c9
-rw-r--r--Utilities/cmcurl/lib/socks.c12
-rw-r--r--Utilities/cmcurl/lib/speedcheck.c61
-rw-r--r--Utilities/cmcurl/lib/splay.c110
-rw-r--r--Utilities/cmcurl/lib/splay.h3
-rw-r--r--Utilities/cmcurl/lib/ssh.c319
-rw-r--r--Utilities/cmcurl/lib/strcase.c6
-rw-r--r--Utilities/cmcurl/lib/system_win32.c4
-rw-r--r--Utilities/cmcurl/lib/telnet.c37
-rw-r--r--Utilities/cmcurl/lib/tftp.c6
-rw-r--r--Utilities/cmcurl/lib/timeval.c3
-rw-r--r--Utilities/cmcurl/lib/transfer.c48
-rw-r--r--Utilities/cmcurl/lib/url.c719
-rw-r--r--Utilities/cmcurl/lib/urldata.h62
-rw-r--r--Utilities/cmcurl/lib/vauth/digest.c8
-rw-r--r--Utilities/cmcurl/lib/vauth/digest_sspi.c290
-rw-r--r--Utilities/cmcurl/lib/vauth/krb5_gssapi.c4
-rw-r--r--Utilities/cmcurl/lib/vauth/krb5_sspi.c4
-rw-r--r--Utilities/cmcurl/lib/vauth/ntlm.c22
-rw-r--r--Utilities/cmcurl/lib/vauth/ntlm.h2
-rw-r--r--Utilities/cmcurl/lib/vauth/spnego_sspi.c3
-rw-r--r--Utilities/cmcurl/lib/vtls/axtls.c28
-rw-r--r--Utilities/cmcurl/lib/vtls/axtls.h8
-rw-r--r--Utilities/cmcurl/lib/vtls/cyassl.c47
-rw-r--r--Utilities/cmcurl/lib/vtls/cyassl.h10
-rw-r--r--Utilities/cmcurl/lib/vtls/darwinssl.c218
-rw-r--r--Utilities/cmcurl/lib/vtls/darwinssl.h6
-rw-r--r--Utilities/cmcurl/lib/vtls/gskit.c52
-rw-r--r--Utilities/cmcurl/lib/vtls/gtls.c173
-rw-r--r--Utilities/cmcurl/lib/vtls/gtls.h8
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls.c166
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls.h12
-rw-r--r--Utilities/cmcurl/lib/vtls/nss.c181
-rw-r--r--Utilities/cmcurl/lib/vtls/nssg.h8
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.c364
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.h6
-rw-r--r--Utilities/cmcurl/lib/vtls/polarssl.c100
-rw-r--r--Utilities/cmcurl/lib/vtls/polarssl.h3
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel.c81
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel.h4
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls.c63
-rw-r--r--Utilities/cmcurl/lib/warnless.c5
-rw-r--r--Utilities/cmcurl/lib/wildcard.c18
-rw-r--r--Utilities/cmcurl/lib/wildcard.h9
-rw-r--r--Utilities/cmjsoncpp/CMakeLists.txt1
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt4
-rw-r--r--Utilities/cmlibuv/CMakeLists.txt22
-rw-r--r--Utilities/cmlibuv/include/uv-unix.h15
-rw-r--r--Utilities/cmlibuv/include/uv.h8
-rw-r--r--Utilities/cmlibuv/src/threadpool.c35
-rw-r--r--Utilities/cmlibuv/src/unix/aix.c7
-rw-r--r--Utilities/cmlibuv/src/unix/async.c121
-rw-r--r--Utilities/cmlibuv/src/unix/bsd-ifaddrs.c133
-rw-r--r--Utilities/cmlibuv/src/unix/core.c45
-rw-r--r--Utilities/cmlibuv/src/unix/darwin.c104
-rw-r--r--Utilities/cmlibuv/src/unix/freebsd.c114
-rw-r--r--Utilities/cmlibuv/src/unix/internal.h22
-rw-r--r--Utilities/cmlibuv/src/unix/kqueue.c36
-rw-r--r--Utilities/cmlibuv/src/unix/linux-core.c53
-rw-r--r--Utilities/cmlibuv/src/unix/linux-inotify.c67
-rw-r--r--Utilities/cmlibuv/src/unix/loop.c38
-rw-r--r--Utilities/cmlibuv/src/unix/netbsd.c108
-rw-r--r--Utilities/cmlibuv/src/unix/openbsd.c111
-rw-r--r--Utilities/cmlibuv/src/unix/os390-syscalls.c2
-rw-r--r--Utilities/cmlibuv/src/unix/os390.c6
-rw-r--r--Utilities/cmlibuv/src/unix/pipe.c7
-rw-r--r--Utilities/cmlibuv/src/unix/posix-hrtime.c35
-rw-r--r--Utilities/cmlibuv/src/unix/signal.c100
-rw-r--r--Utilities/cmlibuv/src/unix/stream.c9
-rw-r--r--Utilities/cmlibuv/src/unix/sunos.c38
-rw-r--r--Utilities/cmlibuv/src/unix/udp.c33
-rw-r--r--Utilities/cmlibuv/src/uv-common.h35
-rw-r--r--Utilities/cmlibuv/src/win/async.c3
-rw-r--r--Utilities/cmlibuv/src/win/atomicops-inl.h3
-rw-r--r--Utilities/cmlibuv/src/win/core.c21
-rw-r--r--Utilities/cmlibuv/src/win/detect-wakeup.c6
-rw-r--r--Utilities/cmlibuv/src/win/fs-event.c33
-rw-r--r--Utilities/cmlibuv/src/win/fs.c10
-rw-r--r--Utilities/cmlibuv/src/win/getaddrinfo.c4
-rw-r--r--Utilities/cmlibuv/src/win/getnameinfo.c3
-rw-r--r--Utilities/cmlibuv/src/win/internal.h23
-rw-r--r--Utilities/cmlibuv/src/win/pipe.c17
-rw-r--r--Utilities/cmlibuv/src/win/poll.c10
-rw-r--r--Utilities/cmlibuv/src/win/process.c3
-rw-r--r--Utilities/cmlibuv/src/win/req-inl.h9
-rw-r--r--Utilities/cmlibuv/src/win/signal.c45
-rw-r--r--Utilities/cmlibuv/src/win/stream-inl.h3
-rw-r--r--Utilities/cmlibuv/src/win/stream.c3
-rw-r--r--Utilities/cmlibuv/src/win/tcp.c13
-rw-r--r--Utilities/cmlibuv/src/win/tty.c5
-rw-r--r--Utilities/cmlibuv/src/win/udp.c6
-rw-r--r--Utilities/cmlibuv/src/win/util.c161
-rw-r--r--Utilities/cmlibuv/src/win/winapi.c2
-rw-r--r--Utilities/cmlibuv/src/win/winsock.c2
-rwxr-xr-xbootstrap44
630 files changed, 9191 insertions, 6653 deletions
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..a9d121a
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,30 @@
+---
+Checks: "-*,\
+misc-*,\
+-misc-incorrect-roundings,\
+-misc-macro-parentheses,\
+-misc-misplaced-widening-cast,\
+-misc-static-assert,\
+modernize-make-shared,\
+modernize-make-unique,\
+modernize-redundant-void-arg,\
+modernize-use-bool-literals,\
+modernize-use-nullptr,\
+modernize-use-override,\
+performance-*,\
+-performance-inefficient-string-concatenation,\
+readability-*,\
+-readability-function-size,\
+-readability-identifier-naming,\
+-readability-implicit-bool-cast,\
+-readability-inconsistent-declaration-parameter-name,\
+-readability-named-parameter,\
+-readability-redundant-declaration,\
+-readability-redundant-member-init,\
+-readability-simplify-boolean-expr,\
+"
+HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
+CheckOptions:
+ - key: modernize-use-nullptr.NullMacros
+ value: 'CM_NULLPTR'
+...
diff --git a/Auxiliary/vim/cmake.vim.in b/Auxiliary/vim/cmake.vim.in
index 89ece66..389d9e4 100644
--- a/Auxiliary/vim/cmake.vim.in
+++ b/Auxiliary/vim/cmake.vim.in
@@ -14,54 +14,56 @@ if exists("b:current_syntax")
finish
endif
-syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained
syn region cmakeComment start="#" end="$" contains=cmakeTodo,@Spell
syn region cmakeLuaComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell
-syn region cmakeGeneratorExpression start=/$</ end=/>/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeVariable,cmakeProperty,cmakeGeneratorExpressions
-syn region cmakeRegistry start=/\[/ end=/]/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeEscaped
-syn region cmakeVariableValue start=/\${/ end=/}/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeVariable
-syn region cmakeEnvironment start=/\$ENV{/ end=/}/
- \ contained oneline contains=CONTAINED,cmakeTodo
-syn region cmakeString start=/"/ end=/"/
- \ contains=CONTAINED,cmakeTodo
-syn region cmakeArguments start=/(/ end=/)/
- \ contains=ALLBUT,cmakeArguments,cmakeTodo
+
+syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained
+syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped
+
+syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo
+
+syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue
+
+syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo
+
+syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo
+
+syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeArguments,cmakeTodo
syn case match
-syn keyword cmakeProperty
+
+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_DIRECTORY_DEBUG ARCHIVE_OUTPUT_DIRECTORY_RELEASE ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_DEBUG ARCHIVE_OUTPUT_NAME_RELEASE ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_MOC_OPTIONS AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTOUIC AUTOUIC_OPTIONS BINARY_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_DEFINITIONS_DEBUG COMPILE_DEFINITIONS_RELEASE COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_NAME_DEBUG COMPILE_PDB_NAME_RELEASE COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXCLUDE_FROM_DEFAULT_BUILD_DEBUG EXCLUDE_FROM_DEFAULT_BUILD_RELEASE EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME 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_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE IMPORTED_NO_SONAME IMPORTED_NO_SONAME_DEBUG IMPORTED_NO_SONAME_RELEASE IMPORTED_SONAME IMPORTED_SONAME_DEBUG IMPORTED_SONAME_RELEASE 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 INTERPROCEDURAL_OPTIMIZATION_DEBUG INTERPROCEDURAL_OPTIMIZATION_RELEASE IN_TRY_COMPILE JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_DEBUG LIBRARY_OUTPUT_DIRECTORY_RELEASE LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_DEBUG LIBRARY_OUTPUT_NAME_RELEASE LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_FLAGS_DEBUG LINK_FLAGS_RELEASE LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_LIBRARIES_RELEASE LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_DEBUG LINK_INTERFACE_MULTIPLICITY_RELEASE LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LISTFILE_STACK LOCATION LOCATION_DEBUG LOCATION_RELEASE MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MAP_IMPORTED_CONFIG_DEBUG MAP_IMPORTED_CONFIG_RELEASE MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OSX_ARCHITECTURES_DEBUG OSX_ARCHITECTURES_RELEASE OUTPUT_NAME OUTPUT_NAME_DEBUG OUTPUT_NAME_RELEASE PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_NAME_DEBUG PDB_NAME_RELEASE PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_DEBUG PDB_OUTPUT_DIRECTORY_RELEASE 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_DIRECTORY_DEBUG RUNTIME_OUTPUT_DIRECTORY_RELEASE RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_DEBUG RUNTIME_OUTPUT_NAME_RELEASE RUN_SERIAL SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_DEBUG STATIC_LIBRARY_FLAGS_RELEASE STRINGS SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TIMEOUT TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE 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_EXPLICIT_FILE_TYPE XCODE_LAST_KNOWN_FILE_TYPE XCTEST
- \ contained
-syn keyword cmakeVariable
+syn keyword cmakeVariable contained
@VARIABLE_LIST@
- \ contained
-syn keyword cmakeModule
+syn keyword cmakeModule contained
@MODULES@
- \ contained
@KEYWORDS@
-syn keyword cmakeGeneratorExpressions
+syn keyword cmakeGeneratorExpressions contained
@GENERATOR_EXPRESSIONS@
- \ contained
syn case ignore
+
syn keyword cmakeCommand
@COMMAND_LIST@
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandConditional
@CONDITIONALS@
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandRepeat
@LOOPS@
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandDeprecated
@DEPRECATED@
\ nextgroup=cmakeArguments
+
syn case match
syn keyword cmakeTodo
@@ -76,15 +78,15 @@ hi def link cmakeComment Comment
hi def link cmakeEnvironment Special
hi def link cmakeEscaped Special
hi def link cmakeGeneratorExpression WarningMsg
-hi def link cmakeGeneratorExpressions ModeMsg
+hi def link cmakeGeneratorExpressions Constant
hi def link cmakeLuaComment Comment
hi def link cmakeModule Include
hi def link cmakeProperty Constant
hi def link cmakeRegistry Underlined
hi def link cmakeString String
hi def link cmakeTodo TODO
-hi def link cmakeVariable Identifier
hi def link cmakeVariableValue Type
+hi def link cmakeVariable Identifier
@KEYWORDS_HIGHLIGHT@
diff --git a/Auxiliary/vim/extract-upper-case.pl b/Auxiliary/vim/extract-upper-case.pl
index e945d52..ea77cbb 100755
--- a/Auxiliary/vim/extract-upper-case.pl
+++ b/Auxiliary/vim/extract-upper-case.pl
@@ -3,6 +3,9 @@
use strict;
use warnings;
+#my $cmake = "/home/pboettch/devel/upstream/cmake/build/bin/cmake";
+my $cmake = "cmake";
+
my @variables;
my @commands;
my @properties;
@@ -10,7 +13,7 @@ my @modules;
my %keywords; # command => keyword-list
# unwanted upper-cases
-my %unwanted = map { $_ => 1 } qw(VS CXX IDE NOTFOUND NO_ DFOO DBAR);
+my %unwanted = map { $_ => 1 } qw(VS CXX IDE NOTFOUND NO_ DFOO DBAR NEW);
# cannot remove ALL - exists for add_custom_command
# control-statements
@@ -24,9 +27,10 @@ my %deprecated = map { $_ => 1 } qw(build_name exec_program export_library_depen
push @modules, "ExternalProject";
# variables
-open(CMAKE, "cmake --help-variable-list|") or die "could not run cmake";
+open(CMAKE, "$cmake --help-variable-list|") or die "could not run cmake";
while (<CMAKE>) {
chomp;
+ next if /\</; # skip VARIABLES which contained <>-"templates"
push @variables, $_;
}
close(CMAKE);
@@ -35,17 +39,16 @@ close(CMAKE);
my %variables = map { $_ => 1 } @variables;
# commands
-open(CMAKE, "cmake --help-command-list|");
+open(CMAKE, "$cmake --help-command-list|");
while (my $cmd = <CMAKE>) {
chomp $cmd;
-
push @commands, $cmd;
}
close(CMAKE);
# now generate a keyword-list per command
foreach my $cmd (@commands) {
- my @word = extract_upper("cmake --help-command $cmd|");
+ my @word = extract_upper("$cmake --help-command $cmd|");
next if scalar @word == 0;
@@ -54,7 +57,7 @@ foreach my $cmd (@commands) {
# and now for modules
foreach my $mod (@modules) {
- my @word = extract_upper("cmake --help-module $mod|");
+ my @word = extract_upper("$cmake --help-module $mod|");
next if scalar @word == 0;
@@ -62,10 +65,10 @@ foreach my $mod (@modules) {
}
# and now for generator-expressions
-my @generator_expr = extract_upper("cmake --help-manual cmake-generator-expressions |");
+my @generator_expr = extract_upper("$cmake --help-manual cmake-generator-expressions |");
# properties
-open(CMAKE, "cmake --help-property-list|");
+open(CMAKE, "$cmake --help-property-list|");
while (<CMAKE>) {
chomp;
push @properties, $_;
@@ -88,7 +91,7 @@ while(<IN>)
! exists $deprecated{$_} } @commands;
print OUT " " x 12 , "\\ ", join(" ", @tmp), "\n";
} elsif ($1 eq "VARIABLE_LIST") {
- print OUT " " x 12 , "\\ ", join(" ", @variables), "\n";
+ print OUT " " x 12 , "\\ ", join(" ", sort keys %variables), "\n";
} elsif ($1 eq "MODULES") {
print OUT " " x 12 , "\\ ", join("\n", @modules), "\n";
} elsif ($1 eq "GENERATOR_EXPRESSIONS") {
@@ -101,9 +104,8 @@ while(<IN>)
print OUT " " x 12 , "\\ ", join(" ", sort keys %deprecated), "\n";
} elsif ($1 eq "KEYWORDS") {
foreach my $k (sort keys %keywords) {
- print OUT "syn keyword cmakeKW$k\n";
+ print OUT "syn keyword cmakeKW$k contained\n";
print OUT " " x 12, "\\ ", join(" ", @{$keywords{$k}}), "\n";
- print OUT " " x 12, "\\ contained\n";
print OUT "\n";
push @keyword_hi, "hi def link cmakeKW$k ModeMsg";
}
@@ -130,7 +132,8 @@ sub extract_upper
foreach my $w (m/\b([A-Z_]{2,})\b/g) {
next
if exists $variables{$w} or # skip if it is a variable
- exists $unwanted{$w}; # skip if not wanted
+ exists $unwanted{$w} or # skip if not wanted
+ grep(/$w/, @word); # skip if already in array
push @word, $w;
}
diff --git a/Auxiliary/vim/indent/cmake.vim b/Auxiliary/vim/indent/cmake.vim
index 76aff64..6063e43 100644
--- a/Auxiliary/vim/indent/cmake.vim
+++ b/Auxiliary/vim/indent/cmake.vim
@@ -14,6 +14,7 @@ if exists("b:did_indent")
endif
let b:did_indent = 1
+setlocal et
setlocal indentexpr=CMakeGetIndent(v:lnum)
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 1f19cb7..a191c18 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -14,425 +14,334 @@ if exists("b:current_syntax")
finish
endif
-syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained
syn region cmakeComment start="#" end="$" contains=cmakeTodo,@Spell
syn region cmakeLuaComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell
-syn region cmakeGeneratorExpression start=/$</ end=/>/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeVariable,cmakeProperty,cmakeGeneratorExpressions
-syn region cmakeRegistry start=/\[/ end=/]/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeEscaped
-syn region cmakeVariableValue start=/\${/ end=/}/
- \ contained oneline contains=CONTAINED,cmakeTodo,cmakeVariable
-syn region cmakeEnvironment start=/\$ENV{/ end=/}/
- \ contained oneline contains=CONTAINED,cmakeTodo
-syn region cmakeString start=/"/ end=/"/
- \ contains=CONTAINED,cmakeTodo
-syn region cmakeArguments start=/(/ end=/)/
- \ contains=ALLBUT,cmakeArguments,cmakeTodo
+
+syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained
+syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped
+
+syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo
+
+syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue
+
+syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo
+
+syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo
+
+syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeArguments,cmakeTodo
syn case match
-syn keyword cmakeProperty
- \ 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_DIRECTORY_DEBUG ARCHIVE_OUTPUT_DIRECTORY_RELEASE ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_DEBUG ARCHIVE_OUTPUT_NAME_RELEASE ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_MOC_OPTIONS AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTOUIC AUTOUIC_OPTIONS BINARY_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_DEFINITIONS_DEBUG COMPILE_DEFINITIONS_RELEASE COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_NAME_DEBUG COMPILE_PDB_NAME_RELEASE COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CXX_EXTENSIONS CXX_CPPLINT CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_CPPLINT C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXCLUDE_FROM_DEFAULT_BUILD_DEBUG EXCLUDE_FROM_DEFAULT_BUILD_RELEASE EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME 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_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE IMPORTED_NO_SONAME IMPORTED_NO_SONAME_DEBUG IMPORTED_NO_SONAME_RELEASE IMPORTED_SONAME IMPORTED_SONAME_DEBUG IMPORTED_SONAME_RELEASE 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 INTERPROCEDURAL_OPTIMIZATION_DEBUG INTERPROCEDURAL_OPTIMIZATION_RELEASE IN_TRY_COMPILE JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_DEBUG LIBRARY_OUTPUT_DIRECTORY_RELEASE LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_DEBUG LIBRARY_OUTPUT_NAME_RELEASE LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_FLAGS_DEBUG LINK_FLAGS_RELEASE LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_LIBRARIES_RELEASE LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_DEBUG LINK_INTERFACE_MULTIPLICITY_RELEASE LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LISTFILE_STACK LOCATION LOCATION_DEBUG LOCATION_RELEASE MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MAP_IMPORTED_CONFIG_DEBUG MAP_IMPORTED_CONFIG_RELEASE MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OSX_ARCHITECTURES_DEBUG OSX_ARCHITECTURES_RELEASE OUTPUT_NAME OUTPUT_NAME_DEBUG OUTPUT_NAME_RELEASE PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_NAME_DEBUG PDB_NAME_RELEASE PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_DEBUG PDB_OUTPUT_DIRECTORY_RELEASE 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_DIRECTORY_DEBUG RUNTIME_OUTPUT_DIRECTORY_RELEASE RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_DEBUG RUNTIME_OUTPUT_NAME_RELEASE RUN_SERIAL SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_DEBUG STATIC_LIBRARY_FLAGS_RELEASE STRINGS SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TIMEOUT TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE 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_EXPLICIT_FILE_TYPE XCODE_LAST_KNOWN_FILE_TYPE XCTEST
- \ contained
-syn keyword cmakeVariable
- \ <PROJECT-NAME>_BINARY_DIR <PROJECT-NAME>_SOURCE_DIR <PROJECT-NAME>_VERSION <PROJECT-NAME>_VERSION_MAJOR <PROJECT-NAME>_VERSION_MINOR <PROJECT-NAME>_VERSION_PATCH <PROJECT-NAME>_VERSION_TWEAK APPLE BORLAND BUILD_SHARED_LIBS CMAKE_<CONFIG>_POSTFIX CMAKE_<LANG>_ARCHIVE_APPEND CMAKE_<LANG>_ARCHIVE_CREATE CMAKE_<LANG>_ARCHIVE_FINISH CMAKE_<LANG>_COMPILER CMAKE_<LANG>_COMPILER_ABI CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN CMAKE_<LANG>_COMPILER_ID CMAKE_<LANG>_COMPILER_LAUNCHER CMAKE_<LANG>_COMPILER_LOADED CMAKE_<LANG>_COMPILER_TARGET CMAKE_<LANG>_COMPILER_VERSION CMAKE_<LANG>_COMPILE_OBJECT CMAKE_<LANG>_CREATE_SHARED_LIBRARY CMAKE_<LANG>_CREATE_SHARED_MODULE CMAKE_<LANG>_CREATE_STATIC_LIBRARY CMAKE_<LANG>_FLAGS CMAKE_<LANG>_FLAGS_DEBUG CMAKE_<LANG>_FLAGS_MINSIZEREL CMAKE_<LANG>_FLAGS_RELEASE CMAKE_<LANG>_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_GHS_KERNEL_FLAGS_DEBUG CMAKE_<LANG>_GHS_KERNEL_FLAGS_MINSIZEREL CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELEASE CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_IGNORE_EXTENSIONS CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE CMAKE_<LANG>_CPPLINT CMAKE_<LANG>_LIBRARY_ARCHITECTURE CMAKE_<LANG>_LINKER_PREFERENCE CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES CMAKE_<LANG>_LINK_EXECUTABLE CMAKE_<LANG>_OUTPUT_EXTENSION CMAKE_<LANG>_PLATFORM_ID CMAKE_<LANG>_SIMULATE_ID CMAKE_<LANG>_SIMULATE_VERSION CMAKE_<LANG>_SIZEOF_DATA_PTR CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS CMAKE_<LANG>_VISIBILITY_PRESET CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH 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_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE 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_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNU<LANG> CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND 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_DISABLE_FIND_PACKAGE_<PackageName> CMAKE_DL_LIBS 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_<CONFIG> 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_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_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_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_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI 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_OUTPUT_DIRECTORY_<CONFIG> 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_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_<CONFIG> CMAKE_MODULE_PATH 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_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_POLICY_DEFAULT_CMP<NNNN> CMAKE_POLICY_WARNING_CMP<NNNN> CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_<CONFIG> 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_STANDARD_LIBRARIES CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_<CONFIG> CMAKE_SYSROOT 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_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG> 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_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_MSDEV_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET 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_ATTRIBUTE_<an-attribute> 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_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS 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_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_VERSION
- \ contained
+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_DIRECTORY_DEBUG ARCHIVE_OUTPUT_DIRECTORY_RELEASE ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_DEBUG ARCHIVE_OUTPUT_NAME_RELEASE ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_MOC_OPTIONS AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTOUIC AUTOUIC_OPTIONS BINARY_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_DEFINITIONS_DEBUG COMPILE_DEFINITIONS_RELEASE COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_NAME_DEBUG COMPILE_PDB_NAME_RELEASE COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXCLUDE_FROM_DEFAULT_BUILD_DEBUG EXCLUDE_FROM_DEFAULT_BUILD_RELEASE EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME 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_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE IMPORTED_NO_SONAME IMPORTED_NO_SONAME_DEBUG IMPORTED_NO_SONAME_RELEASE IMPORTED_SONAME IMPORTED_SONAME_DEBUG IMPORTED_SONAME_RELEASE 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 INTERPROCEDURAL_OPTIMIZATION_DEBUG INTERPROCEDURAL_OPTIMIZATION_RELEASE IN_TRY_COMPILE JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_DEBUG LIBRARY_OUTPUT_DIRECTORY_RELEASE LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_DEBUG LIBRARY_OUTPUT_NAME_RELEASE LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_FLAGS_DEBUG LINK_FLAGS_RELEASE LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_LIBRARIES_RELEASE LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_DEBUG LINK_INTERFACE_MULTIPLICITY_RELEASE LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LISTFILE_STACK LOCATION LOCATION_DEBUG LOCATION_RELEASE MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MAP_IMPORTED_CONFIG_DEBUG MAP_IMPORTED_CONFIG_RELEASE MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OSX_ARCHITECTURES_DEBUG OSX_ARCHITECTURES_RELEASE OUTPUT_NAME OUTPUT_NAME_DEBUG OUTPUT_NAME_RELEASE PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_NAME_DEBUG PDB_NAME_RELEASE PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_DEBUG PDB_OUTPUT_DIRECTORY_RELEASE 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_DIRECTORY_DEBUG RUNTIME_OUTPUT_DIRECTORY_RELEASE RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_DEBUG RUNTIME_OUTPUT_NAME_RELEASE RUN_SERIAL SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_DEBUG STATIC_LIBRARY_FLAGS_RELEASE STRINGS SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TIMEOUT TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE 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_EXPLICIT_FILE_TYPE XCODE_LAST_KNOWN_FILE_TYPE XCTEST
-syn keyword cmakeModule
+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_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_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_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_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_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_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
+
+syn keyword cmakeModule contained
\ ExternalProject
- \ contained
-syn keyword cmakeKWExternalProject
- \ ALGO ALWAYS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE BYPRODUCTS CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS COMMAND COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_ CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DIRECTORY DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL EXCLUDE_FROM_MAIN FORCE GIT_REMOTE_NAME GIT_REPOSITORY GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG INDEPENDENT INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR STAMP_DIR STEP_TARGETS SVN_ SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH HTTP_USERNAME HTTP_PASSWORD HTTP_HEADER USES_TERMINAL USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY _COMMAND _DIR
- \ contained
+syn keyword cmakeKWExternalProject contained
+ \ ALGO BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS COMMENT CONFIGURE_COMMAND CVSROOT CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DOWNLOADED_FILE DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_EXTRACT DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL FORCE GIT_CONFIG GIT_PROGRESS GIT_REMOTE_NAME GIT_REPOSITORY GIT_SHALLOW GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG HTTP_HEADER HTTP_PASSWORD HTTP_USERNAME INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR SOURCE_SUBDIR STAMP_DIR STEP_TARGETS SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY
-syn keyword cmakeKWadd_compile_options
+syn keyword cmakeKWadd_compile_options contained
\ COMPILE_OPTIONS
- \ contained
-syn keyword cmakeKWadd_custom_command
- \ APPEND ARGS BYPRODUCTS COMMAND COMMENT DEPENDS GENERATE GENERATED IMPLICIT_DEPENDS MAIN_DEPENDENCY NOT OUTPUT POST_BUILD PRE_BUILD PRE_LINK SYMBOLIC TARGET TARGET_FILE USES_TERMINAL VERBATIM WORKING_DIRECTORY
- \ contained
+syn keyword cmakeKWadd_custom_command contained
+ \ APPEND ARGS BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS DEPFILE GENERATED IMPLICIT_DEPENDS INCLUDE_DIRECTORIES JOIN MAIN_DEPENDENCY NOT OUTPUT POST_BUILD PRE_BUILD PRE_LINK SYMBOLIC TARGET_FILE TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY
-syn keyword cmakeKWadd_custom_target
- \ ALL BYPRODUCTS COMMAND COMMENT DEPENDS GENERATE GENERATED SOURCES USES_TERMINAL VERBATIM WORKING_DIRECTORY
- \ contained
+syn keyword cmakeKWadd_custom_target contained
+ \ ALL BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS GENERATED INCLUDE_DIRECTORIES JOIN SOURCES TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY
-syn keyword cmakeKWadd_definitions
+syn keyword cmakeKWadd_definitions contained
\ COMPILE_DEFINITIONS
- \ contained
-syn keyword cmakeKWadd_dependencies
+syn keyword cmakeKWadd_dependencies contained
\ DEPENDS OBJECT_DEPENDS
- \ contained
-syn keyword cmakeKWadd_executable
+syn keyword cmakeKWadd_executable contained
\ ALIAS CONFIG EXCLUDE_FROM_ALL GLOBAL IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ MACOSX_BUNDLE OUTPUT_NAME RUNTIME_OUTPUT_DIRECTORY TARGET
- \ contained
-syn keyword cmakeKWadd_library
- \ ALIAS ARCHIVE_OUTPUT_DIRECTORY CLI CONFIG DLL EXCLUDE_FROM_ALL FRAMEWORK GLOBAL IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ INTERFACE INTERFACE_ LIBRARY_OUTPUT_DIRECTORY MODULE OBJECT ON OS OUTPUT_NAME POSITION_INDEPENDENT_CODE POST_BUILD PRE_BUILD PRE_LINK RUNTIME_OUTPUT_DIRECTORY SHARED STATIC TARGET TARGET_OBJECTS UNKNOWN
- \ contained
+syn keyword cmakeKWadd_library contained
+ \ ALIAS ARCHIVE_OUTPUT_DIRECTORY CLI CONFIG DLL EXCLUDE_FROM_ALL FRAMEWORK GLOBAL IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ INTERFACE_ LIBRARY_OUTPUT_DIRECTORY MODULE OBJECT ON OUTPUT_NAME POSITION_INDEPENDENT_CODE POST_BUILD PRE_BUILD PRE_LINK RUNTIME_OUTPUT_DIRECTORY SHARED STATIC TARGET_OBJECTS UNKNOWN
-syn keyword cmakeKWadd_subdirectory
- \ ALL EXCLUDE_FROM_ALL
- \ contained
+syn keyword cmakeKWadd_subdirectory contained
+ \ EXCLUDE_FROM_ALL
-syn keyword cmakeKWadd_test
- \ BUILD_TESTING COMMAND CONFIGURATION CONFIGURATIONS FAIL_REGULAR_EXPRESSION NAME ON PASS_REGULAR_EXPRESSION TARGET_FILE WILL_FAIL WORKING_DIRECTORY
- \ contained
+syn keyword cmakeKWadd_test contained
+ \ BUILD_TESTING COMMAND CONFIGURATIONS FAIL_REGULAR_EXPRESSION NAME PASS_REGULAR_EXPRESSION TARGET_FILE WILL_FAIL WORKING_DIRECTORY
-syn keyword cmakeKWbuild_command
- \ CONFIGURATION NEW TARGET
- \ contained
+syn keyword cmakeKWbuild_command contained
+ \ CONFIGURATION TARGET
-syn keyword cmakeKWbuild_name
+syn keyword cmakeKWbuild_name contained
\ CMAKE_CXX_COMPILER
- \ contained
-syn keyword cmakeKWcmake_host_system_information
+syn keyword cmakeKWcmake_host_system_information contained
\ AVAILABLE_PHYSICAL_MEMORY AVAILABLE_VIRTUAL_MEMORY FQDN HOSTNAME NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES QUERY RESULT TOTAL_PHYSICAL_MEMORY TOTAL_VIRTUAL_MEMORY
- \ contained
-syn keyword cmakeKWcmake_minimum_required
+syn keyword cmakeKWcmake_minimum_required contained
\ FATAL_ERROR VERSION
- \ contained
-syn keyword cmakeKWcmake_parse_arguments
- \ ARGN CONFIGURATIONS DESTINATION FALSE FAST FILES MY_INSTALL MY_INSTALL_CONFIGURATIONS MY_INSTALL_DESTINATION MY_INSTALL_FAST MY_INSTALL_OPTIONAL MY_INSTALL_RENAME MY_INSTALL_TARGETS MY_INSTALL_UNPARSED_ARGUMENTS OPTIONAL RENAME TARGETS TRUE _UNPARSED_ARGUMENTS
- \ contained
+syn keyword cmakeKWcmake_parse_arguments contained
+ \ ARGN CONFIGURATIONS DESTINATION FALSE FAST FILES MY_INSTALL MY_INSTALL_CONFIGURATIONS MY_INSTALL_DESTINATION MY_INSTALL_FAST MY_INSTALL_OPTIONAL MY_INSTALL_RENAME MY_INSTALL_TARGETS MY_INSTALL_UNPARSED_ARGUMENTS OPTIONAL PARSE_ARGV RENAME TARGETS TRUE _UNPARSED_ARGUMENTS
-syn keyword cmakeKWcmake_policy
- \ CMAKE_POLICY_DEFAULT_CMP CMP GET NEW NNNN NO_POLICY_SCOPE OLD POP PUSH SET VERSION
- \ contained
+syn keyword cmakeKWcmake_policy contained
+ \ CMAKE_POLICY_DEFAULT_CMP CMP GET NNNN NO_POLICY_SCOPE OLD POP PUSH SET VERSION
-syn keyword cmakeKWconfigure_file
- \ COPYONLY CRLF DOS ESCAPE_QUOTES FOO_ENABLE FOO_STRING LF NEWLINE_STYLE ON ONLY VAR
- \ contained
+syn keyword cmakeKWconfigure_file contained
+ \ COPYONLY CRLF DOS ESCAPE_QUOTES FOO_ENABLE FOO_STRING LF NEWLINE_STYLE VAR
-syn keyword cmakeKWcreate_test_sourcelist
+syn keyword cmakeKWcreate_test_sourcelist contained
\ CMAKE_TESTDRIVER_AFTER_TESTMAIN CMAKE_TESTDRIVER_BEFORE_TESTMAIN EXTRA_INCLUDE FUNCTION
- \ contained
-syn keyword cmakeKWctest_build
- \ ALL_BUILD APPEND BUILD CONFIGURATION CTEST_BUILD_CONFIGURATION CTEST_BUILD_FLAGS CTEST_BUILD_TARGET CTEST_PROJECT_NAME FLAGS NUMBER_ERRORS NUMBER_WARNINGS QUIET RETURN_VALUE TARGET
- \ contained
+syn keyword cmakeKWctest_build contained
+ \ ALL_BUILD APPEND BUILD CAPTURE_CMAKE_ERROR CONFIGURATION CTEST_BUILD_CONFIGURATION CTEST_BUILD_FLAGS CTEST_BUILD_TARGET CTEST_PROJECT_NAME FLAGS NUMBER_ERRORS NUMBER_WARNINGS QUIET RETURN_VALUE TARGET
-syn keyword cmakeKWctest_configure
- \ APPEND BUILD OPTIONS QUIET RETURN_VALUE SOURCE
- \ contained
+syn keyword cmakeKWctest_configure contained
+ \ APPEND BUILD CAPTURE_CMAKE_ERROR OPTIONS QUIET RETURN_VALUE SOURCE
-syn keyword cmakeKWctest_coverage
- \ APPEND BUILD LABELS QUIET RETURN_VALUE
- \ contained
+syn keyword cmakeKWctest_coverage contained
+ \ APPEND BUILD CAPTURE_CMAKE_ERROR LABELS QUIET RETURN_VALUE
-syn keyword cmakeKWctest_memcheck
- \ APPEND BUILD DEFECT_COUNT END EXCLUDE EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
- \ contained
+syn keyword cmakeKWctest_memcheck contained
+ \ APPEND BUILD DEFECT_COUNT EXCLUDE EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
-syn keyword cmakeKWctest_run_script
+syn keyword cmakeKWctest_run_script contained
\ NEW_PROCESS RETURN_VALUE
- \ contained
-syn keyword cmakeKWctest_start
+syn keyword cmakeKWctest_start contained
\ APPEND QUIET TAG TRACK
- \ contained
-syn keyword cmakeKWctest_submit
+syn keyword cmakeKWctest_submit contained
\ API CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE
- \ contained
-syn keyword cmakeKWctest_test
- \ APPEND BUILD CPU END EXCLUDE EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
- \ contained
+syn keyword cmakeKWctest_test contained
+ \ APPEND BUILD CAPTURE_CMAKE_ERROR CPU EXCLUDE EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
-syn keyword cmakeKWctest_update
+syn keyword cmakeKWctest_update contained
\ QUIET RETURN_VALUE SOURCE
- \ contained
-syn keyword cmakeKWctest_upload
- \ FILES QUIET
- \ contained
+syn keyword cmakeKWctest_upload contained
+ \ CAPTURE_CMAKE_ERROR FILES QUIET
-syn keyword cmakeKWdefine_property
+syn keyword cmakeKWdefine_property contained
\ BRIEF_DOCS CACHED_VARIABLE DIRECTORY FULL_DOCS GLOBAL INHERITED PROPERTY SOURCE TARGET TEST VARIABLE
- \ contained
-syn keyword cmakeKWenable_language
+syn keyword cmakeKWenable_language contained
\ OPTIONAL
- \ contained
-syn keyword cmakeKWexec_program
+syn keyword cmakeKWexec_program contained
\ ARGS OUTPUT_VARIABLE RETURN_VALUE
- \ contained
-syn keyword cmakeKWexecute_process
- \ COMMAND ERROR_ ERROR_FILE ERROR_QUIET ERROR_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE INPUT_ INPUT_FILE OUTPUT_ OUTPUT_FILE OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE RESULT_VARIABLE TIMEOUT VERBATIM WORKING_DIRECTORY
- \ contained
+syn keyword cmakeKWexecute_process contained
+ \ ANSI AUTO COMMAND ENCODING ERROR_FILE ERROR_QUIET ERROR_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE INPUT_FILE NONE OEM OUTPUT_FILE OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE RESULT_VARIABLE TIMEOUT UTF VERBATIM WORKING_DIRECTORY
-syn keyword cmakeKWexport
- \ APPEND CONFIG EXPORT EXPORT_LINK_INTERFACE_LIBRARIES FILE IMPORTED IMPORTED_ LINK_INTERFACE_LIBRARIES NAMESPACE NEW PACKAGE TARGETS
- \ contained
+syn keyword cmakeKWexport contained
+ \ ANDROID_MK APPEND CONFIG EXPORT EXPORT_LINK_INTERFACE_LIBRARIES FILE IMPORTED IMPORTED_ NAMESPACE NDK OLD PACKAGE TARGETS
-syn keyword cmakeKWexport_library_dependencies
+syn keyword cmakeKWexport_library_dependencies contained
\ APPEND EXPORT INCLUDE LINK_INTERFACE_LIBRARIES SET
- \ contained
-syn keyword cmakeKWfile
- \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILE FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HEX INACTIVITY_TIMEOUT INPUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NEW NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFF OFFSET OLD ON OUTPUT PATH PATTERN PERMISSIONS PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SORT SSL STATUS STRINGS TIMEOUT TIMESTAMP TLS TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USE_SOURCE_PERMISSIONS UTC UTF WRITE
- \ contained
+syn keyword cmakeKWfile contained
+ \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HASH HEX HTTPHEADER INACTIVITY_TIMEOUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFFSET OLD PATTERN PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SORT SSL STATUS STRINGS TIMESTAMP TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USERPWD USE_SOURCE_PERMISSIONS UTC UTF WRITE
-syn keyword cmakeKWfind_file
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATH PATHS PATH_SUFFIXES VAR
- \ contained
+syn keyword cmakeKWfind_file contained
+ \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
-syn keyword cmakeKWfind_library
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS LIB NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATH PATHS PATH_SUFFIXES VAR
- \ contained
+syn keyword cmakeKWfind_library contained
+ \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS LIB NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
-syn keyword cmakeKWfind_package
- \ CMAKE_DISABLE_FIND_PACKAGE_ CMAKE_FIND_ROOT_PATH_BOTH COMPONENTS CONFIG CONFIGS DVAR EXACT HINTS MODULE NAMES NO_CMAKE_BUILDS_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_PATH NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_MODULE NO_POLICY_SCOPE NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OPTIONAL_COMPONENTS OS PACKAGE_FIND_NAME PACKAGE_FIND_VERSION PACKAGE_FIND_VERSION_COUNT PACKAGE_FIND_VERSION_MAJOR PACKAGE_FIND_VERSION_MINOR PACKAGE_FIND_VERSION_PATCH PACKAGE_FIND_VERSION_TWEAK PACKAGE_VERSION PACKAGE_VERSION_COMPATIBLE PACKAGE_VERSION_EXACT PACKAGE_VERSION_UNSUITABLE PATH PATHS PATH_SUFFIXES QUIET REQUIRED TRUE _CONFIG _CONSIDERED_CONFIGS _CONSIDERED_VERSIONS _DIR _FIND_COMPONENTS _FIND_QUIETLY _FIND_REQUIRED _FIND_REQUIRED_ _FIND_VERSION _FIND_VERSION_COUNT _FIND_VERSION_EXACT _FIND_VERSION_MAJOR _FIND_VERSION_MINOR _FIND_VERSION_PATCH _FIND_VERSION_TWEAK _FOUND _VERSION _VERSION_COUNT _VERSION_MAJOR _VERSION_MINOR _VERSION_PATCH _VERSION_TWEAK
- \ contained
+syn keyword cmakeKWfind_package contained
+ \ CMAKE_DISABLE_FIND_PACKAGE_ CMAKE_FIND_ROOT_PATH_BOTH COMPONENTS CONFIG CONFIGS DEC DVAR EXACT HINTS MODULE NAMES NATURAL NO_CMAKE_BUILDS_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_PATH NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_MODULE NO_POLICY_SCOPE NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OPTIONAL_COMPONENTS OS PACKAGE_FIND_NAME PACKAGE_FIND_VERSION PACKAGE_FIND_VERSION_COUNT PACKAGE_FIND_VERSION_MAJOR PACKAGE_FIND_VERSION_MINOR PACKAGE_FIND_VERSION_PATCH PACKAGE_FIND_VERSION_TWEAK PACKAGE_VERSION PACKAGE_VERSION_COMPATIBLE PACKAGE_VERSION_EXACT PACKAGE_VERSION_UNSUITABLE PATHS PATH_SUFFIXES QUIET REQUIRED SET TRUE _CONFIG _CONSIDERED_CONFIGS _CONSIDERED_VERSIONS _DIR _FIND_COMPONENTS _FIND_QUIETLY _FIND_REQUIRED _FIND_REQUIRED_ _FIND_VERSION_EXACT _FOUND
-syn keyword cmakeKWfind_path
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATH PATHS PATH_SUFFIXES VAR
- \ contained
+syn keyword cmakeKWfind_path contained
+ \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
-syn keyword cmakeKWfind_program
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATH PATHS PATH_SUFFIXES VAR
- \ contained
+syn keyword cmakeKWfind_program contained
+ \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
-syn keyword cmakeKWfltk_wrap_ui
+syn keyword cmakeKWfltk_wrap_ui contained
\ FLTK
- \ contained
-syn keyword cmakeKWforeach
+syn keyword cmakeKWforeach contained
\ ARGS IN ITEMS LISTS RANGE
- \ contained
-syn keyword cmakeKWfunction
+syn keyword cmakeKWfunction contained
\ ARGC ARGN ARGS ARGV PARENT_SCOPE
- \ contained
-syn keyword cmakeKWget_cmake_property
- \ VAR
- \ contained
+syn keyword cmakeKWget_cmake_property contained
+ \ COMPONENTS GLOBAL MACROS VAR VARIABLES
-syn keyword cmakeKWget_directory_property
+syn keyword cmakeKWget_directory_property contained
\ DEFINITION DIRECTORY
- \ contained
-syn keyword cmakeKWget_filename_component
+syn keyword cmakeKWget_filename_component contained
\ ABSOLUTE ARG_VAR BASE_DIR CACHE COMP DIRECTORY EXT NAME NAME_WE PATH PROGRAM PROGRAM_ARGS REALPATH VAR
- \ contained
-syn keyword cmakeKWget_property
+syn keyword cmakeKWget_property contained
\ BRIEF_DOCS CACHE DEFINED DIRECTORY FULL_DOCS GLOBAL INSTALL PROPERTY SET SOURCE TARGET TEST VARIABLE
- \ contained
-syn keyword cmakeKWget_source_file_property
+syn keyword cmakeKWget_source_file_property contained
\ LOCATION VAR
- \ contained
-syn keyword cmakeKWget_target_property
+syn keyword cmakeKWget_target_property contained
\ VAR
- \ contained
-syn keyword cmakeKWget_test_property
+syn keyword cmakeKWget_test_property contained
\ VAR
- \ contained
-syn keyword cmakeKWif
- \ AND ARGS CMP COMMAND DEFINED EQUAL EXISTS FALSE GREATER IGNORE IN_LIST IS_ABSOLUTE IS_DIRECTORY IS_NEWER_THAN IS_SYMLINK LESS MATCHES NNNN NO NOT OFF ON OR POLICY STREQUAL STRGREATER STRLESS TARGET TEST THEN TRUE VERSION_EQUAL VERSION_GREATER VERSION_LESS YES
- \ contained
+syn keyword cmakeKWif contained
+ \ ARGS CMAKE_MATCH_ CMP COMMAND DEFINED EQUAL EXISTS FALSE GREATER GREATER_EQUAL IGNORE IN_LIST IS_ABSOLUTE IS_DIRECTORY IS_NEWER_THAN IS_SYMLINK LESS LESS_EQUAL MATCHES NNNN NOT OFF OR POLICY STREQUAL STRGREATER STRGREATER_EQUAL STRLESS STRLESS_EQUAL TARGET TEST THEN TRUE VERSION_EQUAL VERSION_GREATER VERSION_GREATER_EQUAL VERSION_LESS VERSION_LESS_EQUAL YES
-syn keyword cmakeKWinclude
- \ NO_POLICY_SCOPE OPTIONAL RESULT_VARIABLE VAR
- \ contained
+syn keyword cmakeKWinclude contained
+ \ NO_POLICY_SCOPE OPTIONAL RESULT_VARIABLE
-syn keyword cmakeKWinclude_directories
+syn keyword cmakeKWinclude_directories contained
\ AFTER BEFORE INCLUDE_DIRECTORIES ON SYSTEM
- \ contained
-syn keyword cmakeKWinclude_external_msproject
- \ GUID PLATFORM TYPE WIX
- \ contained
+syn keyword cmakeKWinclude_external_msproject contained
+ \ GUID MAP_IMPORTED_CONFIG_ PLATFORM TYPE WIX
-syn keyword cmakeKWinstall
- \ ARCHIVE BUNDLE CODE COMPONENT CONFIG CONFIGURATIONS CVS DESTDIR DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DLL EXCLUDE EXCLUDE_FROM_ALL EXPORT EXPORT_LINK_INTERFACE_LIBRARIES FILE FILES FILES_MATCHING FILE_PERMISSIONS FRAMEWORK GROUP_EXECUTE GROUP_READ GROUP_WRITE IMPORTED_ INCLUDES INSTALL_PREFIX INTERFACE_INCLUDE_DIRECTORIES LIBRARY LINK_INTERFACE_LIBRARIES MACOSX_BUNDLE MESSAGE MESSAGE_NEVER NAMELINK_ONLY NAMELINK_SKIP NAMESPACE NEW OPTIONAL OS OWNER_EXECUTE OWNER_READ OWNER_WRITE PATTERN PERMISSIONS POST_INSTALL_SCRIPT PRE_INSTALL_SCRIPT PRIVATE_HEADER PROGRAMS PUBLIC_HEADER REGEX RENAME RESOURCE RUNTIME SCRIPT SETGID SETUID SOVERSION TARGETS TRUE USE_SOURCE_PERMISSIONS VERSION WORLD_EXECUTE WORLD_READ WORLD_WRITE
- \ contained
+syn keyword cmakeKWinstall contained
+ \ ARCHIVE BUNDLE CODE COMPONENT CONFIGURATIONS CVS DESTDIR DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DLL EXCLUDE_FROM_ALL EXPORT EXPORT_ANDROID_MK EXPORT_LINK_INTERFACE_LIBRARIES FILES FILES_MATCHING FILE_PERMISSIONS FRAMEWORK GROUP_EXECUTE GROUP_READ GROUP_WRITE IMPORTED_ INCLUDES INSTALL_PREFIX INTERFACE_INCLUDE_DIRECTORIES LIBRARY MACOSX_BUNDLE MESSAGE_NEVER NAMELINK_ONLY NAMELINK_SKIP NAMESPACE NDK OBJECTS OPTIONAL OWNER_EXECUTE OWNER_READ OWNER_WRITE PATTERN PERMISSIONS POST_INSTALL_SCRIPT PRE_INSTALL_SCRIPT PRIVATE_HEADER PROGRAMS PUBLIC_HEADER REGEX RENAME RESOURCE RUNTIME SCRIPT SETGID SETUID SOVERSION TARGETS TRUE USE_SOURCE_PERMISSIONS VERSION WORLD_EXECUTE WORLD_READ WORLD_WRITE
-syn keyword cmakeKWinstall_files
+syn keyword cmakeKWinstall_files contained
\ FILES GLOB
- \ contained
-syn keyword cmakeKWinstall_programs
+syn keyword cmakeKWinstall_programs contained
\ FILES GLOB PROGRAMS TARGETS
- \ contained
-syn keyword cmakeKWinstall_targets
+syn keyword cmakeKWinstall_targets contained
\ DLL RUNTIME_DIRECTORY TARGETS
- \ contained
-syn keyword cmakeKWlist
- \ APPEND CACHE FIND GET INSERT INTERNAL LENGTH LIST NOTES PARENT_SCOPE REMOVE_AT REMOVE_DUPLICATES REMOVE_ITEM REVERSE SORT
- \ contained
+syn keyword cmakeKWlist contained
+ \ APPEND CACHE EXCLUDE FILTER FIND GET INCLUDE INSERT INTERNAL LENGTH LIST NOTES PARENT_SCOPE REGEX REMOVE_AT REMOVE_DUPLICATES REMOVE_ITEM REVERSE SORT
-syn keyword cmakeKWload_cache
+syn keyword cmakeKWload_cache contained
\ EXCLUDE INCLUDE_INTERNALS READ_WITH_PREFIX
- \ contained
-syn keyword cmakeKWload_command
+syn keyword cmakeKWload_command contained
\ CMAKE_LOADED_COMMAND_ COMMAND_NAME
- \ contained
-syn keyword cmakeKWmacro
- \ ARGC ARGN ARGS ARGV DEFINED GREATER IN LISTS NOT _BAR _FOO
- \ contained
+syn keyword cmakeKWmacro contained
+ \ ARGC ARGN ARGS ARGV DEFINED GREATER LISTS NOT _BAR _FOO
-syn keyword cmakeKWmake_directory
+syn keyword cmakeKWmake_directory contained
\ MAKE_DIRECTORY
- \ contained
-syn keyword cmakeKWmark_as_advanced
+syn keyword cmakeKWmark_as_advanced contained
\ CLEAR FORCE VAR
- \ contained
-syn keyword cmakeKWmath
+syn keyword cmakeKWmath contained
\ EXPR
- \ contained
-syn keyword cmakeKWmessage
+syn keyword cmakeKWmessage contained
\ AUTHOR_WARNING DEPRECATION FATAL_ERROR GUI SEND_ERROR STATUS WARNING
- \ contained
-syn keyword cmakeKWoption
+syn keyword cmakeKWoption contained
\ OFF ON
- \ contained
-syn keyword cmakeKWproject
- \ CMAKE_PROJECT_ LANGUAGES NAME NEW NONE PROJECT VERSION _BINARY_DIR _INCLUDE _SOURCE_DIR _VERSION _VERSION_MAJOR _VERSION_MINOR _VERSION_PATCH _VERSION_TWEAK
- \ contained
+syn keyword cmakeKWproject contained
+ \ CMAKE_PROJECT_ DESCRIPTION LANGUAGES NAME NONE PROJECT VERSION _BINARY_DIR _INCLUDE _SOURCE_DIR _VERSION _VERSION_MAJOR _VERSION_MINOR _VERSION_PATCH _VERSION_TWEAK
-syn keyword cmakeKWremove
+syn keyword cmakeKWremove contained
\ REMOVE_ITEM VALUE VAR
- \ contained
-syn keyword cmakeKWseparate_arguments
- \ MSDN UNIX_COMMAND VARIABLE WINDOWS WINDOWS_COMMAND _COMMAND
- \ contained
+syn keyword cmakeKWseparate_arguments contained
+ \ MSDN NATIVE NATIVE_COMMAND UNIX_COMMAND WINDOWS WINDOWS_COMMAND _COMMAND
-syn keyword cmakeKWset
- \ BOOL CACHE FILEPATH FORCE INTERNAL OFF ON PARENT_SCOPE PATH STRING STRINGS
- \ contained
+syn keyword cmakeKWset contained
+ \ BOOL CACHE FILEPATH FORCE INTERNAL OFF ON PARENT_SCOPE STRING STRINGS
-syn keyword cmakeKWset_directory_properties
+syn keyword cmakeKWset_directory_properties contained
\ PROPERTIES
- \ contained
-syn keyword cmakeKWset_property
+syn keyword cmakeKWset_property contained
\ APPEND APPEND_STRING CACHE DIRECTORY GLOBAL INSTALL PROPERTY SOURCE TARGET TEST WIX
- \ contained
-syn keyword cmakeKWset_source_files_properties
+syn keyword cmakeKWset_source_files_properties contained
\ PROPERTIES
- \ contained
-syn keyword cmakeKWset_target_properties
+syn keyword cmakeKWset_target_properties contained
\ PROPERTIES
- \ contained
-syn keyword cmakeKWset_tests_properties
+syn keyword cmakeKWset_tests_properties contained
\ PROPERTIES
- \ contained
-syn keyword cmakeKWsource_group
- \ FILES REGULAR_EXPRESSION
- \ contained
+syn keyword cmakeKWsource_group contained
+ \ FILES PREFIX REGULAR_EXPRESSION TREE
-syn keyword cmakeKWstring
- \ ALPHABET APPEND ASCII CMAKE_MATCH_ COMPARE CONCAT CONFIGURE EQUAL ESCAPE_QUOTES FIND GENEX_STRIP GREATER GUID LENGTH LESS MAKE_C_IDENTIFIER MATCH MATCHALL MATCHES NAME NAMESPACE NOTEQUAL ONLY RANDOM RANDOM_SEED REGEX REPLACE REVERSE STRIP SUBSTRING SZ TIMESTAMP TOLOWER TOUPPER TYPE UPPER UTC UUID
- \ contained
+syn keyword cmakeKWstring contained
+ \ ALPHABET APPEND ASCII CMAKE_MATCH_ COMPARE CONCAT CONFIGURE EQUAL ESCAPE_QUOTES FIND GENEX_STRIP GREATER GREATER_EQUAL GUID HASH LENGTH LESS LESS_EQUAL MAKE_C_IDENTIFIER MATCH MATCHALL MATCHES NAMESPACE NOTEQUAL ONLY RANDOM RANDOM_SEED REGEX REPLACE REVERSE RFC SHA SOURCE_DATE_EPOCH STRIP SUBSTRING SZ TIMESTAMP TOLOWER TOUPPER TYPE US UTC UUID
-syn keyword cmakeKWsubdirs
+syn keyword cmakeKWsubdirs contained
\ EXCLUDE_FROM_ALL PREORDER
- \ contained
-syn keyword cmakeKWtarget_compile_definitions
+syn keyword cmakeKWtarget_compile_definitions contained
\ COMPILE_DEFINITIONS INTERFACE INTERFACE_COMPILE_DEFINITIONS PRIVATE PUBLIC
- \ contained
-syn keyword cmakeKWtarget_compile_features
+syn keyword cmakeKWtarget_compile_features contained
\ COMPILE_FEATURES IMPORTED INTERFACE INTERFACE_COMPILE_FEATURES PRIVATE PUBLIC
- \ contained
-syn keyword cmakeKWtarget_compile_options
+syn keyword cmakeKWtarget_compile_options contained
\ BEFORE COMPILE_OPTIONS IMPORTED INTERFACE INTERFACE_COMPILE_OPTIONS PRIVATE PUBLIC
- \ contained
-syn keyword cmakeKWtarget_include_directories
+syn keyword cmakeKWtarget_include_directories contained
\ BEFORE BUILD_INTERFACE IMPORTED INCLUDE_DIRECTORIES INSTALL_INTERFACE INTERFACE INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES PRIVATE PUBLIC SYSTEM
- \ contained
-syn keyword cmakeKWtarget_link_libraries
- \ ALIAS DAG DEBUG_CONFIGURATIONS IMPORTED IMPORTED_NO_SONAME INTERFACE INTERFACE_LINK_LIBRARIES LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_MULTIPLICITY LINK_PRIVATE LINK_PUBLIC NEW OLD OSX PRIVATE PUBLIC SONAME STATIC
- \ contained
+syn keyword cmakeKWtarget_link_libraries contained
+ \ ALIAS DAG DEBUG_CONFIGURATIONS IMPORTED IMPORTED_NO_SONAME INTERFACE INTERFACE_LINK_LIBRARIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_MULTIPLICITY LINK_PRIVATE LINK_PUBLIC OLD OSX PRIVATE PUBLIC STATIC
-syn keyword cmakeKWtarget_sources
+syn keyword cmakeKWtarget_sources contained
\ IMPORTED INTERFACE INTERFACE_SOURCES PRIVATE PUBLIC SOURCES
- \ contained
-syn keyword cmakeKWtry_compile
- \ ALL_BUILD CMAKE_FLAGS COMPILE_DEFINITIONS COPY_FILE COPY_FILE_ERROR DEFINED DLINK_LIBRARIES DVAR FALSE INCLUDE_DIRECTORIES LINK_DIRECTORIES LINK_LIBRARIES NEW NOT OUTPUT_VARIABLE RESULT_VAR SOURCES TRUE TYPE VALUE
- \ contained
+syn keyword cmakeKWtry_compile contained
+ \ ALL_BUILD CMAKE_FLAGS COMPILE_DEFINITIONS COPY_FILE COPY_FILE_ERROR CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEFINED DLINK_LIBRARIES DVAR FALSE INCLUDE_DIRECTORIES LANG LINK_DIRECTORIES LINK_LIBRARIES NOT OUTPUT_VARIABLE RESULT_VAR SOURCES TRUE TYPE VALUE _EXTENSIONS _STANDARD _STANDARD_REQUIRED
-syn keyword cmakeKWtry_run
- \ ARGS CMAKE_FLAGS COMPILE_DEFINITIONS COMPILE_OUTPUT_VARIABLE COMPILE_RESULT_VAR DLINK_LIBRARIES DVAR FAILED_TO_RUN FALSE INCLUDE_DIRECTORIES LINK_DIRECTORIES LINK_LIBRARIES OUTPUT_VARIABLE RUN_OUTPUT_VARIABLE RUN_RESULT_VAR TRUE TYPE VALUE __TRYRUN_OUTPUT
- \ contained
+syn keyword cmakeKWtry_run contained
+ \ ARGS CMAKE_FLAGS COMPILE_DEFINITIONS COMPILE_OUTPUT_VARIABLE COMPILE_RESULT_VAR DLINK_LIBRARIES DVAR FAILED_TO_RUN FALSE INCLUDE_DIRECTORIES LINK_DIRECTORIES LINK_LIBRARIES RUN_OUTPUT_VARIABLE RUN_RESULT_VAR TRUE TYPE VALUE __TRYRUN_OUTPUT
-syn keyword cmakeKWunset
+syn keyword cmakeKWunset contained
\ CACHE LD_LIBRARY_PATH PARENT_SCOPE
- \ contained
-syn keyword cmakeKWuse_mangled_mesa
+syn keyword cmakeKWuse_mangled_mesa contained
\ GL OUTPUT_DIRECTORY PATH_TO_MESA
- \ contained
-syn keyword cmakeKWvariable_requires
+syn keyword cmakeKWvariable_requires contained
\ RESULT_VARIABLE TEST_VARIABLE
- \ contained
-syn keyword cmakeKWvariable_watch
+syn keyword cmakeKWvariable_watch contained
\ COMMAND
- \ contained
-syn keyword cmakeKWwhile
+syn keyword cmakeKWwhile contained
\ ARGS
- \ contained
-syn keyword cmakeKWwrite_file
+syn keyword cmakeKWwrite_file contained
\ APPEND CONFIGURE_FILE NOTE WRITE
- \ contained
-syn keyword cmakeGeneratorExpressions
- \ LINK_LIBRARIES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS CONFIG DEBUG_MODE DEBUG_MODE BOOL AND OR NOT STREQUAL STREQUAL EQUAL EQUAL CONFIG MAP_IMPORTED_CONFIG_ CONFIG IMPORTED PLATFORM_ID C_COMPILER_ID CXX_COMPILER_ID VERSION_GREATER VERSION_LESS VERSION_EQUAL C_COMPILER_VERSION CXX_COMPILER_VERSION TARGET_POLICY NEW COMPILE_FEATURES C_STANDARD CXX_STANDARD COMPILE_LANGUAGE PRIVATE COMPILE_LANGUAGE PUBLIC PRIVATE COMPILE_LANGUAGE COMPILING_CXX PRIVATE COMPILE_LANGUAGE CXX_COMPILER_ID GNU VERSION_LESS CXX_COMPILER_VERSION OLD_COMPILER OLD_COMPILER CMAKE_CXX_COMPILER_VERSION CONFIGURATION CONFIG CONFIG PLATFORM_ID C_COMPILER_ID CMAKE_ LANG _COMPILER_ID CXX_COMPILER_ID CMAKE_ LANG _COMPILER_ID C_COMPILER_VERSION CMAKE_ LANG _COMPILER_VERSION CXX_COMPILER_VERSION CMAKE_ LANG _COMPILER_VERSION TARGET_FILE TARGET_FILE_NAME TARGET_FILE_DIR TARGET_LINKER_FILE TARGET_LINKER_FILE_NAME TARGET_LINKER_FILE_DIR TARGET_SONAME_FILE TARGET_SONAME_FILE_NAME TARGET_SONAME_FILE_DIR TARGET_PDB_FILE PDB_NAME PDB_OUTPUT_DIRECTORY PDB_NAME_ CONFIG PDB_OUTPUT_DIRECTORY_ CONFIG TARGET_PDB_FILE_NAME TARGET_PDB_FILE_DIR TARGET_PROPERTY TARGET_PROPERTY INSTALL_PREFIX EXPORT COMPILE_LANGUAGE JOIN TARGET_PROPERTY INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES BOOL JOIN TARGET_PROPERTY INCLUDE_DIRECTORIES JOIN ANGLE COMMA SEMICOLON TARGET_NAME LINK_ONLY INTERFACE_LINK_LIBRARIES INSTALL_INTERFACE EXPORT BUILD_INTERFACE LOWER_CASE UPPER_CASE MAKE_C_IDENTIFIER TARGET_OBJECTS OBJECT_LIBRARY SHELL_PATH MSYS
- \ contained
+syn keyword cmakeGeneratorExpressions contained
+ \ LINK_LIBRARIES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS CONFIG DEBUG_MODE BOOL AND NOT IF STREQUAL MAP_IMPORTED_CONFIG_ PLATFORM_ID C_COMPILER_ID CXX_COMPILER_ID VERSION_LESS VERSION_GREATER VERSION_EQUAL VERSION_LESS_EQUAL VERSION_GREATER_EQUAL C_COMPILER_VERSION CXX_COMPILER_VERSION TARGET_POLICY COMPILE_FEATURES C_STANDARD CXX_STANDARD COMPILE_LANGUAGE PRIVATE PUBLIC COMPILING_CXX GNU OLD_COMPILER CMAKE_CXX_COMPILER_VERSION CONFIGURATION TARGET_FILE TARGET_FILE_NAME TARGET_FILE_DIR TARGET_LINKER_FILE TARGET_LINKER_FILE_NAME TARGET_LINKER_FILE_DIR TARGET_SONAME_FILE TARGET_SONAME_FILE_NAME TARGET_SONAME_FILE_DIR TARGET_PDB_FILE PDB_NAME PDB_OUTPUT_DIRECTORY PDB_NAME_ PDB_OUTPUT_DIRECTORY_ TARGET_PDB_FILE_NAME TARGET_PDB_FILE_DIR TARGET_BUNDLE_DIR TARGET_BUNDLE_CONTENT_DIR SDK TARGET_PROPERTY INSTALL_PREFIX EXPORT JOIN ANGLE COMMA SEMICOLON TARGET_NAME LINK_ONLY INTERFACE_LINK_LIBRARIES INSTALL_INTERFACE BUILD_INTERFACE LOWER_CASE UPPER_CASE MAKE_C_IDENTIFIER TARGET_OBJECTS OBJECT_LIBRARY SHELL_PATH MSYS
syn case ignore
+
syn keyword cmakeCommand
\ add_compile_options add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_host_system_information cmake_minimum_required cmake_parse_arguments cmake_policy configure_file continue create_test_sourcelist ctest_build ctest_configure ctest_coverage ctest_empty_binary_directory ctest_memcheck ctest_read_custom_files ctest_run_script ctest_sleep ctest_start ctest_submit ctest_test ctest_update ctest_upload define_property enable_language enable_testing endfunction endmacro execute_process export file find_file find_library find_package find_path find_program fltk_wrap_ui function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property include include_directories include_external_msproject include_regular_expression install link_directories list load_cache load_command macro mark_as_advanced math message option project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_compile_definitions target_compile_features target_compile_options target_include_directories target_link_libraries target_sources try_compile try_run unset variable_watch
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandConditional
\ else elseif endif if
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandRepeat
\ endforeach endwhile foreach while
\ nextgroup=cmakeArguments
+
syn keyword cmakeCommandDeprecated
\ build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file
\ nextgroup=cmakeArguments
+
syn case match
syn keyword cmakeTodo
@@ -447,15 +356,15 @@ hi def link cmakeComment Comment
hi def link cmakeEnvironment Special
hi def link cmakeEscaped Special
hi def link cmakeGeneratorExpression WarningMsg
-hi def link cmakeGeneratorExpressions ModeMsg
+hi def link cmakeGeneratorExpressions Constant
hi def link cmakeLuaComment Comment
hi def link cmakeModule Include
hi def link cmakeProperty Constant
hi def link cmakeRegistry Underlined
hi def link cmakeString String
hi def link cmakeTodo TODO
-hi def link cmakeVariable Identifier
hi def link cmakeVariableValue Type
+hi def link cmakeVariable Identifier
hi def link cmakeKWExternalProject ModeMsg
hi def link cmakeKWadd_compile_options ModeMsg
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 545177b..eb46c3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,14 +55,22 @@ if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD)
endif()
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD)
- include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake)
- if(NOT CMake_CXX14_CSTDIO_BROKEN)
- set(CMAKE_CXX_STANDARD 14)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14)
+ set(CMAKE_CXX_STANDARD 98)
else()
- set(CMAKE_CXX_STANDARD 11)
+ include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake)
+ if(NOT CMake_CXX14_CSTDIO_BROKEN)
+ set(CMAKE_CXX_STANDARD 14)
+ else()
+ set(CMAKE_CXX_STANDARD 11)
+ endif()
endif()
endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ # include special compile flags for some compilers
+ include(CompileFlags.cmake)
+
+ # check for available C++ features
include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake)
endif()
@@ -226,6 +234,20 @@ option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
mark_as_advanced(CMAKE_USE_FOLDERS)
+option(CMake_RUN_CLANG_TIDY "Run clang-tidy with the compiler." OFF)
+if(CMake_RUN_CLANG_TIDY)
+ if(CMake_SOURCE_DIR STREQUAL CMake_BINARY_DIR)
+ message(FATAL_ERROR "CMake_RUN_CLANG_TIDY requires an out-of-source build!")
+ endif()
+ find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
+ if(NOT CLANG_TIDY_COMMAND)
+ message(FATAL_ERROR "CMake_RUN_CLANG_TIDY is ON but clang-tidy is not found!")
+ endif()
+ set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
+endif()
+configure_file(.clang-tidy .clang-tidy COPYONLY)
+
+
option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF)
if(CMake_RUN_IWYU)
find_program(IWYU_COMMAND NAMES include-what-you-use iwyu)
@@ -634,9 +656,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
endif()
- # include special compile flags for some compilers
- include(CompileFlags.cmake)
-
# no clue why we are testing for this here
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index d70e3af..d1f4f13 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -61,7 +61,14 @@ endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
+ if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
+ elseif(CMAKE_VERSION VERSION_LESS 3.8.20170502)
+ # CMake knows how to add this flag for compilation as C++11,
+ # but has not been taught that SunPro needs it for linking too.
+ # Add it in a place that will be used for both.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
endif()
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst
index 19ca658..c088796 100644
--- a/Help/command/add_executable.rst
+++ b/Help/command/add_executable.rst
@@ -40,6 +40,9 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
+pre-processed, and you want to have the original sources reachable from
+within IDE.
--------------------------------------------------------------------------
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 3a76040..de5335e 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -59,6 +59,10 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
+pre-processed, and you want to have the original sources reachable from
+within IDE.
+
Imported Libraries
^^^^^^^^^^^^^^^^^^
@@ -119,7 +123,7 @@ Alias Libraries
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be
used to refer to ``<target>`` in subsequent commands. The ``<name>`` does
-not appear in the generatedbuildsystem as a make target. The ``<target>``
+not appear in the generated buildsystem as a make target. The ``<target>``
may not be an :ref:`Imported Target <Imported Targets>` or an ``ALIAS``.
``ALIAS`` targets can be used as linkable targets and as targets to
read properties from. They can also be tested for existence with the
diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst
index a983d68..288b65a 100644
--- a/Help/command/ctest_memcheck.rst
+++ b/Help/command/ctest_memcheck.rst
@@ -13,6 +13,9 @@ Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`.
[INCLUDE <include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
+ [EXCLUDE_FIXTURE <regex>]
+ [EXCLUDE_FIXTURE_SETUP <regex>]
+ [EXCLUDE_FIXTURE_CLEANUP <regex>]
[PARALLEL_LEVEL <level>]
[TEST_LOAD <threshold>]
[SCHEDULE_RANDOM <ON|OFF>]
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index a7d9708..6b49da3 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -6,6 +6,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`.
::
ctest_submit([PARTS <part>...] [FILES <file>...]
+ [HTTPHEADER <header>]
[RETRY_COUNT <count>]
[RETRY_DELAY <delay>]
[RETURN_VALUE <result-var>]
@@ -36,6 +37,10 @@ The options are:
Specify an explicit list of specific files to be submitted.
Each individual file must exist at the time of the call.
+``HTTPHEADER <HTTP-header>``
+ Specify HTTP header to be included in the request to CDash during submission.
+ This suboption can be repeated several times.
+
``RETRY_COUNT <count>``
Specify how many times to retry a timed-out submission.
@@ -57,6 +62,7 @@ Submit to CDash Upload API
::
ctest_submit(CDASH_UPLOAD <file> [CDASH_UPLOAD_TYPE <type>]
+ [HTTPHEADER <header>]
[RETRY_COUNT <count>]
[RETRY_DELAY <delay>]
[QUIET])
@@ -67,5 +73,5 @@ with a content hash of the file. If CDash does not already have the file,
then it is uploaded. Along with the file, a CDash type string is specified
to tell CDash which handler to use to process the data.
-This signature accepts the ``RETRY_COUNT``, ``RETRY_DELAY``, and ``QUIET``
-options as described above.
+This signature accepts the ``HTTPHEADER``, ``RETRY_COUNT``, ``RETRY_DELAY``, and
+``QUIET`` options as described above.
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst
index ce50d42..4a69491 100644
--- a/Help/command/ctest_test.rst
+++ b/Help/command/ctest_test.rst
@@ -13,6 +13,9 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
[INCLUDE <include-regex>]
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
+ [EXCLUDE_FIXTURE <regex>]
+ [EXCLUDE_FIXTURE_SETUP <regex>]
+ [EXCLUDE_FIXTURE_CLEANUP <regex>]
[PARALLEL_LEVEL <level>]
[TEST_LOAD <threshold>]
[SCHEDULE_RANDOM <ON|OFF>]
@@ -61,6 +64,20 @@ The options are:
Specify a regular expression matching test labels to include.
Tests not matching this expression are excluded.
+``EXCLUDE_FIXTURE <regex>``
+ If a test in the set of tests to be executed requires a particular fixture,
+ that fixture's setup and cleanup tests would normally be added to the test
+ set automatically. This option prevents adding setup or cleanup tests for
+ fixtures matching the ``<regex>``. Note that all other fixture behavior is
+ retained, including test dependencies and skipping tests that have fixture
+ setup tests that fail.
+
+``EXCLUDE_FIXTURE_SETUP <regex>``
+ Same as ``EXCLUDE_FIXTURE`` except only matching setup tests are excluded.
+
+``EXCLUDE_FIXTURE_CLEANUP <regex>``
+ Same as ``EXCLUDE_FIXTURE`` except only matching cleanup tests are excluded.
+
``PARALLEL_LEVEL <level>``
Specify a positive number representing the number of tests to
be run in parallel.
diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst
index 1fd3cd1..47982a5 100644
--- a/Help/command/separate_arguments.rst
+++ b/Help/command/separate_arguments.rst
@@ -5,9 +5,9 @@ Parse space-separated arguments into a semicolon-separated list.
::
- separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>")
+ separate_arguments(<var> <NATIVE|UNIX|WINDOWS>_COMMAND "<args>")
-Parses a unix- or windows-style command-line string "<args>" and
+Parses a UNIX- or Windows-style command-line string "<args>" and
stores a semicolon-separated list of the arguments in ``<var>``. The
entire command line must be given in one "<args>" argument.
@@ -16,12 +16,15 @@ recognizes both single-quote and double-quote pairs. A backslash
escapes the next literal character (``\"`` is ``"``); there are no special
escapes (``\n`` is just ``n``).
-The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same
+The ``WINDOWS_COMMAND`` mode parses a Windows command-line using the same
syntax the runtime library uses to construct argv at startup. It
separates arguments by whitespace that is not double-quoted.
Backslashes are literal unless they precede double-quotes. See the
MSDN article `Parsing C Command-Line Arguments`_ for details.
+The ``NATIVE_COMMAND`` mode parses a Windows command-line if the host
+system is Windows, and a UNIX command-line otherwise.
+
.. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx
::
diff --git a/Help/dev/review.rst b/Help/dev/review.rst
index 3db1f40..c4122d4 100644
--- a/Help/dev/review.rst
+++ b/Help/dev/review.rst
@@ -261,6 +261,10 @@ until one of the following occurs:
and the MR cannot be merged into the topic stage again due to conflicts.
* A developer or the submitter posts an explicit ``Do: unstage`` command.
+ This is useful to remove a MR from the topic stage when one is not ready
+ to push an update to the MR topic branch. It is unnecessary to explicitly
+ unstage just before or after pushing an update because the push will cause
+ the MR to be unstaged automatically.
* The MR is closed.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 448fe9a..fa2aa8d 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -335,7 +335,7 @@ versions specified for each:
* ``Clang``: Clang compiler versions 2.9 through 3.4.
* ``GNU``: GNU compiler versions 4.4 through 5.0.
* ``MSVC``: Microsoft Visual Studio versions 2010 through 2015.
-* ``SunPro``: Oracle SolarisStudio version 12.4.
+* ``SunPro``: Oracle SolarisStudio versions 12.4 through 12.5.
* ``Intel``: Intel compiler versions 12.1 through 17.0.
CMake is currently aware of the :prop_tgt:`C standards <C_STANDARD>`
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 1e8342c..4a03b7a 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -54,6 +54,7 @@ All Modules
/module/CMakePrintSystemInformation
/module/CMakePushCheckState
/module/CMakeVerifyManifest
+ /module/CPackArchive
/module/CPackBundle
/module/CPackComponent
/module/CPackCygwin
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 4317f67..6ee4257 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -171,6 +171,8 @@ Variables that Change Behavior
/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
/variable/CMAKE_SYSROOT
+ /variable/CMAKE_SYSROOT_COMPILE
+ /variable/CMAKE_SYSROOT_LINK
/variable/CMAKE_SYSTEM_APPBUNDLE_PATH
/variable/CMAKE_SYSTEM_FRAMEWORK_PATH
/variable/CMAKE_SYSTEM_IGNORE_PATH
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index ce81578..a89c4e9 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -117,6 +117,23 @@ Options
This option tells ctest to NOT run the tests whose labels match the
given regular expression.
+``-FA <regex>, --fixture-exclude-any <regex>``
+ Exclude fixtures matching ``<regex>`` from automatically adding any tests to
+ the test set.
+
+ If a test in the set of tests to be executed requires a particular fixture,
+ that fixture's setup and cleanup tests would normally be added to the test set
+ automatically. This option prevents adding setup or cleanup tests for fixtures
+ matching the ``<regex>``. Note that all other fixture behavior is retained,
+ including test dependencies and skipping tests that have fixture setup tests
+ that fail.
+
+``-FS <regex>, --fixture-exclude-setup <regex>``
+ Same as ``-FA`` except only matching setup tests are excluded.
+
+``-FC <regex>, --fixture-exclude-cleanup <regex>``
+ Same as ``-FA`` except only matching cleanup tests are excluded.
+
``-D <dashboard>, --dashboard <dashboard>``
Execute dashboard test.
diff --git a/Help/module/CPackArchive.rst b/Help/module/CPackArchive.rst
new file mode 100644
index 0000000..eb8d9d2
--- /dev/null
+++ b/Help/module/CPackArchive.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/CPackArchive.cmake
diff --git a/Help/prop_sf/HEADER_FILE_ONLY.rst b/Help/prop_sf/HEADER_FILE_ONLY.rst
index b4fb2db..71d62ae 100644
--- a/Help/prop_sf/HEADER_FILE_ONLY.rst
+++ b/Help/prop_sf/HEADER_FILE_ONLY.rst
@@ -7,3 +7,18 @@ A property on a source file that indicates if the source file is a
header file with no associated implementation. This is set
automatically based on the file extension and is used by CMake to
determine if certain dependency information should be computed.
+
+By setting this property to ``ON``, you can disable compilation of
+the given source file, even if it should be compiled because it is
+part of the library's/executable's sources.
+
+This is useful if you have some source files which you somehow
+pre-process, and then add these pre-processed sources via
+:command:`add_library` or :command:`add_executable`. Normally, in IDE,
+there would be no reference of the original sources, only of these
+pre-processed sources. So by setting this property for all the original
+source files to ``ON``, and then either calling :command:`add_library`
+or :command:`add_executable` while passing both the pre-processed
+sources and the original sources, or by using :command:`target_sources`
+to add original source files will do exactly what would one expect, i.e.
+the original source files would be visible in IDE, and will not be built.
diff --git a/Help/release/dev/ExtractGTestMacro.rst b/Help/release/dev/ExtractGTestMacro.rst
index 574982c..ff2b444 100644
--- a/Help/release/dev/ExtractGTestMacro.rst
+++ b/Help/release/dev/ExtractGTestMacro.rst
@@ -2,4 +2,8 @@ ExtractGTestMacro
-----------------
* A new :module:`GoogleTest` module was added to provide the
- ``gtest_add_tests`` macro independently of the :module:`FindGTest` module.
+ :command:`gtest_add_tests` function independently of the :module:`FindGTest`
+ module. The function was also updated to support keyword arguments, with
+ functionality expanded to allow a test name prefix and suffix to be
+ specified, the dependency on the source files to be optional and the list of
+ discovered test cases to be returned to the caller.
diff --git a/Help/release/dev/FindProtobuf-targets.rst b/Help/release/dev/FindProtobuf-targets.rst
new file mode 100644
index 0000000..e38303d
--- /dev/null
+++ b/Help/release/dev/FindProtobuf-targets.rst
@@ -0,0 +1,5 @@
+FindProtobuf-targets
+--------------------
+
+* The :module:`FindProtobuf` module now provides imported targets
+ when the libraries are found.
diff --git a/Help/release/dev/cpack-archive-per-component-filename.rst b/Help/release/dev/cpack-archive-per-component-filename.rst
new file mode 100644
index 0000000..a7a413f
--- /dev/null
+++ b/Help/release/dev/cpack-archive-per-component-filename.rst
@@ -0,0 +1,6 @@
+cpack-rpm-debuginfo-honor-package-filename
+------------------------------------------
+
+* The :module:`CPackArchive` module learned to modify filename per component.
+ See :variable:`CPACK_ARCHIVE_FILE_NAME` variable and its per component
+ version.
diff --git a/Help/release/dev/cpackifw-i18n.rst b/Help/release/dev/cpackifw-i18n.rst
new file mode 100644
index 0000000..59327fe
--- /dev/null
+++ b/Help/release/dev/cpackifw-i18n.rst
@@ -0,0 +1,7 @@
+cpackifw-i18n
+-------------
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
+ :command:`cpack_ifw_configure_component_group` commands gained a
+ internationalization support for ``DISPLAY_NAME`` and ``DESCRIPTION`` options
+ to more specific configuration.
diff --git a/Help/release/dev/ctest_submit_headers.rst b/Help/release/dev/ctest_submit_headers.rst
new file mode 100644
index 0000000..61fbc7a
--- /dev/null
+++ b/Help/release/dev/ctest_submit_headers.rst
@@ -0,0 +1,5 @@
+ctest_submit_headers
+--------------------
+
+* The :command:`ctest_submit` command gained a ``HTTPHEADER`` option
+ to specify custom headers to send during submission.
diff --git a/Help/release/dev/excludeFixtures.rst b/Help/release/dev/excludeFixtures.rst
new file mode 100644
index 0000000..56d4226
--- /dev/null
+++ b/Help/release/dev/excludeFixtures.rst
@@ -0,0 +1,9 @@
+excludeFixtures
+---------------
+
+* The :manual:`ctest(1)` executable gained new options which allow the
+ developer to disable automatically adding tests to the test set to satisfy
+ fixture dependencies. ``-FS`` prevents adding setup tests for fixtures
+ matching the provided regular expression, ``-FC`` prevents adding cleanup
+ tests for matching fixtures and ``-FA`` prevents adding any test for matching
+ fixtures.
diff --git a/Help/release/dev/separgs-native.rst b/Help/release/dev/separgs-native.rst
new file mode 100644
index 0000000..943f08e
--- /dev/null
+++ b/Help/release/dev/separgs-native.rst
@@ -0,0 +1,5 @@
+separgs-native
+-------------------
+
+* A ``NATIVE_COMMAND`` mode was added to :command:`separate_arguments`
+ performing argument separation depening on the host operating system.
diff --git a/Help/release/dev/split-sysroot.rst b/Help/release/dev/split-sysroot.rst
new file mode 100644
index 0000000..8144e3f
--- /dev/null
+++ b/Help/release/dev/split-sysroot.rst
@@ -0,0 +1,5 @@
+split-sysroot
+-------------
+
+* The :variable:`CMAKE_SYSROOT_COMPILE` and :variable:`CMAKE_SYSROOT_LINK`
+ variables were added to use separate sysroots for compiling and linking.
diff --git a/Help/variable/CMAKE_SYSROOT.rst b/Help/variable/CMAKE_SYSROOT.rst
index 7aa0450..64f81bb 100644
--- a/Help/variable/CMAKE_SYSROOT.rst
+++ b/Help/variable/CMAKE_SYSROOT.rst
@@ -10,3 +10,6 @@ paths searched by the ``find_*`` commands.
This variable may only be set in a toolchain file specified by
the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
+
+See also the :variable:`CMAKE_SYSROOT_COMPILE` and
+:variable:`CMAKE_SYSROOT_LINK` variables.
diff --git a/Help/variable/CMAKE_SYSROOT_COMPILE.rst b/Help/variable/CMAKE_SYSROOT_COMPILE.rst
new file mode 100644
index 0000000..e96c62b
--- /dev/null
+++ b/Help/variable/CMAKE_SYSROOT_COMPILE.rst
@@ -0,0 +1,9 @@
+CMAKE_SYSROOT_COMPILE
+---------------------
+
+Path to pass to the compiler in the ``--sysroot`` flag when compiling source
+files. This is the same as :variable:`CMAKE_SYSROOT` but is used only for
+compiling sources and not linking.
+
+This variable may only be set in a toolchain file specified by
+the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
diff --git a/Help/variable/CMAKE_SYSROOT_LINK.rst b/Help/variable/CMAKE_SYSROOT_LINK.rst
new file mode 100644
index 0000000..88b48ef
--- /dev/null
+++ b/Help/variable/CMAKE_SYSROOT_LINK.rst
@@ -0,0 +1,9 @@
+CMAKE_SYSROOT_LINK
+------------------
+
+Path to pass to the compiler in the ``--sysroot`` flag when linking. This is
+the same as :variable:`CMAKE_SYSROOT` but is used only for linking and not
+compiling sources.
+
+This variable may only be set in a toolchain file specified by
+the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
diff --git a/Modules/CMakeCSharpInformation.cmake b/Modules/CMakeCSharpInformation.cmake
index dc775bd..cd86016 100644
--- a/Modules/CMakeCSharpInformation.cmake
+++ b/Modules/CMakeCSharpInformation.cmake
@@ -68,38 +68,38 @@ if(CMAKE_CSharp_STANDARD_LIBRARIES_INIT)
mark_as_advanced(CMAKE_CSharp_STANDARD_LIBRARIES)
endif()
-# set missing flags (if they do not exist). This is needed in the
+# set missing flags (if they are not defined). This is needed in the
# unlikely case that you have only C# and no C/C++ targets in your
# project.
-if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS)
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_DEBUG)
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_DEBUG)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_RELEASE)
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELEASE)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL)
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL)
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS)
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_DEBUG)
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_DEBUG)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_RELEASE)
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELEASE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_MINSIZEREL)
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_MINSIZEREL)
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
endif()
-if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
endif()
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index 1b5178d..e60ffe0 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -22,6 +22,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+ FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL
FAIL_REGEX "not supported in this configuration. ignored" # AIX
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
FAIL_REGEX "[Uu]nknown switch" # PGI
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 7ca79bd..f2d43b6 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -95,13 +95,13 @@ function(compiler_id_detection outvar lang)
if(CID_ID_DEFINE)
foreach(Id ${ordered_compilers})
- set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
+ string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
endforeach()
endif()
set(pp_if "#if")
if (CID_VERSION_STRINGS)
- set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch
+ string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */\n")
endif()
@@ -126,7 +126,7 @@ function(compiler_id_detection outvar lang)
string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
string(APPEND id_content "${VERSION_BLOCK}\n")
endif()
- set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}")
+ string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${id_content}")
set(pp_if "#elif")
endforeach()
@@ -145,7 +145,7 @@ function(compiler_id_detection outvar lang)
# define ${CID_PREFIX}COMPILER_ID \"\"")
endif()
- set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
+ string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${platform_compiler_detection}\n#endif")
endif()
set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 9e9770a..d5220b4 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -60,6 +60,7 @@ else()
# fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
# ifc: Intel Fortran 95 compiler for Linux/x86
# efc: Intel Fortran 95 compiler for IA64
+ # nagfor: NAG Fortran compiler
#
# The order is 95 or newer compilers first, then 90,
# then 77 or older compilers, gnu is always last in the group,
@@ -68,7 +69,7 @@ else()
ftn
ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95
fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77
- frt pgf77 xlf fl32 af77 g77 f77
+ frt pgf77 xlf fl32 af77 g77 f77 nag
)
# Vendor-specific compiler names.
@@ -79,6 +80,7 @@ else()
set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
set(_Fortran_COMPILER_NAMES_XL xlf)
set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)
+ set(_Fortran_COMPILER_NAMES_NAG nagfor)
endif()
_cmake_find_compiler(Fortran)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 67cda3b..26b2ed6 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -103,6 +103,11 @@
PRINT *, 'INFO:compiler[MIPSpro]'
#elif defined(__hpux) || defined(__hpux__)
PRINT *, 'INFO:compiler[HP]'
+#elif defined(NAGFOR)
+ PRINT *, 'INFO:compiler[NAG]'
+#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
+#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
+#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
#elif 1
# if 0
! The above 'elif 1' instead of 'else' is to work around a bug in the
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 3273443..1d0030c 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -38,11 +38,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(line "${xline}")
endif()
endif()
- if(UNIX)
- separate_arguments(args UNIX_COMMAND "${line}")
- else()
- separate_arguments(args WINDOWS_COMMAND "${line}")
- endif()
+ separate_arguments(args NATIVE_COMMAND "${line}")
list(GET args 0 cmd)
endif()
set(is_msvc 0)
@@ -137,7 +133,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# We remove items that are not language-specific.
set(implicit_libs "")
foreach(lib IN LISTS implicit_libs_tmp)
- if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*|.*libclang_rt.*)$")
+ if("x${lib}" MATCHES "^x(crt.*\\.o|System.*|.*libclang_rt.*)$")
string(APPEND log " remove lib [${lib}]\n")
elseif(IS_ABSOLUTE "${lib}")
get_filename_component(abs "${lib}" ABSOLUTE)
diff --git a/Modules/CPackArchive.cmake b/Modules/CPackArchive.cmake
new file mode 100644
index 0000000..741fb1f
--- /dev/null
+++ b/Modules/CPackArchive.cmake
@@ -0,0 +1,39 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# CPackArchive
+# ------------
+#
+# Archive CPack generator that supports packaging of sources and binaries in
+# different formats:
+#
+# - 7Z - 7zip - (.7z)
+# - TBZ2 (.tar.bz2)
+# - TGZ (.tar.gz)
+# - TXZ (.tar.xz)
+# - TZ (.tar.Z)
+# - ZIP (.zip)
+#
+# Variables specific to CPack Archive generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# .. variable:: CPACK_ARCHIVE_FILE_NAME
+# CPACK_ARCHIVE_<component>_FILE_NAME
+#
+# Package file name without extension which is added automatically depending
+# on the archive format.
+#
+# * Mandatory : YES
+# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with
+# spaces replaced by '-'
+#
+# .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
+#
+# Enable component packaging for CPackArchive
+#
+# * Mandatory : NO
+# * Default : OFF
+#
+# If enabled (ON) multiple packages are generated. By default a single package
+# containing files of all components is generated.
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 2adc9b9..3a10b99 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -309,11 +309,11 @@ set(CPackComponent_CMake_INCLUDED 1)
# configuration file.
macro(cpack_append_variable_set_command var strvar)
if (DEFINED ${var})
- set(${strvar} "${${strvar}}set(${var}")
+ string(APPEND ${strvar} "set(${var}")
foreach(APPENDVAL ${${var}})
- set(${strvar} "${${strvar}} ${APPENDVAL}")
+ string(APPEND ${strvar} " ${APPENDVAL}")
endforeach()
- set(${strvar} "${${strvar}})\n")
+ string(APPEND ${strvar} ")\n")
endif ()
endmacro()
@@ -325,7 +325,7 @@ macro(cpack_append_string_variable_set_command var strvar)
if (DEFINED ${var})
list(LENGTH ${var} CPACK_APP_VALUE_LEN)
if(${CPACK_APP_VALUE_LEN} EQUAL 1)
- set(${strvar} "${${strvar}}set(${var} \"${${var}}\")\n")
+ string(APPEND ${strvar} "set(${var} \"${${var}}\")\n")
endif()
endif ()
endmacro()
@@ -352,7 +352,7 @@ macro(cpack_append_option_set_command var strvar)
if (${var})
list(LENGTH ${var} CPACK_APP_VALUE_LEN)
if(${CPACK_APP_VALUE_LEN} EQUAL 1)
- set(${strvar} "${${strvar}}set(${var} TRUE)\n")
+ string(APPEND ${strvar} "set(${var} TRUE)\n")
endif()
endif ()
endmacro()
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index b4a6dc6..c1cb52f 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -55,6 +55,33 @@
# The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides
# the value of the :variable:`QTIFWDIR` variable.
#
+# Internationalization
+# ^^^^^^^^^^^^^^^^^^^^
+#
+# Some variables and command arguments support internationalization via
+# CMake script. This is an optional feature.
+#
+# Installers created by QtIFW_ tools have built-in support for
+# internationalization and many phrases are localized to many languages,
+# but this does not apply to the description of the your components and groups
+# that will be distributed.
+#
+# Localization of the description of your components and groups is useful for
+# users of your installers.
+#
+# A localized variable or argument can contain a single default value, and a
+# set of pairs the name of the locale and the localized value.
+#
+# For example:
+#
+# .. code-block:: cmake
+#
+# set(LOCALIZABLE_VARIABLE "Default value"
+# en "English value"
+# en_US "American value"
+# en_GB "Great Britain value"
+# )
+#
# Variables
# ^^^^^^^^^
#
@@ -265,8 +292,8 @@
# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
-# [DISPLAY_NAME <display_name>]
-# [DESCRIPTION <description>]
+# [DISPLAY_NAME <display_name>] # Note: Internationalization supported
+# [DESCRIPTION <description>] # Note: Internationalization supported
# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
# [RELEASE_DATE <release_date>]
@@ -368,8 +395,8 @@
# cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
-# [DISPLAY_NAME <display_name>]
-# [DESCRIPTION <description>]
+# [DISPLAY_NAME <display_name>] # Note: Internationalization supported
+# [DESCRIPTION <description>] # Note: Internationalization supported
# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
# [RELEASE_DATE <release_date>]
@@ -546,8 +573,9 @@
#
# cpack_add_component(myapp
# DISPLAY_NAME "MyApp"
-# DESCRIPTION "My Application")
+# DESCRIPTION "My Application") # Default description
# cpack_ifw_configure_component(myapp
+# DESCRIPTION ru_RU "Мое Приложение" # Localized description
# VERSION "1.2.3" # Version of component
# SCRIPT "operations.qs")
# cpack_add_component(mybigplugin
@@ -835,8 +863,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 DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
- set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
+ 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)
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)
@@ -876,8 +904,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 DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
- set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
+ 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)
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/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index 712a95e..6bbde13 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -217,7 +217,7 @@ function(check_ipo_supported)
return()
endif()
- if(CMAKE_GENERATOR MATCHES "^(Visual Studio |Xcode$)")
+ if(CMAKE_GENERATOR MATCHES "^Visual Studio ")
_ipo_not_supported("CMake doesn't support IPO for current generator")
return()
endif()
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 4b3e223..fcf1df7 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -247,10 +247,10 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
set(${VARIABLE}_CODE)
set(_if if)
foreach(key ${${VARIABLE}_KEYS})
- set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n")
+ string(APPEND ${VARIABLE}_CODE "#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n")
set(_if elif)
endforeach()
- set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif")
+ string(APPEND ${VARIABLE}_CODE "#else\n# error ${VARIABLE} unknown\n#endif")
set(_if)
elseif(${VARIABLE})
set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}")
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index f874e74..c18f541 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -12,17 +12,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
- if (NOT CMAKE_C_COMPILER_FORCED)
- if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
- endif()
- set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_C_STANDARD_DEFAULT 99)
- endif()
-endif()
+__compiler_check_default_language_standard(C 4.0 99)
macro(cmake_record_c_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index ee900ae..904d965 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -27,18 +27,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
- if (NOT CMAKE_CXX_COMPILER_FORCED)
- if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
- endif()
- set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
- endif()
-endif()
-
+__compiler_check_default_language_standard(CXX 4.0 98)
macro(cmake_record_cxx_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
new file mode 100644
index 0000000..cb365d6
--- /dev/null
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -0,0 +1,62 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This module is shared by multiple languages and compilers; use include guard
+if (__COMPILER_CMAKE_COMMON_COMPILER_MACROS)
+ return()
+endif ()
+set(__COMPILER_CMAKE_COMMON_COMPILER_MACROS 1)
+
+
+# Check that a compiler's language standard is properly detected
+# Parameters:
+# lang - Language to check
+# stdver1 - Minimum version to set a given default for
+# std1 - Default to use for compiler ver >= stdver1
+# stdverN - Minimum version to set a given default for
+# stdN - Default to use for compiler ver >= stdverN
+#
+# The order of stdverN stdN pairs passed as arguments is expected to be in
+# monotonically increasing version order.
+#
+# Note:
+# This macro can be called with multiple version / std pairs to convey that
+# newer compiler versions may use a newer standard default.
+#
+# Example:
+# To specify that compiler version 6.1 and newer defaults to C++11 while
+# 4.8 <= ver < 6.1 default to C++98, you would call:
+#
+# __compiler_check_default_language_standard(CXX 4.8 98 6.1 11)
+#
+macro(__compiler_check_default_language_standard lang stdver1 std1)
+ set(__std_ver_pairs "${stdver1};${std1};${ARGN}")
+ string(REGEX REPLACE " *; *" " " __std_ver_pairs "${__std_ver_pairs}")
+ string(REGEX MATCHALL "[^ ]+ [^ ]+" __std_ver_pairs "${__std_ver_pairs}")
+
+ # If the compiler version is below the threshold of even having CMake
+ # support for language standards, then don't bother.
+ if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "${stdver1}")
+ if (NOT CMAKE_${lang}_COMPILER_FORCED)
+ if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}")
+ endif ()
+ set(CMAKE_${lang}_STANDARD_DEFAULT ${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT})
+ else ()
+ list(REVERSE __std_ver_pairs)
+ foreach (__std_ver_pair IN LISTS __std_ver_pairs)
+ string(REGEX MATCH "([^ ]+) (.+)" __std_ver_pair "${__std_ver_pair}")
+ set(__stdver ${CMAKE_MATCH_1})
+ set(__std ${CMAKE_MATCH_2})
+ if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver AND
+ NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_${lang}_STANDARD_DEFAULT ${__std})
+ endif ()
+ unset(__std)
+ unset(__stdver)
+ endforeach ()
+ endif ()
+ endif ()
+ unset(__std_ver_pairs)
+endmacro()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index bcd9218..b94087f 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -17,21 +17,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if (NOT CMAKE_C_COMPILER_FORCED)
- if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
- endif()
- set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)
- set(CMAKE_C_STANDARD_DEFAULT 11)
- else()
- set(CMAKE_C_STANDARD_DEFAULT 99)
- endif()
- endif()
-endif()
+__compiler_check_default_language_standard(C 3.4 99 3.6 11)
macro(cmake_record_c_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 8ed3695..5904efa 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -36,17 +36,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
- if (NOT CMAKE_CXX_COMPILER_FORCED)
- if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
- endif()
- set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
- endif()
-endif()
+__compiler_check_default_language_standard(CXX 3.1 98)
macro(cmake_record_cxx_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake
new file mode 100644
index 0000000..c81e77a
--- /dev/null
+++ b/Modules/Compiler/Clang-FindBinUtils.cmake
@@ -0,0 +1,25 @@
+if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
+ message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
+endif()
+
+# Try to find tools in the same directory as Clang itself
+get_filename_component(__clang_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH)
+get_filename_component(__clang_hint_1 "${__clang_hint_1}" DIRECTORY)
+
+get_filename_component(__clang_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)
+
+set(__clang_hints ${__clang_hint_1} ${__clang_hint_2})
+
+# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html
+find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
+ "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar"
+ HINTS ${__clang_hints}
+ DOC "LLVM archiver"
+)
+
+# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html
+find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
+ "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib"
+ HINTS ${__clang_hints}
+ DOC "Generate index for LLVM archive"
+)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 6b99a08..ef7ff2e 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -8,6 +8,8 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
+include(Compiler/CMakeCommonCompilerMacros)
+
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
macro(__compiler_clang lang)
@@ -28,12 +30,54 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
endif()
- set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO)
- set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
+ set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES)
+ set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
+
+ string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "AppleClang" __is_apple_clang)
+
+ # '-flto=thin' available since Clang 3.9 and Xcode 8
+ # * http://clang.llvm.org/docs/ThinLTO.html#clang-llvm
+ # * https://trac.macports.org/wiki/XcodeVersionInfo
+ set(_CMAKE_LTO_THIN TRUE)
+ if(__is_apple_clang)
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0)
+ set(_CMAKE_LTO_THIN FALSE)
+ endif()
+ else()
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.9)
+ set(_CMAKE_LTO_THIN FALSE)
+ endif()
+ endif()
+
+ if(_CMAKE_LTO_THIN)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ endif()
+
+ if(ANDROID)
+ # https://github.com/android-ndk/ndk/issues/242
+ set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold")
+ endif()
+
+ if(ANDROID OR __is_apple_clang)
+ set(__ar "${CMAKE_AR}")
+ set(__ranlib "${CMAKE_RANLIB}")
+ else()
+ set(__ar "${CMAKE_${lang}_COMPILER_AR}")
+ set(__ranlib "${CMAKE_${lang}_COMPILER_RANLIB}")
+ endif()
+
+ set(CMAKE_${lang}_ARCHIVE_CREATE_IPO
+ "${__ar} cr <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
+
+ set(CMAKE_${lang}_ARCHIVE_APPEND_IPO
+ "${__ar} r <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
- unset(CMAKE_${lang}_COMPILE_OPTIONS_IPO)
- unset(CMAKE_${lang}_ARCHIVE_CREATE_IPO)
- unset(CMAKE_${lang}_ARCHIVE_APPEND_IPO)
- unset(CMAKE_${lang}_ARCHIVE_FINISH_IPO)
+ set(CMAKE_${lang}_ARCHIVE_FINISH_IPO
+ "${__ranlib} <TARGET>"
+ )
endmacro()
endif()
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index 675560c..87ce20f 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -1 +1,22 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/Cray)
+
set(CMAKE_C_VERBOSE_FLAG "-v")
+
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION -h noc99,conform)
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu)
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform)
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu)
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform)
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu)
+ endif ()
+endif ()
+
+__compiler_check_default_language_standard(C 8.1 99)
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index 9fb191c..8506c094 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -1 +1,20 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/Cray)
+
set(CMAKE_CXX_VERBOSE_FLAG "-v")
+
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
+
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform)
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11)
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
+ endif ()
+endif ()
+
+__compiler_check_default_language_standard(CXX 8.1 98)
diff --git a/Modules/Compiler/Cray.cmake b/Modules/Compiler/Cray.cmake
new file mode 100644
index 0000000..8fe8eeb
--- /dev/null
+++ b/Modules/Compiler/Cray.cmake
@@ -0,0 +1,10 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_CRAY)
+ return()
+endif()
+set(__COMPILER_CRAY 1)
+
+include(Compiler/CMakeCommonCompilerMacros)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 3f02618..8090fa6 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -22,21 +22,7 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if (NOT CMAKE_C_COMPILER_FORCED)
- if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
- endif()
- set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
- set(CMAKE_C_STANDARD_DEFAULT 11)
- else()
- set(CMAKE_C_STANDARD_DEFAULT 90)
- endif()
- endif()
-endif()
+__compiler_check_default_language_standard(C 3.4 90 5.0 11)
macro(cmake_record_c_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 2499d2f..b221c4a 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -38,17 +38,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- if (NOT CMAKE_CXX_COMPILER_FORCED)
- if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
- endif()
- set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
- endif()
-endif()
+__compiler_check_default_language_standard(CXX 4.4 98 6.0 14)
macro(cmake_record_cxx_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/GNU-FindBinUtils.cmake b/Modules/Compiler/GNU-FindBinUtils.cmake
index 1aa0219..142636c 100644
--- a/Modules/Compiler/GNU-FindBinUtils.cmake
+++ b/Modules/Compiler/GNU-FindBinUtils.cmake
@@ -2,6 +2,12 @@ if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL
message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
endif()
+# Ubuntu 16.04:
+# * /usr/bin/gcc-ar-5
+# * /usr/bin/gcc-ranlib-5
+string(REGEX MATCH "^([0-9]+)" __version_x
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
+
string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
@@ -10,16 +16,18 @@ get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPIL
# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
- "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
HINTS ${__gcc_hints}
DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
)
# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
- "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
HINTS ${__gcc_hints}
DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 0a510f5..e2739a8 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -8,6 +8,8 @@ if(__COMPILER_GNU)
endif()
set(__COMPILER_GNU 1)
+include(Compiler/CMakeCommonCompilerMacros)
+
macro(__compiler_gnu lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 9c67fbd..d583dba 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -30,25 +30,11 @@ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=${_ext}99")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
- if (NOT CMAKE_C_COMPILER_FORCED)
- if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
- endif()
- set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- set(CMAKE_C_STANDARD_DEFAULT 11)
- else()
- set(CMAKE_C_STANDARD_DEFAULT 90)
- endif()
- endif()
-endif()
-
unset(_std)
unset(_ext)
+__compiler_check_default_language_standard(C 12.1 90 15.0.0 11)
+
macro(cmake_record_c_compile_features)
set(_result 0)
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 9c39236..4aef30a 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -47,22 +47,11 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
endif()
endif()
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- if (NOT CMAKE_CXX_COMPILER_FORCED)
- if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
- else()
- set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
- endif()
- elseif (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
- endif()
-endif()
-
unset(_std)
unset(_ext)
+__compiler_check_default_language_standard(CXX 12.1 98)
+
macro(cmake_record_cxx_compile_features)
set(_result 0)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
index 06d01f1..635ac4d 100644
--- a/Modules/Compiler/Intel.cmake
+++ b/Modules/Compiler/Intel.cmake
@@ -8,6 +8,8 @@ if(__COMPILER_INTEL)
endif()
set(__COMPILER_INTEL 1)
+include(Compiler/CMakeCommonCompilerMacros)
+
if(CMAKE_HOST_WIN32)
# MSVC-like
macro(__compiler_intel lang)
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 316cab8..785e269 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -24,4 +24,10 @@ else()
set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
+
+ if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
+ set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
+ endif()
+
endif()
diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake
index 85d6e7e..3b3848a 100644
--- a/Modules/Compiler/PGI-C.cmake
+++ b/Modules/Compiler/PGI-C.cmake
@@ -2,3 +2,16 @@ include(Compiler/PGI)
__compiler_pgi(C)
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION -c89)
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION -c89)
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION -c99)
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION -c99)
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.3)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION -c11)
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION -c11)
+ endif ()
+endif ()
+
+__compiler_check_default_language_standard(C 12.10 90)
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 896e298..35076bb 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -2,3 +2,22 @@ include(Compiler/PGI)
__compiler_pgi(CXX)
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
+
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -A)
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions)
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11 -A)
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions)
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14 -A)
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions)
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17 -A)
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions)
+ endif()
+ endif()
+ endif()
+endif()
+
+__compiler_check_default_language_standard(CXX 12.10 98)
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index cc76deb..bdabeba 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -8,6 +8,8 @@ if(__COMPILER_PGI)
endif()
set(__COMPILER_PGI 1)
+include(Compiler/CMakeCommonCompilerMacros)
+
macro(__compiler_pgi lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/SunPro-C-FeatureTests.cmake b/Modules/Compiler/SunPro-C-FeatureTests.cmake
new file mode 100644
index 0000000..cccf3ae
--- /dev/null
+++ b/Modules/Compiler/SunPro-C-FeatureTests.cmake
@@ -0,0 +1,14 @@
+set(_cmake_oldestSupported "__SUNPRO_C >= 0x5130")
+
+set(SunPro_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L || __STDC_VERSION__ >= 199901L && defined(__C11FEATURES__))")
+set(_cmake_feature_test_c_static_assert "${SunPro_C11}")
+unset(SunPro_C11)
+
+set(SunPro_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${SunPro_C99}")
+set(_cmake_feature_test_c_variadic_macros "${SunPro_C99}")
+unset(SunPro_C99)
+
+set(SunPro_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${SunPro_C90}")
+unset(SunPro_C90)
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 503684a..ac88e6f 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -1,3 +1,8 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/SunPro)
+
set(CMAKE_C_VERBOSE_FLAG "-#")
set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC)
@@ -22,5 +27,36 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
endforeach()
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=c89")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11")
+elseif (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.11)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-xc99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-xc99")
+endif()
+
+__compiler_check_default_language_standard(C 5.11 90 5.14 11)
+
+macro(cmake_record_c_compile_features)
+ set(_result 0)
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
+ if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(11)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(99)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(90)
+ endif()
+ endif()
+endmacro()
+
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
index 8e97e1d..60280ca 100644
--- a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
@@ -5,6 +5,10 @@
set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130")
+set(SolarisStudio125_CXX11 "(__SUNPRO_CC >= 0x5140) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_binary_literals "${SolarisStudio125_CXX11}")
+set(_cmake_feature_test_cxx_reference_qualified_functions "${SolarisStudio125_CXX11}")
+
set(SolarisStudio124_CXX11 "(__SUNPRO_CC >= 0x5130) && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_alignas "${SolarisStudio124_CXX11}")
set(_cmake_feature_test_cxx_alignof "${SolarisStudio124_CXX11}")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index f4345b8..5db7987 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -1,3 +1,8 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/SunPro)
+
set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
@@ -36,19 +41,10 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- if (NOT CMAKE_CXX_COMPILER_FORCED)
- if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
- endif()
- set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
- elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
- endif()
-endif()
+__compiler_check_default_language_standard(CXX 5.13 98)
macro(cmake_record_cxx_compile_features)
set(_result 0)
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 6607926..9b25c0b 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -19,7 +19,7 @@ set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
set(CMAKE_Fortran_MODPATH_FLAG "-M")
set(CMAKE_Fortran_PREPROCESS_SOURCE
- "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
+ "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F -fpp <SOURCE> -o <PREPROCESSED_SOURCE>")
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F -fpp <SOURCE> -o <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro.cmake b/Modules/Compiler/SunPro.cmake
new file mode 100644
index 0000000..52da39a
--- /dev/null
+++ b/Modules/Compiler/SunPro.cmake
@@ -0,0 +1,10 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_SUNPRO)
+ return()
+endif()
+set(__COMPILER_SUNPRO 1)
+
+include(Compiler/CMakeCommonCompilerMacros)
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index f976c99..5dc8bc1 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -3,6 +3,39 @@ __compiler_xl(C)
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
-# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qhalt=e = Halt on error messages (rather than just severe errors)
-string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded -qhalt=e")
+# -qthreaded = Ensures that all optimizations will be thread-safe
+string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
+
+# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
+# front end and accepts the -std= option while only reserving -qlanglevel= for
+# compatibility. All other versions (previous versions on Linux ppc64
+# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
+# and BGQ, etc) are derived from the UNIX compiler and only accept the
+# -qlanglvl option.
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
+ if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
+ CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ else ()
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
+ endif ()
+ else ()
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
+ endif ()
+ endif ()
+endif()
+
+__compiler_check_default_language_standard(C 10.1 90)
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 545d657..b87e923 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -3,9 +3,47 @@ __compiler_xl(CXX)
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
-# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qhalt=e = Halt on error messages (rather than just severe errors)
-string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded -qhalt=e")
+# -qthreaded = Ensures that all optimizations will be thread-safe
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
+
+# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
+# front end and accepts the -std= option while only reserving -qlanglevel= for
+# compatibility. All other versions (previous versions on Linux ppc64
+# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
+# and BGQ, etc) are derived from the UNIX compiler and only accept the
+# -qlanglvl option.
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
+ if (CMAKE_SYSTEM MATCHES "Linux.*ppc64")
+ if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y")
+ else ()
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
+ endif ()
+ else ()
+ # The non-clang based Linux ppc64 compiler, both big-endian and
+ # little-endian lacks, the non-extension language level flags
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
+ endif ()
+ else ()
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
+ endif ()
+endif ()
+
+__compiler_check_default_language_standard(CXX 10.1 98)
set(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 55f71bd..4783785 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -8,6 +8,8 @@ if(__COMPILER_XL)
endif()
set(__COMPILER_XL 1)
+include(Compiler/CMakeCommonCompilerMacros)
+
# Find the CreateExportList program that comes with this toolchain.
find_program(CMAKE_XL_CreateExportList
NAMES CreateExportList
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 873f88d..7331fb2 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -1111,7 +1111,7 @@ if("${ExternalData_ACTION}" STREQUAL "fetch")
list(GET algo_list ${ii} algo)
_ExternalData_download_object("${name}" "${hash}" "${algo}"
obj succeeded algoErrorMsg)
- set(errorMsg "${errorMsg}\n${algoErrorMsg}")
+ string(APPEND errorMsg "\n${algoErrorMsg}")
if(succeeded)
break()
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index b812845..2495736 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -415,7 +415,7 @@ file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
foreach(line IN LISTS lines)
if("${line}" MATCHES "^\\.\\. command:: ([A-Za-z0-9_]+)")
if(_ep_func)
- set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
+ string(APPEND _ep_keywords_${_ep_func} ")$")
endif()
set(_ep_func "${CMAKE_MATCH_1}")
#message("function [${_ep_func}]")
@@ -424,13 +424,13 @@ foreach(line IN LISTS lines)
elseif("${line}" MATCHES "^ ``([A-Z0-9_]+) .*``$")
set(_ep_key "${CMAKE_MATCH_1}")
#message(" keyword [${_ep_key}]")
- set(_ep_keywords_${_ep_func}
- "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}")
+ string(APPEND _ep_keywords_${_ep_func}
+ "${_ep_keyword_sep}${_ep_key}")
set(_ep_keyword_sep "|")
endif()
endforeach()
if(_ep_func)
- set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
+ string(APPEND _ep_keywords_${_ep_func} ")$")
endif()
# Save regex matching supported hash algorithm names.
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 093d8c9..b2fb4b7 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -889,6 +889,33 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
endfunction()
#
+# Some boost libraries may require particular set of compler features.
+# The very first one was `boost::fiber` introduced in Boost 1.62.
+# One can check required compiler features of it in
+# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
+#
+function(_Boost_COMPILER_FEATURES component _ret)
+ # Boost >= 1.62 and < 1.65
+ if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500)
+ set(_Boost_FIBER_COMPILER_FEATURES
+ cxx_alias_templates
+ cxx_auto_type
+ cxx_constexpr
+ cxx_defaulted_functions
+ cxx_final
+ cxx_lambdas
+ cxx_noexcept
+ cxx_nullptr
+ cxx_rvalue_references
+ cxx_thread_local
+ cxx_variadic_templates
+ )
+ endif()
+ string(TOUPPER ${component} uppercomponent)
+ set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE)
+endfunction()
+
+#
# Update library search directory hint variable with paths used by prebuilt boost binaries.
#
# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/)
@@ -1640,6 +1667,9 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
_Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
+ # Check if component requires some compiler features
+ _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
+
endforeach()
# Restore the original find library ordering
@@ -1811,6 +1841,10 @@ if(Boost_FOUND)
set_target_properties(Boost::${COMPONENT} PROPERTIES
INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
endif()
+ if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}")
+ endif()
endif()
endif()
endforeach()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index e323430..a4dca54 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1825,7 +1825,7 @@ macro(cuda_compile_base cuda_target format generated_files)
else()
set(_counter 1)
endif()
- set(_cuda_target "${_cuda_target}_${_counter}")
+ string(APPEND _cuda_target "_${_counter}")
set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter})
# Separate the sources from the options
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index 4b868a2..f6c8e3f 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -25,7 +25,7 @@
# library interfaces with OpenGL. It is not strictly needed
# in applications.
# IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files.
-# IL_FOUND - this is set to TRUE if all the above variables were set.
+# DevIL_FOUND - this is set to TRUE if all the above variables were set.
# This will be set to false if ILU or ILUT are not found,
# even if they are not needed. In most systems, if one
# library is found all the others are as well. That's the
@@ -70,3 +70,5 @@ find_library(ILU_LIBRARIES
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG
IL_LIBRARIES ILU_LIBRARIES
IL_INCLUDE_DIR)
+# provide legacy variable for compatiblity
+set(IL_FOUND ${DevIL_FOUND})
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 1e2ea69..5962c5b 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -354,11 +354,7 @@ macro( _HDF5_parse_compile_line
libraries
libraries_hl)
- if(UNIX)
- separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}")
- else()
- separate_arguments(_HDF5_COMPILE_ARGS WINDOWS_COMMAND "${${compile_line_var}}")
- endif()
+ separate_arguments(_HDF5_COMPILE_ARGS NATIVE_COMMAND "${${compile_line_var}}")
foreach(arg IN LISTS _HDF5_COMPILE_ARGS)
if("${arg}" MATCHES "^-I(.*)$")
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 4265a97..3d32560 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -143,6 +143,9 @@ if(Java_JAVA_EXECUTABLE)
if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"")
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "openjdk version \"([0-9]+)-[a-z]+\"")
+ # OpenJDK 9 early access builds or locally built
+ set(Java_VERSION_STRING "1.${CMAKE_MATCH_1}.0")
elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
# Kaffe style
set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index fab53cb..37f3255 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -645,8 +645,7 @@ foreach (lang C CXX Fortran)
add_library(MPI::MPI_${lang} INTERFACE IMPORTED)
endif()
if(MPI_${lang}_COMPILE_FLAGS)
- set(_MPI_${lang}_COMPILE_OPTIONS "${MPI_${lang}_COMPILE_FLAGS}")
- separate_arguments(_MPI_${lang}_COMPILE_OPTIONS)
+ separate_arguments(_MPI_${lang}_COMPILE_OPTIONS NATIVE_COMMAND "${MPI_${lang}_COMPILE_FLAGS}")
set_property(TARGET MPI::MPI_${lang} PROPERTY
INTERFACE_COMPILE_OPTIONS "${_MPI_${lang}_COMPILE_OPTIONS}")
endif()
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index eae1585..80bcda3 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -225,6 +225,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2017a=9.2"
"R2016b=9.1"
"R2016a=9.0"
"R2015b=8.6"
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 3eca5e1..b8a7d82 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -117,7 +117,12 @@ if(WIN32)
endif()
else()
find_library(OpenCL_LIBRARY
- NAMES OpenCL)
+ NAMES OpenCL
+ PATHS
+ ENV AMDAPPSDKROOT
+ PATH_SUFFIXES
+ lib/x86_64
+ lib/x64)
endif()
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 503d955..af83fb7 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -178,7 +178,7 @@ if(OPENGL_FOUND)
if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_gl_fw}.tbd")
- set(_gl_fw "${_gl_fw}.tbd")
+ string(APPEND _gl_fw ".tbd")
endif()
set_target_properties(OpenGL::GL PROPERTIES
IMPORTED_LOCATION "${_gl_fw}")
@@ -201,7 +201,7 @@ if(OPENGL_FOUND)
if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_glu_fw}.tbd")
- set(_glu_fw "${_glu_fw}.tbd")
+ string(APPEND _glu_fw ".tbd")
endif()
set_target_properties(OpenGL::GLU PROPERTIES
IMPORTED_LOCATION "${_glu_fw}")
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 8c1b018..1093be0 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -76,10 +76,10 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST
function(_OPENMP_FLAG_CANDIDATES LANG)
if(NOT OpenMP_${LANG}_FLAG)
- set(OpenMP_FLAG_CANDIDATES "")
+ unset(OpenMP_FLAG_CANDIDATES)
set(OMP_FLAG_GNU "-fopenmp")
- set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5")
+ set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
set(OMP_FLAG_HP "+Oopenmp")
if(WIN32)
set(OMP_FLAG_Intel "-Qopenmp")
@@ -92,16 +92,21 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "-openmp")
set(OMP_FLAG_PathScale "-openmp")
+ set(OMP_FLAG_NAG "-openmp")
+ set(OMP_FLAG_Absoft "-openmp")
set(OMP_FLAG_PGI "-mp")
set(OMP_FLAG_SunPro "-xopenmp")
set(OMP_FLAG_XL "-qsmp=omp")
# Cray compiles with OpenMP automatically
+ set(OMP_FLAG_Cray " ")
+ # If we know the correct flags, use those
if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
- list(APPEND OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ set(OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ # Fall back to reasonable default tries otherwise
+ else()
+ set(OpenMP_FLAG_CANDIDATES "-openmp" "-fopenmp" "-mp" " ")
endif()
-
- list(APPEND OpenMP_FLAG_CANDIDATES " ")
set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
else()
set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_${LANG}_FLAG}" PARENT_SCOPE)
@@ -152,7 +157,7 @@ endfunction()
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
-function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
+function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
_OPENMP_FLAG_CANDIDATES("${LANG}")
_OPENMP_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenMPTryFlag _OPENMP_TEST_SRC)
@@ -161,13 +166,13 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
if(CMAKE_${LANG}_VERBOSE_FLAG)
string(APPEND OPENMP_FLAGS_TEST " ${CMAKE_${LANG}_VERBOSE_FLAG}")
endif()
- try_compile( OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
+ string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
+ try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
)
- if(OpenMP_TRY_COMPILE_RESULT)
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
+ if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG})
set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE)
if(CMAKE_${LANG}_VERBOSE_FLAG)
@@ -219,7 +224,6 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
endif()
set("${OPENMP_LIB_NAMES_VAR}" "NOTFOUND" PARENT_SCOPE)
set("${OPENMP_FLAG_VAR}" "NOTFOUND" PARENT_SCOPE)
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
endforeach()
endfunction()
@@ -265,19 +269,18 @@ function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
_OPENMP_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenMPCheckVersion _OPENMP_TEST_SRC)
set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP/ompver_${LANG}.bin")
- try_compile(OpenMP_TRY_COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
+ string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
+ try_compile(OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG} "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}"
COPY_FILE ${BIN_FILE})
- if(${OpenMP_TRY_COMPILE_RESULT})
+ if(${OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG}})
file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenMP-date")
set(regex_spec_date ".*INFO:OpenMP-date\\[0*([^]]*)\\].*")
if("${specstr}" MATCHES "${regex_spec_date}")
set(${SPEC_DATE} "${CMAKE_MATCH_1}" PARENT_SCOPE)
endif()
endif()
-
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
endfunction()
macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG)
@@ -318,7 +321,7 @@ foreach(LANG IN ITEMS C CXX)
if(CMAKE_${LANG}_COMPILER_LOADED)
if(NOT DEFINED OpenMP_${LANG}_FLAGS OR "${OpenMP_${LANG}_FLAGS}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_${LANG}_LIB_NAMES OR "${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND")
- _OPENMP_GET_FLAGS("${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("${LANG}" "${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
endif()
set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}"
@@ -334,7 +337,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE)
set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none")
- _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("Fortran" "FortranHeader" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
if(OpenMP_Fortran_FLAGS_WORK)
set(OpenMP_Fortran_HAVE_OMPLIB_MODULE TRUE CACHE BOOL INTERNAL "")
endif()
@@ -350,7 +353,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_HEADER)
set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'")
- _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("Fortran" "FortranModule" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
if(OpenMP_Fortran_FLAGS_WORK)
set(OpenMP_Fortran_HAVE_OMPLIB_HEADER TRUE CACHE BOOL INTERNAL "")
endif()
@@ -411,11 +414,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
add_library(OpenMP::OpenMP_${LANG} INTERFACE IMPORTED)
endif()
if(OpenMP_${LANG}_FLAGS)
- if(CMAKE_HOST_WIN32)
- separate_arguments(_OpenMP_${LANG}_OPTIONS WINDOWS_COMMAND "${OpenMP_${LANG}_FLAGS}")
- else()
- separate_arguments(_OpenMP_${LANG}_OPTIONS UNIX_COMMAND "${OpenMP_${LANG}_FLAGS}")
- endif()
+ separate_arguments(_OpenMP_${LANG}_OPTIONS NATIVE_COMMAND "${OpenMP_${LANG}_FLAGS}")
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
INTERFACE_COMPILE_OPTIONS "${_OpenMP_${LANG}_OPTIONS}")
unset(_OpenMP_${LANG}_OPTIONS)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 1209560..f32eb50 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -376,7 +376,7 @@ set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} )
if (OPENSSL_VERSION)
find_package_handle_standard_args(OpenSSL
REQUIRED_VARS
- OPENSSL_SSL_LIBRARY
+ #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request?
OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR
VERSION_VAR
@@ -386,7 +386,7 @@ if (OPENSSL_VERSION)
)
else ()
find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
- OPENSSL_SSL_LIBRARY
+ #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request?
OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR
)
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index b77925d..b851a90 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -147,7 +147,7 @@ endmacro()
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
- _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
@@ -374,7 +374,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
if(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
else()
- _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
endif()
endif()
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 54572f0..12a5ded 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -190,10 +190,12 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat
string(APPEND _find_opts " NO_CMAKE_ENVIRONMENT_PATH")
endif()
+ unset(_search_paths)
foreach (flag IN LISTS ${_prefix}_LDFLAGS)
if (flag MATCHES "^-L(.*)")
# only look into the given paths from now on
- set(_find_opts HINTS ${CMAKE_MATCH_1} NO_DEFAULT_PATH)
+ list(APPEND _search_paths ${CMAKE_MATCH_1})
+ set(_find_opts HINTS ${_search_paths} NO_DEFAULT_PATH)
continue()
endif()
if (flag MATCHES "^-l(.*)")
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 102ed42..6dc0444 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -40,6 +40,15 @@
# ``Protobuf_LITE_LIBRARIES``
# The protobuf-lite libraries
#
+# The following :prop_tgt:`IMPORTED` targets are also defined:
+#
+# ``Protobuf::protobuf``
+# The protobuf library.
+# ``Protobuf::protobuf-lite``
+# The protobuf lite library.
+# ``Protobuf::protoc``
+# The protoc library.
+#
# The following cache variables are also available to set or use:
#
# ``Protobuf_LIBRARY``
@@ -409,6 +418,78 @@ if(Protobuf_INCLUDE_DIR)
message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}"
" doesn't match library version ${Protobuf_VERSION}")
endif()
+
+ if(Protobuf_LIBRARY)
+ if(NOT TARGET Protobuf::protobuf)
+ add_library(Protobuf::protobuf UNKNOWN IMPORTED)
+ set_target_properties(Protobuf::protobuf PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_LIBRARY}")
+ set_target_properties(Protobuf::protobuf PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_LIBRARY_RELEASE}")
+ set_property(TARGET Protobuf::protobuf APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(Protobuf::protobuf PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_LIBRARY_DEBUG}")
+ set_property(TARGET Protobuf::protobuf APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Protobuf::protobuf PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
+
+ if(Protobuf_LITE_LIBRARY)
+ if(NOT TARGET Protobuf::protobuf-lite)
+ add_library(Protobuf::protobuf-lite UNKNOWN IMPORTED)
+ set_target_properties(Protobuf::protobuf-lite PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_LITE_LIBRARY}")
+ set_target_properties(Protobuf::protobuf-lite PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_LITE_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_LITE_LIBRARY_RELEASE}")
+ set_property(TARGET Protobuf::protobuf-lite APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(Protobuf::protobuf-lite PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_LITE_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_LITE_LIBRARY_DEBUG}")
+ set_property(TARGET Protobuf::protobuf-lite APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Protobuf::protobuf-lite PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
+
+ if(Protobuf_PROTOC_LIBRARY)
+ if(NOT TARGET Protobuf::protoc)
+ add_library(Protobuf::protoc UNKNOWN IMPORTED)
+ set_target_properties(Protobuf::protoc PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY}")
+ set_target_properties(Protobuf::protoc PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY_RELEASE}")
+ set_property(TARGET Protobuf::protoc APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(Protobuf::protoc PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY_DEBUG}")
+ set_property(TARGET Protobuf::protoc APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Protobuf::protoc PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index 3a66f68..e3b81d7 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -15,11 +15,11 @@ int main() { return 0; }
# List manglings of global symbol names to try.
set(global_symbols
my_sub # VisualAge
- my_sub_ # GNU, Intel, HP, SunPro, MIPSpro
+ my_sub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
my_sub__ # GNU g77
MY_SUB # Intel on Windows
mysub # VisualAge
- mysub_ # GNU, Intel, HP, SunPro, MIPSpro
+ mysub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
MYSUB # Intel on Windows
${FortranCInterface_GLOBAL_SYMBOLS}
)
@@ -71,7 +71,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(PathScale|Cray)$")
# use '.in.' so we cannot provide them anyway.
# - Cray Fortran >= 7.3.2 uses module init symbols but module symbols
# use 'mysub$mymodule_' so we cannot provide them anyway.
- list(APPEND symbol_sources mymodule_.c my_module_.c)
+ list(APPEND symbol_sources mymodule_.c my_module_.c MY_MODULE.c MYMODULE.c)
endif()
foreach(symbol IN LISTS global_symbols module_symbols)
# Skip symbols with '$' if C cannot handle them.
@@ -93,11 +93,12 @@ add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
# Provide symbols through C but fall back to Fortran.
add_library(symbols STATIC ${symbol_sources})
-target_link_libraries(symbols myfort)
+target_link_libraries(symbols PUBLIC myfort)
+
# In case the Fortran compiler produces PIC by default make sure
# the C compiler produces PIC even if it is not its default.
set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
# Require symbols through Fortran.
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
-target_link_libraries(FortranCInterface symbols)
+target_link_libraries(FortranCInterface PUBLIC symbols)
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 7612890..7789785 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -27,6 +27,7 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
set(_result)
# Build a sample project which reports symbols.
+set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_COMPILED
${FortranCInterface_BINARY_DIR}
${FortranCInterface_SOURCE_DIR}
@@ -35,6 +36,8 @@ try_compile(FortranCInterface_COMPILED
CMAKE_FLAGS
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
+ "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
@@ -43,7 +46,7 @@ unset(FortranCInterface_COMPILED CACHE)
if(FortranCInterface_COMPILED)
find_program(FortranCInterface_EXE
NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
- PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
+ PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Release
NO_DEFAULT_PATH
)
set(FortranCInterface_EXE ${FortranCInterface_EXE})
diff --git a/Modules/FortranCInterface/MYMODULE.c b/Modules/FortranCInterface/MYMODULE.c
new file mode 100644
index 0000000..19b51fb
--- /dev/null
+++ b/Modules/FortranCInterface/MYMODULE.c
@@ -0,0 +1,3 @@
+void MYMODULE(void)
+{
+}
diff --git a/Modules/FortranCInterface/MY_MODULE.c b/Modules/FortranCInterface/MY_MODULE.c
new file mode 100644
index 0000000..87b3071
--- /dev/null
+++ b/Modules/FortranCInterface/MY_MODULE.c
@@ -0,0 +1,3 @@
+void MY_MODULE(void)
+{
+}
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index a3b97ab..0090cdc 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -943,7 +943,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
if(NOT list_length_before_append EQUAL list_length_after_append)
gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}")
- set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+ if(EXISTS "${resolved_item}")
+ # Recurse only if we could resolve the item.
+ # Otherwise the prerequisites_var list will be cleared
+ set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+ endif()
endif()
endif()
endif()
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 91a3a25..c9e0544 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -9,48 +9,162 @@ This module defines functions to help use the Google Test infrastructure.
.. command:: gtest_add_tests
- Automatically add tests with CTest by scanning source code for Google test
- macros.
+ Automatically add tests with CTest by scanning source code for Google Test
+ macros::
- ::
+ gtest_add_tests(TARGET target
+ [SOURCES src1...]
+ [EXTRA_ARGS arg1...]
+ [WORKING_DIRECTORY dir]
+ [TEST_PREFIX prefix]
+ [TEST_SUFFIX suffix]
+ [SKIP_DEPENDENCY]
+ [TEST_LIST outVar]
+ )
- gtest_add_tests(<exe> <args> <files>...)
+ ``TARGET target``
+ This must be a known CMake target. CMake will substitute the location of
+ the built executable when running the test.
- ``<exe>``
- The path to the test executable.
- ``<args>``
+ ``SOURCES src1...``
+ When provided, only the listed files will be scanned for test cases. If
+ this option is not given, the :prop_tgt:`SOURCES` property of the
+ specified ``target`` will be used to obtain the list of sources.
+
+ ``EXTRA_ARGS arg1...``
+ Any extra arguments to pass on the command line to each test case.
+
+ ``WORKING_DIRECTORY dir``
+ Specifies the directory in which to run the discovered test cases. If this
+ option is not provided, the current binary directory is used.
+
+ ``TEST_PREFIX prefix``
+ Allows the specified ``prefix`` to be prepended to the name of each
+ discovered test case. This can be useful when the same source files are
+ being used in multiple calls to ``gtest_add_test()`` but with different
+ ``EXTRA_ARGS``.
+
+ ``TEST_SUFFIX suffix``
+ Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
+ every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` can be
+ specified.
+
+ ``SKIP_DEPENDENCY``
+ Normally, the function creates a dependency which will cause CMake to be
+ re-run if any of the sources being scanned are changed. This is to ensure
+ that the list of discovered tests is updated. If this behavior is not
+ desired (as may be the case while actually writing the test cases), this
+ option can be used to prevent the dependency from being added.
+
+ ``TEST_LIST outVar``
+ The variable named by ``outVar`` will be populated in the calling scope
+ with the list of discovered test cases. This allows the caller to do things
+ like manipulate test properties of the discovered tests.
+
+ .. code-block:: cmake
+
+ include(GoogleTest)
+ add_executable(FooTest FooUnitTest.cxx)
+ gtest_add_tests(TARGET FooTest
+ TEST_SUFFIX .noArgs
+ TEST_LIST noArgsTests
+ )
+ gtest_add_tests(TARGET FooTest
+ EXTRA_ARGS --someArg someValue
+ TEST_SUFFIX .withArgs
+ TEST_LIST withArgsTests
+ )
+ set_tests_properties(${noArgsTests} PROPERTIES TIMEOUT 10)
+ set_tests_properties(${withArgsTests} PROPERTIES TIMEOUT 20)
+
+ For backward compatibility reasons, the following form is also supported::
+
+ gtest_add_tests(exe args files...)
+
+ ``exe``
+ The path to the test executable or the name of a CMake target.
+ ``args``
A ;-list of extra arguments to be passed to executable. The entire
list must be passed as a single argument. Enclose it in quotes,
or pass ``""`` for no arguments.
- ``<files>...``
+ ``files...``
A list of source files to search for tests and test fixtures.
- Alternatively, use ``AUTO`` to specify that ``<exe>`` is the name
+ Alternatively, use ``AUTO`` to specify that ``exe`` is the name
of a CMake executable target whose sources should be scanned.
-Example
-^^^^^^^
-
-.. code-block:: cmake
+ .. code-block:: cmake
- include(GoogleTest)
- set(FooTestArgs --foo 1 --bar 2)
- add_executable(FooTest FooUnitTest.cc)
- gtest_add_tests(FooTest "${FooTestArgs}" AUTO)
+ include(GoogleTest)
+ set(FooTestArgs --foo 1 --bar 2)
+ add_executable(FooTest FooUnitTest.cxx)
+ gtest_add_tests(FooTest "${FooTestArgs}" AUTO)
#]=======================================================================]
-function(gtest_add_tests executable extra_args)
- if(NOT ARGN)
- message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
+function(gtest_add_tests)
+
+ if (ARGC LESS 1)
+ message(FATAL_ERROR "No arguments supplied to gtest_add_tests()")
endif()
- if(ARGN STREQUAL "AUTO")
- # obtain sources used for building that executable
- get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+
+ set(options
+ SKIP_DEPENDENCY
+ )
+ set(oneValueArgs
+ TARGET
+ WORKING_DIRECTORY
+ TEST_PREFIX
+ TEST_SUFFIX
+ TEST_LIST
+ )
+ set(multiValueArgs
+ SOURCES
+ EXTRA_ARGS
+ )
+ set(allKeywords ${options} ${oneValueArgs} ${multiValueArgs})
+
+ unset(sources)
+ if("${ARGV0}" IN_LIST allKeywords)
+ cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ set(autoAddSources YES)
+ else()
+ # Non-keyword syntax, convert to keyword form
+ if (ARGC LESS 3)
+ message(FATAL_ERROR "gtest_add_tests() without keyword options requires at least 3 arguments")
+ endif()
+ set(ARGS_TARGET "${ARGV0}")
+ set(ARGS_EXTRA_ARGS "${ARGV1}")
+ if(NOT "${ARGV2}" STREQUAL "AUTO")
+ set(ARGS_SOURCES "${ARGV}")
+ list(REMOVE_AT ARGS_SOURCES 0 1)
+ endif()
+ endif()
+
+ # The non-keyword syntax allows the first argument to be an arbitrary
+ # executable rather than a target if source files are also provided. In all
+ # other cases, both forms require a target.
+ if(NOT TARGET "${ARGS_TARGET}" AND NOT ARGS_SOURCES)
+ message(FATAL_ERROR "${ARGS_TARGET} does not define an existing CMake target")
+ endif()
+ if(NOT ARGS_WORKING_DIRECTORY)
+ unset(workDir)
+ else()
+ set(workDir WORKING_DIRECTORY "${ARGS_WORKING_DIRECTORY}")
+ endif()
+
+ if(NOT ARGS_SOURCES)
+ get_property(ARGS_SOURCES TARGET ${ARGS_TARGET} PROPERTY SOURCES)
endif()
+
+ unset(testList)
+
set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
- foreach(source ${ARGN})
- set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
+
+ foreach(source IN LISTS ARGS_SOURCES)
+ if(NOT ARGS_SKIP_DEPENDENCY)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
+ endif()
file(READ "${source}" contents)
string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})
@@ -67,7 +181,16 @@ function(gtest_add_tests executable extra_args)
message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
continue()
endif()
- add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args})
+ add_test(NAME ${ARGS_TEST_PREFIX}${test_name}${ARGS_TEST_SUFFIX}
+ ${workDir}
+ COMMAND ${ARGS_TARGET} --gtest_filter=${test_name} ${ARGS_EXTRA_ARGS}
+ )
+ list(APPEND testList ${ARGS_TEST_PREFIX}${test_name}${ARGS_TEST_SUFFIX})
endforeach()
endforeach()
+
+ if(ARGS_TEST_LIST)
+ set(${ARGS_TEST_LIST} ${testList} PARENT_SCOPE)
+ endif()
+
endfunction()
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 50b8526..de336e7 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -22,9 +22,18 @@ macro(_record_compiler_features lang compile_flags feature_list)
file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
"\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
+ if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION)
+ # This toolchain requires use of the language standard flag
+ # when linking in order to use the matching standard library.
+ set(compile_flags_for_link "${compile_flags}")
+ else()
+ set(compile_flags_for_link "")
+ endif()
+
try_compile(CMAKE_${lang}_FEATURE_TEST
${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
COMPILE_DEFINITIONS "${compile_flags}"
+ LINK_LIBRARIES "${compile_flags_for_link}"
OUTPUT_VARIABLE _output
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
COPY_FILE_ERROR _copy_error
@@ -35,6 +44,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
set(_result 255)
endif()
unset(CMAKE_${lang}_FEATURE_TEST CACHE)
+ unset(compile_flags_for_link)
if (_result EQUAL 0)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index ca6e97c..7f08c4a 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -19,7 +19,7 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl")
macro(__aix_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
- set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath")
+ string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-G,-bnoipath")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake
index 5e437fa..cbfd58b 100644
--- a/Modules/Platform/AIX-XL-C.cmake
+++ b/Modules/Platform/AIX-XL-C.cmake
@@ -1,2 +1,5 @@
include(Platform/AIX-XL)
__aix_compiler_xl(C)
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake
index ef38a5f..78baef5 100644
--- a/Modules/Platform/AIX-XL-CXX.cmake
+++ b/Modules/Platform/AIX-XL-CXX.cmake
@@ -1,2 +1,5 @@
include(Platform/AIX-XL)
__aix_compiler_xl(CXX)
+
+# -qhalt=s = Halt on severe error messages
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
index f13b517..918ee70 100644
--- a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
@@ -3,3 +3,6 @@
__BlueGeneP_set_dynamic_flags(XL C)
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
index 80c05a1..cfefb0b 100644
--- a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
@@ -3,3 +3,6 @@
__BlueGeneP_set_dynamic_flags(XL CXX)
+
+# -qhalt=s = Halt on severe error messages
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake
index a990b5c..7d4fc13 100644
--- a/Modules/Platform/BlueGeneP-static-XL-C.cmake
+++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake
@@ -3,3 +3,6 @@
__BlueGeneP_set_static_flags(XL C)
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
index 116c0bb..1df276e 100644
--- a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
@@ -3,3 +3,6 @@
__BlueGeneP_set_static_flags(XL CXX)
+
+# -qhalt=s = Halt on severe error messages
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
index f46fa95..c51dacb 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
@@ -3,3 +3,6 @@
__BlueGeneQ_setup_dynamic(XL C)
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
index c463379..5dbc836 100644
--- a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
@@ -3,3 +3,6 @@
__BlueGeneQ_setup_dynamic(XL CXX)
+
+# -qhalt=s = Halt on severe error messages
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
index 465128f..67cd57d 100644
--- a/Modules/Platform/BlueGeneQ-static-XL-C.cmake
+++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
@@ -3,3 +3,6 @@
__BlueGeneQ_setup_static(XL C)
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
index abd4ebf..a171e7f 100644
--- a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
+++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
@@ -3,3 +3,6 @@
__BlueGeneQ_setup_static(XL CXX)
+
+# -qhalt=s = Halt on severe error messages
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index d08dc81..784c8c6 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -40,7 +40,7 @@ macro(__cygwin_compiler_gnu lang)
set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols")
# TODO: Is -Wl,--enable-auto-import now always default?
- set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import")
+ string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,--enable-auto-import")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")
if(NOT CMAKE_RC_COMPILER_INIT)
diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake
index 42e94a9..2aeb132 100644
--- a/Modules/Platform/Darwin-XL-C.cmake
+++ b/Modules/Platform/Darwin-XL-C.cmake
@@ -3,3 +3,6 @@ set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
# Enable shared library versioning.
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name")
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake
index 65c76f8..f8e1906 100644
--- a/Modules/Platform/Darwin-XL-CXX.cmake
+++ b/Modules/Platform/Darwin-XL-CXX.cmake
@@ -3,3 +3,6 @@ set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle")
# Enable shared library versioning.
set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name")
+
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake
index 7ac804b..699c4aa 100644
--- a/Modules/Platform/HP-UX-GNU.cmake
+++ b/Modules/Platform/HP-UX-GNU.cmake
@@ -9,7 +9,7 @@ endif()
set(__HPUX_COMPILER_GNU 1)
macro(__hpux_compiler_gnu lang)
- set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath")
+ string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-E,-b,+nodefaultrpath")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index a407e43..db032c2 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -14,4 +14,5 @@ macro(__linux_compiler_pgi lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS " ")
endmacro()
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 22daa62..50477a4 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -148,6 +148,7 @@ macro(__windows_compiler_gnu_abi lang)
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
DOC "Visual Studio vcvars32.bat"
PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
@@ -161,6 +162,7 @@ macro(__windows_compiler_gnu_abi lang)
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat
DOC "Visual Studio vcvarsamd64.bat"
PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e4aca6e..cfe6e1c 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -152,9 +152,9 @@ if(WINCE)
foreach(lang C CXX)
if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM")
- set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}")
+ string(APPEND _PLATFORM_DEFINES_${lang} " /D${MSVC_${lang}_ARCHITECTURE_ID}")
if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$")
- set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T")
+ string(APPEND _FLAGS_${lang} " /QRarch${CMAKE_MATCH_1}T")
endif()
endif()
endforeach()
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 8ae3720..1182875 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -417,7 +417,7 @@ endfunction ()
function(__java_lcat VAR)
foreach(_line ${ARGN})
- set(${VAR} "${${VAR}}${_line}\n")
+ string(APPEND ${VAR} "${_line}\n")
endforeach()
set(${VAR} "${${VAR}}" PARENT_SCOPE)
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 362099e..e7f9912 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -447,7 +447,7 @@ function(write_compiler_detection_header
endif()
if(NOT _WCD_ALLOW_UNKNOWN_COMPILER_VERSIONS)
- set(${compiler_file_content} "${${compiler_file_content}}
+ string(APPEND ${compiler_file_content} "
# if !(${_cmake_oldestSupported_${compiler}})
# error Unsupported compiler version
# endif\n")
@@ -462,7 +462,7 @@ function(write_compiler_detection_header
set(MACRO_HEX)
endif()
string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY)
- set(${compiler_file_content} "${${compiler_file_content}}${VERSION_BLOCK}\n")
+ string(APPEND ${compiler_file_content} "${VERSION_BLOCK}\n")
set(PREFIX)
set(MACRO_DEC)
set(MACRO_HEX)
@@ -478,7 +478,7 @@ function(write_compiler_detection_header
set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n")
set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n")
endif()
- set(${compiler_file_content} "${${compiler_file_content}}${_define_item}")
+ string(APPEND ${compiler_file_content} "${_define_item}")
endforeach()
endforeach()
if(pp_if STREQUAL "elif")
diff --git a/Source/.gitattributes b/Source/.gitattributes
index f69ad9d..0f829a3 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,20 +1,2 @@
-/cmCommandArgumentLexer.cxx generated
-/cmCommandArgumentLexer.h generated
-/cmCommandArgumentParser.cxx generated
-/cmCommandArgumentParserTokens.h generated
-/cmDependsJavaLexer.cxx generated
-/cmDependsJavaLexer.h generated
-/cmDependsJavaParser.cxx generated
-/cmDependsJavaParserTokens.h generated
-/cmExprLexer.cxx generated
-/cmExprLexer.h generated
-/cmExprParser.cxx generated
-/cmExprParserTokens.h generated
-/cmFortranLexer.cxx generated
-/cmFortranLexer.h generated
-/cmFortranParser.cxx generated
-/cmFortranParserTokens.h generated
-/cmListFileLexer.c generated
-
# Do not format third-party sources.
/kwsys/** -format.clang-format
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8d683cb3f..40403ca 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -78,6 +78,7 @@ configure_file(
include_directories(
"${CMake_BINARY_DIR}/Source"
"${CMake_SOURCE_DIR}/Source"
+ "${CMake_SOURCE_DIR}/Source/LexerParser"
${CMAKE_ZLIB_INCLUDES}
${CMAKE_EXPAT_INCLUDES}
${CMAKE_TAR_INCLUDES}
@@ -88,61 +89,6 @@ include_directories(
# let cmake know it is supposed to use it
add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
-option(CMAKE_REGENERATE_YACCLEX
- "Regenerate YACC and LEXX files" OFF)
-mark_as_advanced(CMAKE_REGENERATE_YACCLEX)
-if(CMAKE_REGENERATE_YACCLEX)
- set(parsersLexers cmFortran cmCommandArgument cmExpr)
- find_program(YACC_EXECUTABLE
- NAMES yacc bison
- PATHS /usr/bin
- DOC "Yacc or Bison executable")
- find_program(FLEX_EXECUTABLE
- NAMES flex
- PATHS /usr/bin
- DOC "Flex executable")
- mark_as_advanced(YACC_EXECUTABLE FLEX_EXECUTABLE)
- if(YACC_EXECUTABLE)
- set(BISON_FLAGS)
- if(YACC_EXECUTABLE MATCHES "bison")
- set(BISON_FLAGS "--yacc")
- endif()
- set(yacc_files)
- foreach(name ${parsersLexers})
- set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y")
- set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx")
- set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h")
- add_custom_command(
- OUTPUT "${dst}"
- DEPENDS "${src}"
- COMMAND
- ${YACC_EXECUTABLE}
- --name-prefix=${name}_yy --defines=${hdr} -o${dst} ${src}
- )
- set(yacc_files ${yacc_files} "${dst}")
- endforeach()
- add_custom_target(RerunYacc DEPENDS ${yacc_files})
- endif()
- if(FLEX_EXECUTABLE)
- set(lex_files)
- foreach(name ${parsersLexers})
- set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l")
- set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx")
- set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h")
- add_custom_command(
- OUTPUT "${dst}"
- DEPENDS "${src}"
- COMMAND
- ${FLEX_EXECUTABLE}
- --prefix=${name}_yy --header-file=${hdr} -o${dst} ${src}
- )
- set(lex_files ${lex_files} "${dst}")
- endforeach()
- add_custom_target(RerunLex DEPENDS ${lex_files})
- endif()
-
-endif()
-
# Check if we can build the ELF parser.
if(CMAKE_USE_ELF_PARSER)
set(ELF_SRCS cmELF.h cmELF.cxx)
@@ -157,14 +103,40 @@ endif()
# Sources for CMakeLib
#
set(SRCS
+ # Lexers/Parsers
+ LexerParser/cmCommandArgumentLexer.cxx
+ LexerParser/cmCommandArgumentLexer.h
+ LexerParser/cmCommandArgumentLexer.in.l
+ LexerParser/cmCommandArgumentParser.cxx
+ LexerParser/cmCommandArgumentParserTokens.h
+ LexerParser/cmCommandArgumentParser.y
+ LexerParser/cmDependsJavaLexer.cxx
+ LexerParser/cmDependsJavaLexer.h
+ LexerParser/cmDependsJavaLexer.in.l
+ LexerParser/cmDependsJavaParser.cxx
+ LexerParser/cmDependsJavaParserTokens.h
+ LexerParser/cmDependsJavaParser.y
+ LexerParser/cmExprLexer.cxx
+ LexerParser/cmExprLexer.h
+ LexerParser/cmExprLexer.in.l
+ LexerParser/cmExprParser.cxx
+ LexerParser/cmExprParserTokens.h
+ LexerParser/cmExprParser.y
+ LexerParser/cmFortranLexer.cxx
+ LexerParser/cmFortranLexer.h
+ LexerParser/cmFortranLexer.in.l
+ LexerParser/cmFortranParser.cxx
+ LexerParser/cmFortranParserTokens.h
+ LexerParser/cmFortranParser.y
+ LexerParser/cmListFileLexer.c
+ LexerParser/cmListFileLexer.in.l
+
cmArchiveWrite.cxx
cmBase32.cxx
cmCacheManager.cxx
cmCacheManager.h
cmCLocaleEnvironmentScope.h
cmCLocaleEnvironmentScope.cxx
- cmCommandArgumentLexer.cxx
- cmCommandArgumentParser.cxx
cmCommandArgumentParserHelper.cxx
cmCommonTargetGenerator.cxx
cmCommonTargetGenerator.h
@@ -196,8 +168,6 @@ set(SRCS
cmDependsFortran.h
cmDependsJava.cxx
cmDependsJava.h
- cmDependsJavaLexer.cxx
- cmDependsJavaParser.cxx
cmDependsJavaParserHelper.cxx
cmDependsJavaParserHelper.h
cmDocumentation.cxx
@@ -206,8 +176,6 @@ set(SRCS
cmDynamicLoader.cxx
cmDynamicLoader.h
${ELF_SRCS}
- cmExprLexer.cxx
- cmExprParser.cxx
cmExprParserHelper.cxx
cmExportBuildAndroidMKGenerator.h
cmExportBuildAndroidMKGenerator.cxx
@@ -247,10 +215,6 @@ set(SRCS
cmFilePathChecksum.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
- cmFortranLexer.cxx
- cmFortranLexer.h
- cmFortranParser.cxx
- cmFortranParser.h
cmFortranParserImpl.cxx
cmGeneratedFileStream.cxx
cmGeneratorExpressionContext.cxx
@@ -302,7 +266,6 @@ set(SRCS
cmLinkLineDeviceComputer.h
cmListFileCache.cxx
cmListFileCache.h
- cmListFileLexer.c
cmLocalCommonGenerator.cxx
cmLocalCommonGenerator.h
cmLocalGenerator.cxx
@@ -904,10 +867,6 @@ set(CPACK_SRCS
CPack/cmCPackGenerator.cxx
CPack/cmCPackLog.cxx
CPack/cmCPackNSISGenerator.cxx
- CPack/IFW/cmCPackIFWPackage.cxx
- CPack/IFW/cmCPackIFWInstaller.cxx
- CPack/IFW/cmCPackIFWRepository.cxx
- CPack/IFW/cmCPackIFWGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
CPack/cmCPackTGZGenerator.cxx
CPack/cmCPackTXZGenerator.cxx
@@ -916,6 +875,19 @@ set(CPACK_SRCS
CPack/cmCPackZIPGenerator.cxx
CPack/cmCPack7zGenerator.cxx
)
+# CPack IFW generator
+set(CPACK_SRCS ${CPACK_SRCS}
+ CPack/IFW/cmCPackIFWCommon.cxx
+ CPack/IFW/cmCPackIFWCommon.h
+ CPack/IFW/cmCPackIFWGenerator.cxx
+ CPack/IFW/cmCPackIFWGenerator.h
+ CPack/IFW/cmCPackIFWInstaller.cxx
+ CPack/IFW/cmCPackIFWInstaller.h
+ CPack/IFW/cmCPackIFWPackage.cxx
+ CPack/IFW/cmCPackIFWPackage.h
+ CPack/IFW/cmCPackIFWRepository.cxx
+ CPack/IFW/cmCPackIFWRepository.h
+ )
if(CYGWIN)
set(CPACK_SRCS ${CPACK_SRCS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d18bf2c..5cb5a84 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170428)
+set(CMake_VERSION_PATCH 20170519)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
new file mode 100644
index 0000000..e8f05bd
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -0,0 +1,137 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCPackIFWCommon.h"
+
+#include "cmCPackGenerator.h"
+#include "cmCPackIFWGenerator.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmSystemTools.h"
+#include "cmTimestamp.h"
+#include "cmVersionConfig.h"
+#include "cmXMLWriter.h"
+
+#include <sstream>
+#include <utility>
+#include <vector>
+
+cmCPackIFWCommon::cmCPackIFWCommon()
+ : Generator(CM_NULLPTR)
+{
+}
+
+const char* cmCPackIFWCommon::GetOption(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op)
+ : CM_NULLPTR;
+}
+
+bool cmCPackIFWCommon::IsOn(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsOn(op) : false;
+}
+
+bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsSetToOff(op)
+ : false;
+}
+
+bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsSetToEmpty(op)
+ : false;
+}
+
+bool cmCPackIFWCommon::IsVersionLess(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), version);
+}
+
+bool cmCPackIFWCommon::IsVersionGreater(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion.data(),
+ version);
+}
+
+bool cmCPackIFWCommon::IsVersionEqual(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_EQUAL, this->Generator->FrameworkVersion.data(),
+ version);
+}
+
+void cmCPackIFWCommon::ExpandListArgument(
+ const std::string& arg, std::map<std::string, std::string>& argsOut)
+{
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArgument(arg, args, false);
+ if (args.empty()) {
+ return;
+ }
+
+ std::size_t i = 0;
+ std::size_t c = args.size();
+ if (c % 2) {
+ argsOut[""] = args[i];
+ ++i;
+ }
+
+ --c;
+ for (; i < c; i += 2) {
+ argsOut[args[i]] = args[i + 1];
+ }
+}
+
+void cmCPackIFWCommon::ExpandListArgument(
+ const std::string& arg, std::multimap<std::string, std::string>& argsOut)
+{
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArgument(arg, args, false);
+ if (args.empty()) {
+ return;
+ }
+
+ std::size_t i = 0;
+ std::size_t c = args.size();
+ if (c % 2) {
+ argsOut.insert(std::pair<std::string, std::string>("", args[i]));
+ ++i;
+ }
+
+ --c;
+ for (; i < c; i += 2) {
+ argsOut.insert(std::pair<std::string, std::string>(args[i], args[i + 1]));
+ }
+}
+
+void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout)
+{
+ if (!this->Generator) {
+ return;
+ }
+
+ std::ostringstream comment;
+ comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
+ << "for QtIFW ";
+ if (this->IsVersionEqual("1.9.9")) {
+ comment << "less 2.0";
+ } else {
+ comment << this->Generator->FrameworkVersion;
+ }
+ comment << " tools at " << cmTimestamp().CurrentTime("", true);
+ xout.Comment(comment.str().c_str());
+}
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h
new file mode 100644
index 0000000..354d849
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.h
@@ -0,0 +1,81 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmCPackIFWCommon_h
+#define cmCPackIFWCommon_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <map>
+#include <string>
+
+class cmCPackIFWGenerator;
+class cmXMLWriter;
+
+/** \class cmCPackIFWCommon
+ * \brief A base class for CPack IFW generator implementation subclasses
+ */
+class cmCPackIFWCommon
+{
+public:
+ // Constructor
+
+ /**
+ * Construct Part
+ */
+ cmCPackIFWCommon();
+
+public:
+ // Internal implementation
+
+ const char* GetOption(const std::string& op) const;
+ bool IsOn(const std::string& op) const;
+ bool IsSetToOff(const std::string& op) const;
+ bool IsSetToEmpty(const std::string& op) const;
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionLess(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionGreater(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionEqual(const char* version);
+
+ /** Expand the list argument containing the map of the key-value pairs.
+ * If the number of elements is odd, then the first value is used as the
+ * default value with an empty key.
+ * Any values with the same keys will be permanently overwritten.
+ */
+ static void ExpandListArgument(const std::string& arg,
+ std::map<std::string, std::string>& argsOut);
+
+ /** Expand the list argument containing the multimap of the key-value pairs.
+ * If the number of elements is odd, then the first value is used as the
+ * default value with an empty key.
+ */
+ static void ExpandListArgument(
+ const std::string& arg, std::multimap<std::string, std::string>& argsOut);
+
+ cmCPackIFWGenerator* Generator;
+
+protected:
+ void WriteGeneratedByToStrim(cmXMLWriter& xout);
+};
+
+#define cmCPackIFWLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ if (Generator) { \
+ Generator->Logger->Log(cmCPackLog::LOG_##logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } \
+ } while (false)
+
+#endif // cmCPackIFWCommon_h
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index fa8982f..226ea0a 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -4,92 +4,74 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
-#include "cmTimestamp.h"
-#include "cmVersionConfig.h"
-#include "cmXMLWriter.h"
#include <sstream>
#include <utility>
cmCPackIFWGenerator::cmCPackIFWGenerator()
{
+ this->Generator = this;
}
cmCPackIFWGenerator::~cmCPackIFWGenerator()
{
}
-bool cmCPackIFWGenerator::IsVersionLess(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionGreater(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionEqual(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
- FrameworkVersion.data(), version);
-}
-
int cmCPackIFWGenerator::PackageFiles()
{
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
// Installer configuragion
- Installer.GenerateInstallerFile();
+ this->Installer.GenerateInstallerFile();
// Packages configuration
- Installer.GeneratePackageFiles();
+ this->Installer.GeneratePackageFiles();
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = ifwTLD;
ifwTmpFile += "/IFWOutput.log";
// Run repogen
- if (!Installer.RemoteRepositories.empty()) {
- std::string ifwCmd = RepoGen;
+ if (!this->Installer.RemoteRepositories.empty()) {
+ std::string ifwCmd = this->RepoGen;
- if (IsVersionLess("2.0.0")) {
+ if (this->IsVersionLess("2.0.0")) {
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
}
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (!OnlineOnly && !DownloadedPackages.empty()) {
+ if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
ifwCmd += " -i ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
}
ifwCmd += " " + this->toplevel + "/repository";
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository"
- << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -98,36 +80,39 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
- if (!Repository.RepositoryUpdate.empty() &&
- !Repository.PatchUpdatesXml()) {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" "
- << "file: " << this->toplevel + "/repository/Updates.xml"
- << std::endl);
+ if (!this->Repository.RepositoryUpdate.empty() &&
+ !this->Repository.PatchUpdatesXml()) {
+ cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" "
+ << "file: "
+ << this->toplevel + "/repository/Updates.xml"
+ << std::endl);
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: "
- << this->toplevel << "/repository generated" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- repository: " << this->toplevel
+ << "/repository generated"
+ << std::endl);
}
// Run binary creator
{
- std::string ifwCmd = BinCreator;
+ std::string ifwCmd = this->BinCreator;
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
- if (!Installer.Resources.empty()) {
+ if (!this->Installer.Resources.empty()) {
ifwCmd += " -r ";
- std::vector<std::string>::iterator it = Installer.Resources.begin();
+ std::vector<std::string>::iterator it =
+ this->Installer.Resources.begin();
std::string path = this->toplevel + "/resources/";
ifwCmd += path + *it;
++it;
- while (it != Installer.Resources.end()) {
+ while (it != this->Installer.Resources.end()) {
ifwCmd += "," + path + *it;
++it;
}
@@ -135,52 +120,55 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (OnlineOnly) {
+ if (this->OnlineOnly) {
ifwCmd += " --online-only";
- } else if (!DownloadedPackages.empty() &&
- !Installer.RemoteRepositories.empty()) {
+ } else if (!this->DownloadedPackages.empty() &&
+ !this->Installer.RemoteRepositories.empty()) {
ifwCmd += " -e ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
- } else if (!DependentPackages.empty()) {
+ } else if (!this->DependentPackages.empty()) {
ifwCmd += " -i ";
// Binary
- std::set<cmCPackIFWPackage*>::iterator bit = BinaryPackages.begin();
- while (bit != BinaryPackages.end()) {
+ std::set<cmCPackIFWPackage*>::iterator bit =
+ this->BinaryPackages.begin();
+ while (bit != this->BinaryPackages.end()) {
ifwCmd += (*bit)->Name + ",";
++bit;
}
// Depend
- DependenceMap::iterator it = DependentPackages.begin();
+ DependenceMap::iterator it = this->DependentPackages.begin();
ifwCmd += it->second.Name;
++it;
- while (it != DependentPackages.end()) {
+ while (it != this->DependentPackages.end()) {
ifwCmd += "," + it->second.Name;
++it;
}
}
// TODO: set correct name for multipackages
if (!this->packageFileNames.empty()) {
- ifwCmd += " " + packageFileNames[0];
+ ifwCmd += " " + this->packageFileNames[0];
} else {
ifwCmd += " installer";
}
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -189,10 +177,10 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
}
@@ -202,12 +190,12 @@ int cmCPackIFWGenerator::PackageFiles()
const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
{
- const char* defPrefix = cmCPackGenerator::GetPackagingInstallPrefix();
+ const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
std::string tmpPref = defPrefix ? defPrefix : "";
if (this->Components.empty()) {
- tmpPref += "packages/" + GetRootPackageName() + "/data";
+ tmpPref += "packages/" + this->GetRootPackageName() + "/data";
}
this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str());
@@ -217,7 +205,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
const char* cmCPackIFWGenerator::GetOutputExtension()
{
- return ExecutableSuffix.c_str();
+ return this->ExecutableSuffix.c_str();
}
int cmCPackIFWGenerator::InitializeInternal()
@@ -237,16 +225,15 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* BinCreatorStr = this->GetOption(BinCreatorOpt);
if (!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr)) {
- BinCreator = "";
+ this->BinCreator = "";
} else {
- BinCreator = BinCreatorStr;
+ this->BinCreator = BinCreatorStr;
}
- if (BinCreator.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW compiler \"binarycreator\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ if (this->BinCreator.empty()) {
+ cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
@@ -254,39 +241,40 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* RepoGenStr = this->GetOption(RepoGenOpt);
if (!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr)) {
- RepoGen = "";
+ this->RepoGen = "";
} else {
- RepoGen = RepoGenStr;
+ this->RepoGen = RepoGenStr;
}
// Framework version
if (const char* FrameworkVersionSrt = this->GetOption(FrameworkVersionOpt)) {
- FrameworkVersion = FrameworkVersionSrt;
+ this->FrameworkVersion = FrameworkVersionSrt;
} else {
- FrameworkVersion = "1.9.9";
+ this->FrameworkVersion = "1.9.9";
}
// Variables that Change Behavior
// Resolve duplicate names
- ResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
+ this->ResolveDuplicateNames =
+ this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
// Additional packages dirs
- PkgsDirsVector.clear();
+ this->PkgsDirsVector.clear();
if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(dirs, PkgsDirsVector);
+ cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector);
}
// Installer
- Installer.Generator = this;
- Installer.ConfigureFromOptions();
+ this->Installer.Generator = this;
+ this->Installer.ConfigureFromOptions();
// Repository
- Repository.Generator = this;
- Repository.Name = "Unspecified";
+ this->Repository.Generator = this;
+ this->Repository.Name = "Unspecified";
if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
- Repository.Url = site;
- Installer.RemoteRepositories.push_back(&Repository);
+ this->Repository.Url = site;
+ this->Installer.RemoteRepositories.push_back(&this->Repository);
}
// Repositories
@@ -295,38 +283,38 @@ int cmCPackIFWGenerator::InitializeInternal()
cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
rit != RepoAllVector.end(); ++rit) {
- GetRepository(*rit);
+ this->GetRepository(*rit);
}
}
if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
} else if (const char* cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
} else {
- OnlineOnly = false;
+ this->OnlineOnly = false;
}
- if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW repository generator \"repogen\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ if (!this->Installer.RemoteRepositories.empty() && this->RepoGen.empty()) {
+ cmCPackIFWLogger(ERROR,
+ "Cannot find QtIFW repository generator \"repogen\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
// Executable suffix
if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) {
- ExecutableSuffix = optExeSuffix;
- if (ExecutableSuffix.empty()) {
+ this->ExecutableSuffix = optExeSuffix;
+ if (this->ExecutableSuffix.empty()) {
std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
if (sysName == "Linux") {
- ExecutableSuffix = ".run";
+ this->ExecutableSuffix = ".run";
}
}
} else {
- ExecutableSuffix = cmCPackGenerator::GetOutputExtension();
+ this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension();
}
return this->Superclass::InitializeInternal();
@@ -338,52 +326,53 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
const std::string prefix = "packages/";
const std::string suffix = "/data";
- if (componentPackageMethod == ONE_PACKAGE) {
- return std::string(prefix + GetRootPackageName() + suffix);
+ if (this->componentPackageMethod == this->ONE_PACKAGE) {
+ return std::string(prefix + this->GetRootPackageName() + suffix);
}
- return prefix + GetComponentPackageName(&Components[componentName]) + suffix;
+ return prefix +
+ this->GetComponentPackageName(&this->Components[componentName]) + suffix;
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
- ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end()) {
+ ComponentsMap::iterator cit = this->Components.find(componentName);
+ if (cit != this->Components.end()) {
return &(cit->second);
}
cmCPackComponent* component =
- cmCPackGenerator::GetComponent(projectName, componentName);
+ this->cmCPackGenerator::GetComponent(projectName, componentName);
if (!component) {
return component;
}
- std::string name = GetComponentPackageName(component);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetComponentPackageName(component);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return component;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromComponent(component)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- ComponentPackages.insert(
+ this->ComponentPackages.insert(
std::pair<cmCPackComponent*, cmCPackIFWPackage*>(component, package));
if (component->IsDownloaded) {
- DownloadedPackages.insert(package);
+ this->DownloadedPackages.insert(package);
} else {
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
}
} else {
- Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component \"" << component->Name << "\""
- << std::endl);
+ this->Packages.erase(name);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component \"" << component->Name
+ << "\"" << std::endl);
}
return component;
@@ -393,32 +382,32 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
const std::string& projectName, const std::string& groupName)
{
cmCPackComponentGroup* group =
- cmCPackGenerator::GetComponentGroup(projectName, groupName);
+ this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
if (!group) {
return group;
}
- std::string name = GetGroupPackageName(group);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetGroupPackageName(group);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return group;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromGroup(group)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- GroupPackages.insert(
+ this->GroupPackages.insert(
std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(group, package));
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
} else {
- Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component group \"" << group->Name
- << "\"" << std::endl);
+ this->Packages.erase(name);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component group \"" << group->Name
+ << "\"" << std::endl);
}
return group;
}
@@ -441,7 +430,7 @@ bool cmCPackIFWGenerator::SupportsComponentInstallation() const
bool cmCPackIFWGenerator::IsOnePackage() const
{
- return componentPackageMethod == ONE_PACKAGE;
+ return this->componentPackageMethod == cmCPackGenerator::ONE_PACKAGE;
}
std::string cmCPackIFWGenerator::GetRootPackageName()
@@ -474,16 +463,16 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
if (!group) {
return name;
}
- if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
+ if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) {
return package->Name;
}
const char* option =
- GetOption("CPACK_IFW_COMPONENT_GROUP_" +
- cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
+ this->GetOption("CPACK_IFW_COMPONENT_GROUP_" +
+ cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
name = option ? option : group->Name;
if (group->ParentGroup) {
- cmCPackIFWPackage* package = GetGroupPackage(group->ParentGroup);
- bool dot = !ResolveDuplicateNames;
+ cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup);
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -501,20 +490,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
if (!component) {
return name;
}
- if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
+ if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) {
return package->Name;
}
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
- const char* option = GetOption(prefix + "NAME");
+ const char* option = this->GetOption(prefix + "NAME");
name = option ? option : component->Name;
if (component->Group) {
- cmCPackIFWPackage* package = GetGroupPackage(component->Group);
- if ((componentPackageMethod == ONE_PACKAGE_PER_GROUP) ||
- IsOn(prefix + "COMMON")) {
+ cmCPackIFWPackage* package = this->GetGroupPackage(component->Group);
+ if ((this->componentPackageMethod ==
+ cmCPackGenerator::ONE_PACKAGE_PER_GROUP) ||
+ this->IsOn(prefix + "COMMON")) {
return package->Name;
}
- bool dot = !ResolveDuplicateNames;
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -529,56 +519,42 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
cmCPackComponentGroup* group) const
{
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
- GroupPackages.find(group);
- return pit != GroupPackages.end() ? pit->second : CM_NULLPTR;
+ this->GroupPackages.find(group);
+ return pit != this->GroupPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
cmCPackComponent* component) const
{
std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
- ComponentPackages.find(component);
- return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR;
+ this->ComponentPackages.find(component);
+ return pit != this->ComponentPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
- RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end()) {
+ RepositoriesMap::iterator rit = this->Repositories.find(repositoryName);
+ if (rit != this->Repositories.end()) {
return &(rit->second);
}
- cmCPackIFWRepository* repository = &Repositories[repositoryName];
+ cmCPackIFWRepository* repository = &this->Repositories[repositoryName];
repository->Name = repositoryName;
repository->Generator = this;
if (repository->ConfigureFromOptions()) {
if (repository->Update == cmCPackIFWRepository::None) {
- Installer.RemoteRepositories.push_back(repository);
+ this->Installer.RemoteRepositories.push_back(repository);
} else {
- Repository.RepositoryUpdate.push_back(repository);
+ this->Repository.RepositoryUpdate.push_back(repository);
}
} else {
- Repositories.erase(repositoryName);
+ this->Repositories.erase(repositoryName);
repository = CM_NULLPTR;
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
- << repositoryName << "\""
- << " configuration. Repository will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Invalid repository \""
+ << repositoryName << "\""
+ << " configuration. Repository will be skipped."
+ << std::endl);
}
return repository;
}
-
-void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- std::ostringstream comment;
- comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
- << "for QtIFW ";
- if (IsVersionLess("2.0")) {
- comment << "less 2.0";
- } else {
- comment << FrameworkVersion;
- }
- comment << " tools at " << cmTimestamp().CurrentTime("", true);
- xout.Comment(comment.str().c_str());
-}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 688db4b..8348cee 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -3,10 +3,11 @@
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
-#include "cmConfigure.h"
+#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
@@ -16,14 +17,12 @@
#include <string>
#include <vector>
-class cmXMLWriter;
-
/** \class cmCPackIFWGenerator
* \brief A generator for Qt Installer Framework tools
*
* http://qt-project.org/doc/qtinstallerframework/index.html
*/
-class cmCPackIFWGenerator : public cmCPackGenerator
+class cmCPackIFWGenerator : public cmCPackGenerator, public cmCPackIFWCommon
{
public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
@@ -35,6 +34,11 @@ public:
typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
DependenceMap;
+ using cmCPackIFWCommon::GetOption;
+ using cmCPackIFWCommon::IsOn;
+ using cmCPackIFWCommon::IsSetToOff;
+ using cmCPackIFWCommon::IsSetToEmpty;
+
/**
* Construct IFW generator
*/
@@ -45,21 +49,6 @@ public:
*/
~cmCPackIFWGenerator() CM_OVERRIDE;
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionLess(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionGreater(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionEqual(const char* version);
-
protected:
// cmCPackGenerator reimplementation
@@ -124,12 +113,11 @@ protected:
cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
protected:
// Data
friend class cmCPackIFWPackage;
+ friend class cmCPackIFWCommon;
friend class cmCPackIFWInstaller;
friend class cmCPackIFWRepository;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 5e5f066..288e924 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -2,69 +2,29 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWInstaller.h"
-#include "cmConfigure.h"
-#include <sstream>
-#include <stddef.h>
-#include <utility>
-
-#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
+#include <sstream>
+#include <stddef.h>
+#include <utility>
cmCPackIFWInstaller::cmCPackIFWInstaller()
- : Generator(CM_NULLPTR)
{
}
-const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWInstaller::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
-}
-
void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue)
{
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "Option "
+ cmCPackIFWLogger(
+ WARNING, "Option "
<< optionName << " is set to \"" << optionValue
<< "\" but will be skipped because the specified file does not exist."
<< std::endl);
@@ -75,110 +35,109 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// Name;
if (const char* optIFW_PACKAGE_NAME =
this->GetOption("CPACK_IFW_PACKAGE_NAME")) {
- Name = optIFW_PACKAGE_NAME;
+ this->Name = optIFW_PACKAGE_NAME;
} else if (const char* optPACKAGE_NAME =
this->GetOption("CPACK_PACKAGE_NAME")) {
- Name = optPACKAGE_NAME;
+ this->Name = optPACKAGE_NAME;
} else {
- Name = "Your package";
+ this->Name = "Your package";
}
// Title;
if (const char* optIFW_PACKAGE_TITLE =
- GetOption("CPACK_IFW_PACKAGE_TITLE")) {
- Title = optIFW_PACKAGE_TITLE;
+ this->GetOption("CPACK_IFW_PACKAGE_TITLE")) {
+ this->Title = optIFW_PACKAGE_TITLE;
} else if (const char* optPACKAGE_DESCRIPTION_SUMMARY =
- GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
- Title = optPACKAGE_DESCRIPTION_SUMMARY;
+ this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
+ this->Title = optPACKAGE_DESCRIPTION_SUMMARY;
} else {
- Title = "Your package description";
+ this->Title = "Your package description";
}
// Version;
- if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) {
- Version = option;
+ if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = option;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Publisher
if (const char* optIFW_PACKAGE_PUBLISHER =
- GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) {
- Publisher = optIFW_PACKAGE_PUBLISHER;
+ this->GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) {
+ this->Publisher = optIFW_PACKAGE_PUBLISHER;
} else if (const char* optPACKAGE_VENDOR =
GetOption("CPACK_PACKAGE_VENDOR")) {
- Publisher = optPACKAGE_VENDOR;
+ this->Publisher = optPACKAGE_VENDOR;
}
// ProductUrl
- if (const char* option = GetOption("CPACK_IFW_PRODUCT_URL")) {
- ProductUrl = option;
+ if (const char* option = this->GetOption("CPACK_IFW_PRODUCT_URL")) {
+ this->ProductUrl = option;
}
// ApplicationIcon
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_ICON")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) {
if (cmSystemTools::FileExists(option)) {
- InstallerApplicationIcon = option;
+ this->InstallerApplicationIcon = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option);
}
}
// WindowIcon
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) {
if (cmSystemTools::FileExists(option)) {
- InstallerWindowIcon = option;
+ this->InstallerWindowIcon = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option);
}
}
// Logo
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) {
if (cmSystemTools::FileExists(option)) {
- Logo = option;
+ this->Logo = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option);
}
}
// Watermark
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WATERMARK")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) {
if (cmSystemTools::FileExists(option)) {
- Watermark = option;
+ this->Watermark = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option);
}
}
// Banner
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_BANNER")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) {
if (cmSystemTools::FileExists(option)) {
- Banner = option;
+ this->Banner = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option);
}
}
// Background
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) {
if (cmSystemTools::FileExists(option)) {
- Background = option;
+ this->Background = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option);
}
}
// WizardStyle
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
// Setting the user value in any case
- WizardStyle = option;
+ this->WizardStyle = option;
// Check known values
- if (WizardStyle != "Modern" && WizardStyle != "Aero" &&
- WizardStyle != "Mac" && WizardStyle != "Classic") {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING,
- "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
+ if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" &&
+ this->WizardStyle != "Mac" && this->WizardStyle != "Classic") {
+ cmCPackIFWLogger(
+ WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl);
}
@@ -186,87 +145,89 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// WizardDefaultWidth
if (const char* option =
- GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
- WizardDefaultWidth = option;
+ this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
+ this->WizardDefaultWidth = option;
}
// WizardDefaultHeight
if (const char* option =
- GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) {
- WizardDefaultHeight = option;
+ this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) {
+ this->WizardDefaultHeight = option;
}
// TitleColor
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) {
- TitleColor = option;
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) {
+ this->TitleColor = option;
}
// Start menu
if (const char* optIFW_START_MENU_DIR =
this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) {
- StartMenuDir = optIFW_START_MENU_DIR;
+ this->StartMenuDir = optIFW_START_MENU_DIR;
} else {
- StartMenuDir = Name;
+ this->StartMenuDir = Name;
}
// Default target directory for installation
if (const char* optIFW_TARGET_DIRECTORY =
- GetOption("CPACK_IFW_TARGET_DIRECTORY")) {
- TargetDir = optIFW_TARGET_DIRECTORY;
+ this->GetOption("CPACK_IFW_TARGET_DIRECTORY")) {
+ this->TargetDir = optIFW_TARGET_DIRECTORY;
} else if (const char* optPACKAGE_INSTALL_DIRECTORY =
- GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
- TargetDir = "@ApplicationsDir@/";
- TargetDir += optPACKAGE_INSTALL_DIRECTORY;
+ this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
+ this->TargetDir = "@ApplicationsDir@/";
+ this->TargetDir += optPACKAGE_INSTALL_DIRECTORY;
} else {
- TargetDir = "@RootDir@/usr/local";
+ this->TargetDir = "@RootDir@/usr/local";
}
// Default target directory for installation with administrator rights
- if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) {
- AdminTargetDir = option;
+ if (const char* option =
+ this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) {
+ this->AdminTargetDir = option;
}
// Maintenance tool
if (const char* optIFW_MAINTENANCE_TOOL =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) {
- MaintenanceToolName = optIFW_MAINTENANCE_TOOL;
+ this->MaintenanceToolName = optIFW_MAINTENANCE_TOOL;
}
// Maintenance tool ini file
if (const char* optIFW_MAINTENANCE_TOOL_INI =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) {
- MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI;
+ this->MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI;
}
// Allow non-ASCII characters
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
- if (IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
- AllowNonAsciiCharacters = "true";
+ if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
+ this->AllowNonAsciiCharacters = "true";
} else {
- AllowNonAsciiCharacters = "false";
+ this->AllowNonAsciiCharacters = "false";
}
}
// Space in path
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
- if (IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
- AllowSpaceInPath = "true";
+ if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
+ this->AllowSpaceInPath = "true";
} else {
- AllowSpaceInPath = "false";
+ this->AllowSpaceInPath = "false";
}
}
// Control script
if (const char* optIFW_CONTROL_SCRIPT =
this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) {
- ControlScript = optIFW_CONTROL_SCRIPT;
+ this->ControlScript = optIFW_CONTROL_SCRIPT;
}
// Resources
if (const char* optIFW_PACKAGE_RESOURCES =
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
- Resources.clear();
- cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES, Resources);
+ this->Resources.clear();
+ cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES,
+ this->Resources);
}
}
@@ -280,19 +241,20 @@ public:
: installer(i)
, file(false)
{
- path = i->Directory + "/resources";
+ this->path = i->Directory + "/resources";
}
bool ParseResource(size_t r)
{
- hasFiles = false;
- hasErrors = false;
+ this->hasFiles = false;
+ this->hasErrors = false;
- basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]);
+ this->basePath =
+ cmSystemTools::GetFilenamePath(this->installer->Resources[r]);
- ParseFile(installer->Resources[r].data());
+ this->ParseFile(this->installer->Resources[r].data());
- return hasFiles && !hasErrors;
+ return this->hasFiles && !this->hasErrors;
}
cmCPackIFWInstaller* installer;
@@ -302,22 +264,22 @@ public:
protected:
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
{
- file = name == "file";
+ this->file = name == "file";
if (file) {
- hasFiles = true;
+ this->hasFiles = true;
}
}
void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
- if (file) {
+ if (this->file) {
std::string content(data, data + length);
content = cmSystemTools::TrimWhitespace(content);
- std::string source = basePath + "/" + content;
- std::string destination = path + "/" + content;
+ std::string source = this->basePath + "/" + content;
+ std::string destination = this->path + "/" + content;
if (!cmSystemTools::CopyFileIfDifferent(source.data(),
destination.data())) {
- hasErrors = true;
+ this->hasErrors = true;
}
}
}
@@ -328,12 +290,12 @@ protected:
void cmCPackIFWInstaller::GenerateInstallerFile()
{
// Lazy directory initialization
- if (Directory.empty() && Generator) {
- Directory = Generator->toplevel;
+ if (this->Directory.empty() && this->Generator) {
+ this->Directory = this->Generator->toplevel;
}
// Output stream
- cmGeneratedFileStream fout((Directory + "/config/config.xml").data());
+ cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data());
cmXMLWriter xout(fout);
xout.StartDocument();
@@ -342,163 +304,165 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.StartElement("Installer");
- xout.Element("Name", Name);
- xout.Element("Version", Version);
- xout.Element("Title", Title);
+ xout.Element("Name", this->Name);
+ xout.Element("Version", this->Version);
+ xout.Element("Title", this->Title);
- if (!Publisher.empty()) {
- xout.Element("Publisher", Publisher);
+ if (!this->Publisher.empty()) {
+ xout.Element("Publisher", this->Publisher);
}
- if (!ProductUrl.empty()) {
- xout.Element("ProductUrl", ProductUrl);
+ if (!this->ProductUrl.empty()) {
+ xout.Element("ProductUrl", this->ProductUrl);
}
// ApplicationIcon
- if (!InstallerApplicationIcon.empty()) {
+ if (!this->InstallerApplicationIcon.empty()) {
std::string name =
- cmSystemTools::GetFilenameName(InstallerApplicationIcon);
- std::string path = Directory + "/config/" + name;
+ cmSystemTools::GetFilenameName(this->InstallerApplicationIcon);
+ std::string path = this->Directory + "/config/" + name;
name = cmSystemTools::GetFilenameWithoutExtension(name);
- cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path);
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon,
+ path);
xout.Element("InstallerApplicationIcon", name);
}
// WindowIcon
- if (!InstallerWindowIcon.empty()) {
- std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path);
+ if (!this->InstallerWindowIcon.empty()) {
+ std::string name =
+ cmSystemTools::GetFilenameName(this->InstallerWindowIcon);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerWindowIcon, path);
xout.Element("InstallerWindowIcon", name);
}
// Logo
- if (!Logo.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Logo);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Logo, path);
+ if (!this->Logo.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Logo);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Logo, path);
xout.Element("Logo", name);
}
// Banner
- if (!Banner.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Banner);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Banner, path);
+ if (!this->Banner.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Banner);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Banner, path);
xout.Element("Banner", name);
}
// Watermark
- if (!Watermark.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Watermark);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Watermark, path);
+ if (!this->Watermark.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Watermark);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Watermark, path);
xout.Element("Watermark", name);
}
// Background
- if (!Background.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Background);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Background, path);
+ if (!this->Background.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Background);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Background, path);
xout.Element("Background", name);
}
// WizardStyle
- if (!WizardStyle.empty()) {
- xout.Element("WizardStyle", WizardStyle);
+ if (!this->WizardStyle.empty()) {
+ xout.Element("WizardStyle", this->WizardStyle);
}
// WizardDefaultWidth
- if (!WizardDefaultWidth.empty()) {
- xout.Element("WizardDefaultWidth", WizardDefaultWidth);
+ if (!this->WizardDefaultWidth.empty()) {
+ xout.Element("WizardDefaultWidth", this->WizardDefaultWidth);
}
// WizardDefaultHeight
- if (!WizardDefaultHeight.empty()) {
- xout.Element("WizardDefaultHeight", WizardDefaultHeight);
+ if (!this->WizardDefaultHeight.empty()) {
+ xout.Element("WizardDefaultHeight", this->WizardDefaultHeight);
}
// TitleColor
- if (!TitleColor.empty()) {
- xout.Element("TitleColor", TitleColor);
+ if (!this->TitleColor.empty()) {
+ xout.Element("TitleColor", this->TitleColor);
}
// Start menu
- if (!IsVersionLess("2.0")) {
- xout.Element("StartMenuDir", StartMenuDir);
+ if (!this->IsVersionLess("2.0")) {
+ xout.Element("StartMenuDir", this->StartMenuDir);
}
// Target dir
- if (!TargetDir.empty()) {
- xout.Element("TargetDir", TargetDir);
+ if (!this->TargetDir.empty()) {
+ xout.Element("TargetDir", this->TargetDir);
}
// Admin target dir
- if (!AdminTargetDir.empty()) {
- xout.Element("AdminTargetDir", AdminTargetDir);
+ if (!this->AdminTargetDir.empty()) {
+ xout.Element("AdminTargetDir", this->AdminTargetDir);
}
// Remote repositories
- if (!RemoteRepositories.empty()) {
+ if (!this->RemoteRepositories.empty()) {
xout.StartElement("RemoteRepositories");
- for (RepositoriesVector::iterator rit = RemoteRepositories.begin();
- rit != RemoteRepositories.end(); ++rit) {
+ for (RepositoriesVector::iterator rit = this->RemoteRepositories.begin();
+ rit != this->RemoteRepositories.end(); ++rit) {
(*rit)->WriteRepositoryConfig(xout);
}
xout.EndElement();
}
// Maintenance tool
- if (!IsVersionLess("2.0") && !MaintenanceToolName.empty()) {
- xout.Element("MaintenanceToolName", MaintenanceToolName);
+ if (!this->IsVersionLess("2.0") && !this->MaintenanceToolName.empty()) {
+ xout.Element("MaintenanceToolName", this->MaintenanceToolName);
}
// Maintenance tool ini file
- if (!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty()) {
- xout.Element("MaintenanceToolIniFile", MaintenanceToolIniFile);
+ if (!this->IsVersionLess("2.0") && !this->MaintenanceToolIniFile.empty()) {
+ xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
}
// Different allows
- if (IsVersionLess("2.0")) {
+ if (this->IsVersionLess("2.0")) {
// CPack IFW default policy
xout.Comment("CPack IFW default policy for QtIFW less 2.0");
xout.Element("AllowNonAsciiCharacters", "true");
xout.Element("AllowSpaceInPath", "true");
} else {
- if (!AllowNonAsciiCharacters.empty()) {
- xout.Element("AllowNonAsciiCharacters", AllowNonAsciiCharacters);
+ if (!this->AllowNonAsciiCharacters.empty()) {
+ xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters);
}
- if (!AllowSpaceInPath.empty()) {
- xout.Element("AllowSpaceInPath", AllowSpaceInPath);
+ if (!this->AllowSpaceInPath.empty()) {
+ xout.Element("AllowSpaceInPath", this->AllowSpaceInPath);
}
}
// Control script (copy to config dir)
- if (!IsVersionLess("2.0") && !ControlScript.empty()) {
- std::string name = cmSystemTools::GetFilenameName(ControlScript);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path);
+ if (!this->IsVersionLess("2.0") && !this->ControlScript.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->ControlScript);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->ControlScript, path);
xout.Element("ControlScript", name);
}
// Resources (copy to resources dir)
- if (!Resources.empty()) {
+ if (!this->Resources.empty()) {
std::vector<std::string> resources;
cmCPackIFWResourcesParser parser(this);
- for (size_t i = 0; i < Resources.size(); i++) {
+ for (size_t i = 0; i < this->Resources.size(); i++) {
if (parser.ParseResource(i)) {
- std::string name = cmSystemTools::GetFilenameName(Resources[i]);
- std::string path = Directory + "/resources/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path);
+ std::string name = cmSystemTools::GetFilenameName(this->Resources[i]);
+ std::string path = this->Directory + "/resources/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path);
resources.push_back(name);
} else {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \""
- << Resources[i] << "\". Resource will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Can't copy resources from \""
+ << this->Resources[i]
+ << "\". Resource will be skipped." << std::endl);
}
}
- Resources = resources;
+ this->Resources = resources;
}
xout.EndElement();
@@ -507,13 +471,13 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
void cmCPackIFWInstaller::GeneratePackageFiles()
{
- if (Packages.empty() || Generator->IsOnePackage()) {
+ if (this->Packages.empty() || this->Generator->IsOnePackage()) {
// Generate default package
cmCPackIFWPackage package;
- package.Generator = Generator;
+ package.Generator = this->Generator;
package.Installer = this;
// Check package group
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) {
package.ConfigureFromGroup(option);
std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" +
cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION";
@@ -528,16 +492,9 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
}
// Generate packages meta information
- for (PackagesMap::iterator pit = Packages.begin(); pit != Packages.end();
- ++pit) {
+ for (PackagesMap::iterator pit = this->Packages.begin();
+ pit != this->Packages.end(); ++pit) {
cmCPackIFWPackage* package = pit->second;
package->GeneratePackageFile();
}
}
-
-void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 64239cf..b635f42 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -5,19 +5,19 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
#include <map>
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmCPackIFWPackage;
class cmCPackIFWRepository;
-class cmXMLWriter;
/** \class cmCPackIFWInstaller
* \brief A binary installer to be created CPack IFW generator
*/
-class cmCPackIFWInstaller
+class cmCPackIFWInstaller : public cmCPackIFWCommon
{
public:
// Types
@@ -111,28 +111,17 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
void ConfigureFromOptions();
void GenerateInstallerFile();
void GeneratePackageFiles();
- cmCPackIFWGenerator* Generator;
PackagesMap Packages;
RepositoriesVector RemoteRepositories;
std::string Directory;
protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
-private:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
};
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index eda383f..c5311c3 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -3,37 +3,23 @@
#include "cmCPackIFWPackage.h"
#include "cmCPackComponentGroup.h"
-#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWInstaller.h"
-#include "cmCPackLog.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmXMLWriter.h"
-#include "cmConfigure.h"
#include <map>
#include <sstream>
#include <stddef.h>
-
-//----------------------------------------------------------------- Logger ---
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
+#include <utility>
//---------------------------------------------------------- CompareStruct ---
cmCPackIFWPackage::CompareStruct::CompareStruct()
- : Type(CompareNone)
+ : Type(cmCPackIFWPackage::CompareNone)
{
}
@@ -48,101 +34,66 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
// Search compare section
size_t pos = std::string::npos;
if ((pos = dependence.find("<=")) != std::string::npos) {
- Compare.Type = CompareLessOrEqual;
- Compare.Value = dependence.substr(pos + 2);
+ this->Compare.Type = cmCPackIFWPackage::CompareLessOrEqual;
+ this->Compare.Value = dependence.substr(pos + 2);
} else if ((pos = dependence.find(">=")) != std::string::npos) {
- Compare.Type = CompareGreaterOrEqual;
- Compare.Value = dependence.substr(pos + 2);
+ this->Compare.Type = cmCPackIFWPackage::CompareGreaterOrEqual;
+ this->Compare.Value = dependence.substr(pos + 2);
} else if ((pos = dependence.find('<')) != std::string::npos) {
- Compare.Type = CompareLess;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareLess;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('=')) != std::string::npos) {
- Compare.Type = CompareEqual;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareEqual;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('>')) != std::string::npos) {
- Compare.Type = CompareGreater;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareGreater;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('-')) != std::string::npos) {
- Compare.Type = CompareNone;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareNone;
+ this->Compare.Value = dependence.substr(pos + 1);
}
size_t dashPos = dependence.find('-');
if (dashPos != std::string::npos) {
pos = dashPos;
}
- Name = pos == std::string::npos ? dependence : dependence.substr(0, pos);
+ this->Name =
+ pos == std::string::npos ? dependence : dependence.substr(0, pos);
}
std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
{
- if (Compare.Type == CompareNone) {
- return Name;
+ if (this->Compare.Type == cmCPackIFWPackage::CompareNone) {
+ return this->Name;
}
- std::string result = Name;
+ std::string result = this->Name;
- if (Compare.Type != CompareNone || !Compare.Value.empty()) {
+ if (this->Compare.Type != cmCPackIFWPackage::CompareNone ||
+ !this->Compare.Value.empty()) {
result += "-";
}
- if (Compare.Type == CompareLessOrEqual) {
+ if (this->Compare.Type == cmCPackIFWPackage::CompareLessOrEqual) {
result += "<=";
- } else if (Compare.Type == CompareGreaterOrEqual) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreaterOrEqual) {
result += ">=";
- } else if (Compare.Type == CompareLess) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareLess) {
result += "<";
- } else if (Compare.Type == CompareEqual) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareEqual) {
result += "=";
- } else if (Compare.Type == CompareGreater) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreater) {
result += ">";
}
- result += Compare.Value;
+ result += this->Compare.Value;
return result;
}
//------------------------------------------------------ cmCPackIFWPackage ---
cmCPackIFWPackage::cmCPackIFWPackage()
- : Generator(CM_NULLPTR)
- , Installer(CM_NULLPTR)
-{
-}
-
-const char* cmCPackIFWPackage::GetOption(const std::string& op) const
-{
- const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR;
- return option && *option ? option : CM_NULLPTR;
-}
-
-bool cmCPackIFWPackage::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToOff(const std::string& op) const
-{
- return Generator ? Generator->IsSetToOff(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToEmpty(const std::string& op) const
-{
- return Generator ? Generator->IsSetToEmpty(op) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionEqual(const char* version)
+ : Installer(CM_NULLPTR)
{
- return Generator ? Generator->IsVersionEqual(version) : false;
}
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
@@ -151,62 +102,62 @@ std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
return "";
}
const char* option =
- GetOption("CPACK_IFW_COMPONENT_" +
- cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
+ this->GetOption("CPACK_IFW_COMPONENT_" +
+ cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
return option ? option : component->Name;
}
void cmCPackIFWPackage::DefaultConfiguration()
{
- DisplayName = "";
- Description = "";
- Version = "";
- ReleaseDate = "";
- Script = "";
- Licenses.clear();
- UserInterfaces.clear();
- Translations.clear();
- SortingPriority = "";
- UpdateText = "";
- Default = "";
- Essential = "";
- Virtual = "";
- ForcedInstallation = "";
- RequiresAdminRights = "";
+ this->DisplayName.clear();
+ this->Description.clear();
+ this->Version = "";
+ this->ReleaseDate = "";
+ this->Script = "";
+ this->Licenses.clear();
+ this->UserInterfaces.clear();
+ this->Translations.clear();
+ this->SortingPriority = "";
+ this->UpdateText = "";
+ this->Default = "";
+ this->Essential = "";
+ this->Virtual = "";
+ this->ForcedInstallation = "";
+ this->RequiresAdminRights = "";
}
// Defaul configuration (all in one package)
int cmCPackIFWPackage::ConfigureFromOptions()
{
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
// Name
- Name = Generator->GetRootPackageName();
+ this->Name = this->Generator->GetRootPackageName();
// Display name
if (const char* option = this->GetOption("CPACK_PACKAGE_NAME")) {
- DisplayName = option;
+ this->DisplayName[""] = option;
} else {
- DisplayName = "Your package";
+ this->DisplayName[""] = "Your package";
}
// Description
if (const char* option =
this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
- Description = option;
+ this->Description[""] = option;
} else {
- Description = "Your package description";
+ this->Description[""] = "Your package description";
}
// Version
- if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) {
- Version = option;
+ if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = option;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
- ForcedInstallation = "true";
+ this->ForcedInstallation = "true";
return 1;
}
@@ -218,36 +169,36 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
}
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
// Display name
- DisplayName = component->DisplayName;
+ this->DisplayName[""] = component->DisplayName;
// Description
- Description = component->Description;
+ this->Description[""] = component->Description;
// Version
- if (const char* optVERSION = GetOption(prefix + "VERSION")) {
- Version = optVERSION;
+ if (const char* optVERSION = this->GetOption(prefix + "VERSION")) {
+ this->Version = optVERSION;
} else if (const char* optPACKAGE_VERSION =
- GetOption("CPACK_PACKAGE_VERSION")) {
- Version = optPACKAGE_VERSION;
+ this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = optPACKAGE_VERSION;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Script
- if (const char* option = GetOption(prefix + "SCRIPT")) {
- Script = option;
+ if (const char* option = this->GetOption(prefix + "SCRIPT")) {
+ this->Script = option;
}
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
- UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, UserInterfaces);
+ this->UserInterfaces.clear();
+ cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
}
// CMake dependencies
@@ -255,49 +206,49 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
std::vector<cmCPackComponent*>::iterator dit;
for (dit = component->Dependencies.begin();
dit != component->Dependencies.end(); ++dit) {
- Dependencies.insert(Generator->ComponentPackages[*dit]);
+ this->Dependencies.insert(this->Generator->ComponentPackages[*dit]);
}
}
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
- Licenses.clear();
- cmSystemTools::ExpandListArgument(option, Licenses);
- if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
- Licenses.clear();
+ this->Licenses.clear();
+ cmSystemTools::ExpandListArgument(option, this->Licenses);
+ if (this->Licenses.size() % 2 != 0) {
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
+ this->Licenses.clear();
}
}
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
- SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ this->SortingPriority = option;
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component \"" << component->Name << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
}
// Default
- Default = component->IsDisabledByDefault ? "false" : "true";
+ this->Default = component->IsDisabledByDefault ? "false" : "true";
// Essential
if (this->IsOn(prefix + "ESSENTIAL")) {
- Essential = "true";
+ this->Essential = "true";
}
// Virtual
- Virtual = component->IsHidden ? "true" : "";
+ this->Virtual = component->IsHidden ? "true" : "";
// ForcedInstallation
- ForcedInstallation = component->IsRequired ? "true" : "false";
+ this->ForcedInstallation = component->IsRequired ? "true" : "false";
- return ConfigureFromPrefix(prefix);
+ return this->ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
@@ -307,61 +258,61 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
}
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
std::string prefix = "CPACK_IFW_COMPONENT_GROUP_" +
cmsys::SystemTools::UpperCase(group->Name) + "_";
- DisplayName = group->DisplayName;
- Description = group->Description;
+ this->DisplayName[""] = group->DisplayName;
+ this->Description[""] = group->Description;
// Version
- if (const char* optVERSION = GetOption(prefix + "VERSION")) {
- Version = optVERSION;
+ if (const char* optVERSION = this->GetOption(prefix + "VERSION")) {
+ this->Version = optVERSION;
} else if (const char* optPACKAGE_VERSION =
- GetOption("CPACK_PACKAGE_VERSION")) {
- Version = optPACKAGE_VERSION;
+ this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = optPACKAGE_VERSION;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Script
- if (const char* option = GetOption(prefix + "SCRIPT")) {
- Script = option;
+ if (const char* option = this->GetOption(prefix + "SCRIPT")) {
+ this->Script = option;
}
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
- UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, UserInterfaces);
+ this->UserInterfaces.clear();
+ cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
}
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
- Licenses.clear();
- cmSystemTools::ExpandListArgument(option, Licenses);
- if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
- Licenses.clear();
+ this->Licenses.clear();
+ cmSystemTools::ExpandListArgument(option, this->Licenses);
+ if (this->Licenses.size() % 2 != 0) {
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
+ this->Licenses.clear();
}
}
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
- SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ this->SortingPriority = option;
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component group \"" << group->Name
<< "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
}
- return ConfigureFromPrefix(prefix);
+ return this->ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
@@ -372,29 +323,29 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
std::string prefix =
"CPACK_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(groupName) + "_";
- if (const char* option = GetOption(prefix + "DISPLAY_NAME")) {
+ if (const char* option = this->GetOption(prefix + "DISPLAY_NAME")) {
group.DisplayName = option;
} else {
group.DisplayName = group.Name;
}
- if (const char* option = GetOption(prefix + "DESCRIPTION")) {
+ if (const char* option = this->GetOption(prefix + "DESCRIPTION")) {
group.Description = option;
}
- group.IsBold = IsOn(prefix + "BOLD_TITLE");
- group.IsExpandedByDefault = IsOn(prefix + "EXPANDED");
+ group.IsBold = this->IsOn(prefix + "BOLD_TITLE");
+ group.IsExpandedByDefault = this->IsOn(prefix + "EXPANDED");
// Package configuration
group.Name = groupName;
if (Generator) {
- Name = Generator->GetGroupPackageName(&group);
+ this->Name = this->Generator->GetGroupPackageName(&group);
} else {
- Name = group.Name;
+ this->Name = group.Name;
}
- return ConfigureFromGroup(&group);
+ return this->ConfigureFromGroup(&group);
}
// Common options for components and groups
@@ -405,51 +356,51 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
// Display name
option = prefix + "DISPLAY_NAME";
- if (IsSetToEmpty(option)) {
- DisplayName.clear();
- } else if (const char* value = GetOption(option)) {
- DisplayName = value;
+ if (this->IsSetToEmpty(option)) {
+ this->DisplayName.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ExpandListArgument(value, this->DisplayName);
}
// Description
option = prefix + "DESCRIPTION";
- if (IsSetToEmpty(option)) {
- Description.clear();
- } else if (const char* value = GetOption(option)) {
- Description = value;
+ if (this->IsSetToEmpty(option)) {
+ this->Description.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ExpandListArgument(value, this->Description);
}
// Release date
option = prefix + "RELEASE_DATE";
- if (IsSetToEmpty(option)) {
- ReleaseDate.clear();
- } else if (const char* value = GetOption(option)) {
- ReleaseDate = value;
+ if (this->IsSetToEmpty(option)) {
+ this->ReleaseDate.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ReleaseDate = value;
}
// Sorting priority
option = prefix + "SORTING_PRIORITY";
- if (IsSetToEmpty(option)) {
- SortingPriority.clear();
- } else if (const char* value = GetOption(option)) {
- SortingPriority = value;
+ if (this->IsSetToEmpty(option)) {
+ this->SortingPriority.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->SortingPriority = value;
}
// Update text
option = prefix + "UPDATE_TEXT";
- if (IsSetToEmpty(option)) {
- UpdateText.clear();
- } else if (const char* value = GetOption(option)) {
- UpdateText = value;
+ if (this->IsSetToEmpty(option)) {
+ this->UpdateText.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->UpdateText = value;
}
// Translations
option = prefix + "TRANSLATIONS";
- if (IsSetToEmpty(option)) {
- Translations.clear();
+ if (this->IsSetToEmpty(option)) {
+ this->Translations.clear();
} else if (const char* value = this->GetOption(option)) {
- Translations.clear();
- cmSystemTools::ExpandListArgument(value, Translations);
+ this->Translations.clear();
+ cmSystemTools::ExpandListArgument(value, this->Translations);
}
// QtIFW dependencies
@@ -465,84 +416,84 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
for (std::vector<std::string>::iterator dit = deps.begin();
dit != deps.end(); ++dit) {
DependenceStruct dep(*dit);
- if (Generator->Packages.count(dep.Name)) {
- cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ if (this->Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name];
dep.Name = depPkg.Name;
}
- bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
- DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name];
if (!hasDep) {
depRef = dep;
}
- AlienDependencies.insert(&depRef);
+ this->AlienDependencies.insert(&depRef);
}
// Automatic dependency on
option = prefix + "AUTO_DEPEND_ON";
- if (IsSetToEmpty(option)) {
- AlienAutoDependOn.clear();
+ if (this->IsSetToEmpty(option)) {
+ this->AlienAutoDependOn.clear();
} else if (const char* value = this->GetOption(option)) {
std::vector<std::string> depsOn;
cmSystemTools::ExpandListArgument(value, depsOn);
for (std::vector<std::string>::iterator dit = depsOn.begin();
dit != depsOn.end(); ++dit) {
DependenceStruct dep(*dit);
- if (Generator->Packages.count(dep.Name)) {
- cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ if (this->Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name];
dep.Name = depPkg.Name;
}
- bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
- DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name];
if (!hasDep) {
depRef = dep;
}
- AlienAutoDependOn.insert(&depRef);
+ this->AlienAutoDependOn.insert(&depRef);
}
}
// Visibility
option = prefix + "VIRTUAL";
- if (IsSetToEmpty(option)) {
- Virtual.clear();
- } else if (IsOn(option)) {
- Virtual = "true";
+ if (this->IsSetToEmpty(option)) {
+ this->Virtual.clear();
+ } else if (this->IsOn(option)) {
+ this->Virtual = "true";
}
// Default selection
option = prefix + "DEFAULT";
- if (IsSetToEmpty(option)) {
- Default.clear();
- } else if (const char* value = GetOption(option)) {
+ if (this->IsSetToEmpty(option)) {
+ this->Default.clear();
+ } else if (const char* value = this->GetOption(option)) {
std::string lowerValue = cmsys::SystemTools::LowerCase(value);
if (lowerValue == "true") {
- Default = "true";
+ this->Default = "true";
} else if (lowerValue == "false") {
- Default = "false";
+ this->Default = "false";
} else if (lowerValue == "script") {
- Default = "script";
+ this->Default = "script";
} else {
- Default = value;
+ this->Default = value;
}
}
// Forsed installation
option = prefix + "FORCED_INSTALLATION";
- if (IsSetToEmpty(option)) {
- ForcedInstallation.clear();
- } else if (IsOn(option)) {
- ForcedInstallation = "true";
- } else if (IsSetToOff(option)) {
- ForcedInstallation = "false";
+ if (this->IsSetToEmpty(option)) {
+ this->ForcedInstallation.clear();
+ } else if (this->IsOn(option)) {
+ this->ForcedInstallation = "true";
+ } else if (this->IsSetToOff(option)) {
+ this->ForcedInstallation = "false";
}
// Requires admin rights
option = prefix + "REQUIRES_ADMIN_RIGHTS";
- if (IsSetToEmpty(option)) {
- RequiresAdminRights.clear();
- } else if (IsOn(option)) {
- RequiresAdminRights = "true";
- } else if (IsSetToOff(option)) {
- RequiresAdminRights = "false";
+ if (this->IsSetToEmpty(option)) {
+ this->RequiresAdminRights.clear();
+ } else if (this->IsOn(option)) {
+ this->RequiresAdminRights = "true";
+ } else if (this->IsSetToOff(option)) {
+ this->RequiresAdminRights = "false";
}
return 1;
@@ -551,16 +502,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
void cmCPackIFWPackage::GeneratePackageFile()
{
// Lazy directory initialization
- if (Directory.empty()) {
- if (Installer) {
- Directory = Installer->Directory + "/packages/" + Name;
- } else if (Generator) {
- Directory = Generator->toplevel + "/packages/" + Name;
+ if (this->Directory.empty()) {
+ if (this->Installer) {
+ this->Directory = this->Installer->Directory + "/packages/" + this->Name;
+ } else if (this->Generator) {
+ this->Directory = this->Generator->toplevel + "/packages/" + this->Name;
}
}
// Output stream
- cmGeneratedFileStream fout((Directory + "/meta/package.xml").data());
+ cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data());
cmXMLWriter xout(fout);
xout.StartDocument();
@@ -569,28 +520,49 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.StartElement("Package");
- xout.Element("DisplayName", DisplayName);
- xout.Element("Description", Description);
+ // DisplayName (with translations)
+ for (std::map<std::string, std::string>::iterator it =
+ this->DisplayName.begin();
+ it != this->DisplayName.end(); ++it) {
+ xout.StartElement("DisplayName");
+ if (!it->first.empty()) {
+ xout.Attribute("xml:lang", it->first);
+ }
+ xout.Content(it->second);
+ xout.EndElement();
+ }
+
+ // Description (with translations)
+ for (std::map<std::string, std::string>::iterator it =
+ this->Description.begin();
+ it != this->Description.end(); ++it) {
+ xout.StartElement("Description");
+ if (!it->first.empty()) {
+ xout.Attribute("xml:lang", it->first);
+ }
+ xout.Content(it->second);
+ xout.EndElement();
+ }
// Update text
- if (!UpdateText.empty()) {
- xout.Element("UpdateText", UpdateText);
+ if (!this->UpdateText.empty()) {
+ xout.Element("UpdateText", this->UpdateText);
}
- xout.Element("Name", Name);
- xout.Element("Version", Version);
+ xout.Element("Name", this->Name);
+ xout.Element("Version", this->Version);
- if (!ReleaseDate.empty()) {
- xout.Element("ReleaseDate", ReleaseDate);
+ if (!this->ReleaseDate.empty()) {
+ xout.Element("ReleaseDate", this->ReleaseDate);
} else {
xout.Element("ReleaseDate", cmTimestamp().CurrentTime("%Y-%m-%d", true));
}
// Script (copy to meta dir)
- if (!Script.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Script);
- std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Script, path);
+ if (!this->Script.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Script);
+ std::string path = this->Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Script, path);
xout.Element("Script", name);
}
@@ -598,7 +570,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
std::vector<std::string> userInterfaces = UserInterfaces;
for (size_t i = 0; i < userInterfaces.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]);
- std::string path = Directory + "/meta/" + name;
+ std::string path = this->Directory + "/meta/" + name;
cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path);
userInterfaces[i] = name;
}
@@ -614,7 +586,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
std::vector<std::string> translations = Translations;
for (size_t i = 0; i < translations.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(translations[i]);
- std::string path = Directory + "/meta/" + name;
+ std::string path = this->Directory + "/meta/" + name;
cmsys::SystemTools::CopyFileIfDifferent(translations[i], path);
translations[i] = name;
}
@@ -628,12 +600,13 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Dependencies
std::set<DependenceStruct> compDepSet;
- for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();
- ait != AlienDependencies.end(); ++ait) {
+ for (std::set<DependenceStruct*>::iterator ait =
+ this->AlienDependencies.begin();
+ ait != this->AlienDependencies.end(); ++ait) {
compDepSet.insert(*(*ait));
}
- for (std::set<cmCPackIFWPackage*>::iterator it = Dependencies.begin();
- it != Dependencies.end(); ++it) {
+ for (std::set<cmCPackIFWPackage*>::iterator it = this->Dependencies.begin();
+ it != this->Dependencies.end(); ++it) {
compDepSet.insert(DependenceStruct((*it)->Name));
}
// Write dependencies
@@ -651,8 +624,9 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Automatic dependency on
std::set<DependenceStruct> compAutoDepSet;
- for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin();
- ait != AlienAutoDependOn.end(); ++ait) {
+ for (std::set<DependenceStruct*>::iterator ait =
+ this->AlienAutoDependOn.begin();
+ ait != this->AlienAutoDependOn.end(); ++ait) {
compAutoDepSet.insert(*(*ait));
}
// Write automatic dependency on
@@ -669,10 +643,10 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Licenses (copy to meta dir)
- std::vector<std::string> licenses = Licenses;
+ std::vector<std::string> licenses = this->Licenses;
for (size_t i = 1; i < licenses.size(); i += 2) {
std::string name = cmSystemTools::GetFilenameName(licenses[i]);
- std::string path = Directory + "/meta/" + name;
+ std::string path = this->Directory + "/meta/" + name;
cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path);
licenses[i] = name;
}
@@ -687,37 +661,30 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.EndElement();
}
- if (!ForcedInstallation.empty()) {
- xout.Element("ForcedInstallation", ForcedInstallation);
+ if (!this->ForcedInstallation.empty()) {
+ xout.Element("ForcedInstallation", this->ForcedInstallation);
}
- if (!RequiresAdminRights.empty()) {
- xout.Element("RequiresAdminRights", RequiresAdminRights);
+ if (!this->RequiresAdminRights.empty()) {
+ xout.Element("RequiresAdminRights", this->RequiresAdminRights);
}
- if (!Virtual.empty()) {
- xout.Element("Virtual", Virtual);
- } else if (!Default.empty()) {
- xout.Element("Default", Default);
+ if (!this->Virtual.empty()) {
+ xout.Element("Virtual", this->Virtual);
+ } else if (!this->Default.empty()) {
+ xout.Element("Default", this->Default);
}
// Essential
- if (!Essential.empty()) {
- xout.Element("Essential", Essential);
+ if (!this->Essential.empty()) {
+ xout.Element("Essential", this->Essential);
}
// Priority
- if (!SortingPriority.empty()) {
- xout.Element("SortingPriority", SortingPriority);
+ if (!this->SortingPriority.empty()) {
+ xout.Element("SortingPriority", this->SortingPriority);
}
xout.EndElement();
xout.EndDocument();
}
-
-void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 025a03e..cec59b0 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -5,20 +5,21 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
+#include <map>
#include <set>
#include <string>
#include <vector>
class cmCPackComponent;
class cmCPackComponentGroup;
-class cmCPackIFWGenerator;
class cmCPackIFWInstaller;
-class cmXMLWriter;
/** \class cmCPackIFWPackage
* \brief A single component to be installed by CPack IFW generator
*/
-class cmCPackIFWPackage
+class cmCPackIFWPackage : public cmCPackIFWCommon
{
public:
// Types
@@ -69,10 +70,10 @@ public:
// Configuration
/// Human-readable name of the component
- std::string DisplayName;
+ std::map<std::string, std::string> DisplayName;
/// Human-readable description of the component
- std::string Description;
+ std::map<std::string, std::string> Description;
/// Version number of the component
std::string Version;
@@ -119,15 +120,6 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
- bool IsSetToOff(const std::string& op) const;
- bool IsSetToEmpty(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
std::string GetComponentName(cmCPackComponent* component);
void DefaultConfiguration();
@@ -140,8 +132,6 @@ public:
void GeneratePackageFile();
- // Pointer to generator
- cmCPackIFWGenerator* Generator;
// Pointer to installer
cmCPackIFWInstaller* Installer;
// Collection of dependencies
@@ -152,9 +142,6 @@ public:
std::set<DependenceStruct*> AlienAutoDependOn;
// Patch to package directory
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWPackage_h
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 8ce375e..b115db0 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -2,32 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWRepository.h"
-#include "cmCPackGenerator.h"
#include "cmCPackIFWGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#include "cmConfigure.h"
#include <stddef.h>
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
-
cmCPackIFWRepository::cmCPackIFWRepository()
- : Update(None)
- , Generator(CM_NULLPTR)
+ : Update(cmCPackIFWRepository::None)
{
}
@@ -35,120 +19,95 @@ bool cmCPackIFWRepository::IsValid() const
{
bool valid = true;
- switch (Update) {
- case None:
- valid = !Url.empty();
+ switch (this->Update) {
+ case cmCPackIFWRepository::None:
+ valid = !this->Url.empty();
break;
- case Add:
- valid = !Url.empty();
+ case cmCPackIFWRepository::Add:
+ valid = !this->Url.empty();
break;
- case Remove:
- valid = !Url.empty();
+ case cmCPackIFWRepository::Remove:
+ valid = !this->Url.empty();
break;
- case Replace:
- valid = !OldUrl.empty() && !NewUrl.empty();
+ case cmCPackIFWRepository::Replace:
+ valid = !this->OldUrl.empty() && !this->NewUrl.empty();
break;
}
return valid;
}
-const char* cmCPackIFWRepository::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWRepository::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
-}
-
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
- if (Name.empty()) {
+ if (this->Name.empty()) {
return false;
}
std::string prefix =
- "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
+ "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(this->Name) + "_";
// Update
- if (IsOn(prefix + "ADD")) {
- Update = Add;
+ if (this->IsOn(prefix + "ADD")) {
+ this->Update = cmCPackIFWRepository::Add;
} else if (IsOn(prefix + "REMOVE")) {
- Update = Remove;
+ this->Update = cmCPackIFWRepository::Remove;
} else if (IsOn(prefix + "REPLACE")) {
- Update = Replace;
+ this->Update = cmCPackIFWRepository::Replace;
} else {
- Update = None;
+ this->Update = cmCPackIFWRepository::None;
}
// Url
- if (const char* url = GetOption(prefix + "URL")) {
- Url = url;
+ if (const char* url = this->GetOption(prefix + "URL")) {
+ this->Url = url;
} else {
- Url = "";
+ this->Url = "";
}
// Old url
- if (const char* oldUrl = GetOption(prefix + "OLD_URL")) {
- OldUrl = oldUrl;
+ if (const char* oldUrl = this->GetOption(prefix + "OLD_URL")) {
+ this->OldUrl = oldUrl;
} else {
- OldUrl = "";
+ this->OldUrl = "";
}
// New url
- if (const char* newUrl = GetOption(prefix + "NEW_URL")) {
- NewUrl = newUrl;
+ if (const char* newUrl = this->GetOption(prefix + "NEW_URL")) {
+ this->NewUrl = newUrl;
} else {
- NewUrl = "";
+ this->NewUrl = "";
}
// Enabled
- if (IsOn(prefix + "DISABLED")) {
- Enabled = "0";
+ if (this->IsOn(prefix + "DISABLED")) {
+ this->Enabled = "0";
} else {
- Enabled = "";
+ this->Enabled = "";
}
// Username
- if (const char* username = GetOption(prefix + "USERNAME")) {
- Username = username;
+ if (const char* username = this->GetOption(prefix + "USERNAME")) {
+ this->Username = username;
} else {
- Username = "";
+ this->Username = "";
}
// Password
- if (const char* password = GetOption(prefix + "PASSWORD")) {
- Password = password;
+ if (const char* password = this->GetOption(prefix + "PASSWORD")) {
+ this->Password = password;
} else {
- Password = "";
+ this->Password = "";
}
// DisplayName
- if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
- DisplayName = displayName;
+ if (const char* displayName = this->GetOption(prefix + "DISPLAY_NAME")) {
+ this->DisplayName = displayName;
} else {
- DisplayName = "";
+ this->DisplayName = "";
}
- return IsValid();
+ return this->IsValid();
}
/** \class cmCPackeIFWUpdatesPatcher
@@ -171,8 +130,8 @@ public:
protected:
void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
- xout.StartElement(name);
- StartFragment(atts);
+ this->xout.StartElement(name);
+ this->StartFragment(atts);
}
void StartFragment(const char** atts)
@@ -180,23 +139,23 @@ protected:
for (size_t i = 0; atts[i]; i += 2) {
const char* key = atts[i];
const char* value = atts[i + 1];
- xout.Attribute(key, value);
+ this->xout.Attribute(key, value);
}
}
void EndElement(const std::string& name) CM_OVERRIDE
{
- if (name == "Updates" && !patched) {
- repository->WriteRepositoryUpdates(xout);
- patched = true;
+ if (name == "Updates" && !this->patched) {
+ this->repository->WriteRepositoryUpdates(this->xout);
+ this->patched = true;
}
- xout.EndElement();
- if (patched) {
+ this->xout.EndElement();
+ if (this->patched) {
return;
}
if (name == "Checksum") {
- repository->WriteRepositoryUpdates(xout);
- patched = true;
+ this->repository->WriteRepositoryUpdates(this->xout);
+ this->patched = true;
}
}
@@ -207,20 +166,21 @@ protected:
content == "\n") {
return;
}
- xout.Content(content);
+ this->xout.Content(content);
}
};
bool cmCPackIFWRepository::PatchUpdatesXml()
{
// Lazy directory initialization
- if (Directory.empty() && Generator) {
- Directory = Generator->toplevel;
+ if (this->Directory.empty() && this->Generator) {
+ this->Directory = this->Generator->toplevel;
}
// Filenames
- std::string updatesXml = Directory + "/repository/Updates.xml";
- std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml";
+ std::string updatesXml = this->Directory + "/repository/Updates.xml";
+ std::string updatesPatchXml =
+ this->Directory + "/repository/UpdatesPatch.xml";
// Output stream
cmGeneratedFileStream fout(updatesPatchXml.data());
@@ -228,7 +188,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
xout.StartDocument();
- WriteGeneratedByToStrim(xout);
+ this->WriteGeneratedByToStrim(xout);
// Patch
{
@@ -248,22 +208,22 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
xout.StartElement("Repository");
// Url
- xout.Element("Url", Url);
+ xout.Element("Url", this->Url);
// Enabled
- if (!Enabled.empty()) {
- xout.Element("Enabled", Enabled);
+ if (!this->Enabled.empty()) {
+ xout.Element("Enabled", this->Enabled);
}
// Username
- if (!Username.empty()) {
- xout.Element("Username", Username);
+ if (!this->Username.empty()) {
+ xout.Element("Username", this->Username);
}
// Password
- if (!Password.empty()) {
- xout.Element("Password", Password);
+ if (!this->Password.empty()) {
+ xout.Element("Password", this->Password);
}
// DisplayName
- if (!DisplayName.empty()) {
- xout.Element("DisplayName", DisplayName);
+ if (!this->DisplayName.empty()) {
+ xout.Element("DisplayName", this->DisplayName);
}
xout.EndElement();
@@ -273,42 +233,43 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
{
xout.StartElement("Repository");
- switch (Update) {
- case None:
+ switch (this->Update) {
+ case cmCPackIFWRepository::None:
break;
- case Add:
+ case cmCPackIFWRepository::Add:
xout.Attribute("action", "add");
break;
- case Remove:
+ case cmCPackIFWRepository::Remove:
xout.Attribute("action", "remove");
break;
- case Replace:
+ case cmCPackIFWRepository::Replace:
xout.Attribute("action", "replace");
break;
}
// Url
- if (Update == Add || Update == Remove) {
- xout.Attribute("url", Url);
- } else if (Update == Replace) {
- xout.Attribute("oldUrl", OldUrl);
- xout.Attribute("newUrl", NewUrl);
+ if (this->Update == cmCPackIFWRepository::Add ||
+ this->Update == cmCPackIFWRepository::Remove) {
+ xout.Attribute("url", this->Url);
+ } else if (Update == cmCPackIFWRepository::Replace) {
+ xout.Attribute("oldUrl", this->OldUrl);
+ xout.Attribute("newUrl", this->NewUrl);
}
// Enabled
- if (!Enabled.empty()) {
- xout.Attribute("enabled", Enabled);
+ if (!this->Enabled.empty()) {
+ xout.Attribute("enabled", this->Enabled);
}
// Username
- if (!Username.empty()) {
- xout.Attribute("username", Username);
+ if (!this->Username.empty()) {
+ xout.Attribute("username", this->Username);
}
// Password
- if (!Password.empty()) {
- xout.Attribute("password", Password);
+ if (!this->Password.empty()) {
+ xout.Attribute("password", this->Password);
}
// DisplayName
- if (!DisplayName.empty()) {
- xout.Attribute("displayname", DisplayName);
+ if (!this->DisplayName.empty()) {
+ xout.Attribute("displayname", this->DisplayName);
}
xout.EndElement();
@@ -316,19 +277,12 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
{
- if (!RepositoryUpdate.empty()) {
+ if (!this->RepositoryUpdate.empty()) {
xout.StartElement("RepositoryUpdate");
- for (RepositoriesVector::iterator rit = RepositoryUpdate.begin();
- rit != RepositoryUpdate.end(); ++rit) {
+ for (RepositoriesVector::iterator rit = this->RepositoryUpdate.begin();
+ rit != this->RepositoryUpdate.end(); ++rit) {
(*rit)->WriteRepositoryUpdate(xout);
}
xout.EndElement();
}
}
-
-void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index c09a158..227cfae 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -5,16 +5,17 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmXMLWriter;
/** \class cmCPackIFWRepository
* \brief A remote repository to be created CPack IFW generator
*/
-class cmCPackIFWRepository
+class cmCPackIFWRepository : public cmCPackIFWCommon
{
public:
// Types
@@ -72,13 +73,6 @@ public:
bool IsValid() const;
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
bool ConfigureFromOptions();
bool PatchUpdatesXml();
@@ -87,12 +81,8 @@ public:
void WriteRepositoryUpdate(cmXMLWriter& xout);
void WriteRepositoryUpdates(cmXMLWriter& xout);
- cmCPackIFWGenerator* Generator;
RepositoriesVector RepositoryUpdate;
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWRepository_h
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index c0c96cd..52c7e35 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -7,8 +7,8 @@
#include "cmXMLParser.h"
-#include <list>
#include <map>
+#include <vector>
struct cmWIXPatchNode
{
@@ -36,7 +36,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::list<cmWIXPatchNode*> child_list_t;
+ typedef std::vector<cmWIXPatchNode*> child_list_t;
typedef std::map<std::string, std::string> attributes_t;
std::string name;
@@ -84,7 +84,7 @@ private:
fragment_map_t& Fragments;
- std::list<cmWIXPatchElement*> ElementStack;
+ std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index cc01b0c..575c949 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -25,6 +25,28 @@ cmCPackArchiveGenerator::~cmCPackArchiveGenerator()
{
}
+std::string cmCPackArchiveGenerator::GetArchiveComponentFileName(
+ const std::string& component, bool isGroupName)
+{
+ std::string componentUpper(cmSystemTools::UpperCase(component));
+ std::string packageFileName;
+
+ if (this->IsSet("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME")) {
+ packageFileName +=
+ this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME");
+ } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) {
+ packageFileName += GetComponentPackageFileName(
+ this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName);
+ } else {
+ packageFileName += GetComponentPackageFileName(
+ this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName);
+ }
+
+ packageFileName += this->GetOutputExtension();
+
+ return packageFileName;
+}
+
int cmCPackArchiveGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
@@ -101,11 +123,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Packaging component group: "
<< compGIt->first << std::endl);
// Begin the archive for this group
- std::string packageFileName = std::string(toplevel);
- packageFileName += "/" +
- GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
- compGIt->first, true) +
- this->GetOutputExtension();
+ std::string packageFileName = std::string(toplevel) + "/" +
+ this->GetArchiveComponentFileName(compGIt->first, true);
+
// open a block in order to automatically close archive
// at the end of the block
{
@@ -137,10 +157,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
std::string packageFileName = std::string(toplevel);
localToplevel += "/" + compIt->first;
- packageFileName += "/" + GetComponentPackageFileName(
- this->GetOption("CPACK_PACKAGE_FILE_NAME"),
- compIt->first, false) +
- this->GetOutputExtension();
+ packageFileName +=
+ "/" + this->GetArchiveComponentFileName(compIt->first, false);
+
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
// Add the files of this component to the archive
@@ -161,10 +180,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
std::string packageFileName = std::string(toplevel);
localToplevel += "/" + compIt->first;
- packageFileName += "/" +
- GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"),
- compIt->first, false) +
- this->GetOutputExtension();
+ packageFileName +=
+ "/" + this->GetArchiveComponentFileName(compIt->first, false);
+
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
// Add the files of this component to the archive
@@ -182,9 +200,16 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne()
// reset the package file names
packageFileNames.clear();
packageFileNames.push_back(std::string(toplevel));
- packageFileNames[0] += "/" +
- std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
- this->GetOutputExtension();
+ packageFileNames[0] += "/";
+
+ if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) {
+ packageFileNames[0] += this->GetOption("CPACK_ARCHIVE_FILE_NAME");
+ } else {
+ packageFileNames[0] += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ }
+
+ packageFileNames[0] += this->GetOutputExtension();
+
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging all groups in one package..."
"(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE is set)"
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 58d67e3..e7116c4 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -34,6 +34,11 @@ public:
// component support
bool SupportsComponentInstallation() const CM_OVERRIDE;
+private:
+ // get archive component filename
+ std::string GetArchiveComponentFileName(const std::string& component,
+ bool isGroupName);
+
protected:
int InitializeInternal() CM_OVERRIDE;
/**
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index a95ca76..3e113d3 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -6,7 +6,6 @@
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
-#include <list>
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -314,7 +313,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
const std::string& tempDir = tempInstallDirectory;
for (it = installDirectoriesVector.begin();
it != installDirectoriesVector.end(); ++it) {
- std::list<std::pair<std::string, std::string> > symlinkedFiles;
+ std::vector<std::pair<std::string, std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = *it;
@@ -378,7 +377,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
/* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) {
- std::list<std::pair<std::string, std::string> >::iterator symlinkedIt;
+ std::vector<std::pair<std::string, std::string> >::iterator
+ symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/" + subdir;
@@ -620,7 +620,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
<< installComponent << std::endl);
}
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -795,6 +795,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmsys::Glob glA;
glA.RecurseOn();
glA.SetRecurseListDirs(true);
+ glA.SetRecurseThroughSymlinks(false);
glA.FindFiles(findExpr);
std::vector<std::string> filesAfter = glA.GetFiles();
std::sort(filesAfter.begin(), filesAfter.end());
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index a48c8cd..a44bc3d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -23,7 +23,6 @@
#include "cmDocumentationEntry.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
@@ -189,11 +188,10 @@ int main(int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack config file: " << cpackConfigFile << std::endl);
- cmake cminst;
+ cmake cminst(cmake::RoleScript);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
- cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
CM_AUTO_PTR<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index ed7dd5d..cc29071 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -167,7 +167,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
std::string cmakeOutString;
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 06b5e81..b80ea5a 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -143,9 +143,17 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
::curl_easy_setopt(this->Curl, CURLOPT_WRITEFUNCTION,
curlWriteMemoryCallback);
::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION, curlDebugCallback);
- // Be sure to set Content-Type to satisfy fussy modsecurity rules
+ // Set Content-Type to satisfy fussy modsecurity rules.
struct curl_slist* headers =
::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
+ // Add any additional headers that the user specified.
+ for (std::vector<std::string>::const_iterator h = this->HttpHeaders.begin();
+ h != this->HttpHeaders.end(); ++h) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Add HTTP Header: \"" << *h << "\"" << std::endl,
+ this->Quiet);
+ headers = ::curl_slist_append(headers, h->c_str());
+ }
::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
std::vector<char> responseData;
std::vector<char> debugData;
@@ -203,7 +211,22 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, (void*)&debugData);
::curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1);
+ // Add headers if any were specified.
+ struct curl_slist* headers = CM_NULLPTR;
+ if (!this->HttpHeaders.empty()) {
+ for (std::vector<std::string>::const_iterator h =
+ this->HttpHeaders.begin();
+ h != this->HttpHeaders.end(); ++h) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Add HTTP Header: \"" << *h << "\"" << std::endl,
+ this->Quiet);
+ headers = ::curl_slist_append(headers, h->c_str());
+ }
+ }
+
+ ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
CURLcode res = ::curl_easy_perform(this->Curl);
+ ::curl_slist_free_all(headers);
if (!responseData.empty()) {
response = std::string(responseData.begin(), responseData.end());
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index 67608cb..427a392 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -23,6 +23,10 @@ public:
// currently only supports CURLOPT_SSL_VERIFYPEER_OFF
// and CURLOPT_SSL_VERIFYHOST_OFF
void SetCurlOptions(std::vector<std::string> const& args);
+ void SetHttpHeaders(std::vector<std::string> const& v)
+ {
+ this->HttpHeaders = v;
+ }
void SetUseHttp10On() { this->UseHttp10 = true; }
void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s; }
void SetQuiet(bool b) { this->Quiet = b; }
@@ -35,6 +39,7 @@ protected:
private:
cmCTest* CTest;
CURL* Curl;
+ std::vector<std::string> HttpHeaders;
std::string HTTPProxyAuth;
std::string HTTPProxy;
curl_proxytype HTTPProxyType;
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index bfd4061..503ed23 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -42,14 +42,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "ctest_empty_binary_directory";
- }
};
#endif
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index adc1687..0ea0612 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -25,6 +25,11 @@ public:
cmCTestHandlerCommand();
/**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual std::string GetName() const = 0;
+
+ /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index a782150..5b21351 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -623,7 +623,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
void cmCTestLaunch::LoadConfig()
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index fd7c3a9..b9cae3b 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -3,6 +3,7 @@
#include "cmCTestMemCheckCommand.h"
#include <sstream>
+#include <string>
#include <vector>
#include "cmCTest.h"
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index fea65e8..fa59559 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -7,8 +7,6 @@
#include "cmCTestTestCommand.h"
-#include <string>
-
class cmCTestGenericHandler;
class cmCommand;
@@ -33,11 +31,6 @@ public:
return ni;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; }
-
protected:
cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 04024ab..5989fa0 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -40,11 +40,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; }
};
#endif
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index aac5114..9bd0965 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -41,11 +41,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; }
};
#endif
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 0b87281..f60f78c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -103,8 +103,8 @@ bool cmCTestSVN::NoteOldRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.OldRevision = this->LoadInfo(svninfo);
@@ -127,8 +127,8 @@ bool cmCTestSVN::NoteNewRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.NewRevision = this->LoadInfo(svninfo);
@@ -380,8 +380,8 @@ bool cmCTestSVN::LoadRevisions()
{
bool result = true;
// Get revisions for all the external repositories
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
result = this->LoadRevisions(svninfo) && result;
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index d90d387..46b0778 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -8,7 +8,6 @@
#include "cmCTestGlobalVC.h"
#include <iosfwd>
-#include <list>
#include <string>
#include <vector>
@@ -71,7 +70,7 @@ private:
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
- std::list<SVNInfo> Repositories;
+ std::vector<SVNInfo> Repositories;
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 60e48b6..1d29dfa 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -166,12 +166,12 @@ void cmCTestScriptHandler::UpdateElapsedTime()
}
}
-void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
+void cmCTestScriptHandler::AddCTestCommand(std::string const& name,
+ cmCTestCommand* command)
{
- cmCTestCommand* newCom = command;
- newCom->CTest = this->CTest;
- newCom->CTestScriptHandler = this;
- this->CMake->GetState()->AddCommand(newCom);
+ command->CTest = this->CTest;
+ command->CTestScriptHandler = this;
+ this->CMake->GetState()->AddBuiltinCommand(name, command);
}
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
@@ -275,7 +275,7 @@ void cmCTestScriptHandler::CreateCMake()
delete this->GlobalGenerator;
delete this->Makefile;
}
- this->CMake = new cmake;
+ this->CMake = new cmake(cmake::RoleScript);
this->CMake->SetHomeDirectory("");
this->CMake->SetHomeOutputDirectory("");
this->CMake->GetCurrentSnapshot().SetDefaultDefinitions();
@@ -290,26 +290,21 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
- // remove all cmake commands which are not scriptable, since they can't be
- // used in ctest scripts
- this->CMake->GetState()->RemoveUnscriptableCommands();
-
- // add any ctest specific commands, probably should have common superclass
- // for ctest commands to clean this up. If a couple more commands are
- // created with the same format lets do that - ken
- this->AddCTestCommand(new cmCTestBuildCommand);
- this->AddCTestCommand(new cmCTestConfigureCommand);
- this->AddCTestCommand(new cmCTestCoverageCommand);
- this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
- this->AddCTestCommand(new cmCTestMemCheckCommand);
- this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
- this->AddCTestCommand(new cmCTestRunScriptCommand);
- this->AddCTestCommand(new cmCTestSleepCommand);
- this->AddCTestCommand(new cmCTestStartCommand);
- this->AddCTestCommand(new cmCTestSubmitCommand);
- this->AddCTestCommand(new cmCTestTestCommand);
- this->AddCTestCommand(new cmCTestUpdateCommand);
- this->AddCTestCommand(new cmCTestUploadCommand);
+ this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
+ this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
+ this->AddCTestCommand("ctest_coverage", new cmCTestCoverageCommand);
+ this->AddCTestCommand("ctest_empty_binary_directory",
+ new cmCTestEmptyBinaryDirectoryCommand);
+ this->AddCTestCommand("ctest_memcheck", new cmCTestMemCheckCommand);
+ this->AddCTestCommand("ctest_read_custom_files",
+ new cmCTestReadCustomFilesCommand);
+ this->AddCTestCommand("ctest_run_script", new cmCTestRunScriptCommand);
+ this->AddCTestCommand("ctest_sleep", new cmCTestSleepCommand);
+ this->AddCTestCommand("ctest_start", new cmCTestStartCommand);
+ this->AddCTestCommand("ctest_submit", new cmCTestSubmitCommand);
+ this->AddCTestCommand("ctest_test", new cmCTestTestCommand);
+ this->AddCTestCommand("ctest_update", new cmCTestUpdateCommand);
+ this->AddCTestCommand("ctest_upload", new cmCTestUploadCommand);
}
// this sets up some variables for the script to use, creates the required
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 3070796..6678702 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -126,7 +126,7 @@ private:
int RunConfigurationDashboard();
// Add ctest command
- void AddCTestCommand(cmCTestCommand* command);
+ void AddCTestCommand(std::string const& name, cmCTestCommand* command);
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index a55e9d9..f0b5f1e 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -41,11 +41,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; }
};
#endif
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index 26a63fb..b4943f9 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -54,11 +54,6 @@ public:
*/
bool ShouldBeQuiet() { return this->Quiet; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_start"; }
-
private:
bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
bool CreateNewTag;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 5cf4ddc..409eb51 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -129,6 +129,12 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
}
+ // Pass along any HTTPHEADER to the handler if this option was given.
+ if (!this->HttpHeaders.empty()) {
+ static_cast<cmCTestSubmitHandler*>(handler)->SetHttpHeaders(
+ this->HttpHeaders);
+ }
+
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
"RetryDelay", this->RetryDelay.c_str());
static_cast<cmCTestSubmitHandler*>(handler)->SetOption(
@@ -182,6 +188,11 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
}
}
// Arguments used by both modes.
+ if (arg == "HTTPHEADER") {
+ this->ArgumentDoing = ArgumentDoingHttpHeader;
+ return true;
+ }
+
if (arg == "RETRY_COUNT") {
this->ArgumentDoing = ArgumentDoingRetryCount;
return true;
@@ -230,6 +241,11 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
return true;
}
+ if (this->ArgumentDoing == ArgumentDoingHttpHeader) {
+ this->HttpHeaders.push_back(arg);
+ return true;
+ }
+
if (this->ArgumentDoing == ArgumentDoingRetryCount) {
this->RetryCount = arg;
return true;
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index e566abb..cf65cdc 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -70,6 +70,7 @@ protected:
ArgumentDoingRetryCount,
ArgumentDoingCDashUpload,
ArgumentDoingCDashUploadType,
+ ArgumentDoingHttpHeader,
ArgumentDoingLast2
};
@@ -83,6 +84,7 @@ protected:
bool CDashUpload;
std::string CDashUploadFile;
std::string CDashUploadType;
+ std::vector<std::string> HttpHeaders;
};
#endif
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 96d1491..4aceddb 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -301,9 +301,19 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
CURLcode res;
FILE* ftpfile;
char error_buffer[1024];
+ // Set Content-Type to satisfy fussy modsecurity rules.
struct curl_slist* headers =
::curl_slist_append(CM_NULLPTR, "Content-Type: text/xml");
+ // Add any additional headers that the user specified.
+ for (std::vector<std::string>::const_iterator h = this->HttpHeaders.begin();
+ h != this->HttpHeaders.end(); ++h) {
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ " Add HTTP Header: \"" << *h << "\"" << std::endl,
+ this->Quiet);
+ headers = ::curl_slist_append(headers, h->c_str());
+ }
+
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
@@ -376,7 +386,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- // Be sure to set Content-Type to satisfy fussy modsecurity rules
::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
std::string local_file = *file;
@@ -1014,6 +1023,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
cmSystemTools::ExpandListArgument(curlopt, args);
curl.SetCurlOptions(args);
curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
+ curl.SetHttpHeaders(this->HttpHeaders);
std::string dropMethod;
std::string url;
this->ConstructCDashURL(dropMethod, url);
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index cf36546..2923f4f 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -43,6 +43,11 @@ public:
// handle the cdash file upload protocol
int HandleCDashUploadFile(std::string const& file, std::string const& type);
+ void SetHttpHeaders(std::vector<std::string> const& v)
+ {
+ this->HttpHeaders = v;
+ }
+
void ConstructCDashURL(std::string& dropMethod, std::string& url);
private:
@@ -95,6 +100,7 @@ private:
bool HasWarnings;
bool HasErrors;
cmCTest::SetOfStrings Files;
+ std::vector<std::string> HttpHeaders;
};
#endif
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 21b1003..075b140 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -20,6 +20,9 @@ cmCTestTestCommand::cmCTestTestCommand()
this->Arguments[ctt_INCLUDE] = "INCLUDE";
this->Arguments[ctt_EXCLUDE_LABEL] = "EXCLUDE_LABEL";
this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
+ this->Arguments[ctt_EXCLUDE_FIXTURE] = "EXCLUDE_FIXTURE";
+ this->Arguments[ctt_EXCLUDE_FIXTURE_SETUP] = "EXCLUDE_FIXTURE_SETUP";
+ this->Arguments[ctt_EXCLUDE_FIXTURE_CLEANUP] = "EXCLUDE_FIXTURE_CLEANUP";
this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
this->Arguments[ctt_STOP_TIME] = "STOP_TIME";
@@ -76,6 +79,18 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
handler->SetOption("LabelRegularExpression",
this->Values[ctt_INCLUDE_LABEL]);
}
+ if (this->Values[ctt_EXCLUDE_FIXTURE]) {
+ handler->SetOption("ExcludeFixtureRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE]);
+ }
+ if (this->Values[ctt_EXCLUDE_FIXTURE_SETUP]) {
+ handler->SetOption("ExcludeFixtureSetupRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE_SETUP]);
+ }
+ if (this->Values[ctt_EXCLUDE_FIXTURE_CLEANUP]) {
+ handler->SetOption("ExcludeFixtureCleanupRegularExpression",
+ this->Values[ctt_EXCLUDE_FIXTURE_CLEANUP]);
+ }
if (this->Values[ctt_PARALLEL_LEVEL]) {
handler->SetOption("ParallelLevel", this->Values[ctt_PARALLEL_LEVEL]);
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 1893104..be7e783 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -53,6 +53,9 @@ protected:
ctt_INCLUDE,
ctt_EXCLUDE_LABEL,
ctt_INCLUDE_LABEL,
+ ctt_EXCLUDE_FIXTURE,
+ ctt_EXCLUDE_FIXTURE_SETUP,
+ ctt_EXCLUDE_FIXTURE_CLEANUP,
ctt_PARALLEL_LEVEL,
ctt_SCHEDULE_RANDOM,
ctt_STOP_TIME,
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index d73811b..da3ae2f 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -56,11 +56,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "subdirs"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -136,11 +131,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -206,11 +196,6 @@ public:
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_test"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -244,11 +229,6 @@ public:
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -362,6 +342,9 @@ void cmCTestTestHandler::Initialize()
this->ExcludeLabelRegularExpression = "";
this->IncludeRegExp = "";
this->ExcludeRegExp = "";
+ this->ExcludeFixtureRegExp.clear();
+ this->ExcludeFixtureSetupRegExp.clear();
+ this->ExcludeFixtureCleanupRegExp.clear();
TestsToRunString = "";
this->UseUnion = false;
@@ -439,6 +422,18 @@ int cmCTestTestHandler::ProcessHandler()
this->UseExcludeRegExp();
this->SetExcludeRegExp(val);
}
+ val = this->GetOption("ExcludeFixtureRegularExpression");
+ if (val) {
+ this->ExcludeFixtureRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureSetupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureSetupRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureCleanupRegExp = val;
+ }
this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
this->TestResults.clear();
@@ -828,13 +823,35 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
"Updating test list for fixtures" << std::endl,
this->Quiet);
+ // Prepare regular expression evaluators
+ std::string setupRegExp(this->ExcludeFixtureRegExp);
+ std::string cleanupRegExp(this->ExcludeFixtureRegExp);
+ if (!this->ExcludeFixtureSetupRegExp.empty()) {
+ if (setupRegExp.empty()) {
+ setupRegExp = this->ExcludeFixtureSetupRegExp;
+ } else {
+ setupRegExp.append("(" + setupRegExp + ")|(" +
+ this->ExcludeFixtureSetupRegExp + ")");
+ }
+ }
+ if (!this->ExcludeFixtureCleanupRegExp.empty()) {
+ if (cleanupRegExp.empty()) {
+ cleanupRegExp = this->ExcludeFixtureCleanupRegExp;
+ } else {
+ cleanupRegExp.append("(" + cleanupRegExp + ")|(" +
+ this->ExcludeFixtureCleanupRegExp + ")");
+ }
+ }
+ cmsys::RegularExpression excludeSetupRegex(setupRegExp);
+ cmsys::RegularExpression excludeCleanupRegex(cleanupRegExp);
+
// Prepare some maps to help us find setup and cleanup tests for
// any given fixture
typedef ListOfTests::const_iterator TestIterator;
typedef std::multimap<std::string, TestIterator> FixtureDependencies;
typedef FixtureDependencies::const_iterator FixtureDepsIterator;
FixtureDependencies fixtureSetups;
- FixtureDependencies fixtureDeps;
+ FixtureDependencies fixtureCleanups;
for (ListOfTests::const_iterator it = this->TestList.begin();
it != this->TestList.end(); ++it) {
@@ -844,13 +861,12 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
for (std::set<std::string>::const_iterator depsIt = setups.begin();
depsIt != setups.end(); ++depsIt) {
fixtureSetups.insert(std::make_pair(*depsIt, it));
- fixtureDeps.insert(std::make_pair(*depsIt, it));
}
const std::set<std::string>& cleanups = p.FixturesCleanup;
for (std::set<std::string>::const_iterator depsIt = cleanups.begin();
depsIt != cleanups.end(); ++depsIt) {
- fixtureDeps.insert(std::make_pair(*depsIt, it));
+ fixtureCleanups.insert(std::make_pair(*depsIt, it));
}
}
@@ -924,34 +940,72 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
// added from a previously checked test). A fixture isn't required
// to have setup/cleanup tests.
if (!addedFixtures.insert(requiredFixtureName).second) {
- // Already added this fixture
+ // Already seen this fixture, no need to check it again
continue;
}
- std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
- fixtureDeps.equal_range(requiredFixtureName);
- for (FixtureDepsIterator it = fixtureRange.first;
- it != fixtureRange.second; ++it) {
- ListOfTests::const_iterator lotIt = it->second;
- const cmCTestTestProperties& p = *lotIt;
-
- if (!addedTests.insert(p.Name).second) {
- // Already have p in our test list
- continue;
+
+ // Only add setup tests if this fixture has not been excluded
+ if (setupRegExp.empty() ||
+ !excludeSetupRegex.find(requiredFixtureName)) {
+ std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
+ fixtureSetups.equal_range(requiredFixtureName);
+ for (FixtureDepsIterator it = fixtureRange.first;
+ it != fixtureRange.second; ++it) {
+ ListOfTests::const_iterator lotIt = it->second;
+ const cmCTestTestProperties& p = *lotIt;
+
+ if (!addedTests.insert(p.Name).second) {
+ // Already have p in our test list
+ continue;
+ }
+
+ // This is a test not yet in our list, so add it and
+ // update its index to reflect where it was in the original
+ // full list of all tests (needed to track individual tests
+ // across ctest runs for re-run failed, etc.)
+ tests.push_back(p);
+ tests.back().Index =
+ 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
+ ++fixtureTestsAdded;
+
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Added setup test "
+ << p.Name << " required by fixture "
+ << requiredFixtureName << std::endl,
+ this->Quiet);
}
+ }
- // This is a test not yet in our list, so add it and
- // update its index to reflect where it was in the original
- // full list of all tests (needed to track individual tests
- // across ctest runs for re-run failed, etc.)
- tests.push_back(p);
- tests.back().Index =
- 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
- ++fixtureTestsAdded;
-
- cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Added test "
- << p.Name << " required by fixture "
- << requiredFixtureName << std::endl,
- this->Quiet);
+ // Only add cleanup tests if this fixture has not been excluded
+ if (cleanupRegExp.empty() ||
+ !excludeCleanupRegex.find(requiredFixtureName)) {
+ std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
+ fixtureCleanups.equal_range(requiredFixtureName);
+ for (FixtureDepsIterator it = fixtureRange.first;
+ it != fixtureRange.second; ++it) {
+ ListOfTests::const_iterator lotIt = it->second;
+ const cmCTestTestProperties& p = *lotIt;
+
+ if (!addedTests.insert(p.Name).second) {
+ // Already have p in our test list
+ continue;
+ }
+
+ // This is a test not yet in our list, so add it and
+ // update its index to reflect where it was in the original
+ // full list of all tests (needed to track individual tests
+ // across ctest runs for re-run failed, etc.)
+ tests.push_back(p);
+ tests.back().Index =
+ 1 + static_cast<int>(std::distance(this->TestList.begin(), lotIt));
+ ++fixtureTestsAdded;
+
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Added cleanup test "
+ << p.Name << " required by fixture "
+ << requiredFixtureName << std::endl,
+ this->Quiet);
+ }
}
}
@@ -1576,7 +1630,7 @@ void cmCTestTestHandler::GetListOfTests()
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Constructing a list of tests" << std::endl, this->Quiet);
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -1588,23 +1642,23 @@ void cmCTestTestHandler::GetListOfTests()
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
newCom1->TestHandler = this;
- cm.GetState()->AddCommand(newCom1);
+ cm.GetState()->AddBuiltinCommand("add_test", newCom1);
// Add handler for SUBDIRS
cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
newCom2->TestHandler = this;
- cm.GetState()->AddCommand(newCom2);
+ cm.GetState()->AddBuiltinCommand("subdirs", newCom2);
// Add handler for ADD_SUBDIRECTORY
cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand;
newCom3->TestHandler = this;
- cm.GetState()->AddCommand(newCom3);
+ cm.GetState()->AddBuiltinCommand("add_subdirectory", newCom3);
- // Add handler for SET_SOURCE_FILES_PROPERTIES
+ // Add handler for SET_TESTS_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom4 =
new cmCTestSetTestsPropertiesCommand;
newCom4->TestHandler = this;
- cm.GetState()->AddCommand(newCom4);
+ cm.GetState()->AddBuiltinCommand("set_tests_properties", newCom4);
const char* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 3700f8a..0edcb14 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -280,6 +280,9 @@ private:
std::string ExcludeLabelRegExp;
std::string IncludeRegExp;
std::string ExcludeRegExp;
+ std::string ExcludeFixtureRegExp;
+ std::string ExcludeFixtureSetupRegExp;
+ std::string ExcludeFixtureCleanupRegExp;
cmsys::RegularExpression IncludeLabelRegularExpression;
cmsys::RegularExpression ExcludeLabelRegularExpression;
cmsys::RegularExpression IncludeTestsRegularExpression;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 1698a84..28a0e95 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -81,7 +81,7 @@ int main(int argc, char const* const* argv)
cmDocumentation doc;
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(argc, argv)) {
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index ca824c0..0fa7aa5 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -40,7 +40,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
"Welcome to ccmake, curses based user interface for CMake.");
this->HelpMessage.push_back("");
this->HelpMessage.push_back(s_ConstHelpMessage);
- this->CMakeInstance = new cmake;
+ this->CMakeInstance = new cmake(cmake::RoleProject);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeCursesCommand());
diff --git a/Source/LexerParser/.clang-tidy b/Source/LexerParser/.clang-tidy
new file mode 100644
index 0000000..52b11bf
--- /dev/null
+++ b/Source/LexerParser/.clang-tidy
@@ -0,0 +1,6 @@
+---
+# We want to disable all checks for generated code. However, clang-tidy will
+# assume we did not configure it correctly. Just add one check that will never
+# be found.
+Checks: '-*,llvm-twine-local'
+...
diff --git a/Source/LexerParser/.gitattributes b/Source/LexerParser/.gitattributes
new file mode 100644
index 0000000..47eedfb
--- /dev/null
+++ b/Source/LexerParser/.gitattributes
@@ -0,0 +1,17 @@
+/cmCommandArgumentLexer.cxx generated
+/cmCommandArgumentLexer.h generated
+/cmCommandArgumentParser.cxx generated
+/cmCommandArgumentParserTokens.h generated
+/cmDependsJavaLexer.cxx generated
+/cmDependsJavaLexer.h generated
+/cmDependsJavaParser.cxx generated
+/cmDependsJavaParserTokens.h generated
+/cmExprLexer.cxx generated
+/cmExprLexer.h generated
+/cmExprParser.cxx generated
+/cmExprParserTokens.h generated
+/cmFortranLexer.cxx generated
+/cmFortranLexer.h generated
+/cmFortranParser.cxx generated
+/cmFortranParserTokens.h generated
+/cmListFileLexer.c generated
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx
index 12dce37..12dce37 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/LexerParser/cmCommandArgumentLexer.cxx
diff --git a/Source/cmCommandArgumentLexer.h b/Source/LexerParser/cmCommandArgumentLexer.h
index 82e87b5..82e87b5 100644
--- a/Source/cmCommandArgumentLexer.h
+++ b/Source/LexerParser/cmCommandArgumentLexer.h
diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l
index e3a8094..e3a8094 100644
--- a/Source/cmCommandArgumentLexer.in.l
+++ b/Source/LexerParser/cmCommandArgumentLexer.in.l
diff --git a/Source/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx
index aed0826..aed0826 100644
--- a/Source/cmCommandArgumentParser.cxx
+++ b/Source/LexerParser/cmCommandArgumentParser.cxx
diff --git a/Source/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y
index d6c8312..55a88df 100644
--- a/Source/cmCommandArgumentParser.y
+++ b/Source/LexerParser/cmCommandArgumentParser.y
@@ -189,4 +189,3 @@ void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
{
yyGetParser->Error(message);
}
-
diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/LexerParser/cmCommandArgumentParserTokens.h
index 3172182..3172182 100644
--- a/Source/cmCommandArgumentParserTokens.h
+++ b/Source/LexerParser/cmCommandArgumentParserTokens.h
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx
index 8159f47..8159f47 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/LexerParser/cmDependsJavaLexer.cxx
diff --git a/Source/cmDependsJavaLexer.h b/Source/LexerParser/cmDependsJavaLexer.h
index ccadd70..ccadd70 100644
--- a/Source/cmDependsJavaLexer.h
+++ b/Source/LexerParser/cmDependsJavaLexer.h
diff --git a/Source/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l
index 8cb42b1..8cb42b1 100644
--- a/Source/cmDependsJavaLexer.in.l
+++ b/Source/LexerParser/cmDependsJavaLexer.in.l
diff --git a/Source/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx
index bc45d45..bc45d45 100644
--- a/Source/cmDependsJavaParser.cxx
+++ b/Source/LexerParser/cmDependsJavaParser.cxx
diff --git a/Source/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y
index 1137f39..f7eb228 100644
--- a/Source/cmDependsJavaParser.y
+++ b/Source/LexerParser/cmDependsJavaParser.y
@@ -242,7 +242,7 @@ jp_DECIMALINTEGERLITERAL
yyGetParser->SetCurrentCombine("");
}
|
-jp_HEXINTEGERLITERAL
+jp_HEXINTEGERLITERAL
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3212,4 +3212,3 @@ void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message)
{
yyGetParser->Error(message);
}
-
diff --git a/Source/cmDependsJavaParserTokens.h b/Source/LexerParser/cmDependsJavaParserTokens.h
index 7f18f1d..7f18f1d 100644
--- a/Source/cmDependsJavaParserTokens.h
+++ b/Source/LexerParser/cmDependsJavaParserTokens.h
diff --git a/Source/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx
index fb6f0db..fb6f0db 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/LexerParser/cmExprLexer.cxx
diff --git a/Source/cmExprLexer.h b/Source/LexerParser/cmExprLexer.h
index 835a7a3..835a7a3 100644
--- a/Source/cmExprLexer.h
+++ b/Source/LexerParser/cmExprLexer.h
diff --git a/Source/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l
index 25ddba4..25ddba4 100644
--- a/Source/cmExprLexer.in.l
+++ b/Source/LexerParser/cmExprLexer.in.l
diff --git a/Source/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index 19efca1..67664a5 100644
--- a/Source/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -1696,4 +1696,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
cmExpr_yyget_extra(yyscanner)->Error(message);
}
-
diff --git a/Source/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index 220f7c8..d1c3a97 100644
--- a/Source/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -162,4 +162,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
{
cmExpr_yyget_extra(yyscanner)->Error(message);
}
-
diff --git a/Source/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h
index 84b2bbd..84b2bbd 100644
--- a/Source/cmExprParserTokens.h
+++ b/Source/LexerParser/cmExprParserTokens.h
diff --git a/Source/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx
index 01c09ac..01c09ac 100644
--- a/Source/cmFortranLexer.cxx
+++ b/Source/LexerParser/cmFortranLexer.cxx
diff --git a/Source/cmFortranLexer.h b/Source/LexerParser/cmFortranLexer.h
index ddda919..ddda919 100644
--- a/Source/cmFortranLexer.h
+++ b/Source/LexerParser/cmFortranLexer.h
diff --git a/Source/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l
index 1121210..1121210 100644
--- a/Source/cmFortranLexer.in.l
+++ b/Source/LexerParser/cmFortranLexer.in.l
diff --git a/Source/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx
index 2b3452f..2b3452f 100644
--- a/Source/cmFortranParser.cxx
+++ b/Source/LexerParser/cmFortranParser.cxx
diff --git a/Source/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y
index acfb40a..acfb40a 100644
--- a/Source/cmFortranParser.y
+++ b/Source/LexerParser/cmFortranParser.y
diff --git a/Source/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h
index 8d6a5fe..8d6a5fe 100644
--- a/Source/cmFortranParserTokens.h
+++ b/Source/LexerParser/cmFortranParserTokens.h
diff --git a/Source/cmListFileLexer.c b/Source/LexerParser/cmListFileLexer.c
index 3dd3b85..3dd3b85 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/LexerParser/cmListFileLexer.c
diff --git a/Source/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l
index 5152dbf..5152dbf 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/LexerParser/cmListFileLexer.in.l
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 2e11a8a..9e9df78 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -160,6 +160,25 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES})
+# cmake-gui has not been updated for `include-what-you-use`.
+# Block the tool until this is done.
+set_target_properties(cmake-gui PROPERTIES
+ CXX_INCLUDE_WHAT_YOU_USE ""
+ )
+
+# Files generated by MOC, RCC, and UIC may produce clang-tidy warnings.
+# We generate a dummy .clang-tidy file in the binary directory that disables
+# all clang-tidy checks except one that will never match. This one check is
+# necessary; clang-tidy reports an error when no checks are enabled.
+# Since the Qt code generators will generate source files in the binary tree,
+# clang-tidy will load the configuration from this dummy file when the sources
+# are built.
+file(WRITE "${QtDialog_BINARY_DIR}/.clang-tidy" "
+---
+Checks: '-*,llvm-twine-local'
+...
+")
+
if(APPLE)
file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
LIMIT_COUNT 1 REGEX "^Copyright 2000-20[0-9][0-9] Kitware")
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index b955d77..7fa2ac6 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
doc.addCMakeStandardDocSections();
if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) {
// Construct and print requested documentation.
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 111b28a..57f8e10 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -990,10 +990,10 @@ void CMakeSetupDialog::removeSelectedCacheEntries()
{
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
QList<QPersistentModelIndex> pidxs;
- foreach (QModelIndex i, idxs) {
+ foreach (QModelIndex const& i, idxs) {
pidxs.append(i);
}
- foreach (QPersistentModelIndex pi, pidxs) {
+ foreach (QPersistentModelIndex const& pi, pidxs) {
this->CacheValues->model()->removeRow(pi.row(), pi.parent());
}
}
@@ -1152,7 +1152,7 @@ void CMakeSetupDialog::showUserChanges()
QString command;
QString cache;
- foreach (QCMakeProperty prop, changes) {
+ foreach (QCMakeProperty const& prop, changes) {
QString type;
switch (prop.Type) {
case QCMakeProperty::BOOL:
@@ -1175,12 +1175,9 @@ void CMakeSetupDialog::showUserChanges()
value = prop.Value.toString();
}
- QString line("%1:%2=");
- line = line.arg(prop.Key);
- line = line.arg(type);
-
- command += QString("-D%1\"%2\" ").arg(line).arg(value);
- cache += QString("%1%2\n").arg(line).arg(value);
+ QString const line = QString("%1:%2=").arg(prop.Key, type);
+ command += QString("-D%1\"%2\" ").arg(line, value);
+ cache += QString("%1%2\n").arg(line, value);
}
textedit->append(tr("Commandline options:"));
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index 2f1df4f..b193a27 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -130,7 +130,7 @@ bool StartCompilerSetup::crossCompilerSetup() const
void StartCompilerSetup::onSelectionChanged(bool on)
{
if (on) {
- selectionChanged();
+ emit selectionChanged();
}
}
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index abeff97..d473d9b 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -27,7 +27,7 @@ QCMake::QCMake(QObject* p)
cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this);
cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this);
- this->CMakeInstance = new cmake;
+ this->CMakeInstance = new cmake(cmake::RoleProject);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeGUICommand());
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
@@ -219,14 +219,14 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
}
// remove some properites
- foreach (QString s, toremove) {
+ foreach (QString const& s, toremove) {
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
state->RemoveCacheEntry(s.toLocal8Bit().data());
}
// add some new properites
- foreach (QCMakeProperty s, props) {
+ foreach (QCMakeProperty const& s, props) {
this->CMakeInstance->WatchUnusedCli(s.Key.toLocal8Bit().data());
if (s.Type == QCMakeProperty::BOOL) {
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 9f5208a..08c2d58 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -47,7 +47,7 @@ protected:
}
// check all strings for a match
- foreach (QString str, strs) {
+ foreach (QString const& str, strs) {
if (str.contains(this->filterRegExp())) {
return true;
}
@@ -236,12 +236,12 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
qSort(newP);
qSort(newP2);
int row_count = 0;
- foreach (QCMakeProperty p, newP) {
+ foreach (QCMakeProperty const& p, newP) {
this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, true);
row_count++;
}
- foreach (QCMakeProperty p, newP2) {
+ foreach (QCMakeProperty const& p, newP2) {
this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, false);
row_count++;
@@ -254,8 +254,11 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
QStandardItem* root = this->invisibleRootItem();
- foreach (QString key, newPropsTree.keys()) {
- QCMakePropertyList props2 = newPropsTree[key];
+ for (QMap<QString, QCMakePropertyList>::const_iterator iter =
+ newPropsTree.begin();
+ iter != newPropsTree.end(); ++iter) {
+ QString const& key = iter.key();
+ QCMakePropertyList const& props2 = iter.value();
QList<QStandardItem*> parentItems;
parentItems.append(
@@ -280,8 +283,11 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
}
}
- foreach (QString key, newPropsTree2.keys()) {
- QCMakePropertyList props2 = newPropsTree2[key];
+ for (QMap<QString, QCMakePropertyList>::const_iterator iter =
+ newPropsTree2.begin();
+ iter != newPropsTree2.end(); ++iter) {
+ QString const& key = iter.key();
+ QCMakePropertyList const& props2 = iter.value();
QStandardItem* parentItem =
new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key);
@@ -393,7 +399,7 @@ void QCMakeCacheModel::breakProperties(
{
QMap<QString, QCMakePropertyList> tmp;
// return a map of properties grouped by prefixes, and sorted
- foreach (QCMakeProperty p, props) {
+ foreach (QCMakeProperty const& p, props) {
QString prefix = QCMakeCacheModel::prefix(p.Key);
tmp[prefix].append(p);
}
@@ -423,7 +429,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const
return props;
}
- QList<QModelIndex> idxs;
+ QVector<QModelIndex> idxs;
idxs.append(this->index(0, 0));
// walk the entire model for property entries
@@ -448,7 +454,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const
(idxs.last().row() + 1) >= rowCount(idxs.last().parent()) ||
#endif
!idxs.last().sibling(idxs.last().row() + 1, 0).isValid())) {
- idxs.removeLast();
+ idxs.remove(idxs.size() - 1);
}
if (!idxs.isEmpty()) {
idxs.last() = idxs.last().sibling(idxs.last().row() + 1, 0);
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index 6a55a76..7f0cafa 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -54,11 +54,11 @@ void QCMakeFilePathEditor::chooseFile()
title = tr("Select File for %1");
title = title.arg(this->Variable);
}
- this->fileDialogExists(true);
+ emit this->fileDialogExists(true);
path =
QFileDialog::getOpenFileName(this, title, info.absolutePath(), QString(),
CM_NULLPTR, QFileDialog::DontResolveSymlinks);
- this->fileDialogExists(false);
+ emit this->fileDialogExists(false);
if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
@@ -76,11 +76,11 @@ void QCMakePathEditor::chooseFile()
title = tr("Select Path for %1");
title = title.arg(this->Variable);
}
- this->fileDialogExists(true);
+ emit this->fileDialogExists(true);
path = QFileDialog::getExistingDirectory(this, title, this->text(),
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks);
- this->fileDialogExists(false);
+ emit this->fileDialogExists(false);
if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
}
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 6026a57..cd1fb8a 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -235,35 +235,32 @@ public:
symbol.erase(posAt);
}
}
- // For i386 builds we don't need to remove _
+ // For i386 builds we need to remove _
if (this->IsI386 && symbol[0] == '_') {
symbol.erase(0, 1);
}
- /*
- Check whether it is "Scalar deleting destructor" and
- "Vector deleting destructor"
- */
+ // Check whether it is "Scalar deleting destructor" and "Vector
+ // deleting destructor"
+ // if scalarPrefix and vectorPrefix are not found then print the
+ // symbol
const char* scalarPrefix = "??_G";
const char* vectorPrefix = "??_E";
- // original code had a check for
- // symbol.find("real@") == std::string::npos)
- // but if this disallows memmber functions with the name real
- // if scalarPrefix and vectorPrefix are not found then print
- // the symbol
if (symbol.compare(0, 4, scalarPrefix) &&
symbol.compare(0, 4, vectorPrefix)) {
SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
.Characteristics;
- if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
- // Read only (i.e. constants) must be excluded
- this->DataSymbols.insert(symbol);
- } else {
- if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
- (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
+
+ // skip symbols containing a dot
+ if (symbol.find('.') == std::string::npos) {
+ if (SectChar & IMAGE_SCN_MEM_EXECUTE) {
this->Symbols.insert(symbol);
- } else {
- // printf(" strange symbol: %s \n",symbol.c_str());
+ } else if (SectChar & IMAGE_SCN_MEM_READ) {
+ // skip __real@ and __xmm@
+ if (symbol.find("_real") == std::string::npos &&
+ symbol.find("_xmm") == std::string::npos) {
+ this->DataSymbols.insert(symbol);
+ }
}
}
}
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 105d323..297f901 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -26,11 +26,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_compile_options"; }
};
#endif
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 912a91a..c3a91b2 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_custom_command"; }
-
protected:
bool CheckOutputs(const std::vector<std::string>& outputs);
};
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index c449b10..7229c27 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_custom_target"; }
};
#endif
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index de4bc1c..abf5a59 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_definitions"; }
};
#endif
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 88ac336..c7328d6 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_dependencies"; }
};
#endif
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 6531829..8100da1 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_executable"; }
};
#endif
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 977645e..df49fae 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_library"; }
};
#endif
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index b19477a..0e71ffd 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
};
#endif
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 1d6c4cc..a098a03 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -32,11 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_test"; }
-
private:
bool HandleNameMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index f8800a5..e49e861 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -35,11 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "aux_source_directory"; }
};
#endif
diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx
index 091d619..1dac212 100644
--- a/Source/cmBase32.cxx
+++ b/Source/cmBase32.cxx
@@ -58,7 +58,7 @@ std::string cmBase32Encoder::encodeString(const unsigned char* input,
input += blockSize;
}
- size_t remain(end - input);
+ size_t remain = static_cast<size_t>(end - input);
if (remain != 0) {
// Temporary source buffer filled up with 0s
unsigned char extended[blockSize];
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index 9bb6137..3772c6f 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -41,7 +41,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const& args,
}
}
- status.SetBreakInvoked(true);
+ status.SetBreakInvoked();
if (!args.empty()) {
bool issueMessage = true;
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 8ce5ca2..fcca45c 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "break"; }
};
#endif
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 7df54ec..1f357a9 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -42,11 +42,6 @@ public:
*/
virtual bool TwoArgsSignature(std::vector<std::string> const& args);
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "build_command"; }
-
private:
bool IgnoreErrors() const;
};
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 00f645a..ff26c55 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -18,8 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "build_name"; }
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index fe148a3..ef6ca37 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -40,19 +40,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "cmake_host_system_information";
- }
-
private:
bool GetValue(cmsys::SystemInformation& info, std::string const& key,
std::string& value);
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 8db0860..45b6b78 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -32,16 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
-
private:
std::vector<std::string> UnknownArguments;
bool EnforceUnknownArguments();
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 789e294..0e88243 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -33,16 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
-
private:
bool HandleSetMode(std::vector<std::string> const& args);
bool HandleGetMode(std::vector<std::string> const& args);
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 46fa86e..f469998 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -416,7 +416,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
}
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -1899,6 +1899,34 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
->SetPersistentOption("ExcludeRegularExpression", args[i].c_str());
}
+ if (this->CheckArgument(arg, "-FA", "--fixture-exclude-any") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureRegularExpression",
+ args[i].c_str());
+ }
+ if (this->CheckArgument(arg, "-FS", "--fixture-exclude-setup") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureSetupRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureSetupRegularExpression",
+ args[i].c_str());
+ }
+ if (this->CheckArgument(arg, "-FC", "--fixture-exclude-cleanup") &&
+ i < args.size() - 1) {
+ i++;
+ this->GetHandler("test")->SetPersistentOption(
+ "ExcludeFixtureCleanupRegularExpression", args[i].c_str());
+ this->GetHandler("memcheck")
+ ->SetPersistentOption("ExcludeFixtureCleanupRegularExpression",
+ args[i].c_str());
+ }
+
if (this->CheckArgument(arg, "--rerun-failed")) {
this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 62eced0..ad72fe2 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -80,22 +80,6 @@ public:
virtual cmCommand* Clone() = 0;
/**
- * This determines if the command is invoked when in script mode.
- */
- virtual bool IsScriptable() const { return false; }
-
- /**
- * This determines if the command is defined in a cmake script.
- * It is the case for cmMacroHelperCommand and cmFunctionHelperCommand.
- */
- virtual bool IsUserDefined() const { return false; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- virtual std::string GetName() const = 0;
-
- /**
* Return the last error string.
*/
const char* GetError();
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1576722..e1d8ef1 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -70,7 +70,6 @@
#include "cmTargetLinkLibrariesCommand.h"
#include "cmTryCompileCommand.h"
#include "cmTryRunCommand.h"
-#include "cmUnexpectedCommand.h"
#include "cmUnsetCommand.h"
#include "cmWhileCommand.h"
@@ -79,7 +78,6 @@
#include "cmAuxSourceDirectoryCommand.h"
#include "cmBuildNameCommand.h"
#include "cmCMakeHostSystemInformationCommand.h"
-#include "cmDisallowedCommand.h"
#include "cmExportCommand.h"
#include "cmExportLibraryDependenciesCommand.h"
#include "cmFLTKWrapUICommand.h"
@@ -109,160 +107,247 @@
void GetScriptingCommands(cmState* state)
{
- state->AddCommand(new cmBreakCommand);
- state->AddCommand(new cmCMakeMinimumRequired);
- state->AddCommand(new cmCMakePolicyCommand);
- state->AddCommand(new cmConfigureFileCommand);
- state->AddCommand(new cmContinueCommand);
- state->AddCommand(new cmExecProgramCommand);
- state->AddCommand(new cmExecuteProcessCommand);
- state->AddCommand(new cmFileCommand);
- state->AddCommand(new cmFindFileCommand);
- state->AddCommand(new cmFindLibraryCommand);
- state->AddCommand(new cmFindPackageCommand);
- state->AddCommand(new cmFindPathCommand);
- state->AddCommand(new cmFindProgramCommand);
- state->AddCommand(new cmForEachCommand);
- state->AddCommand(new cmFunctionCommand);
- state->AddCommand(new cmGetCMakePropertyCommand);
- state->AddCommand(new cmGetDirectoryPropertyCommand);
- state->AddCommand(new cmGetFilenameComponentCommand);
- state->AddCommand(new cmGetPropertyCommand);
- state->AddCommand(new cmIfCommand);
- state->AddCommand(new cmIncludeCommand);
- state->AddCommand(new cmListCommand);
- state->AddCommand(new cmMacroCommand);
- state->AddCommand(new cmMakeDirectoryCommand);
- state->AddCommand(new cmMarkAsAdvancedCommand);
- state->AddCommand(new cmMathCommand);
- state->AddCommand(new cmMessageCommand);
- state->AddCommand(new cmOptionCommand);
- state->AddCommand(new cmParseArgumentsCommand);
- state->AddCommand(new cmReturnCommand);
- state->AddCommand(new cmSeparateArgumentsCommand);
- state->AddCommand(new cmSetCommand);
- state->AddCommand(new cmSetDirectoryPropertiesCommand);
- state->AddCommand(new cmSetPropertyCommand);
- state->AddCommand(new cmSiteNameCommand);
- state->AddCommand(new cmStringCommand);
- state->AddCommand(new cmUnsetCommand);
- state->AddCommand(new cmWhileCommand);
+ state->AddBuiltinCommand("break", new cmBreakCommand);
+ state->AddBuiltinCommand("cmake_minimum_required",
+ new cmCMakeMinimumRequired);
+ state->AddBuiltinCommand("cmake_policy", new cmCMakePolicyCommand);
+ state->AddBuiltinCommand("configure_file", new cmConfigureFileCommand);
+ state->AddBuiltinCommand("continue", new cmContinueCommand);
+ state->AddBuiltinCommand("exec_program", new cmExecProgramCommand);
+ state->AddBuiltinCommand("execute_process", new cmExecuteProcessCommand);
+ state->AddBuiltinCommand("file", new cmFileCommand);
+ state->AddBuiltinCommand("find_file", new cmFindFileCommand);
+ state->AddBuiltinCommand("find_library", new cmFindLibraryCommand);
+ state->AddBuiltinCommand("find_package", new cmFindPackageCommand);
+ state->AddBuiltinCommand("find_path", new cmFindPathCommand);
+ state->AddBuiltinCommand("find_program", new cmFindProgramCommand);
+ state->AddBuiltinCommand("foreach", new cmForEachCommand);
+ state->AddBuiltinCommand("function", new cmFunctionCommand);
+ state->AddBuiltinCommand("get_cmake_property",
+ new cmGetCMakePropertyCommand);
+ state->AddBuiltinCommand("get_directory_property",
+ new cmGetDirectoryPropertyCommand);
+ state->AddBuiltinCommand("get_filename_component",
+ new cmGetFilenameComponentCommand);
+ state->AddBuiltinCommand("get_property", new cmGetPropertyCommand);
+ state->AddBuiltinCommand("if", new cmIfCommand);
+ state->AddBuiltinCommand("include", new cmIncludeCommand);
+ state->AddBuiltinCommand("list", new cmListCommand);
+ state->AddBuiltinCommand("macro", new cmMacroCommand);
+ state->AddBuiltinCommand("make_directory", new cmMakeDirectoryCommand);
+ state->AddBuiltinCommand("mark_as_advanced", new cmMarkAsAdvancedCommand);
+ state->AddBuiltinCommand("math", new cmMathCommand);
+ state->AddBuiltinCommand("message", new cmMessageCommand);
+ state->AddBuiltinCommand("option", new cmOptionCommand);
+ state->AddBuiltinCommand("cmake_parse_arguments",
+ new cmParseArgumentsCommand);
+ state->AddBuiltinCommand("return", new cmReturnCommand);
+ state->AddBuiltinCommand("separate_arguments",
+ new cmSeparateArgumentsCommand);
+ state->AddBuiltinCommand("set", new cmSetCommand);
+ state->AddBuiltinCommand("set_directory_properties",
+ new cmSetDirectoryPropertiesCommand);
+ state->AddBuiltinCommand("set_property", new cmSetPropertyCommand);
+ state->AddBuiltinCommand("site_name", new cmSiteNameCommand);
+ state->AddBuiltinCommand("string", new cmStringCommand);
+ state->AddBuiltinCommand("unset", new cmUnsetCommand);
+ state->AddBuiltinCommand("while", new cmWhileCommand);
- state->AddCommand(new cmUnexpectedCommand(
+ state->AddUnexpectedCommand(
"else", "An ELSE command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
- "the opening IF command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "the opening IF command.");
+ state->AddUnexpectedCommand(
"elseif", "An ELSEIF command was found outside of a proper "
- "IF ENDIF structure."));
- state->AddCommand(new cmUnexpectedCommand(
+ "IF ENDIF structure.");
+ state->AddUnexpectedCommand(
"endforeach", "An ENDFOREACH command was found outside of a proper "
"FOREACH ENDFOREACH structure. Or its arguments did "
- "not match the opening FOREACH command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "not match the opening FOREACH command.");
+ state->AddUnexpectedCommand(
"endfunction", "An ENDFUNCTION command was found outside of a proper "
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
- "match the opening FUNCTION command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "match the opening FUNCTION command.");
+ state->AddUnexpectedCommand(
"endif", "An ENDIF command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
- "the opening IF command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "the opening IF command.");
+ state->AddUnexpectedCommand(
"endmacro", "An ENDMACRO command was found outside of a proper "
"MACRO ENDMACRO structure. Or its arguments did not "
- "match the opening MACRO command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "match the opening MACRO command.");
+ state->AddUnexpectedCommand(
"endwhile", "An ENDWHILE command was found outside of a proper "
"WHILE ENDWHILE structure. Or its arguments did not "
- "match the opening WHILE command."));
+ "match the opening WHILE command.");
#if defined(CMAKE_BUILD_WITH_CMAKE)
- state->AddCommand(new cmCMakeHostSystemInformationCommand);
- state->AddCommand(new cmRemoveCommand);
- state->AddCommand(new cmVariableWatchCommand);
- state->AddCommand(new cmWriteFileCommand);
+ state->AddBuiltinCommand("cmake_host_system_information",
+ new cmCMakeHostSystemInformationCommand);
+ state->AddBuiltinCommand("remove", new cmRemoveCommand);
+ state->AddBuiltinCommand("variable_watch", new cmVariableWatchCommand);
+ state->AddBuiltinCommand("write_file", new cmWriteFileCommand);
- state->AddCommand(new cmDisallowedCommand(
- new cmBuildNameCommand, cmPolicies::CMP0036,
- "The build_name command should not be called; see CMP0036."));
- state->AddCommand(new cmDisallowedCommand(
- new cmUseMangledMesaCommand, cmPolicies::CMP0030,
- "The use_mangled_mesa command should not be called; see CMP0030."));
+ state->AddDisallowedCommand(
+ "build_name", new cmBuildNameCommand, cmPolicies::CMP0036,
+ "The build_name command should not be called; see CMP0036.");
+ state->AddDisallowedCommand(
+ "use_mangled_mesa", new cmUseMangledMesaCommand, cmPolicies::CMP0030,
+ "The use_mangled_mesa command should not be called; see CMP0030.");
#endif
}
void GetProjectCommands(cmState* state)
{
- state->AddCommand(new cmAddCustomCommandCommand);
- state->AddCommand(new cmAddCustomTargetCommand);
- state->AddCommand(new cmAddDefinitionsCommand);
- state->AddCommand(new cmAddDependenciesCommand);
- state->AddCommand(new cmAddExecutableCommand);
- state->AddCommand(new cmAddLibraryCommand);
- state->AddCommand(new cmAddSubDirectoryCommand);
- state->AddCommand(new cmAddTestCommand);
- state->AddCommand(new cmBuildCommand);
- state->AddCommand(new cmCreateTestSourceList);
- state->AddCommand(new cmDefinePropertyCommand);
- state->AddCommand(new cmEnableLanguageCommand);
- state->AddCommand(new cmEnableTestingCommand);
- state->AddCommand(new cmGetSourceFilePropertyCommand);
- state->AddCommand(new cmGetTargetPropertyCommand);
- state->AddCommand(new cmGetTestPropertyCommand);
- state->AddCommand(new cmIncludeDirectoryCommand);
- state->AddCommand(new cmIncludeRegularExpressionCommand);
- state->AddCommand(new cmInstallCommand);
- state->AddCommand(new cmInstallFilesCommand);
- state->AddCommand(new cmInstallTargetsCommand);
- state->AddCommand(new cmLinkDirectoriesCommand);
- state->AddCommand(new cmProjectCommand);
- state->AddCommand(new cmSetSourceFilesPropertiesCommand);
- state->AddCommand(new cmSetTargetPropertiesCommand);
- state->AddCommand(new cmSetTestsPropertiesCommand);
- state->AddCommand(new cmSubdirCommand);
- state->AddCommand(new cmTargetLinkLibrariesCommand);
- state->AddCommand(new cmTryCompileCommand);
- state->AddCommand(new cmTryRunCommand);
+ state->AddBuiltinCommand("add_custom_command",
+ new cmAddCustomCommandCommand);
+ state->AddBuiltinCommand("add_custom_target", new cmAddCustomTargetCommand);
+ state->AddBuiltinCommand("add_definitions", new cmAddDefinitionsCommand);
+ state->AddBuiltinCommand("add_dependencies", new cmAddDependenciesCommand);
+ state->AddBuiltinCommand("add_executable", new cmAddExecutableCommand);
+ state->AddBuiltinCommand("add_library", new cmAddLibraryCommand);
+ state->AddBuiltinCommand("add_subdirectory", new cmAddSubDirectoryCommand);
+ state->AddBuiltinCommand("add_test", new cmAddTestCommand);
+ state->AddBuiltinCommand("build_command", new cmBuildCommand);
+ state->AddBuiltinCommand("create_test_sourcelist",
+ new cmCreateTestSourceList);
+ state->AddBuiltinCommand("define_property", new cmDefinePropertyCommand);
+ state->AddBuiltinCommand("enable_language", new cmEnableLanguageCommand);
+ state->AddBuiltinCommand("enable_testing", new cmEnableTestingCommand);
+ state->AddBuiltinCommand("get_source_file_property",
+ new cmGetSourceFilePropertyCommand);
+ state->AddBuiltinCommand("get_target_property",
+ new cmGetTargetPropertyCommand);
+ state->AddBuiltinCommand("get_test_property", new cmGetTestPropertyCommand);
+ state->AddBuiltinCommand("include_directories",
+ new cmIncludeDirectoryCommand);
+ state->AddBuiltinCommand("include_regular_expression",
+ new cmIncludeRegularExpressionCommand);
+ state->AddBuiltinCommand("install", new cmInstallCommand);
+ state->AddBuiltinCommand("install_files", new cmInstallFilesCommand);
+ state->AddBuiltinCommand("install_targets", new cmInstallTargetsCommand);
+ state->AddBuiltinCommand("link_directories", new cmLinkDirectoriesCommand);
+ state->AddBuiltinCommand("project", new cmProjectCommand);
+ state->AddBuiltinCommand("set_source_files_properties",
+ new cmSetSourceFilesPropertiesCommand);
+ state->AddBuiltinCommand("set_target_properties",
+ new cmSetTargetPropertiesCommand);
+ state->AddBuiltinCommand("set_tests_properties",
+ new cmSetTestsPropertiesCommand);
+ state->AddBuiltinCommand("subdirs", new cmSubdirCommand);
+ state->AddBuiltinCommand("target_link_libraries",
+ new cmTargetLinkLibrariesCommand);
+ state->AddBuiltinCommand("try_compile", new cmTryCompileCommand);
+ state->AddBuiltinCommand("try_run", new cmTryRunCommand);
#if defined(CMAKE_BUILD_WITH_CMAKE)
- state->AddCommand(new cmAddCompileOptionsCommand);
- state->AddCommand(new cmAuxSourceDirectoryCommand);
- state->AddCommand(new cmExportCommand);
- state->AddCommand(new cmFLTKWrapUICommand);
- state->AddCommand(new cmIncludeExternalMSProjectCommand);
- state->AddCommand(new cmInstallProgramsCommand);
- state->AddCommand(new cmLinkLibrariesCommand);
- state->AddCommand(new cmLoadCacheCommand);
- state->AddCommand(new cmQTWrapCPPCommand);
- state->AddCommand(new cmQTWrapUICommand);
- state->AddCommand(new cmRemoveDefinitionsCommand);
- state->AddCommand(new cmSourceGroupCommand);
- state->AddCommand(new cmTargetCompileDefinitionsCommand);
- state->AddCommand(new cmTargetCompileFeaturesCommand);
- state->AddCommand(new cmTargetCompileOptionsCommand);
- state->AddCommand(new cmTargetIncludeDirectoriesCommand);
- state->AddCommand(new cmTargetSourcesCommand);
+ state->AddBuiltinCommand("add_compile_options",
+ new cmAddCompileOptionsCommand);
+ state->AddBuiltinCommand("aux_source_directory",
+ new cmAuxSourceDirectoryCommand);
+ state->AddBuiltinCommand("export", new cmExportCommand);
+ state->AddBuiltinCommand("fltk_wrap_ui", new cmFLTKWrapUICommand);
+ state->AddBuiltinCommand("include_external_msproject",
+ new cmIncludeExternalMSProjectCommand);
+ state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand);
+ state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand);
+ state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand);
+ state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand);
+ state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand);
+ state->AddBuiltinCommand("remove_definitions",
+ new cmRemoveDefinitionsCommand);
+ state->AddBuiltinCommand("source_group", new cmSourceGroupCommand);
+ state->AddBuiltinCommand("target_compile_definitions",
+ new cmTargetCompileDefinitionsCommand);
+ state->AddBuiltinCommand("target_compile_features",
+ new cmTargetCompileFeaturesCommand);
+ state->AddBuiltinCommand("target_compile_options",
+ new cmTargetCompileOptionsCommand);
+ state->AddBuiltinCommand("target_include_directories",
+ new cmTargetIncludeDirectoriesCommand);
+ state->AddBuiltinCommand("target_sources", new cmTargetSourcesCommand);
- state->AddCommand(new cmDisallowedCommand(
- new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
+ state->AddDisallowedCommand(
+ "export_library_dependencies", new cmExportLibraryDependenciesCommand,
+ cmPolicies::CMP0033,
"The export_library_dependencies command should not be called; "
- "see CMP0033."));
- state->AddCommand(new cmDisallowedCommand(
- new cmLoadCommandCommand, cmPolicies::CMP0031,
- "The load_command command should not be called; see CMP0031."));
- state->AddCommand(new cmDisallowedCommand(
- new cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
- "The output_required_files command should not be called; "
- "see CMP0032."));
- state->AddCommand(new cmDisallowedCommand(
- new cmSubdirDependsCommand, cmPolicies::CMP0029,
- "The subdir_depends command should not be called; see CMP0029."));
- state->AddCommand(new cmDisallowedCommand(
- new cmUtilitySourceCommand, cmPolicies::CMP0034,
- "The utility_source command should not be called; see CMP0034."));
- state->AddCommand(new cmDisallowedCommand(
- new cmVariableRequiresCommand, cmPolicies::CMP0035,
- "The variable_requires command should not be called; see CMP0035."));
+ "see CMP0033.");
+ state->AddDisallowedCommand(
+ "load_command", new cmLoadCommandCommand, cmPolicies::CMP0031,
+ "The load_command command should not be called; see CMP0031.");
+ state->AddDisallowedCommand(
+ "output_required_files", new cmOutputRequiredFilesCommand,
+ cmPolicies::CMP0032,
+ "The output_required_files command should not be called; see CMP0032.");
+ state->AddDisallowedCommand(
+ "subdir_depends", new cmSubdirDependsCommand, cmPolicies::CMP0029,
+ "The subdir_depends command should not be called; see CMP0029.");
+ state->AddDisallowedCommand(
+ "utility_source", new cmUtilitySourceCommand, cmPolicies::CMP0034,
+ "The utility_source command should not be called; see CMP0034.");
+ state->AddDisallowedCommand(
+ "variable_requires", new cmVariableRequiresCommand, cmPolicies::CMP0035,
+ "The variable_requires command should not be called; see CMP0035.");
#endif
}
+
+void GetProjectCommandsInScriptMode(cmState* state)
+{
+#define CM_UNEXPECTED_PROJECT_COMMAND(NAME) \
+ state->AddUnexpectedCommand(NAME, "command is not scriptable")
+
+ CM_UNEXPECTED_PROJECT_COMMAND("add_compile_options");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_custom_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_custom_target");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_dependencies");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_executable");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_library");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_subdirectory");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_test");
+ CM_UNEXPECTED_PROJECT_COMMAND("aux_source_directory");
+ CM_UNEXPECTED_PROJECT_COMMAND("build_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("create_test_sourcelist");
+ CM_UNEXPECTED_PROJECT_COMMAND("define_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("enable_language");
+ CM_UNEXPECTED_PROJECT_COMMAND("enable_testing");
+ CM_UNEXPECTED_PROJECT_COMMAND("export");
+ CM_UNEXPECTED_PROJECT_COMMAND("fltk_wrap_ui");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_source_file_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_target_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_test_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_external_msproject");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_regular_expression");
+ CM_UNEXPECTED_PROJECT_COMMAND("install");
+ CM_UNEXPECTED_PROJECT_COMMAND("link_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("link_libraries");
+ CM_UNEXPECTED_PROJECT_COMMAND("load_cache");
+ CM_UNEXPECTED_PROJECT_COMMAND("project");
+ CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_cpp");
+ CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_ui");
+ CM_UNEXPECTED_PROJECT_COMMAND("remove_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_source_files_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_target_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_tests_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("source_group");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_features");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_options");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_include_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_link_libraries");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_sources");
+ CM_UNEXPECTED_PROJECT_COMMAND("try_compile");
+ CM_UNEXPECTED_PROJECT_COMMAND("try_run");
+
+ // deprected commands
+ CM_UNEXPECTED_PROJECT_COMMAND("export_library_dependencies");
+ CM_UNEXPECTED_PROJECT_COMMAND("load_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("output_required_files");
+ CM_UNEXPECTED_PROJECT_COMMAND("subdir_depends");
+ CM_UNEXPECTED_PROJECT_COMMAND("utility_source");
+ CM_UNEXPECTED_PROJECT_COMMAND("variable_requires");
+
+#undef CM_UNEXPECTED_PROJECT_COMMAND
+}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 7895ece..1f8fafb 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -12,5 +12,6 @@ class cmState;
*/
void GetScriptingCommands(cmState* state);
void GetProjectCommands(cmState* state);
+void GetProjectCommandsInScriptMode(cmState* state);
#endif
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 178a7ce..391d65c 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -43,17 +43,6 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
}
-void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
- const std::string& lang)
-{
- // Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
-
- if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) {
- this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
- }
-}
-
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
cmLinkLineComputer* linkLineComputer, std::string& flags)
{
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 8ba2e22..c36145f 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -28,9 +28,6 @@ public:
std::string const& GetConfigName() const;
protected:
- // Add language feature flags.
- void AddFeatureFlags(std::string& flags, const std::string& lang);
-
// Feature query methods.
const char* GetFeature(const std::string& feature);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index b273443..c2ada43 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1737,7 +1737,13 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
}
if (use_build_rpath || use_link_rpath) {
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ std::string rootPath;
+ if (const char* sysrootLink =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) {
+ rootPath = sysrootLink;
+ } else {
+ rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
const char* stagePath =
this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
const char* installPrefix =
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 882219d..6cebbd2 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -25,16 +25,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "configure_file"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
int ConfigureFile();
diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx
index 53d035d..2298a05 100644
--- a/Source/cmContinueCommand.cxx
+++ b/Source/cmContinueCommand.cxx
@@ -19,7 +19,7 @@ bool cmContinueCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
- status.SetContinueInvoked(true);
+ status.SetContinueInvoked();
if (!args.empty()) {
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 4428d79..92bc68e 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "continue"; }
};
#endif
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 2287bc2..d8ddf45 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -41,6 +41,8 @@ static std::string const kCMAKE_OSX_SYSROOT = "CMAKE_OSX_SYSROOT";
static std::string const kCMAKE_POSITION_INDEPENDENT_CODE =
"CMAKE_POSITION_INDEPENDENT_CODE";
static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT";
+static std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE";
+static std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK";
static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
"CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
@@ -609,6 +611,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_OSX_SYSROOT);
vars.insert(kCMAKE_POSITION_INDEPENDENT_CODE);
vars.insert(kCMAKE_SYSROOT);
+ vars.insert(kCMAKE_SYSROOT_COMPILE);
+ vars.insert(kCMAKE_SYSROOT_LINK);
vars.insert(kCMAKE_WARN_DEPRECATED);
if (const char* varListStr = this->Makefile->GetDefinition(
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 47391f3..f1f1e4b 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "create_test_sourcelist"; }
};
#endif
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 7a6e127..bc120c5 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -24,11 +24,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "define_property"; }
-
private:
std::string PropertyName;
std::string BriefDocs;
diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h
index 7c141dd..0030116 100644
--- a/Source/cmDisallowedCommand.h
+++ b/Source/cmDisallowedCommand.h
@@ -42,13 +42,6 @@ public:
return this->Command->HasFinalPass();
}
- bool IsScriptable() const CM_OVERRIDE
- {
- return this->Command->IsScriptable();
- }
-
- std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); }
-
private:
cmCommand* Command;
cmPolicies::PolicyID Policy;
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 0748283..33c1c22 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -34,11 +34,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "enable_language"; }
};
#endif
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index b4ac068..e249662 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -39,11 +39,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "enable_testing"; }
};
#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 53d35cf..6463c4d 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -36,16 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "exec_program"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
static bool RunCommand(const char* command, std::string& output, int& retVal,
const char* directory = CM_NULLPTR,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index 65e16d4..08fde0a 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -32,16 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "execute_process"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index fd3c416..ac5fe1d 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -11,16 +11,13 @@
class cmExecutionStatus
{
public:
- cmExecutionStatus() { this->Clear(); }
-
- void SetReturnInvoked(bool val) { this->ReturnInvoked = val; }
- bool GetReturnInvoked() { return this->ReturnInvoked; }
-
- void SetBreakInvoked(bool val) { this->BreakInvoked = val; }
- bool GetBreakInvoked() { return this->BreakInvoked; }
-
- void SetContinueInvoked(bool val) { this->ContinueInvoked = val; }
- bool GetContinueInvoked() { return this->ContinueInvoked; }
+ cmExecutionStatus()
+ : ReturnInvoked(false)
+ , BreakInvoked(false)
+ , ContinueInvoked(false)
+ , NestedError(false)
+ {
+ }
void Clear()
{
@@ -29,8 +26,18 @@ public:
this->ContinueInvoked = false;
this->NestedError = false;
}
- void SetNestedError(bool val) { this->NestedError = val; }
- bool GetNestedError() { return this->NestedError; }
+
+ void SetReturnInvoked() { this->ReturnInvoked = true; }
+ bool GetReturnInvoked() const { return this->ReturnInvoked; }
+
+ void SetBreakInvoked() { this->BreakInvoked = true; }
+ bool GetBreakInvoked() const { return this->BreakInvoked; }
+
+ void SetContinueInvoked() { this->ContinueInvoked = true; }
+ bool GetContinueInvoked() const { return this->ContinueInvoked; }
+
+ void SetNestedError() { this->NestedError = true; }
+ bool GetNestedError() const { return this->NestedError; }
private:
bool ReturnInvoked;
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index b95ea86..c47bc42 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "export"; }
-
private:
cmCommandArgumentsHelper Helper;
cmCommandArgumentGroup ArgumentGroup;
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 4d3e36e..5559af9 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -21,10 +21,6 @@ public:
}
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE
- {
- return "export_library_dependencies";
- }
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE { return true; }
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 7dde9c1..d8045ab 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -43,11 +43,6 @@ public:
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE { return true; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "fltk_wrap_ui"; }
-
private:
/**
* List of produced files.
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fa166a0..ff6e2b7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,11 +10,11 @@
#include "cmsys/String.hxx"
#include <algorithm>
#include <assert.h>
-#include <list>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <vector>
#include "cmAlgorithms.h"
#include "cmCommandArgumentsHelper.h"
@@ -44,6 +44,10 @@
#include "cmELF.h"
#endif
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
class cmSystemToolsFileTime;
// Table of permissions flags.
@@ -2618,7 +2622,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
- std::list<std::string> curl_headers;
+ std::vector<std::string> curl_headers;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -2862,7 +2866,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
struct curl_slist* headers = CM_NULLPTR;
- for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ for (std::vector<std::string>::const_iterator h = curl_headers.begin();
h != curl_headers.end(); ++h) {
headers = ::curl_slist_append(headers, h->c_str());
}
@@ -2952,7 +2956,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
- std::list<std::string> curl_headers;
+ std::vector<std::string> curl_headers;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -3120,7 +3124,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
}
struct curl_slist* headers = CM_NULLPTR;
- for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ for (std::vector<std::string>::const_iterator h = curl_headers.begin();
h != curl_headers.end(); ++h) {
headers = ::curl_slist_append(headers, h->c_str());
}
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 121fec0..d09ef42 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -31,16 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "file"; }
-
protected:
bool HandleRename(std::vector<std::string> const& args);
bool HandleRemove(std::vector<std::string> const& args, bool recurse);
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index 689ddd7..c96a8c2 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -5,8 +5,8 @@
#include "cmConfigure.h"
-#include <list>
#include <string>
+#include <vector>
class cmFileLock;
class cmFileLockResult;
@@ -70,14 +70,14 @@ private:
bool IsAlreadyLocked(const std::string& filename) const;
private:
- typedef std::list<cmFileLock*> List;
+ typedef std::vector<cmFileLock*> List;
typedef List::iterator It;
typedef List::const_iterator CIt;
List Locks;
};
- typedef std::list<ScopePool*> List;
+ typedef std::vector<ScopePool*> List;
typedef List::iterator It;
typedef List::const_iterator CIt;
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index ed794c3..8027535 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -2,12 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileMonitor.h"
+#include "cmAlgorithms.h"
#include "cmsys/SystemTools.hxx"
#include <cassert>
-#include <iostream>
-#include <set>
+#include <stddef.h>
#include <unordered_map>
+#include <utility>
namespace {
void on_directory_change(uv_fs_event_t* handle, const char* filename,
@@ -36,12 +37,7 @@ public:
class cmVirtualDirectoryWatcher : public cmIBaseWatcher
{
public:
- ~cmVirtualDirectoryWatcher() override
- {
- for (auto i : this->Children) {
- delete i.second;
- }
- }
+ ~cmVirtualDirectoryWatcher() override { cmDeleteAll(this->Children); }
cmIBaseWatcher* Find(const std::string& ps)
{
@@ -102,9 +98,7 @@ public:
void Reset()
{
- for (auto c : this->Children) {
- delete c.second;
- }
+ cmDeleteAll(this->Children);
this->Children.clear();
}
diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h
index 8574db0..d7ec92a 100644
--- a/Source/cmFileMonitor.h
+++ b/Source/cmFileMonitor.h
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <functional>
#include <string>
@@ -14,6 +14,8 @@ class cmRootWatcher;
class cmFileMonitor
{
+ CM_DISABLE_COPY(cmFileMonitor)
+
public:
cmFileMonitor(uv_loop_t* l);
~cmFileMonitor();
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 110195c..df57a1b 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -154,10 +154,16 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
}
const char* sysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+ const char* sysrootCompile =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE");
+ const char* sysrootLink =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK");
const char* rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
const bool noSysroot = !sysroot || !*sysroot;
+ const bool noCompileSysroot = !sysrootCompile || !*sysrootCompile;
+ const bool noLinkSysroot = !sysrootLink || !*sysrootLink;
const bool noRootPath = !rootPath || !*rootPath;
- if (noSysroot && noRootPath) {
+ if (noSysroot && noCompileSysroot && noLinkSysroot && noRootPath) {
return;
}
@@ -166,6 +172,12 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
if (rootPath) {
cmSystemTools::ExpandListArgument(rootPath, roots);
}
+ if (sysrootCompile) {
+ roots.push_back(sysrootCompile);
+ }
+ if (sysrootLink) {
+ roots.push_back(sysrootLink);
+ }
if (sysroot) {
roots.push_back(sysroot);
}
@@ -334,15 +346,3 @@ void cmFindCommon::ComputeFinalPaths()
std::for_each(this->SearchPaths.begin(), this->SearchPaths.end(),
&AddTrailingSlash);
}
-
-void cmFindCommon::SetMakefile(cmMakefile* makefile)
-{
- cmCommand::SetMakefile(makefile);
-
- // If we are building for Apple (OSX or also iphone), make sure
- // that frameworks and bundles are searched first.
- if (this->Makefile->IsOn("APPLE")) {
- this->SearchFrameworkFirst = true;
- this->SearchAppBundleFirst = true;
- }
-}
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 426d233..bbb7a38 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -14,8 +14,6 @@
#include "cmPathLabel.h"
#include "cmSearchPath.h"
-class cmMakefile;
-
/** \class cmFindCommon
* \brief Base class for FIND_XXX implementations.
*
@@ -105,7 +103,6 @@ protected:
bool CheckCommonArgument(std::string const& arg);
void AddPathSuffix(std::string const& arg);
- void SetMakefile(cmMakefile* makefile);
bool NoDefaultPath;
bool NoCMakePath;
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 489df65..bf57fec 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -5,8 +5,6 @@
#include "cmConfigure.h"
-#include <string>
-
#include "cmFindPathCommand.h"
class cmCommand;
@@ -27,7 +25,6 @@ public:
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; }
- std::string GetName() const CM_OVERRIDE { return "find_file"; }
};
#endif
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 4a60505..9d38eab 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -36,16 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_library"; }
-
protected:
void AddArchitecturePaths(const char* suffix);
void AddArchitecturePath(std::string const& dir,
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index c42ecce..318b1dc 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -60,16 +60,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_package"; }
-
private:
class PathLabel : public cmFindCommon::PathLabel
{
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 205bb17..3761145 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -36,16 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_path"; }
-
bool IncludeFileInPath;
private:
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 73894ba..a0d6af9 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -37,16 +37,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_program"; }
-
private:
std::string FindProgram();
std::string FindNormalProgram();
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 6273f6e..8346b23 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -58,7 +58,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
status.Clear();
mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) {
- inStatus.SetReturnInvoked(true);
+ inStatus.SetReturnInvoked();
// restore the variable to its prior value
mf.AddDefinition(this->Args[0], oldDef.c_str());
return true;
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index c71b905..7c8a6d8 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -48,16 +48,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "foreach"; }
-
private:
bool HandleInMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 31adcb7..ee52bde 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -21,11 +21,6 @@ public:
~cmFunctionHelperCommand() CM_OVERRIDE {}
/**
- * This determines if the command is defined in a cmake script.
- */
- bool IsUserDefined() const CM_OVERRIDE { return true; }
-
- /**
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE
@@ -40,11 +35,6 @@ public:
}
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
@@ -57,11 +47,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
@@ -126,7 +111,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
// The error message should have already included the call stack
// so we do not need to report an error here.
functionScope.Quiet();
- inStatus.SetNestedError(true);
+ inStatus.SetNestedError();
return false;
}
if (status.GetReturnInvoked()) {
@@ -154,11 +139,7 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked(
f->Functions = this->Functions;
f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
-
- std::string newName = "_" + this->Args[0];
- mf.GetState()->RenameCommand(this->Args[0], newName);
- mf.GetState()->AddCommand(f);
-
+ mf.GetState()->AddScriptedCommand(this->Args[0], f);
// remove the function blocker now that the function is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index d6cc18e..f263126 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -44,16 +44,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "function"; }
};
#endif
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a0f677b..073bde2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -489,7 +489,9 @@ bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
// problem is already reported, no need to issue a message
return false;
}
- if (cmp0069 == cmPolicies::WARN) {
+ const bool in_try_compile =
+ this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile();
+ if (cmp0069 == cmPolicies::WARN && !in_try_compile) {
std::ostringstream w;
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0069) << "\n";
w << "INTERPROCEDURAL_OPTIMIZATION property will be ignored for target "
@@ -2919,6 +2921,19 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
}
}
+bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const
+{
+ std::vector<std::string> features;
+ this->GetCompileFeatures(features, config);
+ for (std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it) {
+ if (!this->Makefile->AddRequiredTargetFeature(this->Target, *it)) {
+ return false;
+ }
+ }
+ return true;
+}
+
std::string cmGeneratorTarget::GetImportedLibName(
std::string const& config) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 13b6b73..134b7c7 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -412,6 +412,8 @@ public:
/** Add the target output files to the global generator manifest. */
void ComputeTargetManifest(const std::string& config) const;
+ bool ComputeCompileFeatures(std::string const& config) const;
+
/**
* Trace through the source files in this target and add al source files
* that they depend on, used by all generators
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index c454e34..9dfc40f 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -23,16 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
};
#endif
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 0adf818..7d97950 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -24,16 +24,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
-
private:
void StoreResult(const std::string& variable, const char* prop);
};
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index efc9d7b..c8a23c7 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -32,16 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
};
#endif
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index a57c675..6497801 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -26,16 +26,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_property"; }
-
private:
enum OutType
{
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 558e2ab..e96bb29 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -23,14 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "get_source_file_property";
- }
};
#endif
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 9cebb3b..5de3225 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -23,11 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_target_property"; }
};
#endif
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index d3d10cb..b17e7a1 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -23,11 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_test_property"; }
};
#endif
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index ba623d5..7032cd5 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -232,10 +232,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
const char* lang = language.c_str();
if (notKernel) {
- this->LocalGenerator->AddLanguageFlags(flags, lang, config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang, config);
} else {
- this->LocalGenerator->AddLanguageFlags(
- flags, lang + std::string("_GHS_KERNEL"), config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang + std::string("_GHS_KERNEL"),
+ config);
}
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
config);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 50ad1a8..f3eb249 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1272,6 +1272,18 @@ bool cmGlobalGenerator::Compute()
this->LocalGenerators[i]->AddHelperCommands();
}
+ // Finalize the set of compile features for each target.
+ // FIXME: This turns into calls to cmMakefile::AddRequiredTargetFeature
+ // which actually modifies the <lang>_STANDARD target property
+ // on the original cmTarget instance. It accumulates features
+ // across all configurations. Some refactoring is needed to
+ // compute a per-config resulta purely during generation.
+ for (i = 0; i < this->LocalGenerators.size(); ++i) {
+ if (!this->LocalGenerators[i]->ComputeTargetCompileFeatures()) {
+ return false;
+ }
+ }
+
#ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmGeneratorTarget const*>::iterator it =
autogenTargets.begin();
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 587e18a..88fcb12 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -898,6 +898,10 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
this->GetCMakeInstance()->GetHomeOutputDirectory();
if (!this->CompileCommandsStream) {
std::string buildFilePath = buildFileDir + "/compile_commands.json";
+ if (this->ComputingUnknownDependencies) {
+ this->CombinedBuildOutputs.insert(
+ this->NinjaOutputPath("compile_commands.json"));
+ }
// Get a stream where to generate things.
this->CompileCommandsStream =
@@ -1903,7 +1907,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
}
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
cm.SetHomeDirectory(dir_top_src);
cm.SetHomeOutputDirectory(dir_top_bld);
CM_AUTO_PTR<cmGlobalNinjaGenerator> ggd(
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index ee9e47a..0e02b0a 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -647,9 +647,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
xw.EndElement(); // ItemGroup
xw.StartElement("PropertyGroup");
xw.Attribute("Label", "Globals");
- xw.StartElement("ProjectGUID");
+ xw.StartElement("ProjectGuid");
xw.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}");
- xw.EndElement(); // ProjectGUID
+ xw.EndElement(); // ProjectGuid
xw.StartElement("Keyword");
xw.Content("Win32Proj");
xw.EndElement(); // Keyword
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 1b75a08..f067d8f 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -12,6 +12,7 @@
#include "cmsys/Encoding.hxx"
#include <assert.h>
+#include <vector>
#include <windows.h>
static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
@@ -680,10 +681,10 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
// default build if another target depends on it
int type = target->GetType();
if (type == cmStateEnums::GLOBAL_TARGET) {
- std::list<std::string> targetNames;
+ std::vector<std::string> targetNames;
targetNames.push_back("INSTALL");
targetNames.push_back("PACKAGE");
- for (std::list<std::string>::const_iterator t = targetNames.begin();
+ for (std::vector<std::string>::const_iterator t = targetNames.begin();
t != targetNames.end(); ++t) {
// check if target <*t> is part of default build
if (target->GetName() == *t) {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6636329..84740ca 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -142,8 +142,6 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(
this->RootObject = 0;
this->MainGroupChildren = 0;
- this->SourcesGroupChildren = 0;
- this->ResourcesGroupChildren = 0;
this->CurrentMakefile = 0;
this->CurrentLocalGenerator = 0;
this->XcodeBuildCommandInitialized = false;
@@ -701,18 +699,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmXCodeObject* buildFile =
this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), gtgt, lang, sf);
- cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
settings->AddAttributeIfNotEmpty("COMPILER_FLAGS",
this->CreateString(flags));
- // Is this a resource file in this target? Add it to the resources group...
- //
-
cmGeneratorTarget::SourceFileFlags tsFlags =
gtgt->GetTargetSourceFileFlags(sf);
- bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
@@ -722,10 +715,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
if (gtgt->IsFrameworkOnApple()) {
if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) {
attrs->AddObject(this->CreateString("Private"));
- isResource = true;
} else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) {
attrs->AddObject(this->CreateString("Public"));
- isResource = true;
}
}
@@ -745,14 +736,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
- // Add the fileRef to the top level Resources group/folder if it is not
- // already there.
- //
- if (isResource && this->ResourcesGroupChildren &&
- !this->ResourcesGroupChildren->HasObject(fileRef)) {
- this->ResourcesGroupChildren->AddObject(fileRef);
- }
-
buildFile->AddAttributeIfNotEmpty("settings", settings);
return buildFile;
}
@@ -1662,7 +1645,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string& flags = cflags[lang];
// Add language-specific flags.
- this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
+ this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang,
+ configName);
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
@@ -1682,8 +1666,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
return;
}
- // Check IPO related warning/error.
- gtgt->IsIPOEnabled(configName);
+ if (gtgt->IsIPOEnabled(configName)) {
+ const char* ltoValue =
+ this->CurrentMakefile->IsOn("_CMAKE_LTO_THIN") ? "YES_THIN" : "YES";
+ buildSettings->AddAttribute("LLVM_LTO", this->CreateString(ltoValue));
+ }
// Add define flags
this->CurrentLocalGenerator->AppendFlags(
@@ -2815,7 +2802,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
tgroup = this->CreatePBXGroup(tgroup, tgt_folders[i]);
this->TargetGroup[curr_tgt_folder] = tgroup;
if (i == 0) {
- this->SourcesGroupChildren->AddObject(tgroup);
+ this->MainGroupChildren->AddObject(tgroup);
}
}
}
@@ -2861,8 +2848,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
{
this->ClearXCodeObjects();
this->RootObject = 0;
- this->SourcesGroupChildren = 0;
- this->ResourcesGroupChildren = 0;
this->MainGroupChildren = 0;
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
@@ -2884,21 +2869,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
mainGroup->AddAttribute("children", this->MainGroupChildren);
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
- sourcesGroup->AddAttribute("children", this->SourcesGroupChildren);
- sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- this->MainGroupChildren->AddObject(sourcesGroup);
-
- cmXCodeObject* resourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
- this->ResourcesGroupChildren =
- this->CreateObject(cmXCodeObject::OBJECT_LIST);
- resourcesGroup->AddAttribute("name", this->CreateString("Resources"));
- resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren);
- resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
- this->MainGroupChildren->AddObject(resourcesGroup);
-
// now create the cmake groups
if (!this->CreateGroups(generators)) {
return false;
@@ -3309,10 +3279,12 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
// Since the lowest available Xcode version for testing was 7.0,
// I'm setting this as a limit then
- if (root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME") &&
- this->XcodeVersion >= 70) {
- this->OutputXCodeSharedSchemes(xcodeDir);
- this->OutputXCodeWorkspaceSettings(xcodeDir);
+ if (this->XcodeVersion >= 70) {
+ if (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() ||
+ root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")) {
+ this->OutputXCodeSharedSchemes(xcodeDir);
+ this->OutputXCodeWorkspaceSettings(xcodeDir);
+ }
}
this->ClearXCodeObjects();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index ee06074..f38fa3c 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -90,6 +90,8 @@ public:
bool HasKnownObjectFileLocation(std::string* reason) const CM_OVERRIDE;
+ bool IsIPOSupported() const CM_OVERRIDE { return true; }
+
bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;
@@ -251,8 +253,6 @@ private:
std::string PostBuildMakeTarget(std::string const& tName,
std::string const& configName);
cmXCodeObject* MainGroupChildren;
- cmXCodeObject* SourcesGroupChildren;
- cmXCodeObject* ResourcesGroupChildren;
cmMakefile* CurrentMakefile;
cmLocalGenerator* CurrentLocalGenerator;
std::vector<std::string> CurrentConfigurationTypes;
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 1fcd3cb..7e953ce 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -61,7 +61,7 @@ cmGraphVizWriter::cmGraphVizWriter(
void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
const char* fallbackSettingsFileName)
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 421c3dd..0972664 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -137,15 +137,15 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
status.Clear();
mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) {
- inStatus.SetReturnInvoked(true);
+ inStatus.SetReturnInvoked();
return true;
}
if (status.GetBreakInvoked()) {
- inStatus.SetBreakInvoked(true);
+ inStatus.SetBreakInvoked();
return true;
}
if (status.GetContinueInvoked()) {
- inStatus.SetContinueInvoked(true);
+ inStatus.SetContinueInvoked();
return true;
}
}
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 59d32e6..5877a7d 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -64,16 +64,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "if"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
const cmMakefile* mf, cmExpandedCommandArgument const& argument);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 06200cd..16dda0e 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -32,16 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "include"; }
};
#endif
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index abe0c05..12de698 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "include_directories"; }
-
protected:
// used internally
void GetIncludes(const std::string& arg, std::vector<std::string>& incs);
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 5274f9e..375646f 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -36,14 +36,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "include_external_msproject";
- }
};
#endif
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index a003360..bac4b8f 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -35,14 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "include_regular_expression";
- }
};
#endif
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index fde629b..f5d1f92 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install"; }
-
private:
bool HandleScriptMode(std::vector<std::string> const& args);
bool HandleTargetsMode(std::vector<std::string> const& args);
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 588c289..b3c27b8 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_files"; }
-
- /**
* This is called at the end after all the information
* specified by the command is accumulated. Most commands do
* not implement this method. At this point, reading and
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index 2381d79..242fb95 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_programs"; }
-
- /**
* This is called at the end after all the information
* specified by the command is accumulated. Most commands do
* not implement this method. At this point, reading and
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 77f461a..cc84843 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_targets"; }
};
#endif
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 4fe8134..fbf754f 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -3,6 +3,8 @@
#ifndef cmInstalledFile_h
#define cmInstalledFile_h
+#include "cmConfigure.h" // IWYU pragma: keep
+
#include "cmGeneratorExpression.h"
#include "cm_auto_ptr.hxx"
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index 334b1b8..b64e48d 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -35,11 +35,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "link_directories"; }
-
private:
void AddLinkDir(std::string const& dir);
};
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 430e5a8..f1b3a68 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "link_libraries"; }
};
#endif
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 8d4aeb1..7789f7d 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -31,16 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "list"; }
-
protected:
bool HandleLengthCommand(std::vector<std::string> const& args);
bool HandleGetCommand(std::vector<std::string> const& args);
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 8dee973..1a8a0fc 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "load_cache"; }
-
protected:
std::set<std::string> VariablesToRead;
std::string Prefix;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 5cf1853..92a32a1 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -66,11 +66,6 @@ public:
return this->info.FinalPass != CM_NULLPTR;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return info.Name; }
-
static const char* LastName;
static void TrapsForSignals(int sig)
{
@@ -246,7 +241,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker and set it up
cmLoadedCommand* f = new cmLoadedCommand();
(*initFunction)(&f->info);
- this->Makefile->GetState()->AddCommand(f);
+ this->Makefile->GetState()->AddScriptedCommand(args[0], f);
return true;
}
this->SetError("Attempt to load command failed. "
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index 97a6bd7..030786e 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmLoadCommandCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "load_command"; }
};
#endif
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index d5f9d27..6524db4 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -16,14 +16,6 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
: cmLocalGenerator(gg, mf)
, WorkingDirectory(wd)
{
-}
-
-cmLocalCommonGenerator::~cmLocalCommonGenerator()
-{
-}
-
-void cmLocalCommonGenerator::SetConfigName()
-{
// Store the configuration name that will be generated.
if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
// Use the build type given by the user.
@@ -34,6 +26,10 @@ void cmLocalCommonGenerator::SetConfigName()
}
}
+cmLocalCommonGenerator::~cmLocalCommonGenerator()
+{
+}
+
std::string cmLocalCommonGenerator::GetTargetFortranFlags(
cmGeneratorTarget const* target, std::string const& config)
{
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 3de29d7..a5afcd8 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -33,7 +33,6 @@ public:
protected:
std::string WorkingDirectory;
- void SetConfigName();
std::string ConfigName;
friend class cmCommonTargetGenerator;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 424ab6f..307024a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -88,7 +88,19 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
std::vector<std::string> enabledLanguages =
this->GetState()->GetEnabledLanguages();
- this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ if (const char* sysrootCompile =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
+ this->CompilerSysroot = sysrootCompile;
+ } else {
+ this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
+
+ if (const char* sysrootLink =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) {
+ this->LinkerSysroot = sysrootLink;
+ } else {
+ this->LinkerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
for (std::vector<std::string>::iterator i = enabledLanguages.begin();
i != enabledLanguages.end(); ++i) {
@@ -142,7 +154,8 @@ cmRulePlaceholderExpander* cmLocalGenerator::CreateRulePlaceholderExpander()
const
{
return new cmRulePlaceholderExpander(this->Compilers, this->VariableMappings,
- this->CompilerSysroot);
+ this->CompilerSysroot,
+ this->LinkerSysroot);
}
cmLocalGenerator::~cmLocalGenerator()
@@ -558,6 +571,31 @@ void cmLocalGenerator::ComputeTargetManifest()
}
}
+bool cmLocalGenerator::ComputeTargetCompileFeatures()
+{
+ // Collect the set of configuration types.
+ std::vector<std::string> configNames;
+ this->Makefile->GetConfigurations(configNames);
+ if (configNames.empty()) {
+ configNames.push_back("");
+ }
+
+ // Process compile features of all targets.
+ std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+ for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t) {
+ cmGeneratorTarget* target = *t;
+ for (std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci) {
+ if (!target->ComputeCompileFeatures(*ci)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool cmLocalGenerator::IsRootMakefile() const
{
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
@@ -742,14 +780,6 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
this->AppendFlagEscape(flags, *i);
}
}
- std::vector<std::string> features;
- target->GetCompileFeatures(features, config);
- for (std::vector<std::string>::const_iterator it = features.begin();
- it != features.end(); ++it) {
- if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) {
- return;
- }
- }
for (std::map<std::string, std::string>::const_iterator it =
target->GetMaxLanguageStandards().begin();
@@ -826,7 +856,13 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ std::string rootPath;
+ if (const char* sysrootCompile =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
+ rootPath = sysrootCompile;
+ } else {
+ rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
std::vector<std::string> implicitDirs;
// Load implicit include directories for this language.
@@ -915,6 +951,9 @@ void cmLocalGenerator::GetTargetFlags(
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
+ const std::string linkLanguage =
+ linkLineComputer->GetLinkerLanguage(target, buildType);
+
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, target);
@@ -976,16 +1015,13 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
}
-
- const std::string linkLanguage =
- linkLineComputer->GetLinkerLanguage(target, buildType);
if (linkLanguage.empty()) {
cmSystemTools::Error(
"CMake can not determine linker language for target: ",
target->GetName().c_str());
return;
}
- this->AddLanguageFlags(flags, linkLanguage, buildType);
+ this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
@@ -1040,6 +1076,8 @@ void cmLocalGenerator::GetTargetFlags(
default:
break;
}
+
+ this->AppendIPOLinkerFlags(linkFlags, target, config, linkLanguage);
}
void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
@@ -1050,11 +1088,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
cmMakefile* mf = this->GetMakefile();
// Add language-specific flags.
- this->AddLanguageFlags(flags, lang, config);
-
- if (target->IsIPOEnabled(config)) {
- this->AppendFeatureOptions(flags, lang, "IPO");
- }
+ this->AddLanguageFlags(flags, target, lang, config);
this->AddArchitectureFlags(flags, target, lang, config);
@@ -1287,6 +1321,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
+ cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config)
{
@@ -1295,6 +1330,26 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
flagsVar += lang;
flagsVar += "_FLAGS";
this->AddConfigVariableFlags(flags, flagsVar, config);
+
+ if (target->IsIPOEnabled(config)) {
+ this->AppendFeatureOptions(flags, lang, "IPO");
+ }
+}
+
+void cmLocalGenerator::AddLanguageFlagsForLinking(
+ std::string& flags, cmGeneratorTarget const* target, const std::string& lang,
+ const std::string& config)
+{
+ if (this->Makefile->IsOn("CMAKE_" + lang +
+ "_LINK_WITH_STANDARD_COMPILE_OPTION")) {
+ // This toolchain requires use of the language standard flag
+ // when linking in order to use the matching standard library.
+ // FIXME: If CMake gains an abstraction for standard library
+ // selection, this will have to be reconciled with it.
+ this->AddCompilerRequirementFlag(flags, target, lang);
+ }
+
+ this->AddLanguageFlags(flags, target, lang, config);
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
@@ -1461,7 +1516,11 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
"does not know the compile flags to use to enable it.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
} else {
- this->AppendFlagEscape(flags, opt);
+ std::vector<std::string> optVec;
+ cmSystemTools::ExpandListArgument(opt, optVec);
+ for (size_t i = 0; i < optVec.size(); ++i) {
+ this->AppendFlagEscape(flags, optVec[i]);
+ }
}
return;
}
@@ -1478,6 +1537,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
langStdMap["C"].push_back("99");
langStdMap["C"].push_back("90");
+ langStdMap["CUDA"].push_back("14");
langStdMap["CUDA"].push_back("11");
langStdMap["CUDA"].push_back("98");
}
@@ -1768,6 +1828,38 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
this->AppendFlags(flags, this->EscapeForShell(rawFlag));
}
+void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
+ cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& lang)
+{
+ if (!target->IsIPOEnabled(config)) {
+ return;
+ }
+
+ switch (target->GetType()) {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ break;
+ default:
+ return;
+ }
+
+ const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
+ const char* rawFlagsList = this->Makefile->GetDefinition(name);
+ if (rawFlagsList == CM_NULLPTR) {
+ return;
+ }
+
+ std::vector<std::string> flagsList;
+ cmSystemTools::ExpandListArgument(rawFlagsList, flagsList);
+ for (std::vector<std::string>::const_iterator oi = flagsList.begin();
+ oi != flagsList.end(); ++oi) {
+ this->AppendFlagEscape(flags, *oi);
+ }
+}
+
void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
const char* defines_list) const
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1459a05..9f78be4 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -70,6 +70,8 @@ public:
*/
void ComputeTargetManifest();
+ bool ComputeTargetCompileFeatures();
+
bool IsRootMakefile() const;
///! Get the makefile for this generator
@@ -98,8 +100,12 @@ public:
const std::string& lang,
const std::string& config);
- void AddLanguageFlags(std::string& flags, const std::string& lang,
- const std::string& config);
+ void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
+ const std::string& lang, const std::string& config);
+ void AddLanguageFlagsForLinking(std::string& flags,
+ cmGeneratorTarget const* target,
+ const std::string& lang,
+ const std::string& config);
void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string& flags,
@@ -115,6 +121,9 @@ public:
virtual void AppendFlags(std::string& flags, const char* newFlags);
virtual void AppendFlagEscape(std::string& flags,
const std::string& rawFlag);
+ void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& lang);
///! Get the include flags for the current makefile and language
std::string GetIncludeFlags(const std::vector<std::string>& includes,
cmGeneratorTarget* target,
@@ -353,6 +362,7 @@ protected:
std::map<std::string, std::string> Compilers;
std::map<std::string, std::string> VariableMappings;
std::string CompilerSysroot;
+ std::string LinkerSysroot;
bool EmitUniversalBinaryFlags;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e0e3e54..a8350b3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -37,8 +37,9 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmRulePlaceholderExpander*
cmLocalNinjaGenerator::CreateRulePlaceholderExpander() const
{
- cmRulePlaceholderExpander* ret = new cmRulePlaceholderExpander(
- this->Compilers, this->VariableMappings, this->CompilerSysroot);
+ cmRulePlaceholderExpander* ret =
+ new cmRulePlaceholderExpander(this->Compilers, this->VariableMappings,
+ this->CompilerSysroot, this->LinkerSysroot);
ret->SetTargetImpLib("$TARGET_IMPLIB");
return ret;
}
@@ -57,8 +58,6 @@ void cmLocalNinjaGenerator::Generate()
this->HomeRelativeOutputPath = "";
}
- this->SetConfigName();
-
this->WriteProcessedMakefile(this->GetBuildFileStream());
#ifdef NINJA_GEN_VERBOSE_FILES
this->WriteProcessedMakefile(this->GetRulesFileStream());
@@ -322,7 +321,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
} else if (cmdLines.size() > 1) {
cmd << "cmd.exe /C \"";
}
- cmd << *li;
+ // Put current cmdLine in brackets if it contains "||" because it has
+ // higher precedence than "&&" in cmd.exe
+ if (li->find("||") != std::string::npos) {
+ cmd << "( " << *li << " )";
+ } else {
+ cmd << *li;
+ }
}
if (cmdLines.size() > 1) {
cmd << "\"";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5f52786..959178e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -105,8 +105,6 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3()
void cmLocalUnixMakefileGenerator3::Generate()
{
- this->SetConfigName();
-
// Record whether some options are enabled to avoid checking many
// times later.
if (!this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) {
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 583f801..a6a9ea3 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -22,11 +22,6 @@ public:
~cmMacroHelperCommand() CM_OVERRIDE {}
/**
- * This determines if the command is defined in a cmake script.
- */
- bool IsUserDefined() const CM_OVERRIDE { return true; }
-
- /**
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE
@@ -41,11 +36,6 @@ public:
}
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
@@ -58,11 +48,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
@@ -156,15 +141,15 @@ bool cmMacroHelperCommand::InvokeInitialPass(
// The error message should have already included the call stack
// so we do not need to report an error here.
macroScope.Quiet();
- inStatus.SetNestedError(true);
+ inStatus.SetNestedError();
return false;
}
if (status.GetReturnInvoked()) {
- inStatus.SetReturnInvoked(true);
+ inStatus.SetReturnInvoked();
return true;
}
if (status.GetBreakInvoked()) {
- inStatus.SetBreakInvoked(true);
+ inStatus.SetBreakInvoked();
return true;
}
}
@@ -189,10 +174,7 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
f->Functions = this->Functions;
f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
- std::string newName = "_" + this->Args[0];
- mf.GetState()->RenameCommand(this->Args[0], newName);
- mf.GetState()->AddCommand(f);
-
+ mf.GetState()->AddScriptedCommand(this->Args[0], f);
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index f0020ff..0d35fe0 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -44,16 +44,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "macro"; }
};
#endif
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 54f4ab3..af72eab 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -35,16 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "make_directory"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cb11060..5af0084 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -118,7 +118,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
{
if (!this->ExecutionStatusStack.empty()) {
if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) {
- this->ExecutionStatusStack.back()->SetNestedError(true);
+ this->ExecutionStatusStack.back()->SetNestedError();
}
}
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
@@ -272,11 +272,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
pcmd->SetMakefile(this);
// Decide whether to invoke the command.
- if (!cmSystemTools::GetFatalErrorOccured() &&
- (this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE ||
- pcmd->IsScriptable()))
-
- {
+ if (!cmSystemTools::GetFatalErrorOccured()) {
// if trace is enabled, print out invoke information
if (this->GetCMakeInstance()->GetTrace()) {
this->PrintCommandTrace(lff);
@@ -298,15 +294,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// use the command
this->FinalPassCommands.push_back(pcmd.release());
}
- } else if (this->GetCMakeInstance()->GetWorkingMode() ==
- cmake::SCRIPT_MODE &&
- !pcmd->IsScriptable()) {
- std::string error = "Command ";
- error += pcmd->GetName();
- error += "() is not scriptable";
- this->IssueMessage(cmake::FATAL_ERROR, error);
- result = false;
- cmSystemTools::SetFatalErrorOccured();
}
} else {
if (!cmSystemTools::GetFatalErrorOccured()) {
@@ -3187,7 +3174,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// make sure the same generator is used
// use this program as the cmake to be run, it should not
// be run that way but the cmake object requires a vailid path
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetIsInTryCompile(true);
cmGlobalGenerator* gg =
cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index a719887..359b9fd 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -150,7 +150,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
linkLanguage, *this->GeneratorTarget));
// Add language feature flags.
- this->AddFeatureFlags(flags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
@@ -433,7 +434,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
// Add language feature flags.
- this->AddFeatureFlags(flags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
@@ -455,6 +457,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
}
+ this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
+ this->ConfigName, linkLanguage);
+
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2823977..2b37b4d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -395,9 +395,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
vars.LinkFlags = linkFlags.c_str();
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
- // Add language feature flags.
+ // Add language-specific flags.
std::string langFlags;
- this->AddFeatureFlags(langFlags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
vars.LanguageCompileFlags = langFlags.c_str();
@@ -493,6 +494,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Create set of linking flags.
std::string linkFlags;
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
+ this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
+ this->ConfigName, linkLanguage);
// Add OSX version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -853,9 +856,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
}
- // Add language feature flags.
+ // Add language-specific flags.
std::string langFlags;
- this->AddFeatureFlags(langFlags, linkLanguage);
+ this->LocalGenerator->AddLanguageFlagsForLinking(
+ langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 8c2f85b..a7791a9 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -31,19 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- * mark_as_advanced() will have no effect in script mode, but this will
- * make many of the modules usable in cmake/ctest scripts, (among them
- * FindUnixMake.cmake used by the CTEST_BUILD command.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 496d836..67dbdda 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -28,16 +28,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "math"; }
-
protected:
bool HandleExprCommand(std::vector<std::string> const& args);
};
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index ca83ed6..96939e5 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -30,16 +30,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "message"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 8206083..0331828 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -655,7 +655,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t = "";
- localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName);
+ localGen.AddLanguageFlagsForLinking(t, &genTarget, cudaLinkLanguage,
+ cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
@@ -874,7 +875,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["ARCH_FLAGS"] = t;
t = "";
t += lwyuFlags;
- localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
+ localGen.AddLanguageFlagsForLinking(t, &genTarget, TargetLinkLanguage,
+ cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 86fa41f..634e3a8 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "option"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index e261eb0..d20bfbd 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -21,7 +21,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "output_required_files"; }
void ListDependencies(cmDependInformation const* info, FILE* fout,
std::set<cmDependInformation const*>* visited);
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index 4d9416d..359fb85 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -29,16 +29,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
};
#endif
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index 8fc90d2..3c579ac 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -34,11 +34,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "project"; }
};
#endif
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 34adf29..ad1ccf3 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "qt_wrap_cpp"; }
};
#endif
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 279d4e9..ac7ab01 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "qt_wrap_ui"; }
};
#endif
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index eec1fc6..d40e809 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -286,7 +286,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config)
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeOutputDirectory(targetDirectory);
cm.SetHomeDirectory(targetDirectory);
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -396,6 +396,14 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
if (this->MocEnabled()) {
InfoGet(makefile, "AM_MOC_SKIP", this->MocSkipList);
InfoGet(makefile, "AM_MOC_DEFINITIONS", config, this->MocDefinitions);
+#ifdef _WIN32
+ {
+ const std::string win32("WIN32");
+ if (!ListContains(this->MocDefinitions, win32)) {
+ this->MocDefinitions.push_back(win32);
+ }
+ }
+#endif
InfoGet(makefile, "AM_MOC_INCLUDES", config, this->MocIncludePaths);
InfoGet(makefile, "AM_MOC_OPTIONS", this->MocOptions);
InfoGet(makefile, "AM_MOC_RELAXED_MODE", this->MocRelaxedMode);
@@ -517,32 +525,39 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
// Compose current settings strings
{
cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
+ const std::string sep(" ~~~ ");
if (this->MocEnabled()) {
std::string str;
+ str += this->MocExecutable;
+ str += sep;
str += JoinOptionsList(this->MocDefinitions);
- str += " ~~~ ";
+ str += sep;
str += JoinOptionsList(this->MocIncludePaths);
- str += " ~~~ ";
+ str += sep;
str += JoinOptionsList(this->MocOptions);
- str += " ~~~ ";
+ str += sep;
str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
- str += " ~~~ ";
+ str += sep;
str += JoinOptionsList(this->MocPredefsCmd);
- str += " ~~~ ";
+ str += sep;
this->SettingsStringMoc = crypt.HashString(str);
}
if (this->UicEnabled()) {
std::string str;
+ str += this->UicExecutable;
+ str += sep;
str += JoinOptionsList(this->UicTargetOptions);
- str += " ~~~ ";
+ str += sep;
str += JoinOptionsMap(this->UicOptions);
- str += " ~~~ ";
+ str += sep;
this->SettingsStringUic = crypt.HashString(str);
}
if (this->RccEnabled()) {
std::string str;
+ str += this->RccExecutable;
+ str += sep;
str += JoinOptionsMap(this->RccOptions);
- str += " ~~~ ";
+ str += sep;
this->SettingsStringRcc = crypt.HashString(str);
}
}
@@ -1214,9 +1229,6 @@ bool cmQtAutoGenerators::MocGenerateAll(
this->MocDefinitions.begin();
it != this->MocDefinitions.end(); ++it) {
cmd.push_back("-D" + (*it));
-#ifdef _WIN32
- cmd.push_back("-DWIN32");
-#endif
}
// Add options
cmd.insert(cmd.end(), this->MocOptions.begin(),
@@ -1362,9 +1374,6 @@ bool cmQtAutoGenerators::MocGenerateFile(
it != this->MocDefinitions.end(); ++it) {
cmd.push_back("-D" + (*it));
}
-#ifdef _WIN32
- cmd.push_back("-DWIN32");
-#endif
// Add options
cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end());
// Add predefs include
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 38223a5..f2e89f6 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "remove"; }
};
#endif
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 2f6c924..9a9a5d5 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "remove_definitions"; }
};
#endif
diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx
index f8b3129..ceea8b4 100644
--- a/Source/cmReturnCommand.cxx
+++ b/Source/cmReturnCommand.cxx
@@ -8,6 +8,6 @@
bool cmReturnCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus& status)
{
- status.SetReturnInvoked(true);
+ status.SetReturnInvoked();
return true;
}
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index ceed6b5..87900e7 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "return"; }
};
#endif
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index f190a5c..d5d2f67 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -12,10 +12,11 @@
cmRulePlaceholderExpander::cmRulePlaceholderExpander(
std::map<std::string, std::string> const& compilers,
std::map<std::string, std::string> const& variableMappings,
- std::string const& compilerSysroot)
+ std::string const& compilerSysroot, std::string const& linkerSysroot)
: Compilers(compilers)
, VariableMappings(variableMappings)
, CompilerSysroot(compilerSysroot)
+ , LinkerSysroot(linkerSysroot)
{
}
@@ -249,10 +250,19 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
ret += compilerOptionExternalToolchain;
ret += outputConverter->EscapeForShell(compilerExternalToolchain, true);
}
- if (!this->CompilerSysroot.empty() && !compilerOptionSysroot.empty()) {
+ std::string sysroot;
+ // Some platforms may use separate sysroots for compiling and linking.
+ // If we detect link flags, then we pass the link sysroot instead.
+ // FIXME: Use a more robust way to detect link line expansion.
+ if (replaceValues.LinkFlags) {
+ sysroot = this->LinkerSysroot;
+ } else {
+ sysroot = this->CompilerSysroot;
+ }
+ if (!sysroot.empty() && !compilerOptionSysroot.empty()) {
ret += " ";
ret += compilerOptionSysroot;
- ret += outputConverter->EscapeForShell(this->CompilerSysroot, true);
+ ret += outputConverter->EscapeForShell(sysroot, true);
}
return ret;
}
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 90b4119..7b19210 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -17,7 +17,7 @@ public:
cmRulePlaceholderExpander(
std::map<std::string, std::string> const& compilers,
std::map<std::string, std::string> const& variableMappings,
- std::string const& compilerSysroot);
+ std::string const& compilerSysroot, std::string const& linkerSysroot);
void SetTargetImpLib(std::string const& targetImpLib)
{
@@ -76,6 +76,7 @@ private:
std::map<std::string, std::string> Compilers;
std::map<std::string, std::string> VariableMappings;
std::string CompilerSysroot;
+ std::string LinkerSysroot;
};
#endif
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index b27d227..7b222a0 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -40,6 +40,13 @@ bool cmSeparateArgumentsCommand::InitialPass(
if (doing == DoingVariable) {
var = args[i];
doing = DoingMode;
+ } else if (doing == DoingMode && args[i] == "NATIVE_COMMAND") {
+#ifdef _WIN32
+ mode = ModeWindows;
+#else
+ mode = ModeUnix;
+#endif
+ doing = DoingCommand;
} else if (doing == DoingMode && args[i] == "UNIX_COMMAND") {
mode = ModeUnix;
doing = DoingCommand;
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 7edde48..6bf8549 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
};
#endif
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 5a71dc0..19bdd45 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -6,18 +6,15 @@
#include "cmServerDictionary.h"
#include "cmServerProtocol.h"
#include "cmSystemTools.h"
-#include "cmVersionMacros.h"
-#include "cmake.h"
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#endif
+#include "cm_jsoncpp_writer.h"
+#include "cmake.h"
+#include "cmsys/FStream.hxx"
#include <algorithm>
-#include <fstream>
-#include <iostream>
-#include <memory>
+#include <cassert>
+#include <cstdint>
+#include <utility>
class cmServer::DebugInfo
{
@@ -270,10 +267,8 @@ void cmServer::WriteJsonObject(const Json::Value& jsonValue,
}
if (!debug->OutputFile.empty()) {
- std::ofstream myfile;
- myfile.open(debug->OutputFile);
+ cmsys::ofstream myfile(debug->OutputFile.c_str());
myfile << result;
- myfile.close();
}
}
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 7f29e32..b814050 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -2,13 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmListFileCache.h"
-#include "cmState.h"
+#include "cmConfigure.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_jsoncpp_value.h"
#include "cm_uv.h"
-#endif
#include <string>
#include <vector>
@@ -21,6 +18,8 @@ class cmServerResponse;
class cmServer
{
+ CM_DISABLE_COPY(cmServer)
+
public:
class DebugInfo;
diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx
index 008052b..36312ed 100644
--- a/Source/cmServerConnection.cxx
+++ b/Source/cmServerConnection.cxx
@@ -2,10 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerConnection.h"
-#include "cmServerDictionary.h"
-
#include "cmFileMonitor.h"
#include "cmServer.h"
+#include "cmServerDictionary.h"
#include <assert.h>
#include <string.h>
diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h
index 1fabe37..b96bf3c 100644
--- a/Source/cmServerConnection.h
+++ b/Source/cmServerConnection.h
@@ -2,21 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
-#include <string>
-#include <vector>
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_uv.h"
-#endif
-class cmServer;
+#include <string>
+
class cmFileMonitor;
-class LoopGuard;
+class cmServer;
class cmServerConnection
{
+ CM_DISABLE_COPY(cmServerConnection)
+
public:
cmServerConnection();
virtual ~cmServerConnection();
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 11ee897..defba77 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -4,27 +4,32 @@
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLinkLineComputer.h"
-#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmServer.h"
#include "cmServerDictionary.h"
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_uv.h"
#include "cmake.h"
-#include "cmServerDictionary.h"
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#endif
-
#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <functional>
+#include <limits>
+#include <map>
+#include <set>
#include <string>
+#include <unordered_map>
#include <vector>
// Get rid of some windows macros:
@@ -210,7 +215,7 @@ bool cmServerProtocol::Activate(cmServer* server,
{
assert(server);
this->m_Server = server;
- this->m_CMakeInstance = std::make_unique<cmake>();
+ this->m_CMakeInstance = std::make_unique<cmake>(cmake::RoleProject);
const bool result = this->DoActivate(request, errorMessage);
if (!result) {
this->m_CMakeInstance = CM_NULLPTR;
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 027f145..83b3d58 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -2,20 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmListFileCache.h"
-#include "cmake.h"
+#include "cmConfigure.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_writer.h"
-#endif
+#include "cm_jsoncpp_value.h"
+#include "cmake.h"
#include <memory>
#include <string>
+#include <utility>
-class cmake;
class cmFileMonitor;
class cmServer;
-
class cmServerRequest;
class cmServerResponse
@@ -72,8 +69,11 @@ private:
class cmServerProtocol
{
+ CM_DISABLE_COPY(cmServerProtocol)
+
public:
- virtual ~cmServerProtocol() {}
+ cmServerProtocol() = default;
+ virtual ~cmServerProtocol() = default;
virtual std::pair<int, int> ProtocolVersion() const = 0;
virtual bool IsExperimental() const = 0;
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 1c67bf9..c0858b1 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set"; }
};
#endif
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index e04de6e..8832b33 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -29,19 +29,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "set_directory_properties";
- }
-
- /**
* Static entry point for use by other commands
*/
static bool RunCommand(cmMakefile* mf,
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 3657f63..0815824 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -31,16 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_property"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
std::set<std::string> Names;
std::string PropertyName;
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 7dce437..2e22dc9 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -28,14 +28,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "set_source_files_properties";
- }
-
static bool RunCommand(cmMakefile* mf,
std::vector<std::string>::const_iterator filebeg,
std::vector<std::string>::const_iterator fileend,
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index bb34d1e..4256181 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -26,11 +26,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_target_properties"; }
-
- /**
* Used by this command and cmSetPropertiesCommand
*/
static bool SetOneTarget(const std::string& tname,
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 56a864f..90f004c 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -25,11 +25,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
-
static bool SetOneTest(const std::string& tname,
std::vector<std::string>& propertyPairs,
cmMakefile* mf, std::string& errors);
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index c7425f6..6c65480 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "site_name"; }
};
#endif
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index f54d777..a966300 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroupCommand.h"
-#include <algorithm>
-#include <iterator>
#include <set>
#include <sstream>
#include <stddef.h>
@@ -16,7 +14,7 @@ namespace {
const size_t RootIndex = 1;
const size_t FilesWithoutPrefixKeywordIndex = 2;
const size_t FilesWithPrefixKeywordIndex = 4;
-const size_t PrefixKeywordIdex = 2;
+const size_t PrefixKeywordIndex = 2;
std::vector<std::string> tokenizePath(const std::string& path)
{
@@ -80,17 +78,26 @@ cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath,
return sg;
}
-std::string prepareFilePathForTree(const std::string& path)
+std::string prepareFilePathForTree(const std::string& path,
+ const std::string& currentSourceDir)
{
+ if (!cmSystemTools::FileIsFullPath(path)) {
+ return cmSystemTools::CollapseFullPath(currentSourceDir + "/" + path);
+ }
return cmSystemTools::CollapseFullPath(path);
}
std::vector<std::string> prepareFilesPathsForTree(
std::vector<std::string>::const_iterator begin,
- std::vector<std::string>::const_iterator end)
+ std::vector<std::string>::const_iterator end,
+ const std::string& currentSourceDir)
{
- std::vector<std::string> prepared(std::distance(begin, end));
- std::transform(begin, end, prepared.begin(), prepareFilePathForTree);
+ std::vector<std::string> prepared;
+
+ for (; begin != end; ++begin) {
+ prepared.push_back(prepareFilePathForTree(*begin, currentSourceDir));
+ }
+
return prepared;
}
@@ -229,13 +236,13 @@ bool cmSourceGroupCommand::checkTreeArgumentsPreconditions(
}
if (args[FilesWithoutPrefixKeywordIndex] != "FILES" &&
- args[PrefixKeywordIdex] != "PREFIX") {
+ args[PrefixKeywordIndex] != "PREFIX") {
errorMsg = "Unknown argument \"" + args[2] +
"\". Perhaps the FILES keyword is missing.\n";
return false;
}
- if (args[PrefixKeywordIdex] == "PREFIX" &&
+ if (args[PrefixKeywordIndex] == "PREFIX" &&
(args.size() < 5 || args[FilesWithPrefixKeywordIndex] != "FILES")) {
errorMsg = "Missing FILES arguments.";
return false;
@@ -254,13 +261,14 @@ bool cmSourceGroupCommand::processTree(const std::vector<std::string>& args,
const std::string root = cmSystemTools::CollapseFullPath(args[RootIndex]);
std::string prefix;
size_t filesBegin = FilesWithoutPrefixKeywordIndex + 1;
- if (args[PrefixKeywordIdex] == "PREFIX") {
- prefix = args[PrefixKeywordIdex + 1];
+ if (args[PrefixKeywordIndex] == "PREFIX") {
+ prefix = args[PrefixKeywordIndex + 1];
filesBegin = FilesWithPrefixKeywordIndex + 1;
}
const std::vector<std::string> filesVector =
- prepareFilesPathsForTree(args.begin() + filesBegin, args.end());
+ prepareFilesPathsForTree(args.begin() + filesBegin, args.end(),
+ this->Makefile->GetCurrentSourceDirectory());
if (!rootIsPrefix(root, filesVector, errorMsg)) {
return false;
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 3086177..7d56b0d 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "source_group"; }
-
private:
bool processTree(const std::vector<std::string>& args,
std::string& errorMsg);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index aca0358..ce9f470 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -12,10 +12,12 @@
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmDefinitions.h"
+#include "cmDisallowedCommand.h"
#include "cmListFileCache.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
+#include "cmUnexpectedCommand.h"
#include "cmake.h"
cmState::cmState()
@@ -34,7 +36,8 @@ cmState::cmState()
cmState::~cmState()
{
delete this->CacheManager;
- cmDeleteAll(this->Commands);
+ cmDeleteAll(this->BuiltinCommands);
+ cmDeleteAll(this->ScriptedCommands);
}
const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
@@ -375,99 +378,92 @@ void cmState::SetIsGeneratorMultiConfig(bool b)
this->IsGeneratorMultiConfig = b;
}
-void cmState::RenameCommand(std::string const& oldName,
- std::string const& newName)
+void cmState::AddBuiltinCommand(std::string const& name, cmCommand* command)
{
- // if the command already exists, free the old one
- std::string sOldName = cmSystemTools::LowerCase(oldName);
- std::string sNewName = cmSystemTools::LowerCase(newName);
- std::map<std::string, cmCommand*>::iterator pos =
- this->Commands.find(sOldName);
- if (pos == this->Commands.end()) {
- return;
- }
- cmCommand* cmd = pos->second;
+ assert(name == cmSystemTools::LowerCase(name));
+ assert(this->BuiltinCommands.find(name) == this->BuiltinCommands.end());
+ this->BuiltinCommands.insert(std::make_pair(name, command));
+}
- pos = this->Commands.find(sNewName);
- if (pos != this->Commands.end()) {
- delete pos->second;
- this->Commands.erase(pos);
- }
- this->Commands.insert(std::make_pair(sNewName, cmd));
- pos = this->Commands.find(sOldName);
- this->Commands.erase(pos);
+void cmState::AddDisallowedCommand(std::string const& name, cmCommand* command,
+ cmPolicies::PolicyID policy,
+ const char* message)
+{
+ this->AddBuiltinCommand(name,
+ new cmDisallowedCommand(command, policy, message));
}
-void cmState::AddCommand(cmCommand* command)
+void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
{
- std::string name = cmSystemTools::LowerCase(command->GetName());
- // if the command already exists, free the old one
- std::map<std::string, cmCommand*>::iterator pos = this->Commands.find(name);
- if (pos != this->Commands.end()) {
- delete pos->second;
- this->Commands.erase(pos);
- }
- this->Commands.insert(std::make_pair(name, command));
+ this->AddBuiltinCommand(name, new cmUnexpectedCommand(name, error));
}
-void cmState::RemoveUnscriptableCommands()
+void cmState::AddScriptedCommand(std::string const& name, cmCommand* command)
{
- std::vector<std::string> unscriptableCommands;
- for (std::map<std::string, cmCommand*>::iterator pos =
- this->Commands.begin();
- pos != this->Commands.end();) {
- if (!pos->second->IsScriptable()) {
+ std::string sName = cmSystemTools::LowerCase(name);
+
+ // if the command already exists, give a new name to the old command.
+ if (cmCommand* oldCmd = this->GetCommand(sName)) {
+ std::string const newName = "_" + sName;
+ std::map<std::string, cmCommand*>::iterator pos =
+ this->ScriptedCommands.find(newName);
+ if (pos != this->ScriptedCommands.end()) {
delete pos->second;
- this->Commands.erase(pos++);
- } else {
- ++pos;
+ this->ScriptedCommands.erase(pos);
}
+ this->ScriptedCommands.insert(std::make_pair(newName, oldCmd->Clone()));
}
+
+ // if the command already exists, free the old one
+ std::map<std::string, cmCommand*>::iterator pos =
+ this->ScriptedCommands.find(sName);
+ if (pos != this->ScriptedCommands.end()) {
+ delete pos->second;
+ this->ScriptedCommands.erase(pos);
+ }
+ this->ScriptedCommands.insert(std::make_pair(sName, command));
}
cmCommand* cmState::GetCommand(std::string const& name) const
{
- cmCommand* command = CM_NULLPTR;
std::string sName = cmSystemTools::LowerCase(name);
- std::map<std::string, cmCommand*>::const_iterator pos =
- this->Commands.find(sName);
- if (pos != this->Commands.end()) {
- command = (*pos).second;
+ std::map<std::string, cmCommand*>::const_iterator pos;
+ pos = this->ScriptedCommands.find(sName);
+ if (pos != this->ScriptedCommands.end()) {
+ return pos->second;
+ }
+ pos = this->BuiltinCommands.find(sName);
+ if (pos != this->BuiltinCommands.end()) {
+ return pos->second;
}
- return command;
+ return CM_NULLPTR;
}
std::vector<std::string> cmState::GetCommandNames() const
{
std::vector<std::string> commandNames;
- commandNames.reserve(this->Commands.size());
- std::map<std::string, cmCommand*>::const_iterator cmds =
- this->Commands.begin();
- for (; cmds != this->Commands.end(); ++cmds) {
+ commandNames.reserve(this->BuiltinCommands.size() +
+ this->ScriptedCommands.size());
+ for (std::map<std::string, cmCommand*>::const_iterator cmds =
+ this->BuiltinCommands.begin();
+ cmds != this->BuiltinCommands.end(); ++cmds) {
+ commandNames.push_back(cmds->first);
+ }
+ for (std::map<std::string, cmCommand*>::const_iterator cmds =
+ this->ScriptedCommands.begin();
+ cmds != this->ScriptedCommands.end(); ++cmds) {
commandNames.push_back(cmds->first);
}
+ std::sort(commandNames.begin(), commandNames.end());
+ commandNames.erase(std::unique(commandNames.begin(), commandNames.end()),
+ commandNames.end());
return commandNames;
}
void cmState::RemoveUserDefinedCommands()
{
- std::vector<cmCommand*> renamedCommands;
- for (std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
- j != this->Commands.end();) {
- if (j->second->IsUserDefined()) {
- delete j->second;
- this->Commands.erase(j++);
- } else if (j->first != j->second->GetName()) {
- renamedCommands.push_back(j->second);
- this->Commands.erase(j++);
- } else {
- ++j;
- }
- }
- for (std::vector<cmCommand*>::const_iterator it = renamedCommands.begin();
- it != renamedCommands.end(); ++it) {
- this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it;
- }
+ cmDeleteAll(this->ScriptedCommands);
+ this->ScriptedCommands.clear();
}
void cmState::SetGlobalProperty(const std::string& prop, const char* value)
diff --git a/Source/cmState.h b/Source/cmState.h
index d2af5ce..1a5738f 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -12,6 +12,7 @@
#include "cmDefinitions.h"
#include "cmLinkedTree.h"
+#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
@@ -120,9 +121,11 @@ public:
void SetIsGeneratorMultiConfig(bool b);
cmCommand* GetCommand(std::string const& name) const;
- void AddCommand(cmCommand* command);
- void RemoveUnscriptableCommands();
- void RenameCommand(std::string const& oldName, std::string const& newName);
+ void AddBuiltinCommand(std::string const& name, cmCommand* command);
+ void AddDisallowedCommand(std::string const& name, cmCommand* command,
+ cmPolicies::PolicyID policy, const char* message);
+ void AddUnexpectedCommand(std::string const& name, const char* error);
+ void AddScriptedCommand(std::string const& name, cmCommand* command);
void RemoveUserDefinedCommands();
std::vector<std::string> GetCommandNames() const;
@@ -161,7 +164,8 @@ private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
- std::map<std::string, cmCommand*> Commands;
+ std::map<std::string, cmCommand*> BuiltinCommands;
+ std::map<std::string, cmCommand*> ScriptedCommands;
cmPropertyMap GlobalProperties;
cmCacheManager* CacheManager;
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 89ecb12..88015ad 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -31,16 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "string"; }
-
protected:
bool HandleConfigureCommand(std::vector<std::string> const& args);
bool HandleAsciiCommand(std::vector<std::string> const& args);
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index ce2168d..a2af0fd 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "subdirs"; }
};
#endif
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index ae8fbaf..d8ea928 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmSubdirDependsCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "subdir_depends"; }
};
#endif
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 663b9d0..11abf57 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -32,14 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "target_compile_definitions";
- }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 95214bf..9908680 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -21,8 +21,6 @@ class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "target_compile_features"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index e4dfa75..b5408f7 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -29,11 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_compile_options"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index d6d33f2..374a867 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -32,14 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "target_include_directories";
- }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index bfa233e..3fd20ac 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_link_libraries"; }
-
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 6cc1abc..09ba729 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -29,11 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_sources"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 8972f7e..4836548 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "try_compile"; }
};
#endif
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index b086dde..c27b026 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "try_run"; }
-
private:
void RunExecutable(const std::string& runArgs,
std::string* runOutputContents);
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
index aee5d4d..995d8a5 100644
--- a/Source/cmUnexpectedCommand.h
+++ b/Source/cmUnexpectedCommand.h
@@ -29,10 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- std::string GetName() const CM_OVERRIDE { return this->Name; }
-
private:
std::string Name;
const char* Error;
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 7e0f5b5..2a1f3f0 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -31,16 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "unset"; }
};
#endif
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index e8bd8c6..5118829 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -18,8 +18,7 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; }
- bool IsScriptable() const CM_OVERRIDE { return true; }
+
protected:
void CopyAndFullPathMesaHeader(const char* source, const char* outdir);
};
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index fa818bf..a95b48d 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "utility_source"; }
};
#endif
diff --git a/Source/cmVS10MASMFlagTable.h b/Source/cmVS10MASMFlagTable.h
index 82e5270..0a45245 100644
--- a/Source/cmVS10MASMFlagTable.h
+++ b/Source/cmVS10MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS10MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS11MASMFlagTable.h b/Source/cmVS11MASMFlagTable.h
index 1aca169..fdf8239 100644
--- a/Source/cmVS11MASMFlagTable.h
+++ b/Source/cmVS11MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS11MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS12MASMFlagTable.h b/Source/cmVS12MASMFlagTable.h
index a7e4a80..acc0d48 100644
--- a/Source/cmVS12MASMFlagTable.h
+++ b/Source/cmVS12MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS12MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVS14MASMFlagTable.h b/Source/cmVS14MASMFlagTable.h
index c4e5e1e..82ec9f1 100644
--- a/Source/cmVS14MASMFlagTable.h
+++ b/Source/cmVS14MASMFlagTable.h
@@ -2,74 +2,72 @@ static cmVS7FlagTable cmVS14MASMFlagTable[] = {
// Enum Properties
{ "PreserveIdentifierCase", "", "Default", "0", 0 },
- { "PreserveIdentifierCase", "/Cp", "Preserves Identifier Case (/Cp)", "1",
+ { "PreserveIdentifierCase", "Cp", "Preserves Identifier Case (/Cp)", "1",
0 },
- { "PreserveIdentifierCase", "/Cu",
+ { "PreserveIdentifierCase", "Cu",
"Maps all identifiers to upper case. (/Cu)", "2", 0 },
- { "PreserveIdentifierCase", "/Cx",
+ { "PreserveIdentifierCase", "Cx",
"Preserves case in public and extern symbols. (/Cx)", "3", 0 },
- { "WarningLevel", "/W0", "Warning Level 0 (/W0)", "0", 0 },
- { "WarningLevel", "/W1", "Warning Level 1 (/W1)", "1", 0 },
- { "WarningLevel", "/W2", "Warning Level 2 (/W2)", "2", 0 },
- { "WarningLevel", "/W3", "Warning Level 3 (/W3)", "3", 0 },
+ { "WarningLevel", "W0", "Warning Level 0 (/W0)", "0", 0 },
+ { "WarningLevel", "W1", "Warning Level 1 (/W1)", "1", 0 },
+ { "WarningLevel", "W2", "Warning Level 2 (/W2)", "2", 0 },
+ { "WarningLevel", "W3", "Warning Level 3 (/W3)", "3", 0 },
{ "PackAlignmentBoundary", "", "Default", "0", 0 },
- { "PackAlignmentBoundary", "/Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
- { "PackAlignmentBoundary", "/Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
- { "PackAlignmentBoundary", "/Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
- { "PackAlignmentBoundary", "/Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
- { "PackAlignmentBoundary", "/Zp16", "Sixteen Byte Boundary (/Zp16)", "5",
- 0 },
+ { "PackAlignmentBoundary", "Zp1", "One Byte Boundary (/Zp1)", "1", 0 },
+ { "PackAlignmentBoundary", "Zp2", "Two Byte Boundary (/Zp2)", "2", 0 },
+ { "PackAlignmentBoundary", "Zp4", "Four Byte Boundary (/Zp4)", "3", 0 },
+ { "PackAlignmentBoundary", "Zp8", "Eight Byte Boundary (/Zp8)", "4", 0 },
+ { "PackAlignmentBoundary", "Zp16", "Sixteen Byte Boundary (/Zp16)", "5", 0 },
{ "CallingConvention", "", "Default", "0", 0 },
- { "CallingConvention", "/Gd", "Use C-style Calling Convention (/Gd)", "1",
- 0 },
- { "CallingConvention", "/Gz", "Use stdcall Calling Convention (/Gz)", "2",
+ { "CallingConvention", "Gd", "Use C-style Calling Convention (/Gd)", "1",
0 },
- { "CallingConvention", "/Gc", "Use Pascal Calling Convention (/Gc)", "3",
+ { "CallingConvention", "Gz", "Use stdcall Calling Convention (/Gz)", "2",
0 },
+ { "CallingConvention", "Gc", "Use Pascal Calling Convention (/Gc)", "3", 0 },
- { "ErrorReporting", "/errorReport:prompt",
+ { "ErrorReporting", "errorReport:prompt",
"Prompt to send report immediately (/errorReport:prompt)", "0", 0 },
- { "ErrorReporting", "/errorReport:queue",
+ { "ErrorReporting", "errorReport:queue",
"Prompt to send report at the next logon (/errorReport:queue)", "1", 0 },
- { "ErrorReporting", "/errorReport:send",
+ { "ErrorReporting", "errorReport:send",
"Automatically send report (/errorReport:send)", "2", 0 },
- { "ErrorReporting", "/errorReport:none",
+ { "ErrorReporting", "errorReport:none",
"Do not send report (/errorReport:none)", "3", 0 },
// Bool Properties
- { "NoLogo", "/nologo", "", "true", 0 },
- { "GeneratePreprocessedSourceListing", "/EP", "", "true", 0 },
- { "ListAllAvailableInformation", "/Sa", "", "true", 0 },
- { "UseSafeExceptionHandlers", "/safeseh", "", "true", 0 },
- { "AddFirstPassListing", "/Sf", "", "true", 0 },
- { "EnableAssemblyGeneratedCodeListing", "/Sg", "", "true", 0 },
- { "DisableSymbolTable", "/Sn", "", "true", 0 },
- { "EnableFalseConditionalsInListing", "/Sx", "", "true", 0 },
- { "TreatWarningsAsErrors", "/WX", "", "true", 0 },
- { "MakeAllSymbolsPublic", "/Zf", "", "true", 0 },
- { "GenerateDebugInformation", "/Zi", "", "true", 0 },
- { "EnableMASM51Compatibility", "/Zm", "", "true", 0 },
- { "PerformSyntaxCheckOnly", "/Zs", "", "true", 0 },
+ { "NoLogo", "nologo", "", "true", 0 },
+ { "GeneratePreprocessedSourceListing", "EP", "", "true", 0 },
+ { "ListAllAvailableInformation", "Sa", "", "true", 0 },
+ { "UseSafeExceptionHandlers", "safeseh", "", "true", 0 },
+ { "AddFirstPassListing", "Sf", "", "true", 0 },
+ { "EnableAssemblyGeneratedCodeListing", "Sg", "", "true", 0 },
+ { "DisableSymbolTable", "Sn", "", "true", 0 },
+ { "EnableFalseConditionalsInListing", "Sx", "", "true", 0 },
+ { "TreatWarningsAsErrors", "WX", "", "true", 0 },
+ { "MakeAllSymbolsPublic", "Zf", "", "true", 0 },
+ { "GenerateDebugInformation", "Zi", "", "true", 0 },
+ { "EnableMASM51Compatibility", "Zm", "", "true", 0 },
+ { "PerformSyntaxCheckOnly", "Zs", "", "true", 0 },
// Bool Properties With Argument
// String List Properties
- { "PreprocessorDefinitions", "/D", "Preprocessor Definitions", "",
+ { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "IncludePaths", "/I", "Include Paths", "",
+ { "IncludePaths", "I", "Include Paths", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
- { "BrowseFile", "/FR", "Generate Browse Information File", "",
+ { "BrowseFile", "FR", "Generate Browse Information File", "",
cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable },
// Skip [AdditionalDependencies] - no command line Switch.
// String Properties
// Skip [Inputs] - no command line Switch.
- { "ObjectFileName", "/Fo", "Object File Name", "",
+ { "ObjectFileName", "Fo", "Object File Name", "",
cmVS7FlagTable::UserValue },
- { "AssembledCodeListingFile", "/Fl", "Assembled Code Listing File", "",
+ { "AssembledCodeListingFile", "Fl", "Assembled Code Listing File", "",
cmVS7FlagTable::UserValue },
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index 6afb11a..9808d5f 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "variable_requires"; }
};
#endif
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 7096ed5..9f04391 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -38,20 +38,10 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
/** This command does not really have a final pass but it needs to
stay alive since it owns variable watch callback information. */
bool HasFinalPass() const CM_OVERRIDE { return true; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "variable_watch"; }
-
protected:
std::set<std::string> WatchedVariables;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5a09718..4fcf5dc 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -297,8 +297,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectConfigurations();
}
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
- this->WriteString("<ProjectGUID>", 2);
- (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
+ this->WriteString("<ProjectGuid>", 2);
+ (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGuid>\n";
if (this->MSTools &&
this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) {
@@ -1943,9 +1943,24 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
hasFlags = true;
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ cmIDEFlagTable const* flagtable = CM_NULLPTR;
+ const std::string& srclang = source->GetLanguage();
+ if (srclang == "C" || srclang == "CXX") {
+ flagtable = gg->GetClFlagTable();
+ } else if (srclang == "ASM_MASM" &&
+ this->GlobalGenerator->IsMasmEnabled()) {
+ flagtable = gg->GetMasmFlagTable();
+ } else if (lang == "ASM_NASM" &&
+ this->GlobalGenerator->IsNasmEnabled()) {
+ flagtable = gg->GetNasmFlagTable();
+ } else if (srclang == "RC") {
+ flagtable = gg->GetRcFlagTable();
+ } else if (srclang == "CSharp") {
+ flagtable = gg->GetCSharpFlagTable();
+ }
cmVisualStudioGeneratorOptions clOptions(
this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler,
- gg->GetClFlagTable(), 0, this);
+ flagtable, 0, this);
if (compileAs) {
clOptions.AddFlag("CompileAs", compileAs);
}
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 38ea637..24d7bf1 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -82,7 +82,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus status;
mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) {
- inStatus.SetReturnInvoked(true);
+ inStatus.SetReturnInvoked();
return true;
}
if (status.GetBreakInvoked()) {
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index daf1046..a95e4c3 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -57,16 +57,6 @@ public:
{
return false;
}
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "while"; }
};
#endif
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 7196ccf..19922cd 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -30,16 +30,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "write_file"; }
};
#endif
diff --git a/Source/cm_auto_ptr.hxx b/Source/cm_auto_ptr.hxx
index 2b5c059..773602a 100644
--- a/Source/cm_auto_ptr.hxx
+++ b/Source/cm_auto_ptr.hxx
@@ -100,10 +100,10 @@ public:
/** Assign from an auto_ptr holding a compatible object. This
transfers ownership to the left-hand-side of the assignment. */
template <class Y>
- auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
+ auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw() // NOLINT
{
this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this;
+ return *this; // NOLINT
}
/**
@@ -127,10 +127,10 @@ public:
/** Assign from another auto_ptr holding an object of the same type.
This transfers ownership to the newly constructed auto_ptr. */
- auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw()
+ auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw() // NOLINT
{
this->reset(cm_AUTO_PTR_CAST(a).release());
- return *this;
+ return *this; // NOLINT
}
/** Destruct and delete the object held. */
@@ -192,7 +192,7 @@ public:
auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
{
this->reset(r.p_);
- return *this;
+ return *this; // NOLINT
}
/** Convert to an auto_ptr_ref. This is used when a function
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 737587d..53e9ab0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -136,7 +136,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cm->MarkCliAsUsed(variable);
}
-cmake::cmake()
+cmake::cmake(Role role)
{
this->Trace = false;
this->TraceExpand = false;
@@ -174,8 +174,12 @@ cmake::cmake()
this->AddDefaultGenerators();
this->AddDefaultExtraGenerators();
- this->AddScriptingCommands();
- this->AddProjectCommands();
+ if (role == RoleScript || role == RoleProject) {
+ this->AddScriptingCommands();
+ }
+ if (role == RoleProject) {
+ this->AddProjectCommands();
+ }
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
@@ -443,6 +447,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmSystemTools::Error("No cmake script provided.");
return false;
}
+ // Register fake project commands that hint misuse in script mode.
+ GetProjectCommandsInScriptMode(this->State);
this->ReadListFile(args, path.c_str());
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
@@ -1888,7 +1894,7 @@ int cmake::CheckBuildSystem()
// Read the rerun check file and use it to decide whether to do the
// global generate.
- cmake cm;
+ cmake cm(RoleScript); // Actually, all we need is the `set` command.
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -2419,6 +2425,9 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::string homeOutputOrig = this->GetHomeOutputDirectory();
this->SetDirectoriesFromFile(cachePath.c_str());
+ this->AddScriptingCommands();
+ this->AddProjectCommands();
+
int ret = this->Configure();
if (ret) {
cmSystemTools::Message("CMake Configure step failed. "
diff --git a/Source/cmake.h b/Source/cmake.h
index 16a2830..4ddacf7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -58,6 +58,13 @@ class cmake
CM_DISABLE_COPY(cmake)
public:
+ enum Role
+ {
+ RoleInternal, // no commands
+ RoleScript, // script commands
+ RoleProject // all commands
+ };
+
enum MessageType
{
AUTHOR_WARNING,
@@ -112,7 +119,7 @@ public:
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
/// Default constructor
- cmake();
+ cmake(Role role);
/// Destructor
~cmake();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 3d11241..6e65955 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -201,7 +201,7 @@ int do_cmake(int ac, char const* const* av)
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(ac, av)) {
// Construct and print requested documentation.
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
@@ -283,13 +283,15 @@ int do_cmake(int ac, char const* const* av)
}
}
if (sysinfo) {
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
int ret = cm.GetSystemInformation(args);
return ret;
}
- cmake cm;
+ cmake::Role const role =
+ workingMode == cmake::NORMAL_MODE ? cmake::RoleProject : cmake::RoleScript;
+ cmake cm(role);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
@@ -407,7 +409,7 @@ static int do_build(int ac, char const* const* av)
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm);
return cm.Build(dir, target, config, nativeOptions, clean);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index cc954e6..dc267e7 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -583,7 +583,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "-E capabilities accepts no additional arguments\n";
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE
std::cout << cm.ReportCapabilities(true);
#else
@@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
const bool verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
- cmake cm;
+ cmake cm(cmake::RoleScript); // All we need is the `set` command.
std::string gen;
std::string homeDir;
std::string startDir;
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 135062d..84e815d 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmDocumentation.h"
#include "cmSystemTools.h"
-#include "cmake.h"
#include "cmsys/Encoding.hxx"
#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
@@ -52,6 +51,18 @@ static const char* cmDocumentationOptions[][2] = {
"expression." },
{ "-LE <regex>, --label-exclude <regex>", "Exclude tests with labels "
"matching regular expression." },
+ { "-FA <regex>, --fixture-exclude-any <regex>", "Do not automatically "
+ "add any tests for "
+ "fixtures matching "
+ "regular expression." },
+ { "-FS <regex>, --fixture-exclude-setup <regex>", "Do not automatically "
+ "add setup tests for "
+ "fixtures matching "
+ "regular expression." },
+ { "-FC <regex>, --fixture-exclude-cleanup <regex>", "Do not automatically "
+ "add cleanup tests for "
+ "fixtures matching "
+ "regular expression." },
{ "-D <dashboard>, --dashboard <dashboard>", "Execute dashboard test" },
{ "-D <var>:<type>=<value>", "Define a variable for script mode" },
{ "-M <model>, --test-model <model>", "Sets the model for a dashboard" },
@@ -158,11 +169,6 @@ int main(int argc, char const* const* argv)
cmDocumentation doc;
doc.addCTestStandardDocSections();
if (doc.CheckOptions(argc, argv)) {
- cmake hcm;
- hcm.SetHomeDirectory("");
- hcm.SetHomeOutputDirectory("");
- hcm.AddCMakePaths();
-
// Construct and print requested documentation.
cmCTestScriptHandler* ch =
static_cast<cmCTestScriptHandler*>(inst.GetHandler("script"));
diff --git a/Source/kwsys/Base64.c b/Source/kwsys/Base64.c
index 37c3b8c..99f008e 100644
--- a/Source/kwsys/Base64.c
+++ b/Source/kwsys/Base64.c
@@ -9,13 +9,11 @@
#include "Base64.h.in"
#endif
-/*--------------------------------------------------------------------------*/
static const unsigned char kwsysBase64EncodeTable[65] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
-/*--------------------------------------------------------------------------*/
static const unsigned char kwsysBase64DecodeTable[256] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -40,19 +38,16 @@ static const unsigned char kwsysBase64DecodeTable[256] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
-/*--------------------------------------------------------------------------*/
static unsigned char kwsysBase64EncodeChar(int c)
{
return kwsysBase64EncodeTable[(unsigned char)c];
}
-/*--------------------------------------------------------------------------*/
static unsigned char kwsysBase64DecodeChar(unsigned char c)
{
return kwsysBase64DecodeTable[c];
}
-/*--------------------------------------------------------------------------*/
/* Encode 3 bytes into a 4 byte string. */
void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
{
@@ -64,7 +59,6 @@ void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
dest[3] = kwsysBase64EncodeChar(src[2] & 0x3F);
}
-/*--------------------------------------------------------------------------*/
/* Encode 2 bytes into a 4 byte string. */
void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
{
@@ -75,7 +69,6 @@ void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
dest[3] = '=';
}
-/*--------------------------------------------------------------------------*/
/* Encode 1 bytes into a 4 byte string. */
void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
{
@@ -85,7 +78,6 @@ void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
dest[3] = '=';
}
-/*--------------------------------------------------------------------------*/
/* Encode 'length' bytes from the input buffer and store the
encoded stream into the output buffer. Return the length of the encoded
buffer (output). Note that the output buffer must be allocated by the caller
@@ -135,7 +127,6 @@ size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
return (size_t)(optr - output);
}
-/*--------------------------------------------------------------------------*/
/* Decode 4 bytes into a 3 byte string. */
int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
{
@@ -169,7 +160,6 @@ int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
return 3;
}
-/*--------------------------------------------------------------------------*/
/* Decode bytes from the input buffer and store the decoded stream
into the output buffer until 'length' bytes have been decoded. Return the
real length of the decoded stream (which should be equal to 'length'). Note
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index e15b49e..e915b1a 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -797,6 +797,8 @@ ENDFOREACH()
IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE}
${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB})
@@ -943,6 +945,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
ENDIF()
IF(KWSYS_USE_ConsoleBuf)
ADD_EXECUTABLE(testConsoleBufChild testConsoleBufChild.cxx)
+ SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE})
@@ -972,6 +976,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
${KWSYS_CXX_TESTS}
)
ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS})
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_CLANG_TIDY "")
+ SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_CLANG_TIDY "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE})
@@ -1039,8 +1045,12 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Some Apple compilers produce bad optimizations in this source.
IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$")
SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0)
- ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL")
+ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND
+ NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
+ NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1"))
# Tell IBM XL not to warn about our test infinite loop
+ # v13.1.1 and newer on Linux ppc64le is clang based and does not accept
+ # the -qsuppress option
SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010)
ENDIF()
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 226263c..5613bd7 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -41,8 +41,6 @@
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
-//============================================================================
struct CommandLineArgumentsCallbackStructure
{
const char* Argument;
@@ -91,10 +89,7 @@ public:
VectorOfStrings UnusedArguments;
};
-//============================================================================
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
CommandLineArguments::CommandLineArguments()
{
this->Internals = new CommandLineArguments::Internal;
@@ -103,13 +98,11 @@ CommandLineArguments::CommandLineArguments()
this->StoreUnusedArgumentsFlag = false;
}
-//----------------------------------------------------------------------------
CommandLineArguments::~CommandLineArguments()
{
delete this->Internals;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::Initialize(int argc, const char* const argv[])
{
int cc;
@@ -121,26 +114,22 @@ void CommandLineArguments::Initialize(int argc, const char* const argv[])
}
}
-//----------------------------------------------------------------------------
void CommandLineArguments::Initialize(int argc, char* argv[])
{
this->Initialize(argc, static_cast<const char* const*>(argv));
}
-//----------------------------------------------------------------------------
void CommandLineArguments::Initialize()
{
this->Internals->Argv.clear();
this->Internals->LastArgument = 0;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::ProcessArgument(const char* arg)
{
this->Internals->Argv.push_back(arg);
}
-//----------------------------------------------------------------------------
bool CommandLineArguments::GetMatchedArguments(
std::vector<std::string>* matches, const std::string& arg)
{
@@ -164,7 +153,6 @@ bool CommandLineArguments::GetMatchedArguments(
return !matches->empty();
}
-//----------------------------------------------------------------------------
int CommandLineArguments::Parse()
{
std::vector<std::string>::size_type cc;
@@ -286,7 +274,6 @@ int CommandLineArguments::Parse()
return 1;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::GetRemainingArguments(int* argc, char*** argv)
{
CommandLineArguments::Internal::VectorOfStrings::size_type size =
@@ -310,7 +297,6 @@ void CommandLineArguments::GetRemainingArguments(int* argc, char*** argv)
*argv = args;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::GetUnusedArguments(int* argc, char*** argv)
{
CommandLineArguments::Internal::VectorOfStrings::size_type size =
@@ -334,7 +320,6 @@ void CommandLineArguments::GetUnusedArguments(int* argc, char*** argv)
*argv = args;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
{
int cc;
@@ -344,7 +329,6 @@ void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
delete[] * argv;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::AddCallback(const char* argument,
ArgumentTypeEnum type,
CallbackType callback, void* call_data,
@@ -363,7 +347,6 @@ void CommandLineArguments::AddCallback(const char* argument,
this->GenerateHelp();
}
-//----------------------------------------------------------------------------
void CommandLineArguments::AddArgument(const char* argument,
ArgumentTypeEnum type,
VariableTypeEnum vtype, void* variable,
@@ -382,7 +365,6 @@ void CommandLineArguments::AddArgument(const char* argument,
this->GenerateHelp();
}
-//----------------------------------------------------------------------------
#define CommandLineArgumentsAddArgumentMacro(type, ctype) \
void CommandLineArguments::AddArgument(const char* argument, \
ArgumentTypeEnum type, \
@@ -392,22 +374,24 @@ void CommandLineArguments::AddArgument(const char* argument,
variable, help); \
}
+/* clang-format off */
CommandLineArgumentsAddArgumentMacro(BOOL, bool)
- CommandLineArgumentsAddArgumentMacro(INT, int)
- CommandLineArgumentsAddArgumentMacro(DOUBLE, double)
- CommandLineArgumentsAddArgumentMacro(STRING, char*)
- CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string)
-
- CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>)
- CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>)
- CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE,
- std::vector<double>)
- CommandLineArgumentsAddArgumentMacro(VECTOR_STRING,
- std::vector<char*>)
- CommandLineArgumentsAddArgumentMacro(
- VECTOR_STL_STRING, std::vector<std::string>)
-
-//----------------------------------------------------------------------------
+CommandLineArgumentsAddArgumentMacro(INT, int)
+CommandLineArgumentsAddArgumentMacro(DOUBLE, double)
+CommandLineArgumentsAddArgumentMacro(STRING, char*)
+CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string)
+
+CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector<double>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector<char*>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING,
+ std::vector<std::string>)
+#ifdef HELP_CLANG_FORMAT
+;
+#endif
+/* clang-format on */
+
#define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \
void CommandLineArguments::AddBooleanArgument( \
const char* argument, ctype* variable, const char* help) \
@@ -416,29 +400,28 @@ CommandLineArgumentsAddArgumentMacro(BOOL, bool)
CommandLineArguments::type##_TYPE, variable, help); \
}
- CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool)
- CommandLineArgumentsAddBooleanArgumentMacro(INT, int)
- CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE,
- double)
- CommandLineArgumentsAddBooleanArgumentMacro(STRING,
- char*)
- CommandLineArgumentsAddBooleanArgumentMacro(
- STL_STRING, std::string)
+/* clang-format off */
+CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool)
+CommandLineArgumentsAddBooleanArgumentMacro(INT, int)
+CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double)
+CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*)
+CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, std::string)
+#ifdef HELP_CLANG_FORMAT
+;
+#endif
+/* clang-format on */
- //----------------------------------------------------------------------------
- void CommandLineArguments::SetClientData(void* client_data)
+void CommandLineArguments::SetClientData(void* client_data)
{
this->Internals->ClientData = client_data;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::SetUnknownArgumentCallback(
CommandLineArguments::ErrorCallbackType callback)
{
this->Internals->UnknownArgumentCallback = callback;
}
-//----------------------------------------------------------------------------
const char* CommandLineArguments::GetHelp(const char* arg)
{
CommandLineArguments::Internal::CallbacksMap::iterator it =
@@ -461,7 +444,6 @@ const char* CommandLineArguments::GetHelp(const char* arg)
return cs->Help;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::SetLineLength(unsigned int ll)
{
if (ll < 9 || ll > 1000) {
@@ -471,19 +453,16 @@ void CommandLineArguments::SetLineLength(unsigned int ll)
this->GenerateHelp();
}
-//----------------------------------------------------------------------------
const char* CommandLineArguments::GetArgv0()
{
return this->Internals->Argv0.c_str();
}
-//----------------------------------------------------------------------------
unsigned int CommandLineArguments::GetLastArgument()
{
return static_cast<unsigned int>(this->Internals->LastArgument + 1);
}
-//----------------------------------------------------------------------------
void CommandLineArguments::GenerateHelp()
{
std::ostringstream str;
@@ -633,7 +612,6 @@ void CommandLineArguments::GenerateHelp()
this->Help = str.str();
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(bool* variable,
const std::string& value)
{
@@ -646,7 +624,6 @@ void CommandLineArguments::PopulateVariable(bool* variable,
}
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(int* variable,
const std::string& value)
{
@@ -658,7 +635,6 @@ void CommandLineArguments::PopulateVariable(int* variable,
// }
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(double* variable,
const std::string& value)
{
@@ -670,7 +646,6 @@ void CommandLineArguments::PopulateVariable(double* variable,
// }
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(char** variable,
const std::string& value)
{
@@ -682,14 +657,12 @@ void CommandLineArguments::PopulateVariable(char** variable,
strcpy(*variable, value.c_str());
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::string* variable,
const std::string& value)
{
*variable = value;
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
const std::string& value)
{
@@ -702,7 +675,6 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
variable->push_back(val);
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
const std::string& value)
{
@@ -714,7 +686,6 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
// }
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
const std::string& value)
{
@@ -726,7 +697,6 @@ void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
// }
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
const std::string& value)
{
@@ -735,14 +705,12 @@ void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
variable->push_back(var);
}
-//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(std::vector<std::string>* variable,
const std::string& value)
{
variable->push_back(value);
}
-//----------------------------------------------------------------------------
bool CommandLineArguments::PopulateVariable(
CommandLineArgumentsCallbackStructure* cs, const char* value)
{
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 3c31b49..ca1cb18 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -20,7 +20,6 @@
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
class DirectoryInternals
{
public:
@@ -31,25 +30,21 @@ public:
std::string Path;
};
-//----------------------------------------------------------------------------
Directory::Directory()
{
this->Internal = new DirectoryInternals;
}
-//----------------------------------------------------------------------------
Directory::~Directory()
{
delete this->Internal;
}
-//----------------------------------------------------------------------------
unsigned long Directory::GetNumberOfFiles() const
{
return static_cast<unsigned long>(this->Internal->Files.size());
}
-//----------------------------------------------------------------------------
const char* Directory::GetFile(unsigned long dindex) const
{
if (dindex >= this->Internal->Files.size()) {
@@ -58,13 +53,11 @@ const char* Directory::GetFile(unsigned long dindex) const
return this->Internal->Files[dindex].c_str();
}
-//----------------------------------------------------------------------------
const char* Directory::GetPath() const
{
return this->Internal->Path.c_str();
}
-//----------------------------------------------------------------------------
void Directory::Clear()
{
this->Internal->Path.resize(0);
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index e494db6..1b4596a 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -26,20 +26,17 @@
// the static methods of DynamicLoader.
#if !KWSYS_SUPPORTS_SHARED_LIBS
-//----------------------------------------------------------------------------
// Implementation for environments without dynamic libs
#include <string.h> // for strerror()
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
return 0;
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
if (!lib) {
@@ -49,14 +46,12 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return 1;
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
return 0;
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
return "General error";
@@ -65,21 +60,18 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(__hpux)
-//----------------------------------------------------------------------------
// Implementation for HPUX machines
#include <dl.h>
#include <errno.h>
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
if (!lib) {
@@ -88,7 +80,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return !shl_unload(lib);
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -132,14 +123,12 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1030)
-//----------------------------------------------------------------------------
// Implementation for Mac OS X 10.2.x and earlier
#include <mach-o/dyld.h>
#include <string.h> // for strlen
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
@@ -158,7 +147,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
return handle;
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
// NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED
@@ -170,7 +158,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return success;
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -191,7 +178,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
return 0;
@@ -200,13 +186,11 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(_WIN32) && !defined(__CYGWIN__)
-//----------------------------------------------------------------------------
// Implementation for Windows win32 code but not cygwin
#include <windows.h>
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
@@ -220,13 +204,11 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
return lh;
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
return (int)FreeLibrary(lib);
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -274,7 +256,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
#endif
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
LPVOID lpMsgBuf = NULL;
@@ -299,7 +280,6 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(__BEOS__)
-//----------------------------------------------------------------------------
// Implementation for BeOS / Haiku
#include <string.h> // for strerror()
@@ -310,7 +290,6 @@ namespace KWSYS_NAMESPACE {
static image_id last_dynamic_err = B_OK;
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
@@ -325,7 +304,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
return rc + 1;
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
if (!lib) {
@@ -343,7 +321,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return 1;
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -372,7 +349,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
const char* retval = strerror(last_dynamic_err);
@@ -383,7 +359,6 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#elif defined(__MINT__)
-//----------------------------------------------------------------------------
// Implementation for FreeMiNT on Atari
#define _GNU_SOURCE /* for program_invocation_name */
#include <dld.h>
@@ -393,7 +368,6 @@ const char* DynamicLoader::LastError()
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
@@ -404,7 +378,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
return (void*)name;
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
dld_unlink_by_file((char*)lib, 0);
@@ -412,7 +385,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return 0;
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -426,7 +398,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
return dld_strerror(dld_errno);
@@ -435,21 +406,18 @@ const char* DynamicLoader::LastError()
} // namespace KWSYS_NAMESPACE
#else
-//----------------------------------------------------------------------------
// Default implementation for *NIX systems (including Mac OS X 10.3 and
// later) which use dlopen
#include <dlfcn.h>
namespace KWSYS_NAMESPACE {
-//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname)
{
return dlopen(libname.c_str(), RTLD_LAZY);
}
-//----------------------------------------------------------------------------
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
{
if (lib) {
@@ -460,7 +428,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
return 0;
}
-//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const std::string& sym)
{
@@ -474,7 +441,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
return result.psym;
}
-//----------------------------------------------------------------------------
const char* DynamicLoader::LastError()
{
return dlerror();
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index fa8760d..d2f0b85 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -37,7 +37,6 @@ namespace KWSYS_NAMESPACE {
#define KWSYS_GLOB_SUPPORT_NETWORK_PATHS
#endif
-//----------------------------------------------------------------------------
class GlobInternals
{
public:
@@ -45,7 +44,6 @@ public:
std::vector<kwsys::RegularExpression> Expressions;
};
-//----------------------------------------------------------------------------
Glob::Glob()
{
this->Internals = new GlobInternals;
@@ -62,19 +60,16 @@ Glob::Glob()
this->RecurseListDirs = false;
}
-//----------------------------------------------------------------------------
Glob::~Glob()
{
delete this->Internals;
}
-//----------------------------------------------------------------------------
std::vector<std::string>& Glob::GetFiles()
{
return this->Internals->Files;
}
-//----------------------------------------------------------------------------
std::string Glob::PatternToRegex(const std::string& pattern,
bool require_whole_string, bool preserve_case)
{
@@ -183,7 +178,6 @@ std::string Glob::PatternToRegex(const std::string& pattern,
return regex;
}
-//----------------------------------------------------------------------------
bool Glob::RecurseDirectory(std::string::size_type start,
const std::string& dir, GlobMessages* messages)
{
@@ -277,7 +271,6 @@ bool Glob::RecurseDirectory(std::string::size_type start,
return true;
}
-//----------------------------------------------------------------------------
void Glob::ProcessDirectory(std::string::size_type start,
const std::string& dir, GlobMessages* messages)
{
@@ -337,7 +330,6 @@ void Glob::ProcessDirectory(std::string::size_type start,
}
}
-//----------------------------------------------------------------------------
bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
{
std::string cexpr;
@@ -420,14 +412,12 @@ bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
return true;
}
-//----------------------------------------------------------------------------
void Glob::AddExpression(const std::string& expr)
{
this->Internals->Expressions.push_back(
kwsys::RegularExpression(this->PatternToRegex(expr)));
}
-//----------------------------------------------------------------------------
void Glob::SetRelative(const char* dir)
{
if (!dir) {
@@ -437,7 +427,6 @@ void Glob::SetRelative(const char* dir)
this->Relative = dir;
}
-//----------------------------------------------------------------------------
const char* Glob::GetRelative()
{
if (this->Relative.empty()) {
@@ -446,7 +435,6 @@ const char* Glob::GetRelative()
return this->Relative.c_str();
}
-//----------------------------------------------------------------------------
void Glob::AddFile(std::vector<std::string>& files, const std::string& file)
{
if (!this->Relative.empty()) {
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index 1310c64..3188fb6 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -13,8 +13,6 @@
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy, strlen */
-/*--------------------------------------------------------------------------*/
-
/* This MD5 implementation has been taken from a third party. Slight
modifications to the arrangement of the code have been made to put
it in a single source file instead of a separate header and
@@ -425,14 +423,12 @@ static void md5_finish(md5_state_t* pms, md5_byte_t digest[16])
#pragma clang diagnostic pop
#endif
-/*--------------------------------------------------------------------------*/
/* Wrap up the MD5 state in our opaque structure. */
struct kwsysMD5_s
{
md5_state_t md5_state;
};
-/*--------------------------------------------------------------------------*/
kwsysMD5* kwsysMD5_New(void)
{
/* Allocate a process control structure. */
@@ -443,7 +439,6 @@ kwsysMD5* kwsysMD5_New(void)
return md5;
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_Delete(kwsysMD5* md5)
{
/* Make sure we have an instance. */
@@ -455,13 +450,11 @@ void kwsysMD5_Delete(kwsysMD5* md5)
free(md5);
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_Initialize(kwsysMD5* md5)
{
md5_init(&md5->md5_state);
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length)
{
size_t dlen;
@@ -473,13 +466,11 @@ void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length)
md5_append(&md5->md5_state, (md5_byte_t const*)data, dlen);
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_Finalize(kwsysMD5* md5, unsigned char digest[16])
{
md5_finish(&md5->md5_state, (md5_byte_t*)digest);
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_FinalizeHex(kwsysMD5* md5, char buffer[32])
{
unsigned char digest[16];
@@ -487,7 +478,6 @@ void kwsysMD5_FinalizeHex(kwsysMD5* md5, char buffer[32])
kwsysMD5_DigestToHex(digest, buffer);
}
-/*--------------------------------------------------------------------------*/
void kwsysMD5_DigestToHex(unsigned char const digest[16], char buffer[32])
{
/* Map from 4-bit index to hexadecimal representation. */
diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in
index b8349a6..237001c 100644
--- a/Source/kwsys/Process.h.in
+++ b/Source/kwsys/Process.h.in
@@ -42,7 +42,6 @@
#define kwsysProcess_State_Expired kwsys_ns(Process_State_Expired)
#define kwsysProcess_State_Killed kwsys_ns(Process_State_Killed)
#define kwsysProcess_State_Disowned kwsys_ns(Process_State_Disowned)
-#define kwsysProcess_GetState kwsys_ns(Process_GetState)
#define kwsysProcess_State_e kwsys_ns(Process_State_e)
#define kwsysProcess_Exception_None kwsys_ns(Process_Exception_None)
#define kwsysProcess_Exception_Fault kwsys_ns(Process_Exception_Fault)
@@ -50,12 +49,21 @@
#define kwsysProcess_Exception_Interrupt kwsys_ns(Process_Exception_Interrupt)
#define kwsysProcess_Exception_Numerical kwsys_ns(Process_Exception_Numerical)
#define kwsysProcess_Exception_Other kwsys_ns(Process_Exception_Other)
-#define kwsysProcess_GetExitException kwsys_ns(Process_GetExitException)
#define kwsysProcess_Exception_e kwsys_ns(Process_Exception_e)
+#define kwsysProcess_GetState kwsys_ns(Process_GetState)
+#define kwsysProcess_GetExitException kwsys_ns(Process_GetExitException)
#define kwsysProcess_GetExitCode kwsys_ns(Process_GetExitCode)
#define kwsysProcess_GetExitValue kwsys_ns(Process_GetExitValue)
#define kwsysProcess_GetErrorString kwsys_ns(Process_GetErrorString)
#define kwsysProcess_GetExceptionString kwsys_ns(Process_GetExceptionString)
+#define kwsysProcess_GetStateByIndex kwsys_ns(Process_GetStateByIndex)
+#define kwsysProcess_GetExitExceptionByIndex \
+ kwsys_ns(Process_GetExitExceptionByIndex)
+#define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex)
+#define kwsysProcess_GetExitValueByIndex kwsys_ns(Process_GetExitValueByIndex)
+#define kwsysProcess_GetExceptionStringByIndex \
+ kwsys_ns(Process_GetExceptionStringByIndex)
+#define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex)
#define kwsysProcess_Execute kwsys_ns(Process_Execute)
#define kwsysProcess_Disown kwsys_ns(Process_Disown)
#define kwsysProcess_WaitForData kwsys_ns(Process_WaitForData)
@@ -298,6 +306,67 @@ kwsysEXPORT const char* kwsysProcess_GetErrorString(kwsysProcess* cp);
kwsysEXPORT const char* kwsysProcess_GetExceptionString(kwsysProcess* cp);
/**
+* Get the current state of the Process instance. Possible states are:
+*
+* kwsysProcess_StateByIndex_Starting = Execute has not yet been called.
+* kwsysProcess_StateByIndex_Exception = Child process exited abnormally.
+* kwsysProcess_StateByIndex_Exited = Child process exited normally.
+* kwsysProcess_StateByIndex_Error = Error getting the child return code.
+*/
+kwsysEXPORT int kwsysProcess_GetStateByIndex(kwsysProcess* cp, int idx);
+enum kwsysProcess_StateByIndex_e
+{
+ kwsysProcess_StateByIndex_Starting = kwsysProcess_State_Starting,
+ kwsysProcess_StateByIndex_Exception = kwsysProcess_State_Exception,
+ kwsysProcess_StateByIndex_Exited = kwsysProcess_State_Exited,
+ kwsysProcess_StateByIndex_Error = kwsysProcess_State_Error
+};
+
+/**
+* When GetState returns "Exception", this method returns a
+* platform-independent description of the exceptional behavior that
+* caused the child to terminate abnormally. Possible exceptions are:
+*
+* kwsysProcess_Exception_None = No exceptional behavior occurred.
+* kwsysProcess_Exception_Fault = Child crashed with a memory fault.
+* kwsysProcess_Exception_Illegal = Child crashed with an illegal
+* instruction.
+* kwsysProcess_Exception_Interrupt = Child was interrupted by user
+* (Cntl-C/Break).
+* kwsysProcess_Exception_Numerical = Child crashed with a numerical
+* exception.
+* kwsysProcess_Exception_Other = Child terminated for another reason.
+*/
+kwsysEXPORT int kwsysProcess_GetExitExceptionByIndex(kwsysProcess* cp,
+ int idx);
+
+/**
+* When GetState returns "Exited" or "Exception", this method returns
+* the platform-specific raw exit code of the process. UNIX platforms
+* should use WIFEXITED/WEXITSTATUS and WIFSIGNALED/WTERMSIG to access
+* this value. Windows users should compare the value to the various
+* EXCEPTION_* values.
+*
+* If GetState returns "Exited", use GetExitValue to get the
+* platform-independent child return value.
+*/
+kwsysEXPORT int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx);
+
+/**
+* When GetState returns "Exited", this method returns the child's
+* platform-independent exit code (such as the value returned by the
+* child's main).
+*/
+kwsysEXPORT int kwsysProcess_GetExitValueByIndex(kwsysProcess* cp, int idx);
+
+/**
+* When GetState returns "Exception", this method returns a string
+* describing the problem. Otherwise, it returns NULL.
+*/
+kwsysEXPORT const char* kwsysProcess_GetExceptionStringByIndex(
+ kwsysProcess* cp, int idx);
+
+/**
* Start executing the child process.
*/
kwsysEXPORT void kwsysProcess_Execute(kwsysProcess* cp);
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index ed09095..9ebcfce 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -140,7 +140,6 @@ typedef struct kwsysProcessCreateInformation_s
int ErrorPipe[2];
} kwsysProcessCreateInformation;
-/*--------------------------------------------------------------------------*/
static void kwsysProcessVolatileFree(volatile void* p);
static int kwsysProcessInitialize(kwsysProcess* cp);
static void kwsysProcessCleanup(kwsysProcess* cp, int error);
@@ -166,7 +165,8 @@ static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
kwsysProcessTime in2);
static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
kwsysProcessTime in2);
-static void kwsysProcessSetExitException(kwsysProcess* cp, int sig);
+static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig,
+ int idx);
static void kwsysProcessChildErrorExit(int errorPipe);
static void kwsysProcessRestoreDefaultSignalHandlers(void);
static pid_t kwsysProcessFork(kwsysProcess* cp,
@@ -184,7 +184,26 @@ static void kwsysProcessesSignalHandler(int signum, siginfo_t* info,
static void kwsysProcessesSignalHandler(int signum);
#endif
-/*--------------------------------------------------------------------------*/
+/* A structure containing results data for each process. */
+typedef struct kwsysProcessResults_s kwsysProcessResults;
+struct kwsysProcessResults_s
+{
+ /* The status of the child process. */
+ int State;
+
+ /* The exceptional behavior that terminated the process, if any. */
+ int ExitException;
+
+ /* The process exit code. */
+ int ExitCode;
+
+ /* The process return code, if any. */
+ int ExitValue;
+
+ /* Description for the ExitException. */
+ char ExitExceptionString[KWSYSPE_PIPE_BUFFER_SIZE + 1];
+};
+
/* Structure containing data used to implement the child's execution. */
struct kwsysProcess_s
{
@@ -255,28 +274,18 @@ struct kwsysProcess_s
/* The number of children still executing. */
int CommandsLeft;
- /* The current status of the child process. Must be atomic because
+ /* The status of the process structure. Must be atomic because
the signal handler checks this to avoid a race. */
volatile sig_atomic_t State;
- /* The exceptional behavior that terminated the child process, if
- * any. */
- int ExitException;
-
- /* The exit code of the child process. */
- int ExitCode;
-
- /* The exit value of the child process, if any. */
- int ExitValue;
-
/* Whether the process was killed. */
volatile sig_atomic_t Killed;
/* Buffer for error message in case of failure. */
char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE + 1];
- /* Description for the ExitException. */
- char ExitExceptionString[KWSYSPE_PIPE_BUFFER_SIZE + 1];
+ /* process results. */
+ kwsysProcessResults* ProcessResults;
/* The exit codes of each child process in the pipeline. */
int* CommandExitCodes;
@@ -301,7 +310,6 @@ struct kwsysProcess_s
char* RealWorkingDirectory;
};
-/*--------------------------------------------------------------------------*/
kwsysProcess* kwsysProcess_New(void)
{
/* Allocate a process control structure. */
@@ -328,7 +336,6 @@ kwsysProcess* kwsysProcess_New(void)
return cp;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Delete(kwsysProcess* cp)
{
/* Make sure we have an instance. */
@@ -354,10 +361,10 @@ void kwsysProcess_Delete(kwsysProcess* cp)
if (cp->CommandExitCodes) {
free(cp->CommandExitCodes);
}
+ free(cp->ProcessResults);
free(cp);
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command)
{
int i;
@@ -382,7 +389,6 @@ int kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command)
return 1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
{
int newNumberOfCommands;
@@ -462,7 +468,6 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
{
if (!cp) {
@@ -476,7 +481,6 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
cp->TimeoutTime.tv_sec = -1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
{
if (!cp) {
@@ -502,7 +506,6 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
return 1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
{
char** pfile;
@@ -543,7 +546,6 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
{
if (!cp) {
@@ -572,7 +574,6 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, int p[2])
{
int* pPipeNative = 0;
@@ -612,7 +613,6 @@ void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, int p[2])
}
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
{
if (!cp) {
@@ -633,7 +633,6 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
{
if (!cp) {
@@ -658,31 +657,32 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
}
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetState(kwsysProcess* cp)
{
return cp ? cp->State : kwsysProcess_State_Error;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitException(kwsysProcess* cp)
{
- return cp ? cp->ExitException : kwsysProcess_Exception_Other;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitException
+ : kwsysProcess_Exception_Other;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitCode(kwsysProcess* cp)
{
- return cp ? cp->ExitCode : 0;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitCode
+ : 0;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitValue(kwsysProcess* cp)
{
- return cp ? cp->ExitValue : -1;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitValue
+ : -1;
}
-/*--------------------------------------------------------------------------*/
const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
{
if (!cp) {
@@ -693,18 +693,58 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
return "Success";
}
-/*--------------------------------------------------------------------------*/
const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
{
- if (!cp) {
+ if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
return "GetExceptionString called with NULL process management structure";
} else if (cp->State == kwsysProcess_State_Exception) {
- return cp->ExitExceptionString;
+ return cp->ProcessResults[cp->NumberOfCommands - 1].ExitExceptionString;
+ }
+ return "No exception";
+}
+
+/* the index should be in array bound. */
+#define KWSYSPE_IDX_CHK(RET) \
+ if (!cp || idx >= cp->NumberOfCommands || idx < 0) { \
+ return RET; \
+ }
+
+int kwsysProcess_GetStateByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(kwsysProcess_State_Error)
+ return cp->ProcessResults[idx].State;
+}
+
+int kwsysProcess_GetExitExceptionByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(kwsysProcess_Exception_Other)
+ return cp->ProcessResults[idx].ExitException;
+}
+
+int kwsysProcess_GetExitValueByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(-1)
+ return cp->ProcessResults[idx].ExitValue;
+}
+
+int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(-1)
+ return cp->CommandExitCodes[idx];
+}
+
+const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
+ "structure or index out of bound")
+ if (cp->ProcessResults[idx].State == kwsysProcess_StateByIndex_Exception) {
+ return cp->ProcessResults[idx].ExitExceptionString;
}
return "No exception";
}
-/*--------------------------------------------------------------------------*/
+#undef KWSYSPE_IDX_CHK
+
void kwsysProcess_Execute(kwsysProcess* cp)
{
int i;
@@ -990,7 +1030,6 @@ void kwsysProcess_Execute(kwsysProcess* cp)
cp->Detached = cp->OptionDetach;
}
-/*--------------------------------------------------------------------------*/
kwsysEXPORT void kwsysProcess_Disown(kwsysProcess* cp)
{
/* Make sure a detached child process is running. */
@@ -1009,7 +1048,6 @@ kwsysEXPORT void kwsysProcess_Disown(kwsysProcess* cp)
cp->State = kwsysProcess_State_Disowned;
}
-/*--------------------------------------------------------------------------*/
typedef struct kwsysProcessWaitData_s
{
int Expired;
@@ -1021,7 +1059,6 @@ typedef struct kwsysProcessWaitData_s
static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
kwsysProcessWaitData* wd);
-/*--------------------------------------------------------------------------*/
int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
double* userTimeout)
{
@@ -1083,7 +1120,6 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
kwsysProcessWaitData* wd)
{
@@ -1285,10 +1321,8 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
#endif
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
{
- int status = 0;
int prPipe = 0;
/* Make sure we are executing a process. */
@@ -1319,10 +1353,6 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
cp->State = kwsysProcess_State_Error;
return 1;
}
-
- /* Use the status of the last process in the pipeline. */
- status = cp->CommandExitCodes[cp->NumberOfCommands - 1];
-
/* Determine the outcome. */
if (cp->Killed) {
/* We killed the child. */
@@ -1330,29 +1360,36 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
} else if (cp->TimeoutExpired) {
/* The timeout expired. */
cp->State = kwsysProcess_State_Expired;
- } else if (WIFEXITED(status)) {
- /* The child exited normally. */
- cp->State = kwsysProcess_State_Exited;
- cp->ExitException = kwsysProcess_Exception_None;
- cp->ExitCode = status;
- cp->ExitValue = (int)WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- /* The child received an unhandled signal. */
- cp->State = kwsysProcess_State_Exception;
- cp->ExitCode = status;
- kwsysProcessSetExitException(cp, (int)WTERMSIG(status));
} else {
- /* Error getting the child return code. */
- strcpy(cp->ErrorMessage, "Error getting child return code.");
- cp->State = kwsysProcess_State_Error;
+ /* The children exited. Report the outcome of the child processes. */
+ for (prPipe = 0; prPipe < cp->NumberOfCommands; ++prPipe) {
+ cp->ProcessResults[prPipe].ExitCode = cp->CommandExitCodes[prPipe];
+ if (WIFEXITED(cp->ProcessResults[prPipe].ExitCode)) {
+ /* The child exited normally. */
+ cp->ProcessResults[prPipe].State = kwsysProcess_StateByIndex_Exited;
+ cp->ProcessResults[prPipe].ExitException = kwsysProcess_Exception_None;
+ cp->ProcessResults[prPipe].ExitValue =
+ (int)WEXITSTATUS(cp->ProcessResults[prPipe].ExitCode);
+ } else if (WIFSIGNALED(cp->ProcessResults[prPipe].ExitCode)) {
+ /* The child received an unhandled signal. */
+ cp->ProcessResults[prPipe].State = kwsysProcess_State_Exception;
+ kwsysProcessSetExitExceptionByIndex(
+ cp, (int)WTERMSIG(cp->ProcessResults[prPipe].ExitCode), prPipe);
+ } else {
+ /* Error getting the child return code. */
+ strcpy(cp->ProcessResults[prPipe].ExitExceptionString,
+ "Error getting child return code.");
+ cp->ProcessResults[prPipe].State = kwsysProcess_StateByIndex_Error;
+ }
+ }
+ /* support legacy state status value */
+ cp->State = cp->ProcessResults[cp->NumberOfCommands - 1].State;
}
-
/* Normal cleanup. */
kwsysProcessCleanup(cp, 0);
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Interrupt(kwsysProcess* cp)
{
int i;
@@ -1384,7 +1421,6 @@ void kwsysProcess_Interrupt(kwsysProcess* cp)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Kill(kwsysProcess* cp)
{
int i;
@@ -1431,7 +1467,6 @@ void kwsysProcess_Kill(kwsysProcess* cp)
cp->CommandsLeft = 0;
}
-/*--------------------------------------------------------------------------*/
/* Call the free() function with a pointer to volatile without causing
compiler warnings. */
static void kwsysProcessVolatileFree(volatile void* p)
@@ -1448,7 +1483,6 @@ static void kwsysProcessVolatileFree(volatile void* p)
#endif
}
-/*--------------------------------------------------------------------------*/
/* Initialize a process control structure for kwsysProcess_Execute. */
static int kwsysProcessInitialize(kwsysProcess* cp)
{
@@ -1474,11 +1508,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
#endif
cp->State = kwsysProcess_State_Starting;
cp->Killed = 0;
- cp->ExitException = kwsysProcess_Exception_None;
- cp->ExitCode = 1;
- cp->ExitValue = 1;
cp->ErrorMessage[0] = 0;
- strcpy(cp->ExitExceptionString, "No exception");
oldForkPIDs = cp->ForkPIDs;
cp->ForkPIDs = (volatile pid_t*)malloc(sizeof(volatile pid_t) *
@@ -1504,6 +1534,23 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
memset(cp->CommandExitCodes, 0,
sizeof(int) * (size_t)(cp->NumberOfCommands));
+ /* Allocate process result information for each process. */
+ free(cp->ProcessResults);
+ cp->ProcessResults = (kwsysProcessResults*)malloc(
+ sizeof(kwsysProcessResults) * (size_t)(cp->NumberOfCommands));
+ if (!cp->ProcessResults) {
+ return 0;
+ }
+ memset(cp->ProcessResults, 0,
+ sizeof(kwsysProcessResults) * (size_t)(cp->NumberOfCommands));
+ for (i = 0; i < cp->NumberOfCommands; i++) {
+ cp->ProcessResults[i].ExitException = kwsysProcess_Exception_None;
+ cp->ProcessResults[i].State = kwsysProcess_StateByIndex_Starting;
+ cp->ProcessResults[i].ExitCode = 1;
+ cp->ProcessResults[i].ExitValue = 1;
+ strcpy(cp->ProcessResults[i].ExitExceptionString, "No exception");
+ }
+
/* Allocate memory to save the real working directory. */
if (cp->WorkingDirectory) {
#if defined(MAXPATHLEN)
@@ -1523,7 +1570,6 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
return 1;
}
-/*--------------------------------------------------------------------------*/
/* Free all resources used by the given kwsysProcess instance that were
allocated by kwsysProcess_Execute. */
static void kwsysProcessCleanup(kwsysProcess* cp, int error)
@@ -1590,7 +1636,6 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error)
}
}
-/*--------------------------------------------------------------------------*/
/* Close the given file descriptor if it is open. Reset its value to -1. */
static void kwsysProcessCleanupDescriptor(int* pfd)
{
@@ -1603,7 +1648,6 @@ static void kwsysProcessCleanupDescriptor(int* pfd)
}
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessClosePipes(kwsysProcess* cp)
{
int i;
@@ -1636,7 +1680,6 @@ static void kwsysProcessClosePipes(kwsysProcess* cp)
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessSetNonBlocking(int fd)
{
int flags = fcntl(fd, F_GETFL);
@@ -1646,12 +1689,10 @@ static int kwsysProcessSetNonBlocking(int fd)
return flags >= 0;
}
-/*--------------------------------------------------------------------------*/
#if defined(__VMS)
int decc$set_child_standard_streams(int fd1, int fd2, int fd3);
#endif
-/*--------------------------------------------------------------------------*/
static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si)
{
@@ -1831,7 +1872,6 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
return 1;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessDestroy(kwsysProcess* cp)
{
/* A child process has terminated. Reap it if it is one handled by
@@ -1880,7 +1920,6 @@ static void kwsysProcessDestroy(kwsysProcess* cp)
sigprocmask(SIG_SETMASK, &old_mask, 0);
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
{
int fout;
@@ -1906,7 +1945,6 @@ static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
return 1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessSetupOutputPipeNative(int* p, int des[2])
{
/* Close the existing descriptor. */
@@ -1925,7 +1963,6 @@ static int kwsysProcessSetupOutputPipeNative(int* p, int des[2])
return 1;
}
-/*--------------------------------------------------------------------------*/
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
@@ -1957,7 +1994,6 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
return 0;
}
-/*--------------------------------------------------------------------------*/
/* Get the length of time before the given timeout time arrives.
Returns 1 if the time has already arrived, and 0 otherwise. */
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
@@ -1992,7 +2028,6 @@ static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
}
}
-/*--------------------------------------------------------------------------*/
static kwsysProcessTime kwsysProcessTimeGetCurrent(void)
{
kwsysProcessTime current;
@@ -2003,13 +2038,11 @@ static kwsysProcessTime kwsysProcessTimeGetCurrent(void)
return current;
}
-/*--------------------------------------------------------------------------*/
static double kwsysProcessTimeToDouble(kwsysProcessTime t)
{
return (double)t.tv_sec + (double)(t.tv_usec) * 0.000001;
}
-/*--------------------------------------------------------------------------*/
static kwsysProcessTime kwsysProcessTimeFromDouble(double d)
{
kwsysProcessTime t;
@@ -2018,14 +2051,12 @@ static kwsysProcessTime kwsysProcessTimeFromDouble(double d)
return t;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessTimeLess(kwsysProcessTime in1, kwsysProcessTime in2)
{
return ((in1.tv_sec < in2.tv_sec) ||
((in1.tv_sec == in2.tv_sec) && (in1.tv_usec < in2.tv_usec)));
}
-/*--------------------------------------------------------------------------*/
static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
kwsysProcessTime in2)
{
@@ -2039,7 +2070,6 @@ static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
return out;
}
-/*--------------------------------------------------------------------------*/
static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
kwsysProcessTime in2)
{
@@ -2053,11 +2083,11 @@ static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
return out;
}
-/*--------------------------------------------------------------------------*/
#define KWSYSPE_CASE(type, str) \
- cp->ExitException = kwsysProcess_Exception_##type; \
- strcpy(cp->ExitExceptionString, str)
-static void kwsysProcessSetExitException(kwsysProcess* cp, int sig)
+ cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_##type; \
+ strcpy(cp->ProcessResults[idx].ExitExceptionString, str)
+static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig,
+ int idx)
{
switch (sig) {
#ifdef SIGSEGV
@@ -2243,14 +2273,13 @@ static void kwsysProcessSetExitException(kwsysProcess* cp, int sig)
#endif
#endif
default:
- cp->ExitException = kwsysProcess_Exception_Other;
- sprintf(cp->ExitExceptionString, "Signal %d", sig);
+ cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other;
+ sprintf(cp->ProcessResults[idx].ExitExceptionString, "Signal %d", sig);
break;
}
}
#undef KWSYSPE_CASE
-/*--------------------------------------------------------------------------*/
/* When the child process encounters an error before its program is
invoked, this is called to report the error to the parent and
exit. */
@@ -2269,7 +2298,6 @@ static void kwsysProcessChildErrorExit(int errorPipe)
_exit(1);
}
-/*--------------------------------------------------------------------------*/
/* Restores all signal handlers to their default values. */
static void kwsysProcessRestoreDefaultSignalHandlers(void)
{
@@ -2377,13 +2405,11 @@ static void kwsysProcessRestoreDefaultSignalHandlers(void)
#endif
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessExit(void)
{
_exit(0);
}
-/*--------------------------------------------------------------------------*/
#if !defined(__VMS)
static pid_t kwsysProcessFork(kwsysProcess* cp,
kwsysProcessCreateInformation* si)
@@ -2433,7 +2459,6 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
}
#endif
-/*--------------------------------------------------------------------------*/
/* We try to obtain process information by invoking the ps command.
Here we define the command to call on each platform and the
corresponding parsing format string. The parsing format should
@@ -2457,7 +2482,6 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
#define KWSYSPE_PS_FORMAT "%d %d %*[^\n]\n"
#endif
-/*--------------------------------------------------------------------------*/
static void kwsysProcessKill(pid_t process_id)
{
#if defined(__linux__) || defined(__CYGWIN__)
@@ -2561,7 +2585,6 @@ static void kwsysProcessKill(pid_t process_id)
#endif
}
-/*--------------------------------------------------------------------------*/
#if defined(__VMS)
int decc$feature_get_index(const char* name);
int decc$feature_set_value(int index, int mode, int value);
@@ -2574,7 +2597,6 @@ static int kwsysProcessSetVMSFeature(const char* name, int value)
}
#endif
-/*--------------------------------------------------------------------------*/
/* Global set of executing processes for use by the signal handler.
This global instance will be zero-initialized by the compiler. */
typedef struct kwsysProcessInstances_s
@@ -2590,7 +2612,6 @@ static struct sigaction kwsysProcessesOldSigChldAction;
static struct sigaction kwsysProcessesOldSigIntAction;
static struct sigaction kwsysProcessesOldSigTermAction;
-/*--------------------------------------------------------------------------*/
static void kwsysProcessesUpdate(kwsysProcessInstances* newProcesses)
{
/* Block signals while we update the set of pipes to check.
@@ -2611,7 +2632,6 @@ static void kwsysProcessesUpdate(kwsysProcessInstances* newProcesses)
sigprocmask(SIG_SETMASK, &oldset, 0);
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcessesAdd(kwsysProcess* cp)
{
/* Create a pipe through which the signal handler can notify the
@@ -2721,7 +2741,6 @@ static int kwsysProcessesAdd(kwsysProcess* cp)
return 1;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessesRemove(kwsysProcess* cp)
{
/* Attempt to remove the given signal pipe from the signal handler set. */
@@ -2772,7 +2791,6 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
kwsysProcessCleanupDescriptor(&cp->SignalPipe);
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessesSignalHandler(int signum
#if KWSYSPE_USE_SIGINFO
,
@@ -2884,7 +2902,6 @@ static void kwsysProcessesSignalHandler(int signum
errno = old_errno;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_ResetStartTime(kwsysProcess* cp)
{
if (!cp) {
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index d10c733..5183e3d 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -86,7 +86,6 @@ typedef struct kwsysProcessCreateInformation_s
HANDLE hStdError;
} kwsysProcessCreateInformation;
-/*--------------------------------------------------------------------------*/
typedef struct kwsysProcessPipeData_s kwsysProcessPipeData;
static DWORD WINAPI kwsysProcessPipeThreadRead(LPVOID ptd);
static void kwsysProcessPipeThreadReadPipe(kwsysProcess* cp,
@@ -119,6 +118,8 @@ static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
kwsysProcessTime in2);
static void kwsysProcessSetExitException(kwsysProcess* cp, int code);
+static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int code,
+ int idx);
static void kwsysProcessKillTree(int pid);
static void kwsysProcessDisablePipeThreads(kwsysProcess* cp);
static int kwsysProcessesInitialize(void);
@@ -129,7 +130,6 @@ static int kwsysProcessesAdd(HANDLE hProcess, DWORD dwProcessId,
static void kwsysProcessesRemove(HANDLE hProcess);
static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType);
-/*--------------------------------------------------------------------------*/
/* A structure containing synchronization data for each thread. */
typedef struct kwsysProcessPipeSync_s kwsysProcessPipeSync;
struct kwsysProcessPipeSync_s
@@ -147,7 +147,6 @@ struct kwsysProcessPipeSync_s
HANDLE Reset;
};
-/*--------------------------------------------------------------------------*/
/* A structure containing data for each pipe's threads. */
struct kwsysProcessPipeData_s
{
@@ -183,7 +182,26 @@ struct kwsysProcessPipeData_s
HANDLE Write;
};
-/*--------------------------------------------------------------------------*/
+/* A structure containing results data for each process. */
+typedef struct kwsysProcessResults_s kwsysProcessResults;
+struct kwsysProcessResults_s
+{
+ /* The status of the process. */
+ int State;
+
+ /* The exceptional behavior that terminated the process, if any. */
+ int ExitException;
+
+ /* The process exit code. */
+ DWORD ExitCode;
+
+ /* The process return code, if any. */
+ int ExitValue;
+
+ /* Description for the ExitException. */
+ char ExitExceptionString[KWSYSPE_PIPE_BUFFER_SIZE + 1];
+};
+
/* Structure containing data used to implement the child's execution. */
struct kwsysProcess_s
{
@@ -249,15 +267,6 @@ struct kwsysProcess_s
/* ------------- Data managed per call to Execute ------------- */
- /* The exceptional behavior that terminated the process, if any. */
- int ExitException;
-
- /* The process exit code. */
- DWORD ExitCode;
-
- /* The process return code, if any. */
- int ExitValue;
-
/* Index of last pipe to report data, if any. */
int CurrentIndex;
@@ -289,8 +298,8 @@ struct kwsysProcess_s
/* Buffer for error messages. */
char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE + 1];
- /* Description for the ExitException. */
- char ExitExceptionString[KWSYSPE_PIPE_BUFFER_SIZE + 1];
+ /* process results. */
+ kwsysProcessResults* ProcessResults;
/* Windows process information data. */
PROCESS_INFORMATION* ProcessInformation;
@@ -308,7 +317,6 @@ struct kwsysProcess_s
HANDLE PipeChildStd[3];
};
-/*--------------------------------------------------------------------------*/
kwsysProcess* kwsysProcess_New(void)
{
int i;
@@ -447,7 +455,6 @@ kwsysProcess* kwsysProcess_New(void)
return cp;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Delete(kwsysProcess* cp)
{
int i;
@@ -519,10 +526,10 @@ void kwsysProcess_Delete(kwsysProcess* cp)
if (cp->CommandExitCodes) {
free(cp->CommandExitCodes);
}
+ free(cp->ProcessResults);
free(cp);
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command)
{
int i;
@@ -543,7 +550,6 @@ int kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command)
return 1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
{
int newNumberOfCommands;
@@ -639,7 +645,6 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
{
if (!cp) {
@@ -653,7 +658,6 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
cp->TimeoutTime.QuadPart = -1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
{
if (!cp) {
@@ -685,7 +689,6 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
return 1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
{
char** pfile;
@@ -727,7 +730,6 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared)
{
if (!cp) {
@@ -756,7 +758,6 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe, HANDLE p[2])
{
HANDLE* pPipeNative = 0;
@@ -796,7 +797,6 @@ void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe, HANDLE p[2])
}
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
{
if (!cp) {
@@ -819,7 +819,6 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
{
if (!cp) {
@@ -847,31 +846,32 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
}
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetState(kwsysProcess* cp)
{
return cp ? cp->State : kwsysProcess_State_Error;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitException(kwsysProcess* cp)
{
- return cp ? cp->ExitException : kwsysProcess_Exception_Other;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitException
+ : kwsysProcess_Exception_Other;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitValue(kwsysProcess* cp)
{
- return cp ? cp->ExitValue : -1;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitValue
+ : -1;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_GetExitCode(kwsysProcess* cp)
{
- return cp ? cp->ExitCode : 0;
+ return (cp && cp->ProcessResults && (cp->NumberOfCommands > 0))
+ ? cp->ProcessResults[cp->NumberOfCommands - 1].ExitCode
+ : 0;
}
-/*--------------------------------------------------------------------------*/
const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
{
if (!cp) {
@@ -882,18 +882,59 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
return "Success";
}
-/*--------------------------------------------------------------------------*/
const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
{
- if (!cp) {
+ if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
return "GetExceptionString called with NULL process management structure";
} else if (cp->State == kwsysProcess_State_Exception) {
- return cp->ExitExceptionString;
+ return cp->ProcessResults[cp->NumberOfCommands - 1].ExitExceptionString;
}
return "No exception";
}
-/*--------------------------------------------------------------------------*/
+/* the index should be in array bound. */
+#define KWSYSPE_IDX_CHK(RET) \
+ if (!cp || idx >= cp->NumberOfCommands || idx < 0) { \
+ KWSYSPE_DEBUG((stderr, "array index out of bound\n")); \
+ return RET; \
+ }
+
+int kwsysProcess_GetStateByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(kwsysProcess_State_Error)
+ return cp->ProcessResults[idx].State;
+}
+
+int kwsysProcess_GetExitExceptionByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(kwsysProcess_Exception_Other)
+ return cp->ProcessResults[idx].ExitException;
+}
+
+int kwsysProcess_GetExitValueByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(-1)
+ return cp->ProcessResults[idx].ExitValue;
+}
+
+int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK(-1)
+ return cp->CommandExitCodes[idx];
+}
+
+const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+{
+ KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
+ "structure or index out of bound")
+ if (cp->ProcessResults[idx].State == kwsysProcess_StateByIndex_Exception) {
+ return cp->ProcessResults[idx].ExitExceptionString;
+ }
+ return "No exception";
+}
+
+#undef KWSYSPE_IDX_CHK
+
void kwsysProcess_Execute(kwsysProcess* cp)
{
int i;
@@ -1135,7 +1176,6 @@ void kwsysProcess_Execute(kwsysProcess* cp)
cp->Detached = cp->OptionDetach;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Disown(kwsysProcess* cp)
{
int i;
@@ -1162,8 +1202,6 @@ void kwsysProcess_Disown(kwsysProcess* cp)
cp->State = kwsysProcess_State_Disowned;
}
-/*--------------------------------------------------------------------------*/
-
int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
double* userTimeout)
{
@@ -1289,7 +1327,6 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
}
}
-/*--------------------------------------------------------------------------*/
int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
{
int i;
@@ -1338,25 +1375,29 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
/* The timeout expired. */
cp->State = kwsysProcess_State_Expired;
} else {
- /* The children exited. Report the outcome of the last process. */
- cp->ExitCode = cp->CommandExitCodes[cp->NumberOfCommands - 1];
- if ((cp->ExitCode & 0xF0000000) == 0xC0000000) {
- /* Child terminated due to exceptional behavior. */
- cp->State = kwsysProcess_State_Exception;
- cp->ExitValue = 1;
- kwsysProcessSetExitException(cp, cp->ExitCode);
- } else {
- /* Child exited without exception. */
- cp->State = kwsysProcess_State_Exited;
- cp->ExitException = kwsysProcess_Exception_None;
- cp->ExitValue = cp->ExitCode;
+ /* The children exited. Report the outcome of the child processes. */
+ for (i = 0; i < cp->NumberOfCommands; ++i) {
+ cp->ProcessResults[i].ExitCode = cp->CommandExitCodes[i];
+ if ((cp->ProcessResults[i].ExitCode & 0xF0000000) == 0xC0000000) {
+ /* Child terminated due to exceptional behavior. */
+ cp->ProcessResults[i].State = kwsysProcess_StateByIndex_Exception;
+ cp->ProcessResults[i].ExitValue = 1;
+ kwsysProcessSetExitExceptionByIndex(cp, cp->ProcessResults[i].ExitCode,
+ i);
+ } else {
+ /* Child exited without exception. */
+ cp->ProcessResults[i].State = kwsysProcess_StateByIndex_Exited;
+ cp->ProcessResults[i].ExitException = kwsysProcess_Exception_None;
+ cp->ProcessResults[i].ExitValue = cp->ProcessResults[i].ExitCode;
+ }
}
+ /* support legacy state status value */
+ cp->State = cp->ProcessResults[cp->NumberOfCommands - 1].State;
}
return 1;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Interrupt(kwsysProcess* cp)
{
int i;
@@ -1394,7 +1435,6 @@ void kwsysProcess_Interrupt(kwsysProcess* cp)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_Kill(kwsysProcess* cp)
{
int i;
@@ -1429,8 +1469,6 @@ void kwsysProcess_Kill(kwsysProcess* cp)
for them to exit. */
}
-/*--------------------------------------------------------------------------*/
-
/*
Function executed for each pipe's thread. Argument is a pointer to
the kwsysProcessPipeData instance for this thread.
@@ -1451,8 +1489,6 @@ DWORD WINAPI kwsysProcessPipeThreadRead(LPVOID ptd)
return 0;
}
-/*--------------------------------------------------------------------------*/
-
/*
Function called in each pipe's thread to handle data for one
execution of a subprocess.
@@ -1494,8 +1530,6 @@ void kwsysProcessPipeThreadReadPipe(kwsysProcess* cp, kwsysProcessPipeData* td)
ReleaseSemaphore(td->Reader.Go, 1, 0);
}
-/*--------------------------------------------------------------------------*/
-
/*
Function executed for each pipe's thread. Argument is a pointer to
the kwsysProcessPipeData instance for this thread.
@@ -1516,8 +1550,6 @@ DWORD WINAPI kwsysProcessPipeThreadWake(LPVOID ptd)
return 0;
}
-/*--------------------------------------------------------------------------*/
-
/*
Function called in each pipe's thread to handle reading thread
wakeup for one execution of a subprocess.
@@ -1540,23 +1572,34 @@ void kwsysProcessPipeThreadWakePipe(kwsysProcess* cp, kwsysProcessPipeData* td)
}
}
-/*--------------------------------------------------------------------------*/
/* Initialize a process control structure for kwsysProcess_Execute. */
int kwsysProcessInitialize(kwsysProcess* cp)
{
+ int i;
/* Reset internal status flags. */
cp->TimeoutExpired = 0;
cp->Terminated = 0;
cp->Killed = 0;
- cp->ExitException = kwsysProcess_Exception_None;
- cp->ExitCode = 1;
- cp->ExitValue = 1;
- /* Reset error data. */
- cp->ErrorMessage[0] = 0;
- strcpy(cp->ExitExceptionString, "No exception");
+ free(cp->ProcessResults);
+ /* Allocate process result information for each process. */
+ cp->ProcessResults = (kwsysProcessResults*)malloc(
+ sizeof(kwsysProcessResults) * (cp->NumberOfCommands));
+ if (!cp->ProcessResults) {
+ return 0;
+ }
+ ZeroMemory(cp->ProcessResults,
+ sizeof(kwsysProcessResults) * cp->NumberOfCommands);
+ for (i = 0; i < cp->NumberOfCommands; i++) {
+ cp->ProcessResults[i].ExitException = kwsysProcess_Exception_None;
+ cp->ProcessResults[i].State = kwsysProcess_StateByIndex_Starting;
+ cp->ProcessResults[i].ExitCode = 1;
+ cp->ProcessResults[i].ExitValue = 1;
+ strcpy(cp->ProcessResults[i].ExitExceptionString, "No exception");
+ }
/* Allocate process information for each process. */
+ free(cp->ProcessInformation);
cp->ProcessInformation = (PROCESS_INFORMATION*)malloc(
sizeof(PROCESS_INFORMATION) * cp->NumberOfCommands);
if (!cp->ProcessInformation) {
@@ -1596,7 +1639,6 @@ int kwsysProcessInitialize(kwsysProcess* cp)
}
}
{
- int i;
for (i = 0; i < 3; ++i) {
cp->PipeChildStd[i] = INVALID_HANDLE_VALUE;
}
@@ -1605,7 +1647,6 @@ int kwsysProcessInitialize(kwsysProcess* cp)
return 1;
}
-/*--------------------------------------------------------------------------*/
static DWORD kwsysProcessCreateChildHandle(PHANDLE out, HANDLE in, int isStdIn)
{
DWORD flags;
@@ -1641,7 +1682,6 @@ static DWORD kwsysProcessCreateChildHandle(PHANDLE out, HANDLE in, int isStdIn)
}
}
-/*--------------------------------------------------------------------------*/
DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
kwsysProcessCreateInformation* si)
{
@@ -1706,7 +1746,6 @@ DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
return error;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcessDestroy(kwsysProcess* cp, int event)
{
int i;
@@ -1756,7 +1795,6 @@ void kwsysProcessDestroy(kwsysProcess* cp, int event)
}
}
-/*--------------------------------------------------------------------------*/
DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
{
HANDLE fout;
@@ -1784,7 +1822,6 @@ DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
return ERROR_SUCCESS;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle)
{
/* Close the existing handle. */
@@ -1793,7 +1830,6 @@ void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle)
*handle = GetStdHandle(nStdHandle);
}
-/*--------------------------------------------------------------------------*/
void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle)
{
/* Close the existing handle. */
@@ -1802,8 +1838,6 @@ void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle)
*handle = native;
}
-/*--------------------------------------------------------------------------*/
-
/* Close the given handle if it is open. Reset its value to 0. */
void kwsysProcessCleanupHandle(PHANDLE h)
{
@@ -1816,8 +1850,6 @@ void kwsysProcessCleanupHandle(PHANDLE h)
}
}
-/*--------------------------------------------------------------------------*/
-
/* Close all handles created by kwsysProcess_Execute. */
void kwsysProcessCleanup(kwsysProcess* cp, DWORD error)
{
@@ -1902,7 +1934,6 @@ void kwsysProcessCleanup(kwsysProcess* cp, DWORD error)
}
}
-/*--------------------------------------------------------------------------*/
void kwsysProcessCleanErrorMessage(kwsysProcess* cp)
{
/* Remove trailing period and newline, if any. */
@@ -1920,7 +1951,6 @@ void kwsysProcessCleanErrorMessage(kwsysProcess* cp)
}
}
-/*--------------------------------------------------------------------------*/
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
@@ -1952,7 +1982,6 @@ int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
return 0;
}
-/*--------------------------------------------------------------------------*/
/* Get the length of time before the given timeout time arrives.
Returns 1 if the time has already arrived, and 0 otherwise. */
int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
@@ -1982,7 +2011,6 @@ int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
}
}
-/*--------------------------------------------------------------------------*/
kwsysProcessTime kwsysProcessTimeGetCurrent()
{
kwsysProcessTime current;
@@ -1993,19 +2021,16 @@ kwsysProcessTime kwsysProcessTimeGetCurrent()
return current;
}
-/*--------------------------------------------------------------------------*/
DWORD kwsysProcessTimeToDWORD(kwsysProcessTime t)
{
return (DWORD)(t.QuadPart * 0.0001);
}
-/*--------------------------------------------------------------------------*/
double kwsysProcessTimeToDouble(kwsysProcessTime t)
{
return t.QuadPart * 0.0000001;
}
-/*--------------------------------------------------------------------------*/
kwsysProcessTime kwsysProcessTimeFromDouble(double d)
{
kwsysProcessTime t;
@@ -2013,13 +2038,11 @@ kwsysProcessTime kwsysProcessTimeFromDouble(double d)
return t;
}
-/*--------------------------------------------------------------------------*/
int kwsysProcessTimeLess(kwsysProcessTime in1, kwsysProcessTime in2)
{
return in1.QuadPart < in2.QuadPart;
}
-/*--------------------------------------------------------------------------*/
kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
kwsysProcessTime in2)
{
@@ -2028,7 +2051,6 @@ kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1,
return out;
}
-/*--------------------------------------------------------------------------*/
kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
kwsysProcessTime in2)
{
@@ -2037,11 +2059,11 @@ kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1,
return out;
}
-/*--------------------------------------------------------------------------*/
#define KWSYSPE_CASE(type, str) \
- cp->ExitException = kwsysProcess_Exception_##type; \
- strcpy(cp->ExitExceptionString, str)
-static void kwsysProcessSetExitException(kwsysProcess* cp, int code)
+ cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_##type; \
+ strcpy(cp->ProcessResults[idx].ExitExceptionString, str)
+static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int code,
+ int idx)
{
switch (code) {
case STATUS_CONTROL_C_EXIT:
@@ -2120,9 +2142,9 @@ static void kwsysProcessSetExitException(kwsysProcess* cp, int code)
case STATUS_NO_MEMORY:
default:
- cp->ExitException = kwsysProcess_Exception_Other;
- _snprintf(cp->ExitExceptionString, KWSYSPE_PIPE_BUFFER_SIZE,
- "Exit code 0x%x\n", code);
+ cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other;
+ _snprintf(cp->ProcessResults[idx].ExitExceptionString,
+ KWSYSPE_PIPE_BUFFER_SIZE, "Exit code 0x%x\n", code);
break;
}
}
@@ -2136,7 +2158,6 @@ static int kwsysProcess_List_NextProcess(kwsysProcess_List* self);
static int kwsysProcess_List_GetCurrentProcessId(kwsysProcess_List* self);
static int kwsysProcess_List_GetCurrentParentId(kwsysProcess_List* self);
-/*--------------------------------------------------------------------------*/
/* Windows NT 4 API definitions. */
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
typedef LONG NTSTATUS;
@@ -2168,7 +2189,6 @@ struct _SYSTEM_PROCESS_INFORMATION
ULONG InheritedFromProcessId;
};
-/*--------------------------------------------------------------------------*/
/* Toolhelp32 API definitions. */
#define TH32CS_SNAPPROCESS 0x00000002
#if defined(_WIN64)
@@ -2192,7 +2212,6 @@ struct tagPROCESSENTRY32
char szExeFile[MAX_PATH];
};
-/*--------------------------------------------------------------------------*/
/* Windows API function types. */
typedef HANDLE(WINAPI* CreateToolhelp32SnapshotType)(DWORD, DWORD);
typedef BOOL(WINAPI* Process32FirstType)(HANDLE, LPPROCESSENTRY32);
@@ -2200,7 +2219,6 @@ typedef BOOL(WINAPI* Process32NextType)(HANDLE, LPPROCESSENTRY32);
typedef NTSTATUS(WINAPI* ZwQuerySystemInformationType)(ULONG, PVOID, ULONG,
PULONG);
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__New_NT4(kwsysProcess_List* self);
static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self);
static void kwsysProcess_List__Delete_NT4(kwsysProcess_List* self);
@@ -2233,7 +2251,6 @@ struct kwsysProcess_List_s
PROCESSENTRY32 CurrentEntry;
};
-/*--------------------------------------------------------------------------*/
static kwsysProcess_List* kwsysProcess_List_New(void)
{
OSVERSIONINFO osv;
@@ -2279,7 +2296,6 @@ static kwsysProcess_List* kwsysProcess_List_New(void)
return self;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcess_List_Delete(kwsysProcess_List* self)
{
if (self) {
@@ -2292,7 +2308,6 @@ static void kwsysProcess_List_Delete(kwsysProcess_List* self)
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List_Update(kwsysProcess_List* self)
{
return self ? (self->NT4 ? kwsysProcess_List__Update_NT4(self)
@@ -2300,7 +2315,6 @@ static int kwsysProcess_List_Update(kwsysProcess_List* self)
: 0;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List_GetCurrentProcessId(kwsysProcess_List* self)
{
return self ? (self->NT4 ? kwsysProcess_List__GetProcessId_NT4(self)
@@ -2308,7 +2322,6 @@ static int kwsysProcess_List_GetCurrentProcessId(kwsysProcess_List* self)
: -1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List_GetCurrentParentId(kwsysProcess_List* self)
{
return self ? (self->NT4 ? kwsysProcess_List__GetParentId_NT4(self)
@@ -2316,7 +2329,6 @@ static int kwsysProcess_List_GetCurrentParentId(kwsysProcess_List* self)
: -1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List_NextProcess(kwsysProcess_List* self)
{
return (self ? (self->NT4 ? kwsysProcess_List__Next_NT4(self)
@@ -2324,7 +2336,6 @@ static int kwsysProcess_List_NextProcess(kwsysProcess_List* self)
: 0);
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__New_NT4(kwsysProcess_List* self)
{
/* Get a handle to the NT runtime module that should already be
@@ -2348,7 +2359,6 @@ static int kwsysProcess_List__New_NT4(kwsysProcess_List* self)
return self->Buffer ? 1 : 0;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcess_List__Delete_NT4(kwsysProcess_List* self)
{
/* Free the process information buffer. */
@@ -2357,7 +2367,6 @@ static void kwsysProcess_List__Delete_NT4(kwsysProcess_List* self)
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__Update_NT4(kwsysProcess_List* self)
{
self->CurrentInfo = 0;
@@ -2387,7 +2396,6 @@ static int kwsysProcess_List__Update_NT4(kwsysProcess_List* self)
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__Next_NT4(kwsysProcess_List* self)
{
if (self->CurrentInfo) {
@@ -2401,19 +2409,16 @@ static int kwsysProcess_List__Next_NT4(kwsysProcess_List* self)
return 0;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__GetProcessId_NT4(kwsysProcess_List* self)
{
return self->CurrentInfo ? self->CurrentInfo->ProcessId : -1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__GetParentId_NT4(kwsysProcess_List* self)
{
return self->CurrentInfo ? self->CurrentInfo->InheritedFromProcessId : -1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self)
{
/* Get a handle to the Windows runtime module that should already be
@@ -2436,7 +2441,6 @@ static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self)
: 0;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcess_List__Delete_Snapshot(kwsysProcess_List* self)
{
if (self->Snapshot) {
@@ -2444,7 +2448,6 @@ static void kwsysProcess_List__Delete_Snapshot(kwsysProcess_List* self)
}
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__Update_Snapshot(kwsysProcess_List* self)
{
if (self->Snapshot) {
@@ -2464,7 +2467,6 @@ static int kwsysProcess_List__Update_Snapshot(kwsysProcess_List* self)
return 1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__Next_Snapshot(kwsysProcess_List* self)
{
if (self->Snapshot) {
@@ -2477,19 +2479,16 @@ static int kwsysProcess_List__Next_Snapshot(kwsysProcess_List* self)
return 0;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__GetProcessId_Snapshot(kwsysProcess_List* self)
{
return self->Snapshot ? self->CurrentEntry.th32ProcessID : -1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysProcess_List__GetParentId_Snapshot(kwsysProcess_List* self)
{
return self->Snapshot ? self->CurrentEntry.th32ParentProcessID : -1;
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessKill(DWORD pid)
{
HANDLE h = OpenProcess(PROCESS_TERMINATE, 0, pid);
@@ -2500,7 +2499,6 @@ static void kwsysProcessKill(DWORD pid)
}
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessKillTree(int pid)
{
kwsysProcess_List* plist = kwsysProcess_List_New();
@@ -2516,7 +2514,6 @@ static void kwsysProcessKillTree(int pid)
}
}
-/*--------------------------------------------------------------------------*/
static void kwsysProcessDisablePipeThreads(kwsysProcess* cp)
{
int i;
@@ -2568,7 +2565,6 @@ static void kwsysProcessDisablePipeThreads(kwsysProcess* cp)
}
}
-/*--------------------------------------------------------------------------*/
/* Global set of executing processes for use by the Ctrl handler.
This global instance will be zero-initialized by the compiler.
@@ -2598,7 +2594,6 @@ typedef struct kwsysProcessInstances_s
} kwsysProcessInstances;
static kwsysProcessInstances kwsysProcesses;
-/*--------------------------------------------------------------------------*/
/* Initialize critial section and set up console Ctrl handler. You MUST call
this before using any other kwsysProcesses* functions below. */
static int kwsysProcessesInitialize(void)
@@ -2617,7 +2612,6 @@ static int kwsysProcessesInitialize(void)
return 1;
}
-/*--------------------------------------------------------------------------*/
/* The Ctrl handler waits on the global list of processes. To prevent an
orphaned process, do not create a new process if the Ctrl handler is
already running. Do so by using this function to check if it is ok to
@@ -2636,7 +2630,6 @@ static int kwsysTryEnterCreateProcessSection(void)
}
}
-/*--------------------------------------------------------------------------*/
/* Matching function on successful kwsysTryEnterCreateProcessSection return.
Make sure you called kwsysProcessesAdd if applicable before calling this.*/
static void kwsysLeaveCreateProcessSection(void)
@@ -2644,7 +2637,6 @@ static void kwsysLeaveCreateProcessSection(void)
LeaveCriticalSection(&kwsysProcesses.Lock);
}
-/*--------------------------------------------------------------------------*/
/* Add new process to global process list. The Ctrl handler will wait for
the process to exit before it returns. Do not close the process handle
until after calling kwsysProcessesRemove. The newProcessGroup parameter
@@ -2702,7 +2694,6 @@ static int kwsysProcessesAdd(HANDLE hProcess, DWORD dwProcessid,
return 1;
}
-/*--------------------------------------------------------------------------*/
/* Removes process to global process list. */
static void kwsysProcessesRemove(HANDLE hProcess)
{
@@ -2738,7 +2729,6 @@ static void kwsysProcessesRemove(HANDLE hProcess)
LeaveCriticalSection(&kwsysProcesses.Lock);
}
-/*--------------------------------------------------------------------------*/
static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType)
{
size_t i;
@@ -2774,7 +2764,6 @@ static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType)
return FALSE;
}
-/*--------------------------------------------------------------------------*/
void kwsysProcess_ResetStartTime(kwsysProcess* cp)
{
if (!cp) {
diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in
index c9ae135..f638267 100644
--- a/Source/kwsys/SharedForward.h.in
+++ b/Source/kwsys/SharedForward.h.in
@@ -72,8 +72,6 @@
#pragma warn - 8019
#endif
-/*--------------------------------------------------------------------------*/
-
/* Full path to the directory in which this executable is built. Do
not include a trailing slash. */
#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD)
@@ -159,7 +157,6 @@
#undef KWSYS_SHARED_FORWARD_OPTION_LDD
#endif
-/*--------------------------------------------------------------------------*/
/* Include needed system headers. */
#include <errno.h>
@@ -180,7 +177,6 @@
#include <unistd.h>
#endif
-/*--------------------------------------------------------------------------*/
/* Configuration for this platform. */
/* The path separator for this platform. */
@@ -292,7 +288,6 @@ static const char kwsys_shared_forward_path_slash[2] = {
#endif
#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV
-/*--------------------------------------------------------------------------*/
typedef struct kwsys_sf_arg_info_s
{
const char* arg;
@@ -300,7 +295,6 @@ typedef struct kwsys_sf_arg_info_s
int quote;
} kwsys_sf_arg_info;
-/*--------------------------------------------------------------------------*/
static kwsys_sf_arg_info kwsys_sf_get_arg_info(const char* in)
{
/* Initialize information. */
@@ -354,7 +348,6 @@ static kwsys_sf_arg_info kwsys_sf_get_arg_info(const char* in)
return info;
}
-/*--------------------------------------------------------------------------*/
static char* kwsys_sf_get_arg(kwsys_sf_arg_info info, char* out)
{
/* String iterator. */
@@ -413,7 +406,6 @@ static char* kwsys_sf_get_arg(kwsys_sf_arg_info info, char* out)
}
#endif
-/*--------------------------------------------------------------------------*/
/* Function to convert a logical or relative path to a physical full path. */
static int kwsys_shared_forward_realpath(const char* in_path, char* out_path)
{
@@ -428,7 +420,6 @@ static int kwsys_shared_forward_realpath(const char* in_path, char* out_path)
#endif
}
-/*--------------------------------------------------------------------------*/
static int kwsys_shared_forward_samepath(const char* file1, const char* file2)
{
#if defined(_WIN32)
@@ -458,7 +449,6 @@ static int kwsys_shared_forward_samepath(const char* file1, const char* file2)
#endif
}
-/*--------------------------------------------------------------------------*/
/* Function to report a system error message. */
static void kwsys_shared_forward_strerror(char* message)
{
@@ -481,7 +471,6 @@ static void kwsys_shared_forward_strerror(char* message)
#endif
}
-/*--------------------------------------------------------------------------*/
/* Functions to execute a child process. */
static void kwsys_shared_forward_execvp(const char* cmd,
char const* const* argv)
@@ -521,7 +510,6 @@ static void kwsys_shared_forward_execvp(const char* cmd,
#endif
}
-/*--------------------------------------------------------------------------*/
/* Function to get the directory containing the given file or directory. */
static void kwsys_shared_forward_dirname(const char* begin, char* result)
{
@@ -557,7 +545,6 @@ static void kwsys_shared_forward_dirname(const char* begin, char* result)
}
}
-/*--------------------------------------------------------------------------*/
/* Function to check if a file exists and is executable. */
static int kwsys_shared_forward_is_executable(const char* f)
{
@@ -578,7 +565,6 @@ static int kwsys_shared_forward_is_executable(const char* f)
}
}
-/*--------------------------------------------------------------------------*/
/* Function to locate the executable currently running. */
static int kwsys_shared_forward_self_path(const char* argv0, char* result)
{
@@ -644,7 +630,6 @@ static int kwsys_shared_forward_self_path(const char* argv0, char* result)
return 0;
}
-/*--------------------------------------------------------------------------*/
/* Function to convert a specified path to a full path. If it is not
already full, it is taken relative to the self path. */
static int kwsys_shared_forward_fullpath(const char* self_path,
@@ -681,7 +666,6 @@ static int kwsys_shared_forward_fullpath(const char* self_path,
return 1;
}
-/*--------------------------------------------------------------------------*/
/* Function to compute the library search path and executable name
based on the self path. */
static int kwsys_shared_forward_get_settings(const char* self_path,
@@ -773,7 +757,6 @@ static int kwsys_shared_forward_get_settings(const char* self_path,
return 1;
}
-/*--------------------------------------------------------------------------*/
/* Function to print why execution of a command line failed. */
static void kwsys_shared_forward_print_failure(char const* const* argv)
{
@@ -791,7 +774,6 @@ static void kwsys_shared_forward_print_failure(char const* const* argv)
static char kwsys_shared_forward_ldpath[65535] =
KWSYS_SHARED_FORWARD_LDPATH "=";
-/*--------------------------------------------------------------------------*/
/* Main driver function to be called from main. */
static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in)
{
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index 43c60c5..b9af8e9 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -22,7 +22,6 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t;
typedef int kwsysSystem_ptrdiff_t;
#endif
-/*--------------------------------------------------------------------------*/
static int kwsysSystem__AppendByte(char* local, char** begin, char** end,
int* size, char c)
{
@@ -47,7 +46,6 @@ static int kwsysSystem__AppendByte(char* local, char** begin, char** end,
return 1;
}
-/*--------------------------------------------------------------------------*/
static int kwsysSystem__AppendArgument(char** local, char*** begin,
char*** end, int* size, char* arg_local,
char** arg_begin, char** arg_end,
@@ -91,7 +89,6 @@ static int kwsysSystem__AppendArgument(char** local, char*** begin,
return 1;
}
-/*--------------------------------------------------------------------------*/
#define KWSYSPE_LOCAL_BYTE_COUNT 1024
#define KWSYSPE_LOCAL_ARGS_COUNT 32
static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
@@ -227,7 +224,6 @@ static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
return newCommand;
}
-/*--------------------------------------------------------------------------*/
char** kwsysSystem_Parse_CommandForUnix(const char* command, int flags)
{
/* Validate the flags. */
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 70f1a43..6b00fc6 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -838,7 +838,6 @@ void SystemInformation::RunMemoryCheck()
this->Implementation->RunMemoryCheck();
}
-// --------------------------------------------------------------
// SystemInformationImplementation starts here
#define STORE_TLBCACHE_INFO(x, y) x = (x < (y)) ? (y) : x
@@ -1314,7 +1313,6 @@ private:
int ReportPath;
};
-// --------------------------------------------------------------------------
std::ostream& operator<<(std::ostream& os, const SymbolProperties& sp)
{
#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
@@ -1333,7 +1331,6 @@ std::ostream& operator<<(std::ostream& os, const SymbolProperties& sp)
return os;
}
-// --------------------------------------------------------------------------
SymbolProperties::SymbolProperties()
{
// not using an initializer list
@@ -1352,7 +1349,6 @@ SymbolProperties::SymbolProperties()
this->GetLineNumber();
}
-// --------------------------------------------------------------------------
std::string SymbolProperties::GetFileName(const std::string& path) const
{
std::string file(path);
@@ -1365,7 +1361,6 @@ std::string SymbolProperties::GetFileName(const std::string& path) const
return file;
}
-// --------------------------------------------------------------------------
std::string SymbolProperties::GetBinary() const
{
// only linux has proc fs
@@ -1386,7 +1381,6 @@ std::string SymbolProperties::GetBinary() const
return this->GetFileName(this->Binary);
}
-// --------------------------------------------------------------------------
std::string SymbolProperties::Demangle(const char* symbol) const
{
std::string result = safes(symbol);
@@ -1406,7 +1400,6 @@ std::string SymbolProperties::Demangle(const char* symbol) const
return result;
}
-// --------------------------------------------------------------------------
void SymbolProperties::Initialize(void* address)
{
this->Address = address;
@@ -1425,7 +1418,6 @@ void SymbolProperties::Initialize(void* address)
}
#endif // don't define this class if we're not using it
-// --------------------------------------------------------------------------
#if defined(_WIN32) || defined(__CYGWIN__)
#define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes
#endif
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index b6da368..5ca382f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -547,8 +547,6 @@ bool SystemTools::HasEnv(const std::string& key)
return SystemTools::HasEnv(key.c_str());
}
-//----------------------------------------------------------------------------
-
#if KWSYS_CXX_HAS_UNSETENV
/* unsetenv("A") removes A from the environment.
On older platforms it returns void instead of int. */
@@ -639,8 +637,6 @@ static int kwsysUnPutEnv(const std::string& env)
}
#endif
-//----------------------------------------------------------------------------
-
#if KWSYS_CXX_HAS_SETENV
/* setenv("A", "B", 1) will set A=B in the environment and makes its
@@ -731,8 +727,6 @@ bool SystemTools::UnPutEnv(const std::string& env)
#endif
-//----------------------------------------------------------------------------
-
const char* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
@@ -1144,7 +1138,6 @@ bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
#endif
}
-//----------------------------------------------------------------------------
bool SystemTools::PathExists(const std::string& path)
{
if (path.empty()) {
@@ -1167,7 +1160,6 @@ bool SystemTools::PathExists(const std::string& path)
#endif
}
-//----------------------------------------------------------------------------
bool SystemTools::FileExists(const char* filename)
{
if (!filename) {
@@ -1176,7 +1168,6 @@ bool SystemTools::FileExists(const char* filename)
return SystemTools::FileExists(std::string(filename));
}
-//----------------------------------------------------------------------------
bool SystemTools::FileExists(const std::string& filename)
{
if (filename.empty()) {
@@ -1203,7 +1194,6 @@ bool SystemTools::FileExists(const std::string& filename)
#endif
}
-//----------------------------------------------------------------------------
bool SystemTools::FileExists(const char* filename, bool isFile)
{
if (!filename) {
@@ -1212,7 +1202,6 @@ bool SystemTools::FileExists(const char* filename, bool isFile)
return SystemTools::FileExists(std::string(filename), isFile);
}
-//----------------------------------------------------------------------------
bool SystemTools::FileExists(const std::string& filename, bool isFile)
{
if (SystemTools::FileExists(filename)) {
@@ -1223,7 +1212,6 @@ bool SystemTools::FileExists(const std::string& filename, bool isFile)
return false;
}
-//----------------------------------------------------------------------------
bool SystemTools::TestFileAccess(const char* filename,
TestFilePermissions permissions)
{
@@ -1233,7 +1221,6 @@ bool SystemTools::TestFileAccess(const char* filename,
return SystemTools::TestFileAccess(std::string(filename), permissions);
}
-//----------------------------------------------------------------------------
bool SystemTools::TestFileAccess(const std::string& filename,
TestFilePermissions permissions)
{
@@ -1255,7 +1242,6 @@ bool SystemTools::TestFileAccess(const std::string& filename,
#endif
}
-//----------------------------------------------------------------------------
int SystemTools::Stat(const char* path, SystemTools::Stat_t* buf)
{
if (!path) {
@@ -1265,7 +1251,6 @@ int SystemTools::Stat(const char* path, SystemTools::Stat_t* buf)
return SystemTools::Stat(std::string(path), buf);
}
-//----------------------------------------------------------------------------
int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
{
if (path.empty()) {
@@ -1287,7 +1272,6 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
#endif
}
-//----------------------------------------------------------------------------
#ifdef __CYGWIN__
bool SystemTools::PathCygwinToWin32(const char* path, char* win32_path)
{
@@ -1752,7 +1736,6 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len)
return n;
}
-//----------------------------------------------------------------------------
std::vector<kwsys::String> SystemTools::SplitString(const std::string& p,
char sep, bool isPath)
{
@@ -1777,7 +1760,6 @@ std::vector<kwsys::String> SystemTools::SplitString(const std::string& p,
return paths;
}
-//----------------------------------------------------------------------------
int SystemTools::EstimateFormatLength(const char* format, va_list ap)
{
if (!format) {
@@ -2165,7 +2147,6 @@ bool SystemTools::FilesDiffer(const std::string& source,
return false;
}
-//----------------------------------------------------------------------------
/**
* Copy a file named by "source" to the file named by "destination".
*/
@@ -2269,7 +2250,6 @@ bool SystemTools::CopyFileAlways(const std::string& source,
return true;
}
-//----------------------------------------------------------------------------
bool SystemTools::CopyAFile(const std::string& source,
const std::string& destination, bool always)
{
@@ -3550,7 +3530,6 @@ static std::string GetCasePathName(std::string const& pathIn)
}
#endif
-//----------------------------------------------------------------------------
std::string SystemTools::GetActualCaseForPath(const std::string& p)
{
#ifndef _WIN32
@@ -3571,7 +3550,6 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p)
#endif
}
-//----------------------------------------------------------------------------
const char* SystemTools::SplitPathRootComponent(const std::string& p,
std::string* root)
{
@@ -3638,7 +3616,6 @@ const char* SystemTools::SplitPathRootComponent(const std::string& p,
return c;
}
-//----------------------------------------------------------------------------
void SystemTools::SplitPath(const std::string& p,
std::vector<std::string>& components,
bool expand_home_dir)
@@ -3695,13 +3672,11 @@ void SystemTools::SplitPath(const std::string& p,
}
}
-//----------------------------------------------------------------------------
std::string SystemTools::JoinPath(const std::vector<std::string>& components)
{
return SystemTools::JoinPath(components.begin(), components.end());
}
-//----------------------------------------------------------------------------
std::string SystemTools::JoinPath(
std::vector<std::string>::const_iterator first,
std::vector<std::string>::const_iterator last)
@@ -3733,7 +3708,6 @@ std::string SystemTools::JoinPath(
return result;
}
-//----------------------------------------------------------------------------
bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
{
#if defined(_WIN32) || defined(__APPLE__)
@@ -3749,7 +3723,6 @@ bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
#endif
}
-//----------------------------------------------------------------------------
bool SystemTools::Split(const std::string& str,
std::vector<std::string>& lines, char separator)
{
@@ -3770,7 +3743,6 @@ bool SystemTools::Split(const std::string& str,
return true;
}
-//----------------------------------------------------------------------------
bool SystemTools::Split(const std::string& str,
std::vector<std::string>& lines)
{
@@ -4707,7 +4679,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
return res;
}
-// ----------------------------------------------------------------------
bool SystemTools::ParseURLProtocol(const std::string& URL,
std::string& protocol,
std::string& dataglom)
@@ -4726,7 +4697,6 @@ bool SystemTools::ParseURLProtocol(const std::string& URL,
return true;
}
-// ----------------------------------------------------------------------
bool SystemTools::ParseURL(const std::string& URL, std::string& protocol,
std::string& username, std::string& password,
std::string& hostname, std::string& dataport,
@@ -4757,7 +4727,6 @@ bool SystemTools::ParseURL(const std::string& URL, std::string& protocol,
return true;
}
-// ----------------------------------------------------------------------
// These must NOT be initialized. Default initialization to zero is
// necessary.
static unsigned int SystemToolsManagerCount;
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index c0b7f45..eaa5c7d 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -9,7 +9,6 @@
#include "Terminal.h.in"
#endif
-/*--------------------------------------------------------------------------*/
/* Configure support for this platform. */
#if defined(_WIN32) || defined(__CYGWIN__)
#define KWSYS_TERMINAL_SUPPORT_CONSOLE
@@ -18,7 +17,6 @@
#define KWSYS_TERMINAL_ISATTY_WORKS
#endif
-/*--------------------------------------------------------------------------*/
/* Include needed system APIs. */
#include <stdarg.h> /* va_list */
@@ -36,7 +34,6 @@
#include <sys/stat.h> /* fstat */
#endif
-/*--------------------------------------------------------------------------*/
static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
int default_tty);
static void kwsysTerminalSetVT100Color(FILE* stream, int color);
@@ -47,7 +44,6 @@ static void kwsysTerminalSetConsoleColor(HANDLE hOut,
FILE* stream, int color);
#endif
-/*--------------------------------------------------------------------------*/
void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
{
/* Setup the stream with the given color if possible. */
@@ -89,7 +85,6 @@ void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
}
}
-/*--------------------------------------------------------------------------*/
/* Detect cases when a stream is definitely not interactive. */
#if !defined(KWSYS_TERMINAL_ISATTY_WORKS)
static int kwsysTerminalStreamIsNotInteractive(FILE* stream)
@@ -106,7 +101,6 @@ static int kwsysTerminalStreamIsNotInteractive(FILE* stream)
}
#endif
-/*--------------------------------------------------------------------------*/
/* List of terminal names known to support VT100 color escape sequences. */
static const char* kwsysTerminalVT100Names[] = { "Eterm",
"ansi",
@@ -162,7 +156,6 @@ static const char* kwsysTerminalVT100Names[] = { "Eterm",
"xterm-termite",
0 };
-/*--------------------------------------------------------------------------*/
/* Detect whether a stream is displayed in a VT100-compatible terminal. */
static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
int default_tty)
@@ -214,7 +207,6 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
#endif
}
-/*--------------------------------------------------------------------------*/
/* VT100 escape sequence strings. */
#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m"
#define KWSYS_TERMINAL_VT100_BOLD "\33[1m"
@@ -238,7 +230,6 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m"
#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m"
-/*--------------------------------------------------------------------------*/
/* Write VT100 escape sequences to the stream for the given color. */
static void kwsysTerminalSetVT100Color(FILE* stream, int color)
{
@@ -307,7 +298,6 @@ static void kwsysTerminalSetVT100Color(FILE* stream, int color)
}
}
-/*--------------------------------------------------------------------------*/
#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
#define KWSYS_TERMINAL_MASK_FOREGROUND \
diff --git a/Source/kwsys/kwsysPlatformTestsC.c b/Source/kwsys/kwsysPlatformTestsC.c
index d12fac0..64a361b 100644
--- a/Source/kwsys/kwsysPlatformTestsC.c
+++ b/Source/kwsys/kwsysPlatformTestsC.c
@@ -27,7 +27,6 @@
main(int argc, char* argv[])
#endif
-/*--------------------------------------------------------------------------*/
#ifdef TEST_KWSYS_C_HAS_PTRDIFF_T
#include <stddef.h>
int f(ptrdiff_t n)
@@ -43,7 +42,6 @@ int KWSYS_PLATFORM_TEST_C_MAIN()
}
#endif
-/*--------------------------------------------------------------------------*/
#ifdef TEST_KWSYS_C_HAS_SSIZE_T
#include <unistd.h>
int f(ssize_t n)
@@ -57,7 +55,6 @@ int KWSYS_PLATFORM_TEST_C_MAIN()
}
#endif
-/*--------------------------------------------------------------------------*/
#ifdef TEST_KWSYS_C_TYPE_MACROS
char* info_macros =
#if defined(__SIZEOF_SHORT__)
diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx
index 3b8cdab..21930f9 100644
--- a/Source/kwsys/testConsoleBuf.cxx
+++ b/Source/kwsys/testConsoleBuf.cxx
@@ -74,7 +74,6 @@ std::basic_streambuf<wchar_t>* errstream(const wchar_t* unused)
return std::wcerr.rdbuf();
}
-//----------------------------------------------------------------------------
template <typename T>
static void dumpBuffers(const T* expected, const T* received, size_t size)
{
@@ -107,7 +106,6 @@ static void dumpBuffers(const T* expected, const T* received, size_t size)
std::cerr << std::endl;
}
-//----------------------------------------------------------------------------
static bool createProcess(HANDLE hIn, HANDLE hOut, HANDLE hErr)
{
BOOL bInheritHandles = FALSE;
@@ -158,7 +156,6 @@ static bool createProcess(HANDLE hIn, HANDLE hOut, HANDLE hErr)
return success;
}
-//----------------------------------------------------------------------------
static void finishProcess(bool success)
{
if (success) {
@@ -172,7 +169,6 @@ static void finishProcess(bool success)
CloseHandle(processInfo.hThread);
}
-//----------------------------------------------------------------------------
static bool createPipe(PHANDLE readPipe, PHANDLE writePipe)
{
SECURITY_ATTRIBUTES securityAttributes;
@@ -183,7 +179,6 @@ static bool createPipe(PHANDLE readPipe, PHANDLE writePipe)
: true;
}
-//----------------------------------------------------------------------------
static void finishPipe(HANDLE readPipe, HANDLE writePipe)
{
if (readPipe != INVALID_HANDLE_VALUE) {
@@ -194,7 +189,6 @@ static void finishPipe(HANDLE readPipe, HANDLE writePipe)
}
}
-//----------------------------------------------------------------------------
static HANDLE createFile(LPCWSTR fileName)
{
SECURITY_ATTRIBUTES securityAttributes;
@@ -218,7 +212,6 @@ static HANDLE createFile(LPCWSTR fileName)
return file;
}
-//----------------------------------------------------------------------------
static void finishFile(HANDLE file)
{
if (file != INVALID_HANDLE_VALUE) {
@@ -226,8 +219,6 @@ static void finishFile(HANDLE file)
}
}
-//----------------------------------------------------------------------------
-
#ifndef MAPVK_VK_TO_VSC
#define MAPVK_VK_TO_VSC (0)
#endif
@@ -269,7 +260,6 @@ static void writeInputKeyEvent(INPUT_RECORD inputBuffer[], WCHAR chr)
inputBuffer[1].Event.KeyEvent.dwControlKeyState = 0;
}
-//----------------------------------------------------------------------------
static int testPipe()
{
int didFail = 1;
@@ -377,7 +367,6 @@ static int testPipe()
return didFail;
}
-//----------------------------------------------------------------------------
static int testFile()
{
int didFail = 1;
@@ -487,7 +476,6 @@ static int testFile()
#define _WIN32_WINNT_VISTA 0x0600
#endif
-//----------------------------------------------------------------------------
static int testConsole()
{
int didFail = 1;
@@ -748,7 +736,6 @@ static int testConsole()
#endif
-//----------------------------------------------------------------------------
int testConsoleBuf(int, char* [])
{
int ret = 0;
diff --git a/Source/kwsys/testConsoleBufChild.cxx b/Source/kwsys/testConsoleBufChild.cxx
index 83bf545..6a743ed 100644
--- a/Source/kwsys/testConsoleBufChild.cxx
+++ b/Source/kwsys/testConsoleBufChild.cxx
@@ -16,7 +16,6 @@
#include "testConsoleBuf.hxx"
-//----------------------------------------------------------------------------
int main(int argc, const char* argv[])
{
#if defined(_WIN32)
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 457e8a8..2c5ef46 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -22,7 +22,6 @@
#include "Encoding.hxx.in"
#endif
-//----------------------------------------------------------------------------
static const unsigned char helloWorldStrings[][32] = {
// English
{ 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', 0 },
@@ -50,7 +49,6 @@ static const unsigned char helloWorldStrings[][32] = {
{ 0 }
};
-//----------------------------------------------------------------------------
static int testHelloWorldEncoding()
{
int ret = 0;
@@ -262,7 +260,6 @@ static int testToWindowsExtendedPath()
#endif
}
-//----------------------------------------------------------------------------
int testEncoding(int, char* [])
{
const char* loc = setlocale(LC_ALL, "");
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
index 670f5e7..a92a781 100644
--- a/Source/kwsys/testFStream.cxx
+++ b/Source/kwsys/testFStream.cxx
@@ -20,7 +20,6 @@
#include <iostream>
-//----------------------------------------------------------------------------
static int testNoFile()
{
kwsys::ifstream in_file("NoSuchFile.txt");
@@ -69,7 +68,6 @@ static unsigned char file_data[num_test_files][max_test_file_size] = {
0x72, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x64 },
};
-//----------------------------------------------------------------------------
static int testBOM()
{
// test various encodings in binary mode
@@ -104,7 +102,6 @@ static int testBOM()
return 0;
}
-//----------------------------------------------------------------------------
int testFStream(int, char* [])
{
int ret = 0;
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index d11bcae..900894c 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -35,7 +35,6 @@
typedef unsigned short mode_t;
#endif
-//----------------------------------------------------------------------------
static const char* toUnixPaths[][2] = {
{ "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
{ "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
@@ -67,7 +66,6 @@ static bool CheckConvertToUnixSlashes(std::string input, std::string output)
return true;
}
-//----------------------------------------------------------------------------
static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\",
"\\1 foo \\2 bar \\2" },
{ " {} ", "{}", "#", " #{#} " },
@@ -86,7 +84,6 @@ static bool CheckEscapeChars(std::string input, const char* chars_to_escape,
return true;
}
-//----------------------------------------------------------------------------
static bool CheckFileOperations()
{
bool res = true;
@@ -469,7 +466,6 @@ static bool CheckFileOperations()
return res;
}
-//----------------------------------------------------------------------------
static bool CheckStringOperations()
{
bool res = true;
@@ -613,8 +609,6 @@ static bool CheckStringOperations()
return res;
}
-//----------------------------------------------------------------------------
-
static bool CheckPutEnv(const std::string& env, const char* name,
const char* value)
{
@@ -842,7 +836,6 @@ static bool CheckGetLineFromStream()
return ret;
}
-//----------------------------------------------------------------------------
int testSystemTools(int, char* [])
{
bool res = true;
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index ecf6fa1..0d3f44f 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -40,7 +40,7 @@ static const int NumTests =
static char* lowercase(const char* string)
{
char *new_string, *p;
- size_t stringSize = 0;
+ size_t stringSize;
stringSize = CM_CAST(size_t, strlen(string) + 1);
new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize));
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2f53cfc9..4b335bd 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1391,6 +1391,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
+ add_subdirectory(GoogleTest)
endif()
if(CMake_TEST_FindICU)
@@ -1437,6 +1438,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindPNG)
endif()
+ if(CMake_TEST_FindProtobuf)
+ add_subdirectory(FindProtobuf)
+ endif()
+
if(CMake_TEST_FindTIFF)
add_subdirectory(FindTIFF)
endif()
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 1cca35d..1619081 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "")
AddCMakeTest(Version "")
AddCMakeTest(Message "")
AddCMakeTest(File "")
-AddCMakeTest(SeparateArguments "")
AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "")
AddCMakeTest(GetProperty "")
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 58e2bf9..6aa23a3 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -7,19 +7,19 @@ include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
# gcc dummy.c -v
set(linux64_gcc_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccEO9iux.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o")
-set(linux64_gcc_libs "c")
+set(linux64_gcc_libs "gcc;gcc_s;c;gcc;gcc_s")
set(linux64_gcc_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_gcc)
# g++ dummy.cxx -v
set(linux64_g++_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccalRBlq.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o")
-set(linux64_g++_libs "stdc++;m;c")
+set(linux64_g++_libs "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_g++_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_g++)
# f95 dummy.f -v
set(linux64_f95_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccAVcN7N.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o")
-set(linux64_f95_libs "gfortranbegin;gfortran;m;c")
+set(linux64_f95_libs "gfortranbegin;gfortran;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_f95_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_f95)
@@ -43,43 +43,43 @@ list(APPEND platforms linux64_sunf90)
# icc dummy.c -v
set(linux64_icc_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/iccBP8OfN.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
-set(linux64_icc_libs "imf;svml;m;ipgo;decimal;irc;irc;c;irc_s;dl;c")
+set(linux64_icc_libs "imf;svml;m;ipgo;decimal;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_icc_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_icc)
# icxx dummy.cxx -v
set(linux64_icxx_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/icpc270GoT.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -Bdynamic -lstdc++ -Bstatic -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
-set(linux64_icxx_libs "imf;svml;m;ipgo;decimal;stdc++;irc;irc;c;irc_s;dl;c")
+set(linux64_icxx_libs "imf;svml;m;ipgo;decimal;stdc++;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_icxx_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_icxx)
# ifort dummy.f -v
set(linux64_ifort_text "ld --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/intel/compiler/11.0/lib/intel64/for_main.o dum.cxx -Bstatic -lifport -lifcore -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -lirc -Bdynamic -lpthread -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
-set(linux64_ifort_libs "ifport;ifcore;imf;svml;m;ipgo;irc;pthread;c;irc_s;dl;c")
+set(linux64_ifort_libs "ifport;ifcore;imf;svml;m;ipgo;irc;pthread;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_ifort_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_ifort)
# pgcc dummy.c -v
set(linux64_pgcc_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgcc7OscXa5ur7Zk.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
-set(linux64_pgcc_libs "nspgc;pgc;m;c")
+set(linux64_pgcc_libs "nspgc;pgc;m;gcc;c;gcc")
set(linux64_pgcc_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgcc)
# pgCC dummy.cxx -v
set(linux64_pgCC_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgCCFhjcDt1fs1Ki.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lstd -lC -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
-set(linux64_pgCC_libs "std;C;nspgc;pgc;m;c")
+set(linux64_pgCC_libs "std;C;nspgc;pgc;m;gcc;c;gcc")
set(linux64_pgCC_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgCC)
# pgf90 dummy.f -v
set(linux64_pgf90_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/pgi/linux86-64/8.0-3/lib/f90main.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgf90QOIc_eB9xY5h.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
-set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;pthread;m;c")
+set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;pthread;m;gcc;c;gcc")
set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgf90)
# nagfor dummy.f -Wl,-v
set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o")
-set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickfit.o;/usr/local/NAG/lib/libf53.a;m;c")
+set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickfit.o;/usr/local/NAG/lib/libf53.a;m;gcc;gcc_s;c;gcc;gcc_s")
set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib")
set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib")
list(APPEND platforms linux64_nagfor)
@@ -87,7 +87,7 @@ list(APPEND platforms linux64_nagfor)
# absoft dummy.f -X -v
set(linux64_absoft_text "collect2 version 4.4.5 (x86-64 Linux/ELF)
/usr/bin/ld --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtbegin.o -L/opt/absoft11.1/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../.. /tmp/E3Bii1/dummy.o -v -laf90math -lafio -lamisc -labsoftmain -laf77math -lm -lmv -lpthread -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crtn.o")
-set(linux64_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;pthread;c")
+set(linux64_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;pthread;gcc;gcc_s;c;gcc;gcc_s")
set(linux64_absoft_dirs "/opt/absoft11.1/lib64;/usr/lib/gcc/x86_64-linux-gnu/4.4.5;/usr/lib;/lib")
list(APPEND platforms linux64_absoft)
@@ -108,13 +108,13 @@ list(APPEND platforms linux64_test2)
# -specs=redhat-hardened-ld
set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie'
/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccNzxFD8.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z now -pie -o a.out /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../.. -z relro dummy.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crtn.o")
-set(linux64_test3_libs "gfortran;m;quadmath;m;c")
+set(linux64_test3_libs "gfortran;m;gcc_s;gcc;quadmath;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib")
list(APPEND platforms linux64_test3)
# clang -fsanitize=memory
set(linux64_clang_sanitize_memory_text [[ "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/lib/llvm-3.8/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a -no-whole-archive --dynamic-list=/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a.syms /tmp/dummy-27898d.o --no-as-needed -lpthread -lrt -lm -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o]])
-set(linux64_clang_sanitize_memory_libs "pthread;rt;m;dl;c")
+set(linux64_clang_sanitize_memory_libs "pthread;rt;m;dl;gcc;gcc_s;c;gcc;gcc_s")
set(linux64_clang_sanitize_memory_dirs "/usr/lib/gcc/x86_64-linux-gnu/5.4.0;/usr/lib/x86_64-linux-gnu;/lib/x86_64-linux-gnu;/lib64;/usr/lib;/usr/lib/llvm-3.8/lib;/lib")
list(APPEND platforms linux64_clang_sanitize_memory)
@@ -137,14 +137,14 @@ Library search paths:
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/")
-set(mac_i686_gcc_Wlv_libs "")
+set(mac_i686_gcc_Wlv_libs "gcc")
set(mac_i686_gcc_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_i686_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_gcc_Wlv)
# gcc -arch i686 dummy.c -v
set(mac_i686_gcc_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccnhXAGL.o -lSystem -lgcc -lSystem")
-set(mac_i686_gcc_libs "")
+set(mac_i686_gcc_libs "gcc")
set(mac_i686_gcc_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_i686_gcc)
@@ -164,14 +164,14 @@ Library search paths:
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/")
-set(mac_i686_g++_Wlv_libs "stdc++")
+set(mac_i686_g++_Wlv_libs "stdc++;gcc")
set(mac_i686_g++_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_i686_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_g++_Wlv)
# g++ -arch i686 dummy.cxx -v
set(mac_i686_g++_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem")
-set(mac_i686_g++_libs "stdc++")
+set(mac_i686_g++_libs "stdc++;gcc")
set(mac_i686_g++_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_i686_g++)
@@ -188,14 +188,14 @@ Library search paths:
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/")
-set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran")
+set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc")
set(mac_i686_gfortran_Wlv_dirs "/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/local/lib;/usr/lib")
set(mac_i686_gfortran_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_gfortran_Wlv)
# gfortran dummy.f -v
set(mac_i686_gfortran_text " /usr/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/lib/gcc -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//ccgqbX5P.o -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem")
-set(mac_i686_gfortran_libs "gfortranbegin;gfortran")
+set(mac_i686_gfortran_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc")
set(mac_i686_gfortran_dirs "/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/lib/gcc;/usr/lib")
list(APPEND platforms mac_i686_gfortran)
@@ -215,14 +215,14 @@ Library search paths:
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/")
-set(mac_ppc_gcc_Wlv_libs "")
+set(mac_ppc_gcc_Wlv_libs "gcc")
set(mac_ppc_gcc_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_ppc_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_ppc_gcc_Wlv)
# gcc -arch ppc dummy.c -v
set(mac_ppc_gcc_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccdcolsP.o -lgcc -lSystemStubs -lSystem")
-set(mac_ppc_gcc_libs "")
+set(mac_ppc_gcc_libs "gcc")
set(mac_ppc_gcc_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_ppc_gcc)
@@ -242,14 +242,14 @@ Library search paths:
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/")
-set(mac_ppc_g++_Wlv_libs "stdc++")
+set(mac_ppc_g++_Wlv_libs "stdc++;gcc")
set(mac_ppc_g++_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_ppc_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_ppc_g++_Wlv)
# g++ -arch ppc dummy.cxx -v
set(mac_ppc_g++_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccbjB6Lj.o -lstdc++ -lgcc -lSystemStubs -lSystem")
-set(mac_ppc_g++_libs "stdc++")
+set(mac_ppc_g++_libs "stdc++;gcc")
set(mac_ppc_g++_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_ppc_g++)
@@ -257,7 +257,7 @@ list(APPEND platforms mac_ppc_g++)
set(mac_absoft_text "collect2 version 4.2.1 (Apple Inc. build 5664) (i686 Darwin)
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld -dynamic -arch i386 -macosx_version_min 10.6.6 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/Applications/Absoft11.1/lib -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/folders/04/04+Djjm8GZWBmuEdp2Gsw++++TM/-Tmp-//bTAoJc/dummy.o -v -Y 10 -laf90math -lafio -lamisc -labsoftmain -laf77math -lm -lmv -lSystem -lgcc -lSystem
")
-set(mac_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv")
+set(mac_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;gcc")
set(mac_absoft_dirs "/Applications/Absoft11.1/lib;/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_absoft)
@@ -485,13 +485,13 @@ list(APPEND platforms irix64_f90_64)
# gcc dummy.c -v
set(cygwin_gcc_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cyg /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. /home/user/AppData/Local/Temp/cczg1Arh.o -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc")
-set(cygwin_gcc_libs "cygwin;user32;kernel32;advapi32;shell32")
+set(cygwin_gcc_libs "gcc;cygwin;user32;kernel32;advapi32;shell32;gcc")
set(cygwin_gcc_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib")
list(APPEND platforms cygwin_gcc)
# g++ dummy.cxx -v
set(cygwin_g++_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cyg /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc")
-set(cygwin_g++_libs "stdc++;cygwin;user32;kernel32;advapi32;shell32")
+set(cygwin_g++_libs "stdc++;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc")
set(cygwin_g++_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib")
list(APPEND platforms cygwin_g++)
@@ -499,7 +499,7 @@ list(APPEND platforms cygwin_g++)
set(cygwin_gfortran_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe
/usr/lib/gcc/i686-pc-cygwin/4.3.2/collect2.exe -Bdynamic --dll-search-prefix=cyg -u ___register_frame_info -u ___deregister_frame_info /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../crt0.o /usr/lib/gcc/i686-pc-cygwin/4.3.2/crtbegin.o -L/usr/lib/gcc/i686-pc-cygwin/4.3.2 -L/usr/lib/gcc/i686-pc-cygwin/4.3.2 -L/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../.. /home/user/AppData/Local/Temp/ccqRWKWg.o -lgfortranbegin -lgfortran -lgcc_s -lgcc_s -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc_s -lgcc /usr/lib/gcc/i686-pc-cygwin/4.3.2/crtend.o
")
-set(cygwin_gfortran_libs "gfortranbegin;gfortran;cygwin;user32;kernel32;advapi32;shell32")
+set(cygwin_gfortran_libs "gfortranbegin;gfortran;gcc_s;gcc_s;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc_s;gcc_s;gcc")
set(cygwin_gfortran_dirs "/usr/lib/gcc/i686-pc-cygwin/4.3.2;/usr/lib")
list(APPEND platforms cygwin_gfortran)
@@ -508,19 +508,19 @@ list(APPEND platforms cygwin_gfortran)
# gcc dummy.c -v
set(msys_gcc_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cckQmvRt.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_gcc_libs "mingw32;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;moldname;mingwex;msvcrt")
+set(msys_gcc_libs "mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
set(msys_gcc_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_gcc)
# g++ dummy.cxx -v
set(msys_g++_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cci5hYPk.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_g++_libs "stdc++;mingw32;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;moldname;mingwex;msvcrt")
+set(msys_g++_libs "stdc++;mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
set(msys_g++_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_g++)
# g77 dummy.f -v
set(msys_g77_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/ccabRxQ1.o -lfrtbegin -lg2c -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
-set(msys_g77_libs "frtbegin;g2c;mingw32;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;moldname;mingwex;msvcrt")
+set(msys_g77_libs "frtbegin;g2c;mingw32;gcc;moldname;mingwex;msvcrt;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex;msvcrt")
set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_g77)
diff --git a/Tests/CMakeTests/SeparateArgumentsTest.cmake.in b/Tests/CMakeTests/SeparateArgumentsTest.cmake.in
deleted file mode 100644
index 48964b8..0000000
--- a/Tests/CMakeTests/SeparateArgumentsTest.cmake.in
+++ /dev/null
@@ -1,25 +0,0 @@
-set(old_out "a b c")
-separate_arguments(old_out)
-set(old_exp "a;b;;c")
-
-set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
-set(unix_exp "a;b c;d e;\;; '\";';\"")
-separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}")
-
-set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
-set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
-separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}")
-
-foreach(mode old unix windows)
- if(NOT "${${mode}_out}" STREQUAL "${${mode}_exp}")
- message(FATAL_ERROR "separate_arguments ${mode}-style failed. "
- "Expected\n [${${mode}_exp}]\nbut got\n [${${mode}_out}]\n")
- endif()
-endforeach()
-
-set(nothing)
-separate_arguments(nothing)
-if(DEFINED nothing)
- message(FATAL_ERROR "separate_arguments null-case failed: "
- "nothing=[${nothing}]")
-endif()
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 2a307d0..bb18543 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -239,6 +239,16 @@ if (CMAKE_C_COMPILE_FEATURES)
EXPECT_C_STATIC_ASSERT=0
)
endif()
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.13)
+ list(APPEND expected_defs
+ EXPECT_C_STATIC_ASSERT=1
+ )
+ else()
+ list(APPEND expected_defs
+ EXPECT_C_STATIC_ASSERT=0
+ )
+ endif()
endif()
list(APPEND expected_defs
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index 0e67095..4debd94 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -11,7 +11,8 @@
#if !DEFAULT_C90
#error Buildsystem error
#endif
-#if defined(__STDC_VERSION__)
+#if defined(__STDC_VERSION__) && \
+ !(defined(__SUNPRO_C) && __STDC_VERSION__ == 199409L)
#error Unexpected __STDC_VERSION__ definition
#endif
#endif
diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt
index 99368ac..b65b9d2 100644
--- a/Tests/FindGTest/Test/CMakeLists.txt
+++ b/Tests/FindGTest/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindGTest CXX)
include(CTest)
-# CMake does not actually provide FindGTest publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(GTest REQUIRED)
add_executable(test_gtest_tgt main.cxx)
diff --git a/Tests/FindMPI/Test/CMakeLists.txt b/Tests/FindMPI/Test/CMakeLists.txt
index 6f177f9..3910c25 100644
--- a/Tests/FindMPI/Test/CMakeLists.txt
+++ b/Tests/FindMPI/Test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
-project(TestFindMPI)
+project(TestFindMPI NONE)
include(CTest)
macro(source_code_mapper_helper LANG_NAME)
diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt
index 4ba0e5c..2692947 100644
--- a/Tests/FindOpenMP/Test/CMakeLists.txt
+++ b/Tests/FindOpenMP/Test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
-project(TestFindOpenMP)
+project(TestFindOpenMP NONE)
include(CTest)
macro(source_code_mapper_helper LANG_NAME SRC_FILE_NAME)
@@ -39,11 +39,7 @@ foreach(c C CXX Fortran)
add_test(NAME test_tgt_${c} COMMAND test_tgt_${c})
add_executable(test_var_${c} ${OpenMPTEST_SOURCE_FILE})
- if(CMAKE_HOST_WIN32)
- separate_arguments(_OpenMP_${c}_OPTIONS WINDOWS_COMMAND "${OpenMP_${c}_FLAGS}")
- else()
- separate_arguments(_OpenMP_${c}_OPTIONS UNIX_COMMAND "${OpenMP_${c}_FLAGS}")
- endif()
+ separate_arguments(_OpenMP_${c}_OPTIONS NATIVE_COMMAND "${OpenMP_${c}_FLAGS}")
target_compile_options(test_var_${c} PRIVATE "${_OpenMP_${c}_OPTIONS}")
target_link_libraries(test_var_${c} PRIVATE "${OpenMP_${c}_FLAGS}")
set_property(TARGET test_var_${c} PROPERTY LINKER_LANGUAGE ${c})
diff --git a/Tests/FindProtobuf/CMakeLists.txt b/Tests/FindProtobuf/CMakeLists.txt
new file mode 100644
index 0000000..1cdb2ae
--- /dev/null
+++ b/Tests/FindProtobuf/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindProtobuf.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindProtobuf/Test"
+ "${CMake_BINARY_DIR}/Tests/FindProtobuf/Test"
+ ${build_generator_args}
+ --build-project TestFindProtobuf
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt
new file mode 100644
index 0000000..d7a5081
--- /dev/null
+++ b/Tests/FindProtobuf/Test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindProtobuf CXX)
+include(CTest)
+
+find_package(Protobuf REQUIRED)
+
+add_executable(test_tgt main.cxx)
+target_link_libraries(test_tgt Protobuf::protobuf)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.cxx)
+target_include_directories(test_var PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${Protobuf_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
+
+add_executable(test_tgt_lite main.cxx)
+target_link_libraries(test_tgt_lite Protobuf::protobuf-lite)
+add_test(NAME test_tgt_lite COMMAND test_tgt_lite)
+
+add_executable(test_var_lite main.cxx)
+target_include_directories(test_var_lite PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var_lite PRIVATE ${Protobuf_LITE_LIBRARIES})
+add_test(NAME test_var_lite COMMAND test_var_lite)
+
+add_executable(test_tgt_protoc main-protoc.cxx)
+target_link_libraries(test_tgt_protoc Protobuf::protoc)
+add_test(NAME test_tgt_protoc COMMAND test_tgt_protoc)
+
+add_executable(test_var_protoc main-protoc.cxx)
+target_include_directories(test_var_protoc PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var_protoc PRIVATE ${Protobuf_PROTOC_LIBRARIES})
+add_test(NAME test_var_protoc COMMAND test_var_protoc)
diff --git a/Tests/FindProtobuf/Test/main-protoc.cxx b/Tests/FindProtobuf/Test/main-protoc.cxx
new file mode 100644
index 0000000..64e5ada
--- /dev/null
+++ b/Tests/FindProtobuf/Test/main-protoc.cxx
@@ -0,0 +1,8 @@
+#include <google/protobuf/compiler/command_line_interface.h>
+
+int main()
+{
+ google::protobuf::compiler::CommandLineInterface();
+
+ return 0;
+}
diff --git a/Tests/FindProtobuf/Test/main.cxx b/Tests/FindProtobuf/Test/main.cxx
new file mode 100644
index 0000000..87d5c12
--- /dev/null
+++ b/Tests/FindProtobuf/Test/main.cxx
@@ -0,0 +1,8 @@
+#include <google/protobuf/stubs/common.h>
+
+int main()
+{
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ return 0;
+}
diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt
index 6985e3f..85453ed 100644
--- a/Tests/FindTIFF/Test/CMakeLists.txt
+++ b/Tests/FindTIFF/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindTIFF C)
include(CTest)
-# CMake does not actually provide FindTIFF publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(TIFF REQUIRED)
add_executable(test_tiff_tgt main.c)
diff --git a/Tests/FindXalanC/Test/CMakeLists.txt b/Tests/FindXalanC/Test/CMakeLists.txt
index b445e0e..a8c2a0a 100644
--- a/Tests/FindXalanC/Test/CMakeLists.txt
+++ b/Tests/FindXalanC/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindXalanC CXX)
include(CTest)
-# CMake does not actually provide FindXalanC publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(XalanC REQUIRED)
add_executable(test_xalanc_tgt main.cxx)
diff --git a/Tests/FindXercesC/Test/CMakeLists.txt b/Tests/FindXercesC/Test/CMakeLists.txt
index 8e7767c..267c6a9 100644
--- a/Tests/FindXercesC/Test/CMakeLists.txt
+++ b/Tests/FindXercesC/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindXercesC CXX)
include(CTest)
-# CMake does not actually provide FindXercesC publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(XercesC REQUIRED)
add_executable(test_xercesc_tgt main.cxx)
diff --git a/Tests/GoogleTest/CMakeLists.txt b/Tests/GoogleTest/CMakeLists.txt
new file mode 100644
index 0000000..21f8b8b
--- /dev/null
+++ b/Tests/GoogleTest/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME GoogleTest.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/GoogleTest/Test"
+ "${CMake_BINARY_DIR}/Tests/GoogleTest/Test"
+ ${build_generator_args}
+ --build-project TestGoogleTest
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt
new file mode 100644
index 0000000..a1f08d4
--- /dev/null
+++ b/Tests/GoogleTest/Test/CMakeLists.txt
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 3.8)
+project(TestGoogleTest)
+include(CTest)
+
+include(GoogleTest)
+
+find_package(GTest REQUIRED)
+
+add_executable(test_gtest1 main1.cxx)
+target_link_libraries(test_gtest1 GTest::GTest)
+
+# Simple test of defaults
+gtest_add_tests(TARGET test_gtest1
+ TEST_LIST testList
+)
+set(expectedTests
+ GoogleTest.LinksAndRuns
+ GoogleTest.ConditionalFail
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+
+# Same target, different arguments, so use test prefix and suffix to
+# differentiate from the above test cases
+gtest_add_tests(TARGET test_gtest1
+ TEST_LIST testList
+ TEST_PREFIX "set2."
+ TEST_SUFFIX ".foo"
+ EXTRA_ARGS --forceFail
+)
+
+set(expectedTests
+ set2.GoogleTest.LinksAndRuns.foo
+ set2.GoogleTest.ConditionalFail.foo
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+set_tests_properties(set2.GoogleTest.ConditionalFail.foo PROPERTIES WILL_FAIL YES)
+
+
+# Search specific sources to get the test list
+add_executable(test_gtest2 main2.cxx)
+target_link_libraries(test_gtest2 GTest::Main)
+gtest_add_tests(TARGET test_gtest2
+ TEST_LIST testList
+ SOURCES main2.h
+)
+set(expectedTests
+ GoogleTest.SomethingElse
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+
+# Non-keyword form, auto-find sources
+add_executable(test_gtest3 main3.cxx)
+target_link_libraries(test_gtest3 GTest::Main)
+gtest_add_tests(test_gtest3 "" AUTO)
+if(NOT TEST GoogleTest.Foo)
+ message(FATAL_ERROR "Test case GoogleTest.Foo not defined")
+endif()
+if(NOT TEST GoogleTest.Bar)
+ message(FATAL_ERROR "Test case GoogleTest.Bar not defined")
+endif()
+
+
+# Non-keyword form, explicitly specified sources. Allows a non-target to be
+# given for the executable.
+add_executable(test_gtest4 main4.cxx)
+target_link_libraries(test_gtest4 GTest::Main)
+gtest_add_tests($<TARGET_FILE:test_gtest4> "" main4.h)
+if(NOT TEST GoogleTest.NoKeywords)
+ message(FATAL_ERROR "Test case GoogleTest.NoKeywords not defined")
+endif()
diff --git a/Tests/GoogleTest/Test/main1.cxx b/Tests/GoogleTest/Test/main1.cxx
new file mode 100644
index 0000000..03d604b
--- /dev/null
+++ b/Tests/GoogleTest/Test/main1.cxx
@@ -0,0 +1,30 @@
+#include <gtest/gtest.h>
+
+#include <string>
+
+namespace {
+bool shouldFail = false;
+}
+
+TEST(GoogleTest, LinksAndRuns)
+{
+ ASSERT_TRUE(true);
+}
+
+TEST(GoogleTest, ConditionalFail)
+{
+ ASSERT_FALSE(shouldFail);
+}
+
+int main(int argc, char* argv[])
+{
+ ::testing::InitGoogleTest(&argc, argv);
+
+ if (argc > 1) {
+ if (argv[1] != std::string("--forceFail")) {
+ throw "Unexpected argument";
+ }
+ shouldFail = true;
+ }
+ return RUN_ALL_TESTS();
+}
diff --git a/Tests/GoogleTest/Test/main2.cxx b/Tests/GoogleTest/Test/main2.cxx
new file mode 100644
index 0000000..05ffb4a
--- /dev/null
+++ b/Tests/GoogleTest/Test/main2.cxx
@@ -0,0 +1 @@
+#include "main2.h"
diff --git a/Tests/GoogleTest/Test/main2.h b/Tests/GoogleTest/Test/main2.h
new file mode 100644
index 0000000..7243f53
--- /dev/null
+++ b/Tests/GoogleTest/Test/main2.h
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, SomethingElse)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/GoogleTest/Test/main3.cxx b/Tests/GoogleTest/Test/main3.cxx
new file mode 100644
index 0000000..98ce13c
--- /dev/null
+++ b/Tests/GoogleTest/Test/main3.cxx
@@ -0,0 +1,11 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, Foo)
+{
+ ASSERT_TRUE(true);
+}
+
+TEST(GoogleTest, Bar)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/GoogleTest/Test/main4.cxx b/Tests/GoogleTest/Test/main4.cxx
new file mode 100644
index 0000000..8023bc1
--- /dev/null
+++ b/Tests/GoogleTest/Test/main4.cxx
@@ -0,0 +1 @@
+#include "main4.h"
diff --git a/Tests/GoogleTest/Test/main4.h b/Tests/GoogleTest/Test/main4.h
new file mode 100644
index 0000000..19da12a
--- /dev/null
+++ b/Tests/GoogleTest/Test/main4.h
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, NoKeywords)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c
index 4b1318b..e70fbb5 100644
--- a/Tests/RunCMake/AutoExportDll/foo.c
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -13,3 +13,5 @@ int bar()
{
return 5;
}
+
+const char testconst[] = "testconst";
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx
index 51060e8..eb9c0ff 100644
--- a/Tests/RunCMake/AutoExportDll/say.cxx
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -13,6 +13,14 @@ int WINAPI foo();
int bar();
int objlib();
void justnop();
+
+// test const export
+#ifdef _WIN32
+// data symbols must be explicitly imported
+__declspec(dllimport) extern const char testconst[];
+#else
+extern const char testconst[];
+#endif
}
// test c++ functions
@@ -43,6 +51,8 @@ int main()
bar();
objlib();
printf("\n");
+ printf("%s", testconst);
+ printf("\n");
#ifdef HAS_JUSTNOP
justnop();
#endif
diff --git a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
index 61ba458..f44f840 100644
--- a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
@@ -5,7 +5,6 @@ run_cmake(CMP0069-NEW-cmake)
run_cmake(CMP0069-NEW-compiler)
run_cmake(CMP0069-WARN)
-string(COMPARE EQUAL "${RunCMake_GENERATOR}" "Xcode" is_xcode)
-if(is_xcode OR RunCMake_GENERATOR MATCHES "^Visual Studio ")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake(CMP0069-NEW-generator)
endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index cf778b6..75d4e29 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -217,6 +217,7 @@ add_RunCMake_test(list)
add_RunCMake_test(message)
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(return)
+add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
foreach(var
diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
index ce039f5..99d3155 100644
--- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
+++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
@@ -33,7 +33,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
# component and monolithic packages differ for some reason by either having
# package filename prefix in path or not
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 8ca7126..faf151a 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -5,7 +5,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT")
-run_cpack_test(CUSTOM_NAMES "RPM;DEB" true "COMPONENT")
+run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT")
run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
run_cpack_test(DIST "RPM" false "MONOLITHIC")
@@ -24,5 +24,6 @@ run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_co
run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT")
run_cpack_source_test(SOURCE_PACKAGE "RPM")
run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC")
+run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT")
run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC")
run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
index 08224d3..68b1eab 100644
--- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake
+++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
@@ -35,7 +35,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
get_filename_component(prefix_ "${file_}" NAME)
# NAME_WE removes everything after the dot and dot is in version so replace instead
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 59751a7..470ebf7 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
-function(findExpectedFile FILE_NO RESULT_VAR)
+function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR)
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data
# set defaults if parameters are not provided
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME)
@@ -21,6 +21,7 @@ function(findExpectedFile FILE_NO RESULT_VAR)
file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}")
set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE)
+ set(${GLOBING_EXPR_VAR} "${EXPECTED_FILE_${FILE_NO}}" PARENT_SCOPE)
endfunction()
include("${config_file}")
@@ -39,7 +40,8 @@ include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake")
# check that expected generated files exist and contain expected content
if(NOT EXPECTED_FILES_COUNT EQUAL 0)
foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
- findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}")
+ findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}"
+ "EXPECTED_FILE_${file_no_}")
list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}")
list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_)
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
index ae5f0af..5cb280c 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
@@ -9,4 +9,7 @@ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
set(EXPECTED_FILE_3 "pkg_3_abc.${file_extension_}")
+elseif(GENERATOR_TYPE STREQUAL "TGZ")
+ set(EXPECTED_FILE_2 "second.tar.gz")
+ set(EXPECTED_FILE_3 "pkg_3_abc.tar.gz")
endif()
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
index 0c2b37b..4c20e41 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
@@ -7,6 +7,9 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second")
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_3_FILE_NAME "pkg_3_abc.${file_extension_}")
+elseif(GENERATOR_TYPE STREQUAL "TGZ")
+ set(CPACK_ARCHIVE_PKG_2_FILE_NAME "second")
+ set(CPACK_ARCHIVE_PKG_3_FILE_NAME "pkg_3_abc")
endif()
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
new file mode 100644
index 0000000..05be748
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
@@ -0,0 +1,13 @@
+set(EXPECTED_FILES_COUNT "1")
+
+set(EXPECTED_FILE_CONTENT_1_LIST
+ "/usr"
+ "/usr/empty_dir"
+ "/usr/non_empty_dir"
+ "/usr/non_empty_dir/CMakeLists.txt"
+ "/usr/symlink_to_empty_dir"
+ "/usr/symlink_to_non_empty_dir")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(EXPECTED_FILE_1_COMPONENT "links")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
new file mode 100644
index 0000000..f3df46b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
@@ -0,0 +1,5 @@
+function(get_test_prerequirements found_var config_file)
+ if(UNIX) # limit test to platforms that support symlinks
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
new file mode 100644
index 0000000..0632319
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
@@ -0,0 +1,26 @@
+set(whitespaces "[\\t\\n\\r ]*")
+
+#######################
+# verify generated symbolic links
+#######################
+file(GLOB_RECURSE symlink_files RELATIVE "${bin_dir}" "${bin_dir}/*/symlink_*")
+
+foreach(check_symlink IN LISTS symlink_files)
+ get_filename_component(symlink_name "${check_symlink}" NAME)
+ execute_process(COMMAND ls -la "${check_symlink}"
+ WORKING_DIRECTORY "${bin_dir}"
+ OUTPUT_VARIABLE SYMLINK_POINT_
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if("${symlink_name}" STREQUAL "symlink_to_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ elseif("${symlink_name}" STREQUAL "symlink_to_non_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}non_empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ else()
+ message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'")
+ endif()
+
+ if(NOT check_symlink)
+ message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
new file mode 100644
index 0000000..fef765c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
@@ -0,0 +1,14 @@
+install(DIRECTORY DESTINATION empty_dir COMPONENT links)
+install(FILES CMakeLists.txt DESTINATION non_empty_dir COMPONENT links)
+
+# test symbolic link to an empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink empty_dir symlink_to_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_empty_dir DESTINATION "." COMPONENT links)
+
+# test symbolic link to a non empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink non_empty_dir symlink_to_non_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_empty_dir DESTINATION "." COMPONENT links)
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL links)
+endif()
diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
index 588a75d..e145569 100644
--- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
@@ -8,6 +8,6 @@ run_cmake(not-supported-by-compiler)
run_cmake(save-to-result)
run_cmake(cmp0069-is-old)
-if(RunCMake_GENERATOR MATCHES "^(Visual Studio |Xcode$)")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake(not-supported-by-generator)
endif()
diff --git a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt
index 8d90f5f..f664db9 100644
--- a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt
+++ b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt
@@ -1 +1,3 @@
-.*/Framework: Mach-O[^\n]* dynamically linked shared library.*
+.*/Framework:( Mach-O universal binary with [^
+]*)? Mach-O[^
+]* dynamically linked shared library.*
diff --git a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt
index c9f50b6..532cfed 100644
--- a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt
+++ b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt
@@ -1 +1,2 @@
-.*/Framework: current ar archive random library.*
+.*/Framework:( Mach-O universal binary with [^
+]*)? current ar archive random library.*
diff --git a/Tests/RunCMake/Ninja/CommandConcat.cmake b/Tests/RunCMake/Ninja/CommandConcat.cmake
new file mode 100644
index 0000000..790cf9d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CommandConcat.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(concat_cmd NONE)
+set(output1 ${CMAKE_BINARY_DIR}/out1.txt)
+set(output2 ${CMAKE_BINARY_DIR}/out2.txt)
+file(REMOVE ${output1} ${output2})
+# Check that second command runs if first command contains "||" which has higher precedence than "&&" on Windows
+add_custom_target(concat_cmd ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "Hello || pipe world" && ${CMAKE_COMMAND} -E touch ${output1} || exit 1
+ COMMAND ${CMAKE_COMMAND} -E touch ${output2})
+# Check output
+add_custom_target(check_output ALL
+ COMMAND ${CMAKE_COMMAND} -E copy ${output1} ${output1}.copy
+ COMMAND ${CMAKE_COMMAND} -E copy ${output2} ${output2}.copy)
+add_dependencies(check_output concat_cmd)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8c3bc20..b3720fb 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -40,6 +40,16 @@ run_CMP0058(NEW-by)
run_cmake(CustomCommandDepfile)
+function(run_CommandConcat)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(CommandConcat)
+ run_cmake_command(CommandConcat-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_CommandConcat()
+
function(run_SubDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build)
diff --git a/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in
index ab50fdd..5cb0b4e 100644
--- a/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.6.2)
+cmake_minimum_required (VERSION 3.8.0)
project(ctest_fixtures LANGUAGES NONE)
include(CTest)
diff --git a/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
index 673cf57..1754203 100644
--- a/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
@@ -19,6 +19,41 @@ run_ctest_test(setupFoo INCLUDE setupFoo)
run_ctest_test(wontRun INCLUDE wontRun)
run_ctest_test(unused INCLUDE Unused)
+run_ctest_test(exclude_setup_foo
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE_SETUP "Foo"
+)
+
+run_ctest_test(exclude_setup_bar
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE_SETUP "Bar"
+)
+
+run_ctest_test(exclude_cleanup_foo
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE_CLEANUP "Foo"
+)
+
+run_ctest_test(exclude_cleanup_bar
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE_CLEANUP "Bar"
+)
+
+run_ctest_test(exclude_any_foo
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE "Foo"
+)
+
+run_ctest_test(exclude_any_bar
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE "Bar"
+)
+
+run_ctest_test(exclude_any_foobar
+ INCLUDE "one|two"
+ EXCLUDE_FIXTURE "Foo|Bar"
+)
+
#------------------------------------------------------------
# CMake configure will fail due to cyclic test dependencies
#------------------------------------------------------------
@@ -35,3 +70,18 @@ set(CASE_CMAKELISTS_CYCLIC_CODE [[
FIXTURES_REQUIRED "Foo")
]])
run_ctest(cyclicCleanup)
+
+#------------------------------------------------------------
+# Repeat some of the exclusion tests with ctest command line
+# options instead of arguments to ctest_test(). This verifies
+# that the command line options make it through as well.
+#------------------------------------------------------------
+unset(CASE_CMAKELISTS_CYCLIC_CODE)
+set(CASE_CTEST_FIXTURES_ARGS "")
+
+run_ctest(exclude_setup_foo -R "one|two" -FS Foo)
+run_ctest(exclude_setup_foo -R "one|two" --fixture-exclude-setup Foo)
+run_ctest(exclude_cleanup_foo -R "one|two" -FC Foo)
+run_ctest(exclude_cleanup_foo -R "one|two" --fixture-exclude-cleanup Foo)
+run_ctest(exclude_any_foo -R "one|two" -FA Foo)
+run_ctest(exclude_any_foo -R "one|two" --fixture-exclude-any Foo)
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_any_bar-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_any_bar-stdout.txt
new file mode 100644
index 0000000..82663d5
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_any_bar-stdout.txt
@@ -0,0 +1,15 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_any_bar-build
+ Start 3: setupFoo
+1/5 Test #3: setupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 2: setupBoth
+2/5 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+3/5 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 5: cleanupFoo
+4/5 Test #5: cleanupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+5/5 Test #6: two +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 5
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_any_foo-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_any_foo-stdout.txt
new file mode 100644
index 0000000..8c08d08
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_any_foo-stdout.txt
@@ -0,0 +1,13 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_any_foo-build
+ Start 2: setupBoth
+1/4 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+2/4 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+3/4 Test #6: two +\.+ +Passed +[0-9.]+ sec
+ Start 7: cleanupBar
+4/4 Test #7: cleanupBar +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 4
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_any_foobar-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_any_foobar-stdout.txt
new file mode 100644
index 0000000..876768b
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_any_foobar-stdout.txt
@@ -0,0 +1,9 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_any_foobar-build
+ Start 1: one
+1/2 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+2/2 Test #6: two +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_cleanup_bar-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_cleanup_bar-stdout.txt
new file mode 100644
index 0000000..0d27198
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_cleanup_bar-stdout.txt
@@ -0,0 +1,15 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_cleanup_bar-build
+ Start 3: setupFoo
+1/5 Test #3: setupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 2: setupBoth
+2/5 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+3/5 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 5: cleanupFoo
+4/5 Test #5: cleanupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+5/5 Test #6: two +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 5
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_cleanup_foo-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_cleanup_foo-stdout.txt
new file mode 100644
index 0000000..5b201a3
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_cleanup_foo-stdout.txt
@@ -0,0 +1,15 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_cleanup_foo-build
+ Start 3: setupFoo
+1/5 Test #3: setupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 2: setupBoth
+2/5 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+3/5 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+4/5 Test #6: two +\.+ +Passed +[0-9.]+ sec
+ Start 7: cleanupBar
+5/5 Test #7: cleanupBar +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 5
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_setup_bar-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_setup_bar-stdout.txt
new file mode 100644
index 0000000..5357fef
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_setup_bar-stdout.txt
@@ -0,0 +1,17 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_setup_bar-build
+ Start 3: setupFoo
+1/6 Test #3: setupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 2: setupBoth
+2/6 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+3/6 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 5: cleanupFoo
+4/6 Test #5: cleanupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+5/6 Test #6: two +\.+ +Passed +[0-9.]+ sec
+ Start 7: cleanupBar
+6/6 Test #7: cleanupBar +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 6
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/exclude_setup_foo-stdout.txt b/Tests/RunCMake/ctest_fixtures/exclude_setup_foo-stdout.txt
new file mode 100644
index 0000000..89f7f44
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/exclude_setup_foo-stdout.txt
@@ -0,0 +1,15 @@
+Test project .*/Tests/RunCMake/ctest_fixtures/exclude_setup_foo-build
+ Start 2: setupBoth
+1/5 Test #2: setupBoth +\.+ +Passed +[0-9.]+ sec
+ Start 1: one
+2/5 Test #1: one +\.+ +Passed +[0-9.]+ sec
+ Start 5: cleanupFoo
+3/5 Test #5: cleanupFoo +\.+ +Passed +[0-9.]+ sec
+ Start 6: two
+4/5 Test #6: two +\.+ +Passed +[0-9.]+ sec
+ Start 7: cleanupBar
+5/5 Test #7: cleanupBar +\.+ +Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 5
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_fixtures/test.cmake.in b/Tests/RunCMake/ctest_fixtures/test.cmake.in
index 43df172..7067117 100644
--- a/Tests/RunCMake/ctest_fixtures/test.cmake.in
+++ b/Tests/RunCMake/ctest_fixtures/test.cmake.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.6.2)
+cmake_minimum_required(VERSION 3.8.0)
set(CTEST_SITE "test-site")
set(CTEST_BUILD_NAME "test-build-name")
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt
new file mode 100644
index 0000000..4825d7a
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt
@@ -0,0 +1,3 @@
+ *Error when uploading file: .*/Configure.xml
+ *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt
new file mode 100644
index 0000000..3973872
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stdout.txt
@@ -0,0 +1 @@
+Add HTTP Header: "Authorization: Bearer asdf"
diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt
new file mode 100644
index 0000000..706e1f5
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stderr.txt
@@ -0,0 +1 @@
+Error in HttpRequest
diff --git a/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt
new file mode 100644
index 0000000..3973872
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashUploadHeaders-stdout.txt
@@ -0,0 +1 @@
+Add HTTP Header: "Authorization: Bearer asdf"
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index e104f8a..b5d90d2 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -25,6 +25,8 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET)
+run_ctest_submit(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
+run_ctest_submit(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")
function(run_ctest_CDashUploadFTP)
set(CASE_DROP_METHOD ftp)
diff --git a/Tests/RunCMake/separate_arguments/CMakeLists.txt b/Tests/RunCMake/separate_arguments/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/separate_arguments/EmptyCommand.cmake b/Tests/RunCMake/separate_arguments/EmptyCommand.cmake
new file mode 100644
index 0000000..895b6ac
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/EmptyCommand.cmake
@@ -0,0 +1,6 @@
+set(nothing)
+separate_arguments(nothing)
+if(DEFINED nothing)
+ message(FATAL_ERROR "separate_arguments null-case failed: "
+ "nothing=[${nothing}]")
+endif()
diff --git a/Tests/RunCMake/separate_arguments/NativeCommand.cmake b/Tests/RunCMake/separate_arguments/NativeCommand.cmake
new file mode 100644
index 0000000..1cb009e
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/NativeCommand.cmake
@@ -0,0 +1,19 @@
+set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
+set(unix_exp "a;b c;d e;\;; '\";';\"")
+
+set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
+set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
+
+if(CMAKE_HOST_WIN32)
+ set(native_cmd "${windows_cmd}")
+ set(native_exp "${windows_exp}")
+else()
+ set(native_cmd "${unix_cmd}")
+ set(native_exp "${unix_exp}")
+endif()
+separate_arguments(native_out NATIVE_COMMAND "${native_cmd}")
+
+if(NOT "${native_out}" STREQUAL "${native_exp}")
+ message(FATAL_ERROR "separate_arguments native-style failed. "
+ "Expected\n [${native_exp}]\nbut got\n [${native_out}]\n")
+endif()
diff --git a/Tests/RunCMake/separate_arguments/PlainCommand.cmake b/Tests/RunCMake/separate_arguments/PlainCommand.cmake
new file mode 100644
index 0000000..311a993
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/PlainCommand.cmake
@@ -0,0 +1,8 @@
+set(old_out "a b c")
+separate_arguments(old_out)
+set(old_exp "a;b;;c")
+
+if(NOT "${old_out}" STREQUAL "${old_exp}")
+ message(FATAL_ERROR "separate_arguments old-style failed. "
+ "Expected\n [${old_exp}]\nbut got\n [${old_out}]\n")
+endif()
diff --git a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake
new file mode 100644
index 0000000..07951bb
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+run_cmake(EmptyCommand)
+run_cmake(PlainCommand)
+run_cmake(UnixCommand)
+run_cmake(WindowsCommand)
+run_cmake(NativeCommand)
diff --git a/Tests/RunCMake/separate_arguments/UnixCommand.cmake b/Tests/RunCMake/separate_arguments/UnixCommand.cmake
new file mode 100644
index 0000000..0b5767a
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/UnixCommand.cmake
@@ -0,0 +1,8 @@
+set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
+set(unix_exp "a;b c;d e;\;; '\";';\"")
+separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}")
+
+if(NOT "${unix_out}" STREQUAL "${unix_exp}")
+ message(FATAL_ERROR "separate_arguments unix-style failed. "
+ "Expected\n [${unix_exp}]\nbut got\n [${unix_out}]\n")
+endif()
diff --git a/Tests/RunCMake/separate_arguments/WindowsCommand.cmake b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake
new file mode 100644
index 0000000..86aa14a
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake
@@ -0,0 +1,8 @@
+set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
+set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
+separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}")
+
+if(NOT "${windows_out}" STREQUAL "${windows_exp}")
+ message(FATAL_ERROR "separate_arguments windows-style failed. "
+ "Expected\n [${windows_exp}]\nbut got\n [${windows_out}]\n")
+endif()
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index d11431d..78450d5 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import sys, subprocess, json
termwidth = 150
@@ -13,8 +14,8 @@ def ordered(obj):
return obj
def col_print(title, array):
- print
- print
+ print()
+ print()
print(title)
indentwidth = 4
diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py
index 14767f4..62d9008 100644
--- a/Tests/Server/server-test.py
+++ b/Tests/Server/server-test.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import sys, cmakelib, json, os, shutil
debug = True
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 9289e84..4e4a030 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 3.8)
project(SourceGroups)
# this is not really a test which can fail
@@ -33,10 +33,11 @@ source_group(EmptyGroup)
set(root ${CMAKE_CURRENT_SOURCE_DIR})
set(tree_files_without_prefix ${root}/sub1/tree_bar.c
- ${root}/sub1/tree_baz.c
- ${root}/sub1/tree_subdir/tree_foobar.c)
+ sub1/tree_baz.c
+ sub1/../sub1/tree_subdir/tree_foobar.c)
-set(tree_files_with_prefix ${root}/tree_foo.c)
+set(tree_files_with_prefix ${root}/tree_prefix_foo.c
+ tree_prefix_bar.c)
source_group(TREE ${root} FILES ${tree_files_without_prefix})
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index b88f2f8..4d84cf2 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -5,7 +5,8 @@ extern int bar(void);
extern int foobar(void);
extern int barbar(void);
extern int baz(void);
-extern int tree_foo(void);
+extern int tree_prefix_foo(void);
+extern int tree_prefix_bar(void);
extern int tree_bar(void);
extern int tree_foobar(void);
extern int tree_baz(void);
@@ -15,7 +16,9 @@ int main()
printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(),
foobar(), barbar(), baz());
- printf("tree_foo: %d tree_bar: %d tree_foobar: %d tree_baz: %d\n",
- tree_foo(), tree_bar(), tree_foobar(), tree_baz());
+ printf("tree_prefix_foo: %d tree_prefix_bar: %d tree_bar: %d tree_foobar: "
+ "%d tree_baz: %d\n",
+ tree_prefix_foo(), tree_prefix_bar(), tree_bar(), tree_foobar(),
+ tree_baz());
return 0;
}
diff --git a/Tests/SourceGroups/tree_foo.c b/Tests/SourceGroups/tree_foo.c
deleted file mode 100644
index d392e41..0000000
--- a/Tests/SourceGroups/tree_foo.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int tree_foo(void)
-{
- return 6;
-}
diff --git a/Tests/SourceGroups/tree_prefix_bar.c b/Tests/SourceGroups/tree_prefix_bar.c
new file mode 100644
index 0000000..bd98476
--- /dev/null
+++ b/Tests/SourceGroups/tree_prefix_bar.c
@@ -0,0 +1,4 @@
+int tree_prefix_bar(void)
+{
+ return 66;
+}
diff --git a/Tests/SourceGroups/tree_prefix_foo.c b/Tests/SourceGroups/tree_prefix_foo.c
new file mode 100644
index 0000000..92c2fd7
--- /dev/null
+++ b/Tests/SourceGroups/tree_prefix_foo.c
@@ -0,0 +1,4 @@
+int tree_prefix_foo(void)
+{
+ return 6;
+}
diff --git a/Utilities/.clang-tidy b/Utilities/.clang-tidy
new file mode 100644
index 0000000..381a0f4
--- /dev/null
+++ b/Utilities/.clang-tidy
@@ -0,0 +1,6 @@
+---
+# We want to disable all checks for 3rd party code. However, clang-tidy will
+# assume we did not configure it correctly. Just add one check that will never
+# be found.
+Checks: '-*,llvm-twine-local'
+...
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 014204b..0564540 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -29,3 +29,6 @@ endif()
if(WIX_CUSTOM_ACTION_ENABLED)
add_subdirectory(Release/WiX)
endif()
+
+# Make sure generated files use the same clang-tidy checks (none).
+configure_file(.clang-tidy .clang-tidy COPYONLY)
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index cfa90cc..a732c9c 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -47,6 +47,12 @@
#{ 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 ] },
+
# Wrappers for headers added in TR1 / C++11
# { include: [ "<array>", public, "\"cm_array.hxx\"", public ] },
# { include: [ "<functional>", public, "\"cm_functional.hxx\"", public ] },
@@ -113,6 +119,11 @@
{ include: [ "\"cmzlib/zconf.h\"", private, "\"cm_zlib.h\"", public ] },
{ include: [ "\"cmzlib/zlib.h\"", private, "\"cm_zlib.h\"", public ] },
+ # System symbols used by libuv
+ { symbol: [ "SIGHUP", private, "\"cm_uv.h\"", public ] },
+ { symbol: [ "SIGINT", private, "\"cm_uv.h\"", public ] },
+ { symbol: [ "ssize_t", private, "\"cm_uv.h\"", public ] },
+
{ symbol: [ "std::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
{ symbol: [ "std::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
{ symbol: [ "cmsys::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake
index 88ea39b..36498a7 100644
--- a/Utilities/Release/osx_release.cmake
+++ b/Utilities/Release/osx_release.cmake
@@ -27,7 +27,7 @@ CMAKE_SKIP_RPATH:BOOL=TRUE
CMake_TEST_NO_FindPackageModeMakefileTest:BOOL=TRUE
")
set(ENV [[
-export CMAKE_PREFIX_PATH='/Users/kitware/SDKs/qt-5.6.0-clang-x64'
+export CMAKE_PREFIX_PATH='/Users/kitware/SDKs/qt-5.6.2-clang-x64'
]])
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/Scripts/update-curl.bash b/Utilities/Scripts/update-curl.bash
index 9cff7ca..d270d37 100755
--- a/Utilities/Scripts/update-curl.bash
+++ b/Utilities/Scripts/update-curl.bash
@@ -8,7 +8,7 @@ readonly name="curl"
readonly ownership="Curl Upstream <curl-library@cool.haxx.se>"
readonly subtree="Utilities/cmcurl"
readonly repo="https://github.com/curl/curl.git"
-readonly tag="curl-7_52_1"
+readonly tag="curl-7_54_0"
readonly shortlog=false
readonly paths="
CMake/*
@@ -32,6 +32,7 @@ extract_source () {
git_archive
pushd "${extractdir}/${name}-reduced"
rm lib/config-*.h
+ echo "* -whitespace" > .gitattributes
popd
}
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index edb9469..a29380c 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -128,18 +128,20 @@ endforeach()
add_custom_target(documentation ALL DEPENDS ${doc_format_outputs})
-foreach(t
- cmake
- ccmake
- cmake-gui
- cpack
- ctest
- )
- if(TARGET ${t})
- # Build documentation after main executables.
- add_dependencies(documentation ${t})
- endif()
-endforeach()
+if(CMake_SPHINX_DEPEND_ON_EXECUTABLES)
+ foreach(t
+ cmake
+ ccmake
+ cmake-gui
+ cpack
+ ctest
+ )
+ if(TARGET ${t})
+ # Build documentation after main executables.
+ add_dependencies(documentation ${t})
+ endif()
+ endforeach()
+endif()
if(SPHINX_MAN)
file(GLOB man_rst RELATIVE ${CMake_SOURCE_DIR}/Help/manual
diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c
index ceff391..bc36c8e 100644
--- a/Utilities/cmcurl/CMake/CurlTests.c
+++ b/Utilities/cmcurl/CMake/CurlTests.c
@@ -533,3 +533,19 @@ main () {
return 0;
}
#endif
+#ifdef HAVE_FSETXATTR_6
+#include <sys/xattr.h> /* header from libc, not from libattr */
+int
+main() {
+ fsetxattr(0, 0, 0, 0, 0, 0);
+ return 0;
+}
+#endif
+#ifdef HAVE_FSETXATTR_5
+#include <sys/xattr.h> /* header from libc, not from libattr */
+int
+main() {
+ fsetxattr(0, 0, 0, 0, 0);
+ return 0;
+}
+#endif
diff --git a/Utilities/cmcurl/CMake/FindGSS.cmake b/Utilities/cmcurl/CMake/FindGSS.cmake
index dfaeaf3..60dcb73 100644
--- a/Utilities/cmcurl/CMake/FindGSS.cmake
+++ b/Utilities/cmcurl/CMake/FindGSS.cmake
@@ -12,7 +12,7 @@
# GSS_LINKER_FLAGS - Additional linker flags
# GSS_COMPILER_FLAGS - Additional compiler flags
# GSS_VERSION - This is set to version advertised by pkg-config or read from manifest.
-# In case the library is found but no version info availabe it'll be set to "unknown"
+# In case the library is found but no version info available it'll be set to "unknown"
set(_MIT_MODNAME mit-krb5-gssapi)
set(_HEIMDAL_MODNAME heimdal-gssapi)
diff --git a/Utilities/cmcurl/CMake/FindMbedTLS.cmake b/Utilities/cmcurl/CMake/FindMbedTLS.cmake
new file mode 100644
index 0000000..a916395
--- /dev/null
+++ b/Utilities/cmcurl/CMake/FindMbedTLS.cmake
@@ -0,0 +1,13 @@
+find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h)
+
+find_library(MBEDTLS_LIBRARY mbedtls)
+find_library(MBEDX509_LIBRARY mbedx509)
+find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
+
+set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
+ MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
+
+mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
diff --git a/Utilities/cmcurl/CMake/Utilities.cmake b/Utilities/cmcurl/CMake/Utilities.cmake
index 37cdfe3..8b6276d 100644
--- a/Utilities/cmcurl/CMake/Utilities.cmake
+++ b/Utilities/cmcurl/CMake/Utilities.cmake
@@ -29,3 +29,16 @@ function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
set(${RETVAL} TRUE PARENT_SCOPE)
endif()
endfunction()
+
+# Returns a list of arguments that evaluate to true
+function(collect_true output_var output_count_var)
+ set(${output_var})
+ foreach(option_var IN LISTS ARGN)
+ if(${option_var})
+ list(APPEND ${output_var} ${option_var})
+ endif()
+ endforeach()
+ set(${output_var} ${${output_var}} PARENT_SCOPE)
+ list(LENGTH ${output_var} ${output_count_var})
+ set(${output_count_var} ${${output_count_var}} PARENT_SCOPE)
+endfunction()
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 6a34e8d..5049d7b 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -34,6 +34,29 @@ set(ENABLE_THREADED_RESOLVER OFF CACHE INTERNAL "No curl POSIX threaded DNS look
set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support")
set(HTTP_ONLY OFF CACHE INTERNAL "Curl is not http-only")
set(USE_WIN32_LDAP OFF CACHE INTERNAL "No curl Windows LDAP")
+if(CMAKE_USE_OPENSSL)
+elseif(WIN32)
+ set(CMAKE_USE_WINSSL ON CACHE INTERNAL "enable Windows native SSL/TLS")
+ set(CURL_WINDOWS_SSPI ON CACHE INTERNAL "Use windows libraries to allow NTLM authentication without openssl")
+elseif(APPLE)
+ # Use OS X SSL/TLS native implementation if available on target version.
+ if(CMAKE_OSX_DEPLOYMENT_TARGET)
+ set(OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
+ else()
+ execute_process(
+ COMMAND sw_vers -productVersion
+ OUTPUT_VARIABLE OSX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
+ if(NOT OSX_VERSION VERSION_LESS 10.6 AND
+ CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
+ set(CMAKE_USE_DARWINSSL ON CACHE INTERNAL "enable Apple OS native SSL/TLS")
+ else()
+ set(CMAKE_USE_DARWINSSL OFF CACHE INTERNAL "enable Apple OS native SSL/TLS")
+ endif()
+endif()
+set(CMAKE_USE_MBEDTLS OFF CACHE INTERNAL "Enable mbedTLS for SSL/TLS")
# Windows Vista and above have inet_pton, but this will link on
# older versions and then the executable will fail to launch at
@@ -291,6 +314,11 @@ if(ENABLE_MANUAL)
endif()
endif()
+if(0) # This code not needed for building within CMake.
+# Required for building manual, docs, tests
+find_package(Perl REQUIRED)
+endif()
+
# We need ansi c-flags, especially on HP
set(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS})
@@ -367,60 +395,99 @@ if(WIN32)
check_library_exists_concat("winmm" getch HAVE_LIBWINMM)
endif()
-set(USE_OPENSSL OFF)
-set(HAVE_LIBCRYPTO OFF)
-set(HAVE_LIBSSL OFF)
+# check SSL libraries
+# TODO support GNUTLS, NSS, POLARSSL, AXTLS, CYASSL
-if(CMAKE_USE_OPENSSL)
- find_package(OpenSSL)
- if(OPENSSL_FOUND)
- list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
- set(USE_OPENSSL ON)
- set(HAVE_LIBCRYPTO ON)
- set(HAVE_LIBSSL ON)
- include_directories(${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
- check_include_file("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
- check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H)
- check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H)
- check_include_file("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
- check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
- check_include_file("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
- check_include_file("openssl/x509.h" HAVE_OPENSSL_X509_H)
- check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H)
-
- # Optionally build with a specific CA cert bundle.
- if(CURL_CA_BUNDLE)
- add_definitions(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
- endif()
- # Optionally build with a specific CA cert dir.
- if(CURL_CA_PATH)
- add_definitions(-DCURL_CA_PATH="${CURL_CA_PATH}")
- endif()
+if(APPLE)
+ option(CMAKE_USE_DARWINSSL "enable Apple OS native SSL/TLS" OFF)
+endif()
+if(WIN32)
+ option(CMAKE_USE_WINSSL "enable Windows native SSL/TLS" OFF)
+ cmake_dependent_option(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON
+ CMAKE_USE_WINSSL OFF)
+endif()
+option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF)
+
+set(openssl_default ON)
+if(WIN32 OR CMAKE_USE_DARWINSSL OR CMAKE_USE_WINSSL OR CMAKE_USE_MBEDTLS)
+ set(openssl_default OFF)
+endif()
+
+collect_true(enabled_ssl_options enabled_ssl_options_count
+ CMAKE_USE_WINSSL
+ CMAKE_USE_DARWINSSL
+ CMAKE_USE_OPENSSL
+ CMAKE_USE_MBEDTLS
+)
+if(enabled_ssl_options_count GREATER 1)
+ message(FATAL_ERROR "Multiple SSL options specified: ${enabled_ssl_options}. Please pick at most one and disable the rest.")
+endif()
+
+if(CMAKE_USE_WINSSL)
+ set(SSL_ENABLED ON)
+ set(USE_SCHANNEL ON) # Windows native SSL/TLS support
+ set(USE_WINDOWS_SSPI ON) # CMAKE_USE_WINSSL implies CURL_WINDOWS_SSPI
+ list(APPEND CURL_LIBS "crypt32")
+endif()
+if(CURL_WINDOWS_SSPI)
+ set(USE_WINDOWS_SSPI ON)
+ set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32")
+endif()
+
+if(CMAKE_USE_DARWINSSL)
+ find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
+ if(NOT COREFOUNDATION_FRAMEWORK)
+ message(FATAL_ERROR "CoreFoundation framework not found")
endif()
-elseif(WIN32)
- # Use Windows SSL/TLS native implementation.
- set(CURL_WINDOWS_SSPI ON)
-elseif(APPLE)
- # Use OS X SSL/TLS native implementation if available on target version.
- if(CMAKE_OSX_DEPLOYMENT_TARGET)
- set(OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
- else()
- execute_process(
- COMMAND sw_vers -productVersion
- OUTPUT_VARIABLE OSX_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
+
+ find_library(SECURITY_FRAMEWORK "Security")
+ if(NOT SECURITY_FRAMEWORK)
+ message(FATAL_ERROR "Security framework not found")
endif()
- if(NOT OSX_VERSION VERSION_LESS 10.6 AND
- CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
- add_definitions(-DUSE_DARWINSSL)
- list(APPEND CURL_LIBS
- "-framework CoreFoundation"
- "-framework Security"
- )
+
+ set(SSL_ENABLED ON)
+ set(USE_DARWINSSL ON)
+ list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}")
+endif()
+
+if(CMAKE_USE_OPENSSL)
+ find_package(OpenSSL REQUIRED)
+ set(SSL_ENABLED ON)
+ set(USE_OPENSSL ON)
+ set(HAVE_LIBCRYPTO ON)
+ set(HAVE_LIBSSL ON)
+ list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
+ include_directories(${OPENSSL_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+ check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
+ check_include_file("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
+ check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H)
+ check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H)
+ check_include_file("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
+ check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
+ check_include_file("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
+ check_include_file("openssl/x509.h" HAVE_OPENSSL_X509_H)
+ check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H)
+ check_symbol_exists(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS)
+ check_symbol_exists(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN)
+ check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
+
+ # Optionally build with a specific CA cert bundle.
+ if(CURL_CA_BUNDLE)
+ add_definitions(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
endif()
+ # Optionally build with a specific CA cert dir.
+ if(CURL_CA_PATH)
+ add_definitions(-DCURL_CA_PATH="${CURL_CA_PATH}")
+ endif()
+endif()
+
+if(CMAKE_USE_MBEDTLS)
+ find_package(MbedTLS REQUIRED)
+ set(SSL_ENABLED ON)
+ set(USE_MBEDTLS ON)
+ list(APPEND CURL_LIBS ${MBEDTLS_LIBRARIES})
+ include_directories(${MBEDTLS_INCLUDE_DIR})
endif()
option(USE_NGHTTP2 "Use Nghttp2 library" OFF)
@@ -681,18 +748,8 @@ if(NOT UNIX)
check_include_file_concat("winsock.h" HAVE_WINSOCK_H)
check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H)
check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H)
- if(CURL_WINDOWS_SSPI)
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32")
- check_include_file_concat("sspi.h" HAVE_SSPI_H)
- if(HAVE_SSPI_H)
- check_include_file_concat("schannel.h" HAVE_SCHANNEL_H)
- set(USE_WINDOWS_SSPI ON)
- if(HAVE_SCHANNEL_H)
- set(USE_SCHANNEL ON)
- set(SSL_ENABLED ON)
- set(CURL_LIBS ${CURL_LIBS} "crypt32")
- endif()
- endif()
+ if(NOT CURL_WINDOWS_SSPI AND USE_OPENSSL)
+ set(CURL_LIBS ${CURL_LIBS} "crypt32")
endif()
else()
set(HAVE_WINDOWS_H 0)
@@ -717,6 +774,7 @@ check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file_concat("sys/uio.h" HAVE_SYS_UIO_H)
check_include_file_concat("sys/un.h" HAVE_SYS_UN_H)
check_include_file_concat("sys/utime.h" HAVE_SYS_UTIME_H)
+check_include_file_concat("sys/xattr.h" HAVE_SYS_XATTR_H)
check_include_file_concat("alloca.h" HAVE_ALLOCA_H)
check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file_concat("arpa/tftp.h" HAVE_ARPA_TFTP_H)
@@ -837,14 +895,6 @@ check_symbol_exists(strlcat "${CURL_INCLUDES}" HAVE_STRLCAT)
check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID)
check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID)
check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME)
-if(CMAKE_USE_OPENSSL)
- check_symbol_exists(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS)
- check_symbol_exists(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN)
- check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
- if(HAVE_LIBCRYPTO AND HAVE_LIBSSL)
- set(USE_OPENSSL 1)
- endif(HAVE_LIBCRYPTO AND HAVE_LIBSSL)
-endif(CMAKE_USE_OPENSSL)
check_symbol_exists(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R)
check_symbol_exists(localtime_r "${CURL_INCLUDES}" HAVE_LOCALTIME_R)
@@ -879,6 +929,13 @@ check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
# symbol exists in win32, but function does not.
check_function_exists(inet_pton HAVE_INET_PTON)
+check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
+if(HAVE_FSETXATTR)
+ foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6)
+ curl_internal_test_run(${CURL_TEST})
+ endforeach(CURL_TEST)
+endif(HAVE_FSETXATTR)
+
# sigaction and sigsetjmp are special. Use special mechanism for
# detecting those, but only if previous attempt failed.
if(HAVE_SIGNAL_H)
@@ -1092,9 +1149,9 @@ function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
- string(REGEX REPLACE "\\\\\n" "§!§" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+ string(REGEX REPLACE "\\\\\n" "!π!α!" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
- string(REPLACE "§!§" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
+ string(REPLACE "!π!α!" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${}
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
@@ -1102,6 +1159,9 @@ function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
endfunction()
+if(0) # This code not needed for building within CMake.
+add_subdirectory(docs)
+endif()
add_subdirectory(lib)
if(BUILD_CURL_EXE)
add_subdirectory(src)
@@ -1125,11 +1185,6 @@ if(BUILD_TESTING)
add_subdirectory(tests)
endif()
-# TODO support GNUTLS, NSS, POLARSSL, AXTLS, CYASSL, WINSSL, DARWINSSL
-if(USE_OPENSSL)
- set(SSL_ENABLED 1)
-endif()
-
# Helper to populate a list (_items) with a label when conditions (the remaining
# args) are satisfied
function(_add_if label)
@@ -1143,6 +1198,8 @@ endfunction()
set(_items)
_add_if("WinSSL" SSL_ENABLED AND USE_WINDOWS_SSPI)
_add_if("OpenSSL" SSL_ENABLED AND USE_OPENSSL)
+_add_if("DarwinSSL" SSL_ENABLED AND USE_DARWINSSL)
+_add_if("mbedTLS" SSL_ENABLED AND USE_MBEDTLS)
_add_if("IPv6" ENABLE_IPV6)
_add_if("unix-sockets" USE_UNIX_SOCKETS)
_add_if("libz" HAVE_LIBZ)
@@ -1159,9 +1216,9 @@ _add_if("SPNEGO" NOT CURL_DISABLE_CRYPTO_AUTH AND
_add_if("Kerberos" NOT CURL_DISABLE_CRYPTO_AUTH AND
(HAVE_GSSAPI OR USE_WINDOWS_SSPI))
# NTLM support requires crypto function adaptions from various SSL libs
-# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS, DARWINSSL
+# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS
if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR
- USE_WINDOWS_SSPI OR GNUTLS_ENABLED OR NSS_ENABLED OR DARWINSSL_ENABLED))
+ USE_WINDOWS_SSPI OR GNUTLS_ENABLED OR NSS_ENABLED OR USE_DARWINSSL OR USE_MBEDTLS))
_add_if("NTLM" 1)
# TODO missing option (autoconf: --enable-ntlm-wb)
_add_if("NTLM_WB" NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED)
diff --git a/Utilities/cmcurl/COPYING b/Utilities/cmcurl/COPYING
index a98663e..1e45a5e 100644
--- a/Utilities/cmcurl/COPYING
+++ b/Utilities/cmcurl/COPYING
@@ -1,6 +1,6 @@
COPYRIGHT AND PERMISSION NOTICE
-Copyright (c) 1996 - 2016, Daniel Stenberg, <daniel@haxx.se>, and many
+Copyright (c) 1996 - 2017, Daniel Stenberg, <daniel@haxx.se>, and many
contributors, see the THANKS file.
All rights reserved.
diff --git a/Utilities/cmcurl/include/curl/curl.h b/Utilities/cmcurl/include/curl/curl.h
index daca8d1..b19dd42 100644
--- a/Utilities/cmcurl/include/curl/curl.h
+++ b/Utilities/cmcurl/include/curl/curl.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -35,6 +35,7 @@
#endif
#include "curlver.h" /* libcurl version defines */
+#include "system.h" /* determine things run-time */
#include "cmcurl/include/curl/curlbuild.h" /* libcurl build definitions */
#include "curlrules.h" /* libcurl rules enforcement */
@@ -193,6 +194,11 @@ typedef int (*curl_xferinfo_callback)(void *clientp,
curl_off_t ultotal,
curl_off_t ulnow);
+#ifndef CURL_MAX_READ_SIZE
+ /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */
+#define CURL_MAX_READ_SIZE 524288
+#endif
+
#ifndef CURL_MAX_WRITE_SIZE
/* Tests have proven that 20K is a very bad buffer size for uploads on
Windows, while 16K for some odd reason performed a lot better.
@@ -479,7 +485,7 @@ typedef enum {
CURLE_LDAP_CANNOT_BIND, /* 38 */
CURLE_LDAP_SEARCH_FAILED, /* 39 */
CURLE_OBSOLETE40, /* 40 - NOT USED */
- CURLE_FUNCTION_NOT_FOUND, /* 41 */
+ CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */
CURLE_ABORTED_BY_CALLBACK, /* 42 */
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
CURLE_OBSOLETE44, /* 44 - NOT USED */
@@ -1595,7 +1601,7 @@ typedef enum {
CINIT(DNS_SERVERS, STRINGPOINT, 211),
/* Time-out accept operations (currently for FTP only) after this amount
- of miliseconds. */
+ of milliseconds. */
CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
/* Set TCP keepalive */
@@ -1770,6 +1776,12 @@ typedef enum {
this option is used only if PROXY_SSL_VERIFYPEER is true */
CINIT(PROXY_PINNEDPUBLICKEY, STRINGPOINT, 263),
+ /* Path to an abstract Unix domain socket */
+ CINIT(ABSTRACT_UNIX_SOCKET, STRINGPOINT, 264),
+
+ /* Suppress proxy CONNECT response headers from user callbacks */
+ CINIT(SUPPRESS_CONNECT_HEADERS, LONG, 265),
+
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;
@@ -1876,6 +1888,18 @@ enum {
CURL_SSLVERSION_LAST /* never use, keep last */
};
+enum {
+ CURL_SSLVERSION_MAX_NONE = 0,
+ CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16),
+ CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16),
+ CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16),
+ CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16),
+ CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16),
+
+ /* never use, keep last */
+ CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16)
+};
+
enum CURL_TLSAUTH {
CURL_TLSAUTH_NONE,
CURL_TLSAUTH_SRP,
@@ -2438,7 +2462,7 @@ typedef struct {
#define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */
#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper
- is suported */
+ is supported */
#define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
#define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */
#define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */
diff --git a/Utilities/cmcurl/include/curl/curlrules.h b/Utilities/cmcurl/include/curl/curlrules.h
index 55d21f6..0abd9f7 100644
--- a/Utilities/cmcurl/include/curl/curlrules.h
+++ b/Utilities/cmcurl/include/curl/curlrules.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -105,11 +105,6 @@
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
#endif
-#ifndef CURL_FORMAT_OFF_T
-# error "CURL_FORMAT_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
-#endif
-
#ifndef CURL_SIZEOF_CURL_OFF_T
# error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
@@ -241,22 +236,4 @@ typedef char
#undef CurlchkszEQ
#undef CurlchkszGE
-/*
- * Get rid of macros not intended to exist beyond this point.
- */
-
-#undef CURL_PULL_WS2TCPIP_H
-#undef CURL_PULL_SYS_TYPES_H
-#undef CURL_PULL_SYS_SOCKET_H
-#undef CURL_PULL_SYS_POLL_H
-#undef CURL_PULL_STDINT_H
-#undef CURL_PULL_INTTYPES_H
-
-#undef CURL_TYPEOF_CURL_SOCKLEN_T
-#undef CURL_TYPEOF_CURL_OFF_T
-
-#ifdef CURL_NO_OLDIES
-#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
-#endif
-
#endif /* __CURL_CURLRULES_H */
diff --git a/Utilities/cmcurl/include/curl/curlver.h b/Utilities/cmcurl/include/curl/curlver.h
index 3967ad2..7f0e3b8 100644
--- a/Utilities/cmcurl/include/curl/curlver.h
+++ b/Utilities/cmcurl/include/curl/curlver.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -26,17 +26,17 @@
a script at release-time. This was made its own header file in 7.11.2 */
/* This is the global package copyright */
-#define LIBCURL_COPYRIGHT "1996 - 2016 Daniel Stenberg, <daniel@haxx.se>."
+#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
/* This is the version number of the libcurl package from which this header
file origins: */
-#define LIBCURL_VERSION "7.52.1"
+#define LIBCURL_VERSION "7.54.0"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 52
-#define LIBCURL_VERSION_PATCH 1
+#define LIBCURL_VERSION_MINOR 54
+#define LIBCURL_VERSION_PATCH 0
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@@ -57,7 +57,7 @@
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
-#define LIBCURL_VERSION_NUM 0x073401
+#define LIBCURL_VERSION_NUM 0x073600
/*
* This is the date and time when the full source package was created. The
diff --git a/Utilities/cmcurl/include/curl/system.h b/Utilities/cmcurl/include/curl/system.h
new file mode 100644
index 0000000..ed3a55c
--- /dev/null
+++ b/Utilities/cmcurl/include/curl/system.h
@@ -0,0 +1,484 @@
+#ifndef __CURL_SYSTEM_H
+#define __CURL_SYSTEM_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/*
+ * This header is supposed to eventually replace curlbuild.h. This little one
+ * is still learning. During the experimental phase, this header files
+ * defines symbols using the prefixes CURLSYS_ or curlsys_. When we feel
+ * confident enough, we replace curlbuild.h with this file and rename all
+ * prefixes to CURL_ and curl_.
+ */
+
+/*
+ * Try to keep one section per platform, compiler and architecture, otherwise,
+ * if an existing section is reused for a different one and later on the
+ * original is adjusted, probably the piggybacking one can be adversely
+ * changed.
+ *
+ * In order to differentiate between platforms/compilers/architectures use
+ * only compiler built in predefined preprocessor symbols.
+ *
+ * curl_off_t
+ * ----------
+ *
+ * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
+ * wide signed integral data type. The width of this data type must remain
+ * constant and independent of any possible large file support settings.
+ *
+ * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
+ * wide signed integral data type if there is no 64-bit type.
+ *
+ * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
+ * only be violated if off_t is the only 64-bit data type available and the
+ * size of off_t is independent of large file support settings. Keep your
+ * build on the safe side avoiding an off_t gating. If you have a 64-bit
+ * off_t then take for sure that another 64-bit data type exists, dig deeper
+ * and you will find it.
+ *
+ */
+
+#if defined(__DJGPP__) || defined(__GO32__)
+# if defined(__DJGPP__) && (__DJGPP__ > 1)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SALFORDC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__BORLANDC__)
+# if (__BORLANDC__ < 0x520)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__TURBOC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__WATCOMC__)
+# if defined(__386__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__POCC__)
+# if (__POCC__ < 280)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# elif defined(_MSC_VER)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__LCC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SYMBIAN32__)
+# if defined(__EABI__) /* Treat all ARM compilers equally */
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__CW32__)
+# pragma longlong on
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__VC32__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MWERKS__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(_WIN32_WCE)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MINGW32__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_WS2TCPIP_H 1
+
+#elif defined(__VMS)
+# if defined(__VAX)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__OS400__)
+# if defined(__ILEC400__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(__MVS__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_ILP32)
+# define CURLSYS_SIZEOF_LONG 4
+# elif defined(_LP64)
+# define CURLSYS_SIZEOF_LONG 8
+# endif
+# if defined(_LONG_LONG)
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(_LP64)
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(__370__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_ILP32)
+# define CURLSYS_SIZEOF_LONG 4
+# elif defined(_LP64)
+# define CURLSYS_SIZEOF_LONG 8
+# endif
+# if defined(_LONG_LONG)
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(_LP64)
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(TPF)
+# define CURLSYS_SIZEOF_LONG 8
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__TINYC__) /* also known as tcc */
+
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+
+/* ===================================== */
+/* KEEP MSVC THE PENULTIMATE ENTRY */
+/* ===================================== */
+
+#elif defined(_MSC_VER)
+# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+/* ===================================== */
+/* KEEP GENERIC GCC THE LAST ENTRY */
+/* ===================================== */
+
+#elif defined(__GNUC__)
+# if !defined(__LP64__) && (defined(__ILP32__) || \
+ defined(__i386__) || defined(__ppc__) || defined(__arm__) || \
+ defined(__sparc__) || defined(__mips__) || defined(__sh__))
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__LP64__) || \
+ defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__)
+# define CURLSYS_SIZEOF_LONG 8
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+
+#else
+/* generic "safe guess" on old 32 bit style */
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+#endif
+
+/* CURLSYS_PULL_WS2TCPIP_H is defined above when inclusion of header file */
+/* ws2tcpip.h is required here to properly make type definitions below. */
+#ifdef CURLSYS_PULL_WS2TCPIP_H
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#endif
+
+/* CURLSYS_PULL_SYS_TYPES_H is defined above when inclusion of header file */
+/* sys/types.h is required here to properly make type definitions below. */
+#ifdef CURLSYS_PULL_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+/* CURLSYS_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
+/* sys/socket.h is required here to properly make type definitions below. */
+#ifdef CURLSYS_PULL_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+/* Data type definition of curl_socklen_t. */
+#ifdef CURLSYS_TYPEOF_CURL_SOCKLEN_T
+ typedef CURLSYS_TYPEOF_CURL_SOCKLEN_T curlsys_socklen_t;
+#endif
+
+/* Data type definition of curl_off_t. */
+
+#ifdef CURLSYS_TYPEOF_CURL_OFF_T
+ typedef CURLSYS_TYPEOF_CURL_OFF_T curlsys_off_t;
+#endif
+
+#endif /* __CURL_SYSTEM_H */
+
diff --git a/Utilities/cmcurl/include/curl/typecheck-gcc.h b/Utilities/cmcurl/include/curl/typecheck-gcc.h
index 4eb896e..3d68315 100644
--- a/Utilities/cmcurl/include/curl/typecheck-gcc.h
+++ b/Utilities/cmcurl/include/curl/typecheck-gcc.h
@@ -219,7 +219,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
/* evaluates to true if option takes a char* argument */
#define _curl_is_string_option(option) \
- ((option) == CURLOPT_ACCEPT_ENCODING || \
+ ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
+ (option) == CURLOPT_ACCEPT_ENCODING || \
(option) == CURLOPT_CAINFO || \
(option) == CURLOPT_CAPATH || \
(option) == CURLOPT_COOKIE || \
diff --git a/Utilities/cmcurl/lib/asyn-ares.c b/Utilities/cmcurl/lib/asyn-ares.c
index c038c2a..281fb03 100644
--- a/Utilities/cmcurl/lib/asyn-ares.c
+++ b/Utilities/cmcurl/lib/asyn-ares.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -358,12 +358,20 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct timeval now = Curl_tvnow();
struct Curl_dns_entry *temp_entry;
+ if(entry)
+ *entry = NULL; /* clear on entry */
+
timeout = Curl_timeleft(data, &now, TRUE);
+ if(timeout < 0) {
+ /* already expired! */
+ connclose(conn, "Timed out before name resolve started");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
if(!timeout)
timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */
/* Wait for the name resolve query to complete. */
- for(;;) {
+ while(!result) {
struct timeval *tvp, tv, store;
long timediff;
int itimeout;
@@ -385,28 +393,25 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timeout_ms = 1000;
waitperform(conn, timeout_ms);
- Curl_resolver_is_resolved(conn, &temp_entry);
+ result = Curl_resolver_is_resolved(conn, &temp_entry);
- if(conn->async.done)
+ if(result || conn->async.done)
break;
- if(Curl_pgrsUpdate(conn)) {
+ if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
- timeout = -1; /* trigger the cancel below */
- }
else {
struct timeval now2 = Curl_tvnow();
timediff = Curl_tvdiff(now2, now); /* spent time */
timeout -= timediff?timediff:1; /* always deduct at least 1 */
now = now2; /* for next loop */
}
-
- if(timeout < 0) {
- /* our timeout, so we cancel the ares operation */
- ares_cancel((ares_channel)data->state.resolver);
- break;
- }
+ if(timeout < 0)
+ result = CURLE_OPERATION_TIMEDOUT;
}
+ if(result)
+ /* failure, so we cancel the ares operation */
+ ares_cancel((ares_channel)data->state.resolver);
/* Operation complete, if the lookup was successful we now have the entry
in the cache. */
diff --git a/Utilities/cmcurl/lib/conncache.c b/Utilities/cmcurl/lib/conncache.c
index d8ef9a5..0590ec6 100644
--- a/Utilities/cmcurl/lib/conncache.c
+++ b/Utilities/cmcurl/lib/conncache.c
@@ -5,8 +5,8 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012, 2016, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2012 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <linus@haxx.se>
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -56,11 +56,7 @@ static CURLcode bundle_create(struct Curl_easy *data,
(*cb_ptr)->num_connections = 0;
(*cb_ptr)->multiuse = BUNDLE_UNKNOWN;
- (*cb_ptr)->conn_list = Curl_llist_alloc((curl_llist_dtor) conn_llist_dtor);
- if(!(*cb_ptr)->conn_list) {
- Curl_safefree(*cb_ptr);
- return CURLE_OUT_OF_MEMORY;
- }
+ Curl_llist_init(&(*cb_ptr)->conn_list, (curl_llist_dtor) conn_llist_dtor);
return CURLE_OK;
}
@@ -69,10 +65,8 @@ static void bundle_destroy(struct connectbundle *cb_ptr)
if(!cb_ptr)
return;
- if(cb_ptr->conn_list) {
- Curl_llist_destroy(cb_ptr->conn_list, NULL);
- cb_ptr->conn_list = NULL;
- }
+ Curl_llist_destroy(&cb_ptr->conn_list, NULL);
+
free(cb_ptr);
}
@@ -80,7 +74,7 @@ static void bundle_destroy(struct connectbundle *cb_ptr)
static CURLcode bundle_add_conn(struct connectbundle *cb_ptr,
struct connectdata *conn)
{
- if(!Curl_llist_insert_next(cb_ptr->conn_list, cb_ptr->conn_list->tail, conn))
+ if(!Curl_llist_insert_next(&cb_ptr->conn_list, cb_ptr->conn_list.tail, conn))
return CURLE_OUT_OF_MEMORY;
conn->bundle = cb_ptr;
@@ -95,10 +89,10 @@ static int bundle_remove_conn(struct connectbundle *cb_ptr,
{
struct curl_llist_element *curr;
- curr = cb_ptr->conn_list->head;
+ curr = cb_ptr->conn_list.head;
while(curr) {
if(curr->ptr == conn) {
- Curl_llist_remove(cb_ptr->conn_list, curr, NULL);
+ Curl_llist_remove(&cb_ptr->conn_list, curr, NULL);
cb_ptr->num_connections--;
conn->bundle = NULL;
return 1; /* we removed a handle */
@@ -127,8 +121,9 @@ void Curl_conncache_destroy(struct conncache *connc)
Curl_hash_destroy(&connc->hash);
}
-/* returns an allocated key to find a bundle for this connection */
-static char *hashkey(struct connectdata *conn)
+/* creates a key to find a bundle for this connection */
+static void hashkey(struct connectdata *conn, char *buf,
+ size_t len) /* something like 128 is fine */
{
const char *hostname;
@@ -141,7 +136,10 @@ static char *hashkey(struct connectdata *conn)
else
hostname = conn->host.name;
- return aprintf("%s:%d", hostname, conn->port);
+ DEBUGASSERT(len > 32);
+
+ /* put the number first so that the hostname gets cut off if too long */
+ snprintf(buf, len, "%ld%s", conn->port, hostname);
}
/* Look up the bundle with all the connections to the same host this
@@ -151,11 +149,9 @@ struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn,
{
struct connectbundle *bundle = NULL;
if(connc) {
- char *key = hashkey(conn);
- if(key) {
- bundle = Curl_hash_pick(&connc->hash, key, strlen(key));
- free(key);
- }
+ char key[128];
+ hashkey(conn, key, sizeof(key));
+ bundle = Curl_hash_pick(&connc->hash, key, strlen(key));
}
return bundle;
@@ -204,21 +200,16 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
bundle = Curl_conncache_find_bundle(conn, data->state.conn_cache);
if(!bundle) {
- char *key;
int rc;
+ char key[128];
result = bundle_create(data, &new_bundle);
if(result)
return result;
- key = hashkey(conn);
- if(!key) {
- bundle_destroy(new_bundle);
- return CURLE_OUT_OF_MEMORY;
- }
-
+ hashkey(conn, key, sizeof(key));
rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle);
- free(key);
+
if(!rc) {
bundle_destroy(new_bundle);
return CURLE_OUT_OF_MEMORY;
@@ -292,7 +283,7 @@ void Curl_conncache_foreach(struct conncache *connc,
bundle = he->ptr;
he = Curl_hash_next_element(&iter);
- curr = bundle->conn_list->head;
+ curr = bundle->conn_list.head;
while(curr) {
/* Yes, we need to update curr before calling func(), because func()
might decide to remove the connection */
@@ -321,7 +312,7 @@ Curl_conncache_find_first_connection(struct conncache *connc)
struct curl_llist_element *curr;
bundle = he->ptr;
- curr = bundle->conn_list->head;
+ curr = bundle->conn_list.head;
if(curr) {
return curr->ptr;
}
diff --git a/Utilities/cmcurl/lib/conncache.h b/Utilities/cmcurl/lib/conncache.h
index b1dadf9..f976cfd 100644
--- a/Utilities/cmcurl/lib/conncache.h
+++ b/Utilities/cmcurl/lib/conncache.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
@@ -38,7 +38,7 @@ struct conncache {
struct connectbundle {
int multiuse; /* supports multi-use */
size_t num_connections; /* Number of connections in the bundle */
- struct curl_llist *conn_list; /* The connectdata members of the bundle */
+ struct curl_llist conn_list; /* The connectdata members of the bundle */
};
int Curl_conncache_init(struct conncache *, int size);
diff --git a/Utilities/cmcurl/lib/connect.c b/Utilities/cmcurl/lib/connect.c
index 524d885..63ec50f 100644
--- a/Utilities/cmcurl/lib/connect.c
+++ b/Utilities/cmcurl/lib/connect.c
@@ -810,8 +810,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return CURLE_OK;
}
- else
- infof(data, "Connection failed\n");
+ infof(data, "Connection failed\n");
}
else if(rc & CURL_CSELECT_ERR)
(void)verifyconnect(conn->tempsock[i], &error);
@@ -1386,7 +1385,7 @@ CURLcode Curl_socket(struct connectdata *conn,
*/
void Curl_conncontrol(struct connectdata *conn,
int ctrl /* see defines in header */
-#ifdef DEBUGBUILD
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
, const char *reason
#endif
)
diff --git a/Utilities/cmcurl/lib/connect.h b/Utilities/cmcurl/lib/connect.h
index 5653cb4..44bdb10 100644
--- a/Utilities/cmcurl/lib/connect.h
+++ b/Utilities/cmcurl/lib/connect.h
@@ -127,16 +127,16 @@ void Curl_tcpnodelay(struct connectdata *conn, curl_socket_t sockfd);
void Curl_conncontrol(struct connectdata *conn,
int closeit
-#ifdef DEBUGBUILD
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
, const char *reason
#endif
);
-#ifdef DEBUGBUILD
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM, y)
#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION, y)
#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP, y)
-#else /* if !CURLDEBUG */
+#else /* if !DEBUGBUILD || CURL_DISABLE_VERBOSE_STRINGS */
#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM)
#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION)
#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP)
diff --git a/Utilities/cmcurl/lib/content_encoding.c b/Utilities/cmcurl/lib/content_encoding.c
index 5385058..652ed97 100644
--- a/Utilities/cmcurl/lib/content_encoding.c
+++ b/Utilities/cmcurl/lib/content_encoding.c
@@ -130,8 +130,7 @@ inflate_stream(struct connectdata *conn,
free(decomp);
if(inflateEnd(z) == Z_OK)
return exit_zlib(z, &k->zlib_init, result);
- else
- return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
+ return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}
/* Done with these bytes, exit */
@@ -314,7 +313,7 @@ Curl_unencode_gzip_write(struct connectdata *conn,
#ifndef OLD_ZLIB_SUPPORT
/* Support for old zlib versions is compiled away and we are running with
an old version, so return an error. */
- return exit_zlib(z, &k->zlib_init, CURLE_FUNCTION_NOT_FOUND);
+ return exit_zlib(z, &k->zlib_init, CURLE_WRITE_ERROR);
#else
/* This next mess is to get around the potential case where there isn't
diff --git a/Utilities/cmcurl/lib/cookie.c b/Utilities/cmcurl/lib/cookie.c
index 092a226..6b678ae 100644
--- a/Utilities/cmcurl/lib/cookie.c
+++ b/Utilities/cmcurl/lib/cookie.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -492,7 +492,6 @@ Curl_cookie_add(struct Curl_easy *data,
}
else if(strcasecompare("domain", name)) {
bool is_ip;
- const char *dotp;
/* Now, we make sure that our host is within the given domain,
or the given domain is not valid and thus cannot be set. */
@@ -500,12 +499,22 @@ Curl_cookie_add(struct Curl_easy *data,
if('.' == whatptr[0])
whatptr++; /* ignore preceding dot */
- is_ip = isip(domain ? domain : whatptr);
+#ifndef USE_LIBPSL
+ /*
+ * Without PSL we don't know when the incoming cookie is set on a
+ * TLD or otherwise "protected" suffix. To reduce risk, we require a
+ * dot OR the exact host name being "localhost".
+ */
+ {
+ const char *dotp;
+ /* check for more dots */
+ dotp = strchr(whatptr, '.');
+ if(!dotp && !strcasecompare("localhost", whatptr))
+ domain=":";
+ }
+#endif
- /* check for more dots */
- dotp = strchr(whatptr, '.');
- if(!dotp)
- domain=":";
+ is_ip = isip(domain ? domain : whatptr);
if(!domain
|| (is_ip && !strcmp(whatptr, domain))
@@ -920,9 +929,8 @@ static char *get_line(char *buf, int len, FILE *input)
}
return b;
}
- else
- /* read a partial, discard the next piece that ends with newline */
- partial = TRUE;
+ /* read a partial, discard the next piece that ends with newline */
+ partial = TRUE;
}
else
break;
@@ -1055,16 +1063,16 @@ static int cookie_sort(const void *p1, const void *p2)
#define CLONE(field) \
do { \
if(src->field) { \
- dup->field = strdup(src->field); \
- if(!dup->field) \
+ d->field = strdup(src->field); \
+ if(!d->field) \
goto fail; \
} \
} while(0)
static struct Cookie *dup_cookie(struct Cookie *src)
{
- struct Cookie *dup = calloc(sizeof(struct Cookie), 1);
- if(dup) {
+ struct Cookie *d = calloc(sizeof(struct Cookie), 1);
+ if(d) {
CLONE(expirestr);
CLONE(domain);
CLONE(path);
@@ -1073,16 +1081,16 @@ static struct Cookie *dup_cookie(struct Cookie *src)
CLONE(value);
CLONE(maxage);
CLONE(version);
- dup->expires = src->expires;
- dup->tailmatch = src->tailmatch;
- dup->secure = src->secure;
- dup->livecookie = src->livecookie;
- dup->httponly = src->httponly;
+ d->expires = src->expires;
+ d->tailmatch = src->tailmatch;
+ d->secure = src->secure;
+ d->livecookie = src->livecookie;
+ d->httponly = src->httponly;
}
- return dup;
+ return d;
fail:
- freecookie(dup);
+ freecookie(d);
return NULL;
}
diff --git a/Utilities/cmcurl/lib/curl_addrinfo.c b/Utilities/cmcurl/lib/curl_addrinfo.c
index 61cdadd..1adf319 100644
--- a/Utilities/cmcurl/lib/curl_addrinfo.c
+++ b/Utilities/cmcurl/lib/curl_addrinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -47,6 +47,8 @@
# define in_addr_t unsigned long
#endif
+#include <stddef.h>
+
#include "curl_addrinfo.h"
#include "inet_pton.h"
#include "warnless.h"
@@ -467,7 +469,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, address, port);
#ifdef ENABLE_IPV6
- else {
+ {
struct in6_addr in6;
if(Curl_inet_pton(AF_INET6, address, &in6) > 0)
/* This is a dotted IPv6 address ::1-style */
@@ -483,24 +485,29 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
* struct initialized with this path.
* Set '*longpath' to TRUE if the error is a too long path.
*/
-Curl_addrinfo *Curl_unix2addr(const char *path, int *longpath)
+Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, bool abstract)
{
Curl_addrinfo *ai;
struct sockaddr_un *sa_un;
size_t path_len;
+ *longpath = FALSE;
+
ai = calloc(1, sizeof(Curl_addrinfo));
if(!ai)
return NULL;
ai->ai_addr = calloc(1, sizeof(struct sockaddr_un));
if(!ai->ai_addr) {
free(ai);
- *longpath = FALSE;
return NULL;
}
+
+ sa_un = (void *) ai->ai_addr;
+ sa_un->sun_family = AF_UNIX;
+
/* sun_path must be able to store the NUL-terminated path */
- path_len = strlen(path);
- if(path_len >= sizeof(sa_un->sun_path)) {
+ path_len = strlen(path) + 1;
+ if(path_len > sizeof(sa_un->sun_path)) {
free(ai->ai_addr);
free(ai);
*longpath = TRUE;
@@ -509,10 +516,15 @@ Curl_addrinfo *Curl_unix2addr(const char *path, int *longpath)
ai->ai_family = AF_UNIX;
ai->ai_socktype = SOCK_STREAM; /* assume reliable transport for HTTP */
- ai->ai_addrlen = (curl_socklen_t) sizeof(struct sockaddr_un);
- sa_un = (void *) ai->ai_addr;
- sa_un->sun_family = AF_UNIX;
- memcpy(sa_un->sun_path, path, path_len + 1); /* copy NUL byte */
+ ai->ai_addrlen = (curl_socklen_t)
+ ((offsetof(struct sockaddr_un, sun_path) + path_len) & 0x7FFFFFFF);
+
+ /* Abstract Unix domain socket have NULL prefix instead of suffix */
+ if(abstract)
+ memcpy(sa_un->sun_path + 1, path, path_len - 1);
+ else
+ memcpy(sa_un->sun_path, path, path_len); /* copy NUL byte */
+
return ai;
}
#endif
diff --git a/Utilities/cmcurl/lib/curl_addrinfo.h b/Utilities/cmcurl/lib/curl_addrinfo.h
index 4f24730..8f6f3d1 100644
--- a/Utilities/cmcurl/lib/curl_addrinfo.h
+++ b/Utilities/cmcurl/lib/curl_addrinfo.h
@@ -80,7 +80,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
Curl_addrinfo *Curl_str2addr(char *dotted, int port);
#ifdef USE_UNIX_SOCKETS
-Curl_addrinfo *Curl_unix2addr(const char *path, int *longpath);
+Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, bool abstract);
#endif
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
diff --git a/Utilities/cmcurl/lib/curl_config.h.cmake b/Utilities/cmcurl/lib/curl_config.h.cmake
index 13f69b2..f9d54b4 100644
--- a/Utilities/cmcurl/lib/curl_config.h.cmake
+++ b/Utilities/cmcurl/lib/curl_config.h.cmake
@@ -512,6 +512,15 @@
/* Define to 1 if you have the send function. */
#cmakedefine HAVE_SEND 1
+/* Define to 1 if you have the 'fsetxattr' function. */
+#cmakedefine HAVE_FSETXATTR 1
+
+/* fsetxattr() takes 5 args */
+#cmakedefine HAVE_FSETXATTR_5 1
+
+/* fsetxattr() takes 6 args */
+#cmakedefine HAVE_FSETXATTR_6 1
+
/* Define to 1 if you have the <setjmp.h> header file. */
#cmakedefine HAVE_SETJMP_H 1
@@ -912,6 +921,9 @@
/* if PolarSSL is enabled */
#cmakedefine USE_POLARSSL 1
+/* if DarwinSSL is enabled */
+#cmakedefine USE_DARWINSSL 1
+
/* if mbedTLS is enabled */
#cmakedefine USE_MBEDTLS 1
diff --git a/Utilities/cmcurl/lib/curl_des.c b/Utilities/cmcurl/lib/curl_des.c
index 421c9f7..b123a00 100644
--- a/Utilities/cmcurl/lib/curl_des.c
+++ b/Utilities/cmcurl/lib/curl_des.c
@@ -34,7 +34,7 @@
*
* The function is a port of the Java based oddParity() function over at:
*
- * http://davenport.sourceforge.net/ntlm.html
+ * https://davenport.sourceforge.io/ntlm.html
*
* Parameters:
*
diff --git a/Utilities/cmcurl/lib/curl_fnmatch.c b/Utilities/cmcurl/lib/curl_fnmatch.c
index e8108bb..46d3ada 100644
--- a/Utilities/cmcurl/lib/curl_fnmatch.c
+++ b/Utilities/cmcurl/lib/curl_fnmatch.c
@@ -145,8 +145,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else if(c == ']') {
if(something_found)
return SETCHARSET_OK;
- else
- something_found = TRUE;
+ something_found = TRUE;
state = CURLFNM_SCHS_RIGHTBR;
charset[c] = 1;
(*p)++;
@@ -244,7 +243,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
if(c == ']') {
return SETCHARSET_OK;
}
- else if(c == '\\') {
+ if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
@@ -345,8 +344,7 @@ static int loop(const unsigned char *pattern, const unsigned char *string)
else if(*p == '\0') {
if(*s == '\0')
return CURL_FNMATCH_MATCH;
- else
- return CURL_FNMATCH_NOMATCH;
+ return CURL_FNMATCH_NOMATCH;
}
else if(*p == '\\') {
state = CURLFNM_LOOP_BACKSLASH;
diff --git a/Utilities/cmcurl/lib/curl_memory.h b/Utilities/cmcurl/lib/curl_memory.h
index 6f792ff..fccf468 100644
--- a/Utilities/cmcurl/lib/curl_memory.h
+++ b/Utilities/cmcurl/lib/curl_memory.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -70,7 +70,7 @@
*
* Programs and libraries in 'tests' subdirectories have specific
* purposes and needs, and as such each one will use whatever fits
- * best, depending additionally wether it links with libcurl or not.
+ * best, depending additionally whether it links with libcurl or not.
*
* Caveat emptor. Proper curlx_* separation is a work in progress
* the same as CURLX_NO_MEMORY_CALLBACKS usage, some adjustments may
diff --git a/Utilities/cmcurl/lib/curl_ntlm_core.c b/Utilities/cmcurl/lib/curl_ntlm_core.c
index 73d983c..fb43dda 100644
--- a/Utilities/cmcurl/lib/curl_ntlm_core.c
+++ b/Utilities/cmcurl/lib/curl_ntlm_core.c
@@ -27,7 +27,7 @@
/*
* NTLM details:
*
- * http://davenport.sourceforge.net/ntlm.html
+ * https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
@@ -501,7 +501,7 @@ CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data,
return CURLE_OK;
}
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
static void ascii_to_unicode_le(unsigned char *dest, const char *src,
size_t srclen)
{
@@ -512,7 +512,7 @@ static void ascii_to_unicode_le(unsigned char *dest, const char *src,
}
}
-#if USE_NTLM_V2 && !defined(USE_WINDOWS_SSPI)
+#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
static void ascii_uppercase_to_unicode_le(unsigned char *dest,
const char *src, size_t srclen)
@@ -597,7 +597,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
return CURLE_OK;
}
-#if USE_NTLM_V2 && !defined(USE_WINDOWS_SSPI)
+#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
/* This returns the HMAC MD5 digest */
CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
@@ -715,8 +715,10 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
/* Create the BLOB structure */
snprintf((char *)ptr + NTLM_HMAC_MD5_LEN, NTLMv2_BLOB_LEN,
- NTLMv2_BLOB_SIGNATURE
+ "%c%c%c%c" /* NTLMv2_BLOB_SIGNATURE */
"%c%c%c%c", /* Reserved = 0 */
+ NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
+ NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
0, 0, 0, 0);
Curl_write64_le(tw, ptr + 24);
diff --git a/Utilities/cmcurl/lib/curl_ntlm_core.h b/Utilities/cmcurl/lib/curl_ntlm_core.h
index c5f90e7..4a83d40 100644
--- a/Utilities/cmcurl/lib/curl_ntlm_core.h
+++ b/Utilities/cmcurl/lib/curl_ntlm_core.h
@@ -33,31 +33,26 @@
!defined(HEADER_SSL_H) && !defined(HEADER_MD5_H)
# error "curl_ntlm_core.h shall not be included before OpenSSL headers."
# endif
-# ifdef OPENSSL_NO_MD4
-# define USE_NTRESPONSES 0
-# define USE_NTLM2SESSION 0
-# define USE_NTLM_V2 0
-# endif
#endif
-/* Define USE_NTRESPONSES to 1 in order to make the type-3 message include
+/* Define USE_NTRESPONSES in order to make the type-3 message include
* the NT response message. */
-#ifndef USE_NTRESPONSES
-#define USE_NTRESPONSES 1
+#if !defined(USE_OPENSSL) || !defined(OPENSSL_NO_MD4)
+#define USE_NTRESPONSES
#endif
-/* Define USE_NTLM2SESSION to 1 in order to make the type-3 message include the
+/* Define USE_NTLM2SESSION in order to make the type-3 message include the
NTLM2Session response message, requires USE_NTRESPONSES defined to 1 and a
Crypto engine that we have curl_ssl_md5sum() for. */
-#if !defined(USE_NTLM2SESSION) && USE_NTRESPONSES && !defined(USE_WIN32_CRYPTO)
-#define USE_NTLM2SESSION 1
+#if defined(USE_NTRESPONSES) && !defined(USE_WIN32_CRYPTO)
+#define USE_NTLM2SESSION
#endif
-/* Define USE_NTLM_V2 to 1 in order to allow the type-3 message to include the
+/* Define USE_NTLM_V2 in order to allow the type-3 message to include the
LMv2 and NTLMv2 response messages, requires USE_NTRESPONSES defined to 1
and support for 64-bit integers. */
-#if !defined(USE_NTLM_V2) && USE_NTRESPONSES && (CURL_SIZEOF_CURL_OFF_T > 4)
-#define USE_NTLM_V2 1
+#if defined(USE_NTRESPONSES) && (CURL_SIZEOF_CURL_OFF_T > 4)
+#define USE_NTLM_V2
#endif
void Curl_ntlm_core_lm_resp(const unsigned char *keys,
@@ -68,12 +63,12 @@ CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data,
const char *password,
unsigned char *lmbuffer /* 21 bytes */);
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
const char *password,
unsigned char *ntbuffer /* 21 bytes */);
-#if USE_NTLM_V2 && !defined(USE_WINDOWS_SSPI)
+#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
const unsigned char *data, unsigned int datalen,
diff --git a/Utilities/cmcurl/lib/curl_ntlm_wb.c b/Utilities/cmcurl/lib/curl_ntlm_wb.c
index 6a90e62..9f5b87b 100644
--- a/Utilities/cmcurl/lib/curl_ntlm_wb.c
+++ b/Utilities/cmcurl/lib/curl_ntlm_wb.c
@@ -28,7 +28,7 @@
/*
* NTLM details:
*
- * http://davenport.sourceforge.net/ntlm.html
+ * https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
diff --git a/Utilities/cmcurl/lib/curl_sasl.c b/Utilities/cmcurl/lib/curl_sasl.c
index 807f5de..b3789da 100644
--- a/Utilities/cmcurl/lib/curl_sasl.c
+++ b/Utilities/cmcurl/lib/curl_sasl.c
@@ -50,7 +50,7 @@
#include "memdebug.h"
/* Supported mechanisms */
-const struct {
+static const struct {
const char *name; /* Name */
size_t len; /* Name length */
unsigned int bit; /* Flag bit */
diff --git a/Utilities/cmcurl/lib/curl_setup.h b/Utilities/cmcurl/lib/curl_setup.h
index c861e97..6ab18cd 100644
--- a/Utilities/cmcurl/lib/curl_setup.h
+++ b/Utilities/cmcurl/lib/curl_setup.h
@@ -128,18 +128,7 @@
/* please, do it beyond the point further indicated in this file. */
/* ================================================================ */
-/*
- * libcurl's external interface definitions are also used internally,
- * and might also include required system header files to define them.
- */
-
-#include <curl/curlbuild.h>
-
-/*
- * Compile time sanity checks must also be done when building the library.
- */
-
-#include <curl/curlrules.h>
+#include <curl/curl.h>
/*
* Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
diff --git a/Utilities/cmcurl/lib/dict.c b/Utilities/cmcurl/lib/dict.c
index 69defc4..451ec38 100644
--- a/Utilities/cmcurl/lib/dict.c
+++ b/Utilities/cmcurl/lib/dict.c
@@ -92,7 +92,7 @@ const struct Curl_handler Curl_handler_dict = {
static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
{
- char *newp;
+ char *newp = NULL;
char *dictp;
char *ptr;
size_t len;
diff --git a/Utilities/cmcurl/lib/easy.c b/Utilities/cmcurl/lib/easy.c
index 1242369..2b5f972 100644
--- a/Utilities/cmcurl/lib/easy.c
+++ b/Utilities/cmcurl/lib/easy.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -179,7 +179,7 @@ curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup;
#endif
#else
/*
- * Symbian OS doesn't support initialization to code in writeable static data.
+ * Symbian OS doesn't support initialization to code in writable static data.
* Initialization will occur in the curl_global_init() call.
*/
curl_malloc_callback Curl_cmalloc;
@@ -619,7 +619,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
/* If nothing updated the timeout, we decrease it by the spent time.
* If it was updated, it has the new timeout time stored already.
*/
- ev->ms += curlx_tvdiff(after, before);
+ ev->ms += (long)curlx_tvdiff(after, before);
}
else
@@ -773,8 +773,7 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
curl_multi_cleanup(multi);
if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY;
- else
- return CURLE_FAILED_INIT;
+ return CURLE_FAILED_INIT;
}
sigpipe_ignore(data, &pipe_st);
@@ -870,6 +869,11 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
* get setup on-demand in the code, as that would probably decrease
* the likeliness of us forgetting to init a buffer here in the future.
*/
+ outcurl->set.buffer_size = data->set.buffer_size;
+ outcurl->state.buffer = malloc(CURL_BUFSIZE(outcurl->set.buffer_size) + 1);
+ if(!outcurl->state.buffer)
+ goto fail;
+
outcurl->state.headerbuff = malloc(HEADERSIZE);
if(!outcurl->state.headerbuff)
goto fail;
@@ -940,6 +944,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
if(outcurl) {
curl_slist_free_all(outcurl->change.cookielist);
outcurl->change.cookielist = NULL;
+ Curl_safefree(outcurl->state.buffer);
Curl_safefree(outcurl->state.headerbuff);
Curl_safefree(outcurl->change.url);
Curl_safefree(outcurl->change.referer);
@@ -975,6 +980,10 @@ void curl_easy_reset(struct Curl_easy *data)
data->progress.flags |= PGRS_HIDE;
data->state.current_speed = -1; /* init to negative == impossible */
+
+ /* zero out authentication data: */
+ memset(&data->state.authhost, 0, sizeof(struct auth));
+ memset(&data->state.authproxy, 0, sizeof(struct auth));
}
/*
@@ -1002,19 +1011,32 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
/* put it back in the keepon */
k->keepon = newstate;
- if(!(newstate & KEEP_RECV_PAUSE) && data->state.tempwrite) {
- /* we have a buffer for sending that we now seem to be able to deliver
- since the receive pausing is lifted! */
-
- /* get the pointer in local copy since the function may return PAUSE
- again and then we'll get a new copy allocted and stored in
- the tempwrite variables */
- char *tempwrite = data->state.tempwrite;
-
- data->state.tempwrite = NULL;
- result = Curl_client_chop_write(data->easy_conn, data->state.tempwritetype,
- tempwrite, data->state.tempwritesize);
- free(tempwrite);
+ if(!(newstate & KEEP_RECV_PAUSE) && data->state.tempcount) {
+ /* there are buffers for sending that can be delivered as the receive
+ pausing is lifted! */
+ unsigned int i;
+ unsigned int count = data->state.tempcount;
+ struct tempbuf writebuf[3]; /* there can only be three */
+
+ /* copy the structs to allow for immediate re-pausing */
+ for(i=0; i < data->state.tempcount; i++) {
+ writebuf[i] = data->state.tempwrite[i];
+ data->state.tempwrite[i].buf = NULL;
+ }
+ data->state.tempcount = 0;
+
+ for(i=0; i < count; i++) {
+ /* even if one function returns error, this loops through and frees all
+ buffers */
+ if(!result)
+ result = Curl_client_chop_write(data->easy_conn,
+ writebuf[i].type,
+ writebuf[i].buf,
+ writebuf[i].len);
+ free(writebuf[i].buf);
+ }
+ if(result)
+ return result;
}
/* if there's no error and we're not pausing both directions, we want
diff --git a/Utilities/cmcurl/lib/escape.c b/Utilities/cmcurl/lib/escape.c
index 9c811b8..973aeb6 100644
--- a/Utilities/cmcurl/lib/escape.c
+++ b/Utilities/cmcurl/lib/escape.c
@@ -113,9 +113,7 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr)
return NULL;
- else {
- ns = testing_ptr;
- }
+ ns = testing_ptr;
}
result = Curl_convert_to_network(data, &in, 1);
diff --git a/Utilities/cmcurl/lib/file.c b/Utilities/cmcurl/lib/file.c
index 3dbc0f2..b26bdea 100644
--- a/Utilities/cmcurl/lib/file.c
+++ b/Utilities/cmcurl/lib/file.c
@@ -355,8 +355,7 @@ static CURLcode file_upload(struct connectdata *conn)
failf(data, "Can't get the size of %s", file->path);
return CURLE_WRITE_ERROR;
}
- else
- data->state.resume_from = (curl_off_t)file_stat.st_size;
+ data->state.resume_from = (curl_off_t)file_stat.st_size;
}
while(!result) {
@@ -476,7 +475,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
time_t filetime;
struct tm buffer;
const struct tm *tm = &buffer;
- snprintf(buf, sizeof(data->state.buffer),
+ snprintf(buf, CURL_BUFSIZE(data->set.buffer_size),
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", expected_size);
result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
if(result)
@@ -519,8 +518,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
failf(data, "Can't get the size of file.");
return CURLE_READ_ERROR;
}
- else
- data->state.resume_from += (curl_off_t)statbuf.st_size;
+ data->state.resume_from += (curl_off_t)statbuf.st_size;
}
if(data->state.resume_from <= expected_size)
diff --git a/Utilities/cmcurl/lib/formdata.c b/Utilities/cmcurl/lib/formdata.c
index abd2da0..2a93434 100644
--- a/Utilities/cmcurl/lib/formdata.c
+++ b/Utilities/cmcurl/lib/formdata.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -342,6 +342,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
#else
current_form->flags |= HTTPPOST_PTRNAME; /* fall through */
#endif
+ /* FALLTHROUGH */
case CURLFORM_COPYNAME:
if(current_form->name)
return_value = CURL_FORMADD_OPTION_TWICE;
@@ -629,70 +630,68 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_INCOMPLETE;
break;
}
- else {
- if(((form->flags & HTTPPOST_FILENAME) ||
- (form->flags & HTTPPOST_BUFFER)) &&
- !form->contenttype) {
- char *f = form->flags & HTTPPOST_BUFFER?
- form->showfilename : form->value;
-
- /* our contenttype is missing */
- form->contenttype = strdup(ContentTypeForFilename(f, prevtype));
- if(!form->contenttype) {
- return_value = CURL_FORMADD_MEMORY;
- break;
- }
- form->contenttype_alloc = TRUE;
+ if(((form->flags & HTTPPOST_FILENAME) ||
+ (form->flags & HTTPPOST_BUFFER)) &&
+ !form->contenttype) {
+ char *f = form->flags & HTTPPOST_BUFFER?
+ form->showfilename : form->value;
+
+ /* our contenttype is missing */
+ form->contenttype = strdup(ContentTypeForFilename(f, prevtype));
+ if(!form->contenttype) {
+ return_value = CURL_FORMADD_MEMORY;
+ break;
}
- if(!(form->flags & HTTPPOST_PTRNAME) &&
- (form == first_form) ) {
- /* Note that there's small risk that form->name is NULL here if the
- app passed in a bad combo, so we better check for that first. */
- if(form->name) {
- /* copy name (without strdup; possibly contains null characters) */
- form->name = Curl_memdup(form->name, form->namelength?
- form->namelength:
- strlen(form->name)+1);
- }
- if(!form->name) {
- return_value = CURL_FORMADD_MEMORY;
- break;
- }
- form->name_alloc = TRUE;
+ form->contenttype_alloc = TRUE;
+ }
+ if(!(form->flags & HTTPPOST_PTRNAME) &&
+ (form == first_form) ) {
+ /* Note that there's small risk that form->name is NULL here if the
+ app passed in a bad combo, so we better check for that first. */
+ if(form->name) {
+ /* copy name (without strdup; possibly contains null characters) */
+ form->name = Curl_memdup(form->name, form->namelength?
+ form->namelength:
+ strlen(form->name)+1);
}
- if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
- HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
- HTTPPOST_CALLBACK)) && form->value) {
- /* copy value (without strdup; possibly contains null characters) */
- size_t clen = (size_t) form->contentslength;
- if(!clen)
- clen = strlen(form->value)+1;
+ if(!form->name) {
+ return_value = CURL_FORMADD_MEMORY;
+ break;
+ }
+ form->name_alloc = TRUE;
+ }
+ if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
+ HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
+ HTTPPOST_CALLBACK)) && form->value) {
+ /* copy value (without strdup; possibly contains null characters) */
+ size_t clen = (size_t) form->contentslength;
+ if(!clen)
+ clen = strlen(form->value)+1;
- form->value = Curl_memdup(form->value, clen);
+ form->value = Curl_memdup(form->value, clen);
- if(!form->value) {
- return_value = CURL_FORMADD_MEMORY;
- break;
- }
- form->value_alloc = TRUE;
- }
- post = AddHttpPost(form->name, form->namelength,
- form->value, form->contentslength,
- form->buffer, form->bufferlength,
- form->contenttype, form->flags,
- form->contentheader, form->showfilename,
- form->userp,
- post, httppost,
- last_post);
-
- if(!post) {
+ if(!form->value) {
return_value = CURL_FORMADD_MEMORY;
break;
}
-
- if(form->contenttype)
- prevtype = form->contenttype;
+ form->value_alloc = TRUE;
+ }
+ post = AddHttpPost(form->name, form->namelength,
+ form->value, form->contentslength,
+ form->buffer, form->bufferlength,
+ form->contenttype, form->flags,
+ form->contentheader, form->showfilename,
+ form->userp,
+ post, httppost,
+ last_post);
+
+ if(!post) {
+ return_value = CURL_FORMADD_MEMORY;
+ break;
}
+
+ if(form->contenttype)
+ prevtype = form->contenttype;
}
if(CURL_FORMADD_OK != return_value) {
/* On error, free allocated fields for nodes of the FormInfo linked
@@ -1332,7 +1331,7 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
char buffer[512];
while((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {
result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);
- if(result)
+ if(result || feof(fileread) || ferror(fileread))
break;
}
}
@@ -1462,8 +1461,7 @@ static size_t readfromfile(struct Form *form, char *buffer,
if(callback) {
if(form->fread_func == ZERO_NULL)
return 0;
- else
- nread = form->fread_func(buffer, 1, size, form->data->line);
+ nread = form->fread_func(buffer, 1, size, form->data->line);
}
else {
if(!form->fp) {
@@ -1553,7 +1551,7 @@ char *Curl_formpostheader(void *formp, size_t *len)
struct Form *form=(struct Form *)formp;
if(!form->data)
- return 0; /* nothing, ERROR! */
+ return NULL; /* nothing, ERROR! */
header = form->data->line;
*len = form->data->length;
diff --git a/Utilities/cmcurl/lib/ftp.c b/Utilities/cmcurl/lib/ftp.c
index 89c7e40..a5ca2ab 100644
--- a/Utilities/cmcurl/lib/ftp.c
+++ b/Utilities/cmcurl/lib/ftp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -916,8 +916,7 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
return bits;
}
- else
- return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
+ return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
}
/* This is called after the FTP_QUOTE state is passed.
@@ -1209,7 +1208,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
possibly_non_local = FALSE; /* don't try this again */
continue;
}
- else if(error != EADDRINUSE && error != EACCES) {
+ if(error != EADDRINUSE && error != EACCES) {
failf(data, "bind(port=%hu) failed: %s", port,
Curl_strerror(conn, error) );
Curl_closesocket(conn, portsock);
@@ -1307,7 +1306,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
}
break;
}
- else if(PORT == fcmd) {
+ if(PORT == fcmd) {
char *source = myhost;
char *dest = tmp;
@@ -1674,31 +1673,29 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
}
if(seekerr != CURL_SEEKFUNC_OK) {
+ curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST;
}
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
- else {
- curl_off_t passed=0;
- do {
- size_t readthisamountnow =
- (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
- BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
-
- size_t actuallyread =
- data->state.fread_func(data->state.buffer, 1, readthisamountnow,
- data->state.in);
-
- passed += actuallyread;
- if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
- /* this checks for greater-than only to make sure that the
- CURL_READFUNC_ABORT return code still aborts */
- failf(data, "Failed to read data");
- return CURLE_FTP_COULDNT_USE_REST;
- }
- } while(passed < data->state.resume_from);
- }
+ do {
+ size_t readthisamountnow =
+ (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
+ BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
+
+ size_t actuallyread =
+ data->state.fread_func(data->state.buffer, 1, readthisamountnow,
+ data->state.in);
+
+ passed += actuallyread;
+ if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Failed to read data");
+ return CURLE_FTP_COULDNT_USE_REST;
+ }
+ } while(passed < data->state.resume_from);
}
/* now, decrease the size of the read */
if(data->state.infilesize>0) {
@@ -1757,7 +1754,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
/*
* This state uses:
* 'count1' to iterate over the commands to send
- * 'count2' to store wether to allow commands to fail
+ * 'count2' to store whether to allow commands to fail
*/
if(init)
@@ -2000,7 +1997,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
if(!addr) {
failf(data, "Can't resolve proxy host %s:%hu", host_name, connectport);
- return CURLE_FTP_CANT_GET_HOST;
+ return CURLE_COULDNT_RESOLVE_PROXY;
}
}
else {
@@ -2040,11 +2037,14 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
/* this just dumps information about this second connection */
ftp_pasv_verbose(conn, addr->addr, ftpc->newhost, connectport);
+ Curl_resolv_unlock(data, addr); /* we're done using this address */
+
Curl_safefree(conn->secondaryhostname);
- conn->secondaryhostname = strdup(ftpc->newhost);
conn->secondary_port = ftpc->newport;
+ conn->secondaryhostname = strdup(ftpc->newhost);
+ if(!conn->secondaryhostname)
+ return CURLE_OUT_OF_MEMORY;
- Curl_resolv_unlock(data, addr); /* we're done using this address */
conn->bits.do_more = TRUE;
state(conn, FTP_STOP); /* this phase is completed */
@@ -2107,7 +2107,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
/* we have a time, reformat it */
time_t secs=time(NULL);
/* using the good old yacc/bison yuck */
- snprintf(buf, sizeof(conn->data->state.buffer),
+ snprintf(buf, CURL_BUFSIZE(conn->data->set.buffer_size),
"%04d%02d%02d %02d:%02d:%02d GMT",
year, month, day, hour, minute, second);
/* now, convert this into a time() value: */
@@ -2318,7 +2318,7 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
if(instate == FTP_SIZE) {
#ifdef CURL_FTP_HTTPSTYLE_HEAD
if(-1 != filesize) {
- snprintf(buf, sizeof(data->state.buffer),
+ snprintf(buf, CURL_BUFSIZE(data->set.buffer_size),
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize);
result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
if(result)
@@ -2409,8 +2409,7 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
return CURLE_OK;
}
- else
- return InitiateTransfer(conn);
+ return InitiateTransfer(conn);
}
/* for LIST and RETR responses */
@@ -2823,6 +2822,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
case FTP_PWD:
if(ftpcode == 257) {
char *ptr=&data->state.buffer[4]; /* start on the first letter */
+ const size_t buf_size = CURL_BUFSIZE(data->set.buffer_size);
char *dir;
char *store;
@@ -2840,7 +2840,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
*/
/* scan for the first double-quote for non-standard responses */
- while(ptr < &data->state.buffer[sizeof(data->state.buffer)]
+ while(ptr < &data->state.buffer[buf_size]
&& *ptr != '\n' && *ptr != '\0' && *ptr != '"')
ptr++;
@@ -2870,7 +2870,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
does not start with a '/'), we probably need some server-dependent
adjustments. For example, this is the case when connecting to
an OS400 FTP server: this server supports two name syntaxes,
- the default one being incompatible with standard pathes. In
+ the default one being incompatible with standard paths. In
addition, this server switches automatically to the regular path
syntax when one is encountered in a command: this results in
having an entrypath in the wrong syntax when later used in CWD.
@@ -2944,12 +2944,10 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
state(conn, FTP_NAMEFMT);
break;
}
- else {
- /* Nothing special for the target server. */
- /* remember target server OS */
- Curl_safefree(ftpc->server_os);
- ftpc->server_os = os;
- }
+ /* Nothing special for the target server. */
+ /* remember target server OS */
+ Curl_safefree(ftpc->server_os);
+ ftpc->server_os = os;
}
else {
/* Cannot identify server OS. Continue anyway and cross fingers. */
@@ -3210,6 +3208,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
/* until we cope better with prematurely ended requests, let them
* fallback as if in complete failure */
+ /* FALLTHROUGH */
default: /* by default, an error means the control connection is
wedged and should not be used anymore */
ftpc->ctl_valid = FALSE;
@@ -3553,7 +3552,7 @@ static CURLcode ftp_range(struct connectdata *conn)
" to %" CURL_FORMAT_CURL_OFF_T ", totally %"
CURL_FORMAT_CURL_OFF_T " bytes\n",
from, to, data->req.maxdownload));
- ftpc->dont_check = TRUE; /* dont check for successful transfer */
+ ftpc->dont_check = TRUE; /* don't check for successful transfer */
}
else
data->req.maxdownload = -1;
@@ -3796,12 +3795,10 @@ static CURLcode init_wc_data(struct connectdata *conn)
result = ftp_parse_url_path(conn);
return result;
}
- else {
- wildcard->pattern = strdup(last_slash);
- if(!wildcard->pattern)
- return CURLE_OUT_OF_MEMORY;
- last_slash[0] = '\0'; /* cut file from path */
- }
+ wildcard->pattern = strdup(last_slash);
+ if(!wildcard->pattern)
+ return CURLE_OUT_OF_MEMORY;
+ last_slash[0] = '\0'; /* cut file from path */
}
else { /* there is only 'wildcard pattern' or nothing */
if(path[0]) {
@@ -3886,8 +3883,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
if(wildcard->state == CURLWC_CLEAN)
/* only listing! */
break;
- else
- wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
+ wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
break;
case CURLWC_MATCHING: {
@@ -3905,7 +3901,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
wildcard->state = CURLWC_CLEAN;
return wc_statemach(conn);
}
- else if(wildcard->filelist->size == 0) {
+ if(wildcard->filelist.size == 0) {
/* no corresponding file */
wildcard->state = CURLWC_CLEAN;
return CURLE_REMOTE_FILE_NOT_FOUND;
@@ -3916,7 +3912,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
case CURLWC_DOWNLOADING: {
/* filelist has at least one file, lets get first one */
struct ftp_conn *ftpc = &conn->proto.ftpc;
- struct curl_fileinfo *finfo = wildcard->filelist->head->ptr;
+ struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
if(!tmp_path)
@@ -3931,7 +3927,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
if(conn->data->set.chunk_bgn) {
long userresponse = conn->data->set.chunk_bgn(
- finfo, wildcard->customptr, (int)wildcard->filelist->size);
+ finfo, wildcard->customptr, (int)wildcard->filelist.size);
switch(userresponse) {
case CURL_CHUNK_BGN_FUNC_SKIP:
infof(conn->data, "Wildcard - \"%s\" skipped by user\n",
@@ -3956,9 +3952,9 @@ static CURLcode wc_statemach(struct connectdata *conn)
return result;
/* we don't need the Curl_fileinfo of first file anymore */
- Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL);
+ Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
- if(wildcard->filelist->size == 0) { /* remains only one file to down. */
+ if(wildcard->filelist.size == 0) { /* remains only one file to down. */
wildcard->state = CURLWC_CLEAN;
/* after that will be ftp_do called once again and no transfer
will be done because of CURLWC_CLEAN state */
@@ -3969,8 +3965,8 @@ static CURLcode wc_statemach(struct connectdata *conn)
case CURLWC_SKIP: {
if(conn->data->set.chunk_end)
conn->data->set.chunk_end(conn->data->wildcard.customptr);
- Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL);
- wildcard->state = (wildcard->filelist->size == 0) ?
+ Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
+ wildcard->state = (wildcard->filelist.size == 0) ?
CURLWC_CLEAN : CURLWC_DOWNLOADING;
return wc_statemach(conn);
}
@@ -3986,6 +3982,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
case CURLWC_DONE:
case CURLWC_ERROR:
+ case CURLWC_CLEAR:
break;
}
@@ -4283,7 +4280,6 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
&ftpc->dirs[ftpc->dirdepth], NULL,
TRUE);
if(result) {
- free(ftpc->dirs[ftpc->dirdepth]);
freedirs(ftpc);
return result;
}
diff --git a/Utilities/cmcurl/lib/ftplistparser.c b/Utilities/cmcurl/lib/ftplistparser.c
index f94b31b..bc18680 100644
--- a/Utilities/cmcurl/lib/ftplistparser.c
+++ b/Utilities/cmcurl/lib/ftplistparser.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -280,7 +280,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn,
curl_fnmatch_callback compare;
struct WildcardData *wc = &conn->data->wildcard;
struct ftp_wc_tmpdata *tmpdata = wc->tmp;
- struct curl_llist *llist = wc->filelist;
+ struct curl_llist *llist = &wc->filelist;
struct ftp_parselist_data *parser = tmpdata->parser;
bool add = TRUE;
@@ -433,10 +433,8 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
}
- else {
- parser->state.UNIX.main = PL_UNIX_FILETYPE;
- finfo->b_used = 0;
- }
+ parser->state.UNIX.main = PL_UNIX_FILETYPE;
+ finfo->b_used = 0;
}
else {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
diff --git a/Utilities/cmcurl/lib/gopher.c b/Utilities/cmcurl/lib/gopher.c
index a073d0b..e6d2746 100644
--- a/Utilities/cmcurl/lib/gopher.c
+++ b/Utilities/cmcurl/lib/gopher.c
@@ -78,7 +78,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
curl_off_t *bytecount = &data->req.bytecount;
char *path = data->state.path;
- char *sel;
+ char *sel = NULL;
char *sel_org = NULL;
ssize_t amount, k;
size_t len;
@@ -106,8 +106,8 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
/* ... and finally unescape */
result = Curl_urldecode(data, newp, 0, &sel, &len, FALSE);
- if(!sel)
- return CURLE_OUT_OF_MEMORY;
+ if(result)
+ return result;
sel_org = sel;
}
diff --git a/Utilities/cmcurl/lib/hash.c b/Utilities/cmcurl/lib/hash.c
index 0655042..b7305a5 100644
--- a/Utilities/cmcurl/lib/hash.c
+++ b/Utilities/cmcurl/lib/hash.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -37,8 +37,6 @@ hash_element_dtor(void *user, void *element)
struct curl_hash *h = (struct curl_hash *) user;
struct curl_hash_element *e = (struct curl_hash_element *) element;
- Curl_safefree(e->key);
-
if(e->ptr) {
h->dtor(e->ptr);
e->ptr = NULL;
@@ -74,54 +72,32 @@ Curl_hash_init(struct curl_hash *h,
h->size = 0;
h->slots = slots;
- h->table = malloc(slots * sizeof(struct curl_llist *));
+ h->table = malloc(slots * sizeof(struct curl_llist));
if(h->table) {
- for(i = 0; i < slots; ++i) {
- h->table[i] = Curl_llist_alloc((curl_llist_dtor) hash_element_dtor);
- if(!h->table[i]) {
- while(i--) {
- Curl_llist_destroy(h->table[i], NULL);
- h->table[i] = NULL;
- }
- free(h->table);
- h->table = NULL;
- h->slots = 0;
- return 1; /* failure */
- }
- }
+ for(i = 0; i < slots; ++i)
+ Curl_llist_init(&h->table[i], (curl_llist_dtor) hash_element_dtor);
return 0; /* fine */
}
- else {
- h->slots = 0;
- return 1; /* failure */
- }
+ h->slots = 0;
+ return 1; /* failure */
}
static struct curl_hash_element *
mk_hash_element(const void *key, size_t key_len, const void *p)
{
- struct curl_hash_element *he = malloc(sizeof(struct curl_hash_element));
-
+ /* allocate the struct plus memory after it to store the key */
+ struct curl_hash_element *he = malloc(sizeof(struct curl_hash_element) +
+ key_len);
if(he) {
- void *dupkey = malloc(key_len);
- if(dupkey) {
- /* copy the key */
- memcpy(dupkey, key, key_len);
-
- he->key = dupkey;
- he->key_len = key_len;
- he->ptr = (void *) p;
- }
- else {
- /* failed to duplicate the key, free memory and fail */
- free(he);
- he = NULL;
- }
+ /* copy the key */
+ memcpy(he->key, key, key_len);
+ he->key_len = key_len;
+ he->ptr = (void *) p;
}
return he;
}
-#define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)]
+#define FETCH_LIST(x,y,z) &x->table[x->hash_func(y, z, x->slots)]
/* Insert the data in the hash. If there already was a match in the hash,
* that data is replaced.
@@ -158,7 +134,6 @@ Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
* "destructor" for the actual data 'p'. When we fail, we shall not touch
* that data.
*/
- free(he->key);
free(he);
}
@@ -243,8 +218,7 @@ Curl_hash_destroy(struct curl_hash *h)
int i;
for(i = 0; i < h->slots; ++i) {
- Curl_llist_destroy(h->table[i], (void *) h);
- h->table[i] = NULL;
+ Curl_llist_destroy(&h->table[i], (void *) h);
}
Curl_safefree(h->table);
@@ -276,7 +250,7 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
return;
for(i = 0; i < h->slots; ++i) {
- list = h->table[i];
+ list = &h->table[i];
le = list->head; /* get first list entry */
while(le) {
struct curl_hash_element *he = le->ptr;
@@ -335,8 +309,8 @@ Curl_hash_next_element(struct curl_hash_iterator *iter)
/* If we have reached the end of the list, find the next one */
if(!iter->current_element) {
for(i = iter->slot_index;i < h->slots;i++) {
- if(h->table[i]->head) {
- iter->current_element = h->table[i]->head;
+ if(h->table[i].head) {
+ iter->current_element = h->table[i].head;
iter->slot_index = i+1;
break;
}
@@ -347,10 +321,8 @@ Curl_hash_next_element(struct curl_hash_iterator *iter)
struct curl_hash_element *he = iter->current_element->ptr;
return he;
}
- else {
- iter->current_element = NULL;
- return NULL;
- }
+ iter->current_element = NULL;
+ return NULL;
}
#if 0 /* useful function for debugging hashes and their contents */
diff --git a/Utilities/cmcurl/lib/hash.h b/Utilities/cmcurl/lib/hash.h
index a5a6cac..a345c8c 100644
--- a/Utilities/cmcurl/lib/hash.h
+++ b/Utilities/cmcurl/lib/hash.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -44,7 +44,7 @@ typedef size_t (*comp_function) (void *key1,
typedef void (*curl_hash_dtor)(void *);
struct curl_hash {
- struct curl_llist **table;
+ struct curl_llist *table;
/* Hash function to be used for this hash table */
hash_function hash_func;
@@ -58,8 +58,8 @@ struct curl_hash {
struct curl_hash_element {
void *ptr;
- char *key;
size_t key_len;
+ char key[1]; /* allocated memory following the struct */
};
struct curl_hash_iterator {
diff --git a/Utilities/cmcurl/lib/hostcheck.c b/Utilities/cmcurl/lib/hostcheck.c
index cbd0893..156091c 100644
--- a/Utilities/cmcurl/lib/hostcheck.c
+++ b/Utilities/cmcurl/lib/hostcheck.c
@@ -87,7 +87,7 @@ static int hostmatch(char *hostname, char *pattern)
if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
return CURL_HOST_NOMATCH;
#ifdef ENABLE_IPV6
- else if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
+ if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
return CURL_HOST_NOMATCH;
#endif
diff --git a/Utilities/cmcurl/lib/hostip.c b/Utilities/cmcurl/lib/hostip.c
index fa4bad9..ed18763 100644
--- a/Utilities/cmcurl/lib/hostip.c
+++ b/Utilities/cmcurl/lib/hostip.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -143,7 +143,7 @@ void Curl_global_host_cache_dtor(void)
}
/*
- * Return # of adresses in a Curl_addrinfo struct
+ * Return # of addresses in a Curl_addrinfo struct
*/
int Curl_num_addresses(const Curl_addrinfo *addr)
{
@@ -573,7 +573,7 @@ int Curl_resolv_timeout(struct connectdata *conn,
#ifdef USE_ALARM_TIMEOUT
#ifdef HAVE_SIGACTION
struct sigaction keep_sigact; /* store the old struct here */
- volatile bool keep_copysig = FALSE; /* wether old sigact has been saved */
+ volatile bool keep_copysig = FALSE; /* whether old sigact has been saved */
struct sigaction sigact;
#else
#ifdef HAVE_SIGNAL
diff --git a/Utilities/cmcurl/lib/hostip.h b/Utilities/cmcurl/lib/hostip.h
index 1dc4079..298eeeee 100644
--- a/Utilities/cmcurl/lib/hostip.h
+++ b/Utilities/cmcurl/lib/hostip.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -130,7 +130,7 @@ int Curl_mk_dnscache(struct curl_hash *hash);
/* prune old entries from the DNS cache */
void Curl_hostcache_prune(struct Curl_easy *data);
-/* Return # of adresses in a Curl_addrinfo struct */
+/* Return # of addresses in a Curl_addrinfo struct */
int Curl_num_addresses(const Curl_addrinfo *addr);
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
diff --git a/Utilities/cmcurl/lib/http.c b/Utilities/cmcurl/lib/http.c
index 4c1c07f..22d4547 100644
--- a/Utilities/cmcurl/lib/http.c
+++ b/Utilities/cmcurl/lib/http.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -297,7 +297,8 @@ static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
pwd = conn->passwd;
}
- snprintf(data->state.buffer, sizeof(data->state.buffer), "%s:%s", user, pwd);
+ snprintf(data->state.buffer, CURL_BUFSIZE(data->set.buffer_size),
+ "%s:%s", user, pwd);
result = Curl_base64_encode(data,
data->state.buffer, strlen(data->state.buffer),
@@ -644,10 +645,10 @@ output_auth_headers(struct connectdata *conn,
proxy ? "Proxy" : "Server", auth,
proxy ? (conn->http_proxy.user ? conn->http_proxy.user : "") :
(conn->user ? conn->user : ""));
- authstatus->multi = (!authstatus->done) ? TRUE : FALSE;
+ authstatus->multipass = (!authstatus->done) ? TRUE : FALSE;
}
else
- authstatus->multi = FALSE;
+ authstatus->multipass = FALSE;
return CURLE_OK;
}
@@ -1196,8 +1197,7 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
This needs FIXing.
*/
return CURLE_SEND_ERROR;
- else
- Curl_pipeline_leave_write(conn);
+ Curl_pipeline_leave_write(conn);
}
}
Curl_add_buffer_free(in);
@@ -1358,6 +1358,10 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
if(result)
return result;
+ if(conn->bits.proxy_connect_closed)
+ /* this is not an error, just part of the connection negotiation */
+ return CURLE_OK;
+
if(CONNECT_FIRSTSOCKET_PROXY_SSL())
return CURLE_OK; /* wait for HTTPS proxy SSL initialization to complete */
@@ -1365,7 +1369,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
/* nothing else to do except wait right now - we're not done here. */
return CURLE_OK;
- if(conn->given->flags & PROTOPT_SSL) {
+ if(conn->given->protocol & CURLPROTO_HTTPS) {
/* perform SSL initialization */
result = https_connecting(conn, done);
if(result)
@@ -1425,7 +1429,10 @@ CURLcode Curl_http_done(struct connectdata *conn,
struct Curl_easy *data = conn->data;
struct HTTP *http = data->req.protop;
- infof(data, "Curl_http_done: called premature == %d\n", premature);
+ /* Clear multipass flag. If authentication isn't done yet, then it will get
+ * a chance to be set back to true when we output the next auth header */
+ data->state.authhost.multipass = FALSE;
+ data->state.authproxy.multipass = FALSE;
Curl_unencode_cleanup(conn);
@@ -1511,6 +1518,20 @@ static bool use_http_1_1plus(const struct Curl_easy *data,
(data->set.httpversion >= CURL_HTTP_VERSION_1_1));
}
+static const char *get_http_string(const struct Curl_easy *data,
+ const struct connectdata *conn)
+{
+#ifdef USE_NGHTTP2
+ if(conn->proto.httpc.h2)
+ return "2";
+#endif
+
+ if(use_http_1_1plus(data, conn))
+ return "1.1";
+
+ return "1.0";
+}
+
/* check and possibly add an Expect: header */
static CURLcode expect100(struct Curl_easy *data,
struct connectdata *conn,
@@ -1849,7 +1870,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(result)
return result;
- if((data->state.authhost.multi || data->state.authproxy.multi) &&
+ if((data->state.authhost.multipass || data->state.authproxy.multipass) &&
(httpreq != HTTPREQ_GET) &&
(httpreq != HTTPREQ_HEAD)) {
/* Auth is required and we are not authenticated yet. Make a PUT or POST
@@ -2134,32 +2155,31 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
if(seekerr != CURL_SEEKFUNC_OK) {
+ curl_off_t passed=0;
+
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_READ_ERROR;
}
/* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
- else {
- curl_off_t passed=0;
- do {
- size_t readthisamountnow =
- (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
- BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
-
- size_t actuallyread =
- data->state.fread_func(data->state.buffer, 1, readthisamountnow,
- data->state.in);
-
- passed += actuallyread;
- if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
- /* this checks for greater-than only to make sure that the
- CURL_READFUNC_ABORT return code still aborts */
- failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T
- " bytes from the input", passed);
- return CURLE_READ_ERROR;
- }
- } while(passed < data->state.resume_from);
- }
+ do {
+ size_t readthisamountnow =
+ (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
+ BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
+
+ size_t actuallyread =
+ data->state.fread_func(data->state.buffer, 1, readthisamountnow,
+ data->state.in);
+
+ passed += actuallyread;
+ if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T
+ " bytes from the input", passed);
+ return CURLE_READ_ERROR;
+ }
+ } while(passed < data->state.resume_from);
}
/* now, decrease the size of the read */
@@ -2225,9 +2245,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
}
- /* Use 1.1 unless the user specifically asked for 1.0 or the server only
- supports 1.0 */
- httpstring= use_http_1_1plus(data, conn)?"1.1":"1.0";
+ httpstring = get_http_string(data, conn);
/* initialize a dynamic send-buffer */
req_buffer = Curl_add_buffer_init();
@@ -2294,20 +2312,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
te
);
- /* clear userpwd to avoid re-using credentials from re-used connections */
+ /* clear userpwd and proxyuserpwd to avoid re-using old credentials
+ * from re-used connections */
Curl_safefree(conn->allocptr.userpwd);
-
- /*
- * Free proxyuserpwd for Negotiate/NTLM. Cannot reuse as it is associated
- * with the connection and shouldn't be repeated over it either.
- */
- switch(data->state.authproxy.picked) {
- case CURLAUTH_NEGOTIATE:
- case CURLAUTH_NTLM:
- case CURLAUTH_NTLM_WB:
- Curl_safefree(conn->allocptr.proxyuserpwd);
- break;
- }
+ Curl_safefree(conn->allocptr.proxyuserpwd);
if(result)
return result;
@@ -2501,7 +2509,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
postsize = data->state.infilesize;
if((postsize != -1) && !data->req.upload_chunky &&
- !Curl_checkheaders(conn, "Content-Length:")) {
+ (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
/* only add Content-Length if not uploading chunked */
result = Curl_add_bufferf(req_buffer,
"Content-Length: %" CURL_FORMAT_CURL_OFF_T
@@ -2553,7 +2561,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
we don't upload data chunked, as RFC2616 forbids us to set both
kinds of headers (Transfer-Encoding: chunked and Content-Length) */
if((postsize != -1) && !data->req.upload_chunky &&
- !Curl_checkheaders(conn, "Content-Length:")) {
+ (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
/* we allow replacing this header if not during auth negotiation,
although it isn't very wise to actually set your own */
result = Curl_add_bufferf(req_buffer,
@@ -2807,8 +2815,7 @@ checkrtspprefix(struct Curl_easy *data,
#endif /* CURL_DOES_CONVERSIONS */
if(checkprefix("RTSP/", s))
return TRUE;
- else
- return FALSE;
+ return FALSE;
}
#endif /* CURL_DISABLE_RTSP */
@@ -3229,9 +3236,17 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
k->maxdownload = k->size;
}
- /* If max download size is *zero* (nothing) we already
- have nothing and can safely return ok now! */
- if(0 == k->maxdownload)
+ /* If max download size is *zero* (nothing) we already have
+ nothing and can safely return ok now! But for HTTP/2, we'd
+ like to call http2_handle_stream_close to properly close a
+ stream. In order to do this, we keep reading until we
+ close the stream. */
+ if(0 == k->maxdownload
+#if defined(USE_NGHTTP2)
+ && !((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
+ conn->httpversion == 20)
+#endif
+ )
*stop_reading = TRUE;
if(*stop_reading) {
@@ -3288,7 +3303,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
/*
* https://tools.ietf.org/html/rfc7230#section-3.1.2
*
- * The reponse code is always a three-digit number in HTTP as the spec
+ * The response code is always a three-digit number in HTTP as the spec
* says. We try to allow any number here, but we cannot make
* guarantees on future behaviors since it isn't within the protocol.
*/
diff --git a/Utilities/cmcurl/lib/http.h b/Utilities/cmcurl/lib/http.h
index 9fb669c..7ce4bd9 100644
--- a/Utilities/cmcurl/lib/http.h
+++ b/Utilities/cmcurl/lib/http.h
@@ -219,6 +219,10 @@ struct http_conn {
/* this is a hash of all individual streams (Curl_easy structs) */
struct h2settings settings;
+
+ /* list of settings that will be sent */
+ nghttp2_settings_entry local_settings[3];
+ size_t local_settings_num;
#else
int unused; /* prevent a compiler warning */
#endif
diff --git a/Utilities/cmcurl/lib/http2.c b/Utilities/cmcurl/lib/http2.c
index 4cc17ba..264c667 100644
--- a/Utilities/cmcurl/lib/http2.c
+++ b/Utilities/cmcurl/lib/http2.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -116,18 +116,11 @@ static int http2_getsock(struct connectdata *conn,
return http2_perform_getsock(conn, sock, numsocks);
}
-static CURLcode http2_disconnect(struct connectdata *conn,
- bool dead_connection)
+/*
+ * http2_stream_free() free HTTP2 stream related data
+ */
+static void http2_stream_free(struct HTTP *http)
{
- struct HTTP *http = conn->data->req.protop;
- struct http_conn *c = &conn->proto.httpc;
- (void)dead_connection;
-
- DEBUGF(infof(conn->data, "HTTP/2 DISCONNECT starts now\n"));
-
- nghttp2_session_del(c->h2);
- Curl_safefree(c->inbuf);
-
if(http) {
Curl_add_buffer_free(http->header_recvbuf);
http->header_recvbuf = NULL; /* clear the pointer */
@@ -139,6 +132,19 @@ static CURLcode http2_disconnect(struct connectdata *conn,
free(http->push_headers);
http->push_headers = NULL;
}
+}
+
+static CURLcode http2_disconnect(struct connectdata *conn,
+ bool dead_connection)
+{
+ struct http_conn *c = &conn->proto.httpc;
+ (void)dead_connection;
+
+ DEBUGF(infof(conn->data, "HTTP/2 DISCONNECT starts now\n"));
+
+ nghttp2_session_del(c->h2);
+ Curl_safefree(c->inbuf);
+ http2_stream_free(conn->data->req.protop);
DEBUGF(infof(conn->data, "HTTP/2 DISCONNECT done\n"));
@@ -402,6 +408,7 @@ static int push_promise(struct Curl_easy *data,
stream = data->req.protop;
if(!stream) {
failf(data, "Internal NULL stream!\n");
+ (void)Curl_close(newhandle);
rv = 1;
goto fail;
}
@@ -415,9 +422,11 @@ static int push_promise(struct Curl_easy *data,
free(stream->push_headers[i]);
free(stream->push_headers);
stream->push_headers = NULL;
+ stream->push_headers_used = 0;
if(rv) {
/* denied, kill off the new handle again */
+ http2_stream_free(newhandle->req.protop);
(void)Curl_close(newhandle);
goto fail;
}
@@ -432,6 +441,7 @@ static int push_promise(struct Curl_easy *data,
rc = Curl_multi_add_perform(data->multi, newhandle, conn);
if(rc) {
infof(data, "failed to add handle to multi\n");
+ http2_stream_free(newhandle->req.protop);
Curl_close(newhandle);
rv = 1;
goto fail;
@@ -587,6 +597,9 @@ static int on_invalid_frame_recv(nghttp2_session *session,
{
struct Curl_easy *data_s = NULL;
(void)userp;
+#if !defined(DEBUGBUILD) || defined(CURL_DISABLE_VERBOSE_STRINGS)
+ (void)lib_error_code;
+#endif
data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
if(data_s) {
@@ -697,6 +710,9 @@ static int on_frame_not_send(nghttp2_session *session,
{
struct Curl_easy *data_s;
(void)userp;
+#if !defined(DEBUGBUILD) || defined(CURL_DISABLE_VERBOSE_STRINGS)
+ (void)lib_error_code;
+#endif
data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
if(data_s) {
@@ -967,14 +983,6 @@ static ssize_t data_source_read_callback(nghttp2_session *session,
return nread;
}
-/*
- * The HTTP2 settings we send in the Upgrade request
- */
-static nghttp2_settings_entry settings[] = {
- { NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100 },
- { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, HTTP2_HUGE_WINDOW_SIZE },
-};
-
#define H2_BUFSIZE 32768
#ifdef NGHTTP2_HAS_ERROR_CALLBACK
@@ -990,6 +998,23 @@ static int error_callback(nghttp2_session *session,
}
#endif
+static void populate_settings(struct connectdata *conn,
+ struct http_conn *httpc)
+{
+ nghttp2_settings_entry *iv = httpc->local_settings;
+
+ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
+ iv[0].value = 100;
+
+ iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
+ iv[1].value = HTTP2_HUGE_WINDOW_SIZE;
+
+ iv[2].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH;
+ iv[2].value = conn->data->multi->push_cb != NULL;
+
+ httpc->local_settings_num = 3;
+}
+
void Curl_http2_done(struct connectdata *conn, bool premature)
{
struct Curl_easy *data = conn->data;
@@ -1103,16 +1128,14 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req,
size_t blen;
struct SingleRequest *k = &conn->data->req;
uint8_t *binsettings = conn->proto.httpc.binsettings;
+ struct http_conn *httpc = &conn->proto.httpc;
- /* As long as we have a fixed set of settings, we don't have to dynamically
- * figure out the base64 strings since it'll always be the same. However,
- * the settings will likely not be fixed every time in the future.
- */
+ populate_settings(conn, httpc);
/* this returns number of bytes it wrote */
binlen = nghttp2_pack_settings_payload(binsettings, H2_BINSETTINGS_LEN,
- settings,
- sizeof(settings)/sizeof(settings[0]));
+ httpc->local_settings,
+ httpc->local_settings_num);
if(!binlen) {
failf(conn->data, "nghttp2 unexpectedly failed on pack_settings_payload");
return CURLE_FAILED_INIT;
@@ -1862,28 +1885,22 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
/* Warn stream may be rejected if cumulative length of headers is too large.
It appears nghttp2 will not send a header frame larger than 64KB. */
+#define MAX_ACC 60000 /* <64KB to account for some overhead */
{
size_t acc = 0;
- const size_t max_acc = 60000; /* <64KB to account for some overhead */
for(i = 0; i < nheader; ++i) {
- if(nva[i].namelen > max_acc - acc)
- break;
- acc += nva[i].namelen;
-
- if(nva[i].valuelen > max_acc - acc)
- break;
- acc += nva[i].valuelen;
+ acc += nva[i].namelen + nva[i].valuelen;
DEBUGF(infof(conn->data, "h2 header: %.*s:%.*s\n",
nva[i].namelen, nva[i].name,
nva[i].valuelen, nva[i].value));
}
- if(i != nheader) {
+ if(acc > MAX_ACC) {
infof(conn->data, "http2_send: Warning: The cumulative length of all "
- "headers exceeds %zu bytes and that could cause the "
- "stream to be rejected.\n", max_acc);
+ "headers exceeds %zu bytes and that could cause the "
+ "stream to be rejected.\n", MAX_ACC);
}
}
@@ -2037,10 +2054,13 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
conn->data);
}
else {
+ populate_settings(conn, httpc);
+
/* stream ID is unknown at this point */
stream->stream_id = -1;
- rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE, settings,
- sizeof(settings) / sizeof(settings[0]));
+ rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE,
+ httpc->local_settings,
+ httpc->local_settings_num);
if(rv != 0) {
failf(data, "nghttp2_submit_settings() failed: %s(%d)",
nghttp2_strerror(rv), rv);
diff --git a/Utilities/cmcurl/lib/http_ntlm.c b/Utilities/cmcurl/lib/http_ntlm.c
index 21c77cd..8a78bd2 100644
--- a/Utilities/cmcurl/lib/http_ntlm.c
+++ b/Utilities/cmcurl/lib/http_ntlm.c
@@ -27,7 +27,7 @@
/*
* NTLM details:
*
- * http://davenport.sourceforge.net/ntlm.html
+ * https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
diff --git a/Utilities/cmcurl/lib/http_proxy.c b/Utilities/cmcurl/lib/http_proxy.c
index e0213f3..d53685f 100644
--- a/Utilities/cmcurl/lib/http_proxy.c
+++ b/Utilities/cmcurl/lib/http_proxy.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -98,16 +98,21 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
* original pointer
*
* This function might be called several times in the multi interface case
- * if the proxy's CONNTECT response is not instant.
+ * if the proxy's CONNECT response is not instant.
*/
prot_save = conn->data->req.protop;
memset(&http_proxy, 0, sizeof(http_proxy));
conn->data->req.protop = &http_proxy;
connkeep(conn, "HTTP proxy CONNECT");
- if(sockindex == SECONDARYSOCKET)
- hostname = conn->secondaryhostname;
- else if(conn->bits.conn_to_host)
+
+ /* for the secondary socket (FTP), use the "connect to host"
+ * but ignore the "connect to port" (use the secondary port)
+ */
+
+ if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
+ else if(sockindex == SECONDARYSOCKET)
+ hostname = conn->secondaryhostname;
else
hostname = conn->host.name;
@@ -199,7 +204,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
free(host_port);
if(!result) {
- char *host=(char *)"";
+ char *host = NULL;
const char *proxyconn="";
const char *useragent="";
const char *http = (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ?
@@ -242,13 +247,13 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
"%s", /* Proxy-Connection */
hostheader,
http,
- host,
+ host?host:"",
conn->allocptr.proxyuserpwd?
conn->allocptr.proxyuserpwd:"",
useragent,
proxyconn);
- if(host && *host)
+ if(host)
free(host);
free(hostheader);
@@ -288,10 +293,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!Curl_conn_data_pending(conn, sockindex))
/* return so we'll be called again polling-style */
return CURLE_OK;
- else {
- DEBUGF(infof(data,
- "Read response immediately from proxy CONNECT\n"));
- }
+ DEBUGF(infof(data,
+ "Read response immediately from proxy CONNECT\n"));
}
/* at this point, the tunnel_connecting phase is over. */
@@ -311,8 +314,6 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
perline = 0;
while(nread < BUFSIZE && keepon && !error) {
- int writetype;
-
if(Curl_pgrsUpdate(conn))
return CURLE_ABORTED_BY_CALLBACK;
@@ -339,7 +340,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
}
continue;
}
- else if(result) {
+ if(result) {
keepon = FALSE;
break;
}
@@ -414,19 +415,20 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
Curl_debug(data, CURLINFO_HEADER_IN,
line_start, (size_t)perline, conn);
- /* send the header to the callback */
- writetype = CLIENTWRITE_HEADER;
- if(data->set.include_header)
- writetype |= CLIENTWRITE_BODY;
+ if(!data->set.suppress_connect_headers) {
+ /* send the header to the callback */
+ int writetype = CLIENTWRITE_HEADER;
+ if(data->set.include_header)
+ writetype |= CLIENTWRITE_BODY;
- result = Curl_client_write(conn, writetype, line_start, perline);
+ result = Curl_client_write(conn, writetype, line_start, perline);
+ if(result)
+ return result;
+ }
data->info.header_size += (long)perline;
data->req.headerbytecount += (long)perline;
- if(result)
- return result;
-
/* Newlines are CRLF, so the CR is ignored as the line isn't
really terminated until the LF comes. Treat a following CR
as end-of-headers as well.*/
@@ -510,33 +512,34 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
}
else if(checkprefix("Content-Length:", line_start)) {
if(k->httpcode/100 == 2) {
- /* A server MUST NOT send any Transfer-Encoding or
- Content-Length header fields in a 2xx (Successful)
- response to CONNECT. (RFC 7231 section 4.3.6) */
- failf(data, "Content-Length: in %03d response",
+ /* A client MUST ignore any Content-Length or Transfer-Encoding
+ header fields received in a successful response to CONNECT.
+ "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */
+ infof(data, "Ignoring Content-Length in CONNECT %03d response\n",
k->httpcode);
- return CURLE_RECV_ERROR;
}
-
- cl = curlx_strtoofft(line_start +
- strlen("Content-Length:"), NULL, 10);
+ else {
+ cl = curlx_strtoofft(line_start +
+ strlen("Content-Length:"), NULL, 10);
+ }
}
else if(Curl_compareheader(line_start, "Connection:", "close"))
closeConnection = TRUE;
- else if(Curl_compareheader(line_start,
- "Transfer-Encoding:",
- "chunked")) {
+ else if(checkprefix("Transfer-Encoding:", line_start)) {
if(k->httpcode/100 == 2) {
- /* A server MUST NOT send any Transfer-Encoding or
- Content-Length header fields in a 2xx (Successful)
- response to CONNECT. (RFC 7231 section 4.3.6) */
- failf(data, "Transfer-Encoding: in %03d response", k->httpcode);
- return CURLE_RECV_ERROR;
+ /* A client MUST ignore any Content-Length or Transfer-Encoding
+ header fields received in a successful response to CONNECT.
+ "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */
+ infof(data, "Ignoring Transfer-Encoding in "
+ "CONNECT %03d response\n", k->httpcode);
+ }
+ else if(Curl_compareheader(line_start,
+ "Transfer-Encoding:", "chunked")) {
+ infof(data, "CONNECT responded chunked\n");
+ chunked_encoding = TRUE;
+ /* init our chunky engine */
+ Curl_httpchunk_init(conn);
}
- infof(data, "CONNECT responded chunked\n");
- chunked_encoding = TRUE;
- /* init our chunky engine */
- Curl_httpchunk_init(conn);
}
else if(Curl_compareheader(line_start, "Proxy-Connection:", "close"))
closeConnection = TRUE;
@@ -612,11 +615,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(conn->bits.proxy_connect_closed)
/* this is not an error, just part of the connection negotiation */
return CURLE_OK;
- else {
- failf(data, "Received HTTP code %d from proxy after CONNECT",
- data->req.httpcode);
- return CURLE_RECV_ERROR;
- }
+ failf(data, "Received HTTP code %d from proxy after CONNECT",
+ data->req.httpcode);
+ return CURLE_RECV_ERROR;
}
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;
diff --git a/Utilities/cmcurl/lib/imap.c b/Utilities/cmcurl/lib/imap.c
index 78dc6fa..b528f77 100644
--- a/Utilities/cmcurl/lib/imap.c
+++ b/Utilities/cmcurl/lib/imap.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -130,7 +130,8 @@ const struct Curl_handler Curl_handler_imap = {
ZERO_NULL, /* readwrite */
PORT_IMAP, /* defport */
CURLPROTO_IMAP, /* protocol */
- PROTOPT_CLOSEACTION /* flags */
+ PROTOPT_CLOSEACTION| /* flags */
+ PROTOPT_URLOPTIONS
};
#ifdef USE_SSL
@@ -952,7 +953,7 @@ static CURLcode imap_state_starttls_resp(struct connectdata *conn,
if(imapcode != 'O') {
if(data->set.use_ssl != CURLUSESSL_TRY) {
- failf(data, "STARTTLS denied. %c", imapcode);
+ failf(data, "STARTTLS denied");
result = CURLE_USE_SSL_FAILED;
}
else
@@ -1748,7 +1749,7 @@ static CURLcode imap_setup_connection(struct connectdata *conn)
*
* imap_sendf()
*
- * Sends the formated string as an IMAP command to the server.
+ * Sends the formatted string as an IMAP command to the server.
*
* Designed to never block.
*/
diff --git a/Utilities/cmcurl/lib/libcurl.rc b/Utilities/cmcurl/lib/libcurl.rc
index c1efbad..3316fba 100644
--- a/Utilities/cmcurl/lib/libcurl.rc
+++ b/Utilities/cmcurl/lib/libcurl.rc
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -51,7 +51,7 @@ BEGIN
VALUE "OriginalFilename", "libcurl.dll\0"
VALUE "ProductName", "The curl library\0"
VALUE "ProductVersion", LIBCURL_VERSION "\0"
- VALUE "LegalCopyright", "© " LIBCURL_COPYRIGHT "\0"
+ VALUE "LegalCopyright", "\xa9 " LIBCURL_COPYRIGHT "\0" /* a9: Copyright symbol */
VALUE "License", "https://curl.haxx.se/docs/copyright.html\0"
END
END
diff --git a/Utilities/cmcurl/lib/llist.c b/Utilities/cmcurl/lib/llist.c
index 482aaa0..b8836bb 100644
--- a/Utilities/cmcurl/lib/llist.c
+++ b/Utilities/cmcurl/lib/llist.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -33,8 +33,8 @@
/*
* @unittest: 1300
*/
-static void
-llist_init(struct curl_llist *l, curl_llist_dtor dtor)
+void
+Curl_llist_init(struct curl_llist *l, curl_llist_dtor dtor)
{
l->size = 0;
l->dtor = dtor;
@@ -42,20 +42,6 @@ llist_init(struct curl_llist *l, curl_llist_dtor dtor)
l->tail = NULL;
}
-struct curl_llist *
-Curl_llist_alloc(curl_llist_dtor dtor)
-{
- struct curl_llist *list;
-
- list = malloc(sizeof(struct curl_llist));
- if(!list)
- return NULL;
-
- llist_init(list, dtor);
-
- return list;
-}
-
/*
* Curl_llist_insert_next()
*
@@ -149,8 +135,6 @@ Curl_llist_destroy(struct curl_llist *list, void *user)
if(list) {
while(list->size > 0)
Curl_llist_remove(list, list->tail, user);
-
- free(list);
}
}
diff --git a/Utilities/cmcurl/lib/llist.h b/Utilities/cmcurl/lib/llist.h
index 39ff408..47935ad 100644
--- a/Utilities/cmcurl/lib/llist.h
+++ b/Utilities/cmcurl/lib/llist.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -43,7 +43,7 @@ struct curl_llist {
size_t size;
};
-struct curl_llist *Curl_llist_alloc(curl_llist_dtor);
+void Curl_llist_init(struct curl_llist *, curl_llist_dtor);
int Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,
const void *);
int Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,
diff --git a/Utilities/cmcurl/lib/memdebug.c b/Utilities/cmcurl/lib/memdebug.c
index 15e8661..32d2adf 100644
--- a/Utilities/cmcurl/lib/memdebug.c
+++ b/Utilities/cmcurl/lib/memdebug.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -458,7 +458,7 @@ int curl_fclose(FILE *file, int line, const char *source)
#define LOGLINE_BUFSIZE 1024
-/* this does the writting to the memory tracking log file */
+/* this does the writing to the memory tracking log file */
void curl_memlog(const char *format, ...)
{
char *buf;
diff --git a/Utilities/cmcurl/lib/mprintf.c b/Utilities/cmcurl/lib/mprintf.c
index 4baa1cc..6d4e733 100644
--- a/Utilities/cmcurl/lib/mprintf.c
+++ b/Utilities/cmcurl/lib/mprintf.c
@@ -1092,8 +1092,7 @@ char *curl_maprintf(const char *format, ...)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer;
}
- else
- return strdup("");
+ return strdup("");
}
char *curl_mvaprintf(const char *format, va_list ap_save)
@@ -1117,8 +1116,7 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer;
}
- else
- return strdup("");
+ return strdup("");
}
static int storebuffer(int output, FILE *data)
diff --git a/Utilities/cmcurl/lib/multi.c b/Utilities/cmcurl/lib/multi.c
index 950b600..b24ce19 100644
--- a/Utilities/cmcurl/lib/multi.c
+++ b/Utilities/cmcurl/lib/multi.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -280,7 +280,7 @@ static int sh_init(struct curl_hash *hash, int hashsize)
static CURLMcode multi_addmsg(struct Curl_multi *multi,
struct Curl_message *msg)
{
- if(!Curl_llist_insert_next(multi->msglist, multi->msglist->tail, msg))
+ if(!Curl_llist_insert_next(&multi->msglist, multi->msglist.tail, msg))
return CURLM_OUT_OF_MEMORY;
return CURLM_OK;
@@ -316,13 +316,8 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
if(Curl_conncache_init(&multi->conn_cache, chashsize))
goto error;
- multi->msglist = Curl_llist_alloc(multi_freeamsg);
- if(!multi->msglist)
- goto error;
-
- multi->pending = Curl_llist_alloc(multi_freeamsg);
- if(!multi->pending)
- goto error;
+ Curl_llist_init(&multi->msglist, multi_freeamsg);
+ Curl_llist_init(&multi->pending, multi_freeamsg);
/* allocate a new easy handle to use when closing cached connections */
multi->closure_handle = curl_easy_init();
@@ -345,8 +340,8 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
Curl_conncache_destroy(&multi->conn_cache);
Curl_close(multi->closure_handle);
multi->closure_handle = NULL;
- Curl_llist_destroy(multi->msglist, NULL);
- Curl_llist_destroy(multi->pending, NULL);
+ Curl_llist_destroy(&multi->msglist, NULL);
+ Curl_llist_destroy(&multi->pending, NULL);
free(multi);
return NULL;
@@ -361,8 +356,6 @@ struct Curl_multi *curl_multi_init(void)
CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
struct Curl_easy *data)
{
- struct curl_llist *timeoutlist;
-
/* First, make some basic checks that the CURLM handle is a good handle */
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
@@ -376,10 +369,8 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
if(data->multi)
return CURLM_ADDED_ALREADY;
- /* Allocate and initialize timeout list for easy handle */
- timeoutlist = Curl_llist_alloc(multi_freetimeout);
- if(!timeoutlist)
- return CURLM_OUT_OF_MEMORY;
+ /* Initialize timeout list for this handle */
+ Curl_llist_init(&data->state.timeoutlist, multi_freetimeout);
/*
* No failure allowed in this function beyond this point. And no
@@ -388,10 +379,6 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
* function no matter what.
*/
- /* Make easy handle use timeout list initialized above */
- data->state.timeoutlist = timeoutlist;
- timeoutlist = NULL;
-
/* set the easy handle */
multistate(data, CURLM_STATE_INIT);
@@ -532,6 +519,7 @@ static CURLcode multi_done(struct connectdata **connp,
CURLcode result;
struct connectdata *conn;
struct Curl_easy *data;
+ unsigned int i;
DEBUGASSERT(*connp);
@@ -579,7 +567,7 @@ static CURLcode multi_done(struct connectdata **connp,
result = CURLE_ABORTED_BY_CALLBACK;
}
- if(conn->send_pipe->size + conn->recv_pipe->size != 0 &&
+ if(conn->send_pipe.size + conn->recv_pipe.size != 0 &&
!data->set.reuse_forbid &&
!conn->bits.close) {
/* Stop if pipeline is not empty and we do not have to close
@@ -598,9 +586,11 @@ static CURLcode multi_done(struct connectdata **connp,
}
/* if the transfer was completed in a paused state there can be buffered
- data left to write and then kill */
- free(data->state.tempwrite);
- data->state.tempwrite = NULL;
+ data left to free */
+ for(i=0; i < data->state.tempcount; i++) {
+ free(data->state.tempwrite[i].buf);
+ }
+ data->state.tempcount = 0;
/* if data->set.reuse_forbid is TRUE, it means the libcurl client has
forced us to close this connection. This is ignored for requests taking
@@ -638,7 +628,10 @@ static CURLcode multi_done(struct connectdata **connp,
infof(data, "Connection #%ld to host %s left intact\n",
conn->connection_id,
- conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
+ conn->bits.socksproxy ? conn->socks_proxy.host.dispname :
+ conn->bits.httpproxy ? conn->http_proxy.host.dispname :
+ conn->bits.conn_to_host ? conn->conn_to_host.dispname :
+ conn->host.dispname);
}
else
data->state.lastconnect = NULL;
@@ -692,13 +685,13 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
if(data->easy_conn &&
data->mstate > CURLM_STATE_DO &&
data->mstate < CURLM_STATE_COMPLETED) {
+ /* Set connection owner so that the DONE function closes it. We can
+ safely do this here since connection is killed. */
+ data->easy_conn->data = easy;
/* If the handle is in a pipeline and has started sending off its
request but not received its response yet, we need to close
connection. */
streamclose(data->easy_conn, "Removed with partial response");
- /* Set connection owner so that the DONE function closes it. We can
- safely do this here since connection is killed. */
- data->easy_conn->data = easy;
easy_owns_conn = TRUE;
}
@@ -735,10 +728,7 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
/* destroy the timeout list that is held in the easy handle, do this *after*
multi_done() as that may actually call Curl_expire that uses this */
- if(data->state.timeoutlist) {
- Curl_llist_destroy(data->state.timeoutlist, NULL);
- data->state.timeoutlist = NULL;
- }
+ Curl_llist_destroy(&data->state.timeoutlist, NULL);
/* as this was using a shared connection cache we clear the pointer to that
since we're not part of that multi handle anymore */
@@ -761,11 +751,11 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
/* make sure there's no pending message in the queue sent from this easy
handle */
- for(e = multi->msglist->head; e; e = e->next) {
+ for(e = multi->msglist.head; e; e = e->next) {
struct Curl_message *msg = e->ptr;
if(msg->extmsg.easy_handle == easy) {
- Curl_llist_remove(multi->msglist, e, NULL);
+ Curl_llist_remove(&multi->msglist, e, NULL);
/* there can only be one from this specific handle */
break;
}
@@ -956,10 +946,8 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
if(s == CURL_SOCKET_BAD)
/* this socket is unused, break out of loop */
break;
- else {
- if((int)s > this_max_fd)
- this_max_fd = (int)s;
- }
+ if((int)s > this_max_fd)
+ this_max_fd = (int)s;
}
data = data->next; /* check next handle */
@@ -970,6 +958,8 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
return CURLM_OK;
}
+#define NUM_POLLS_ON_STACK 10
+
CURLMcode curl_multi_wait(struct Curl_multi *multi,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
@@ -983,8 +973,10 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi,
unsigned int nfds = 0;
unsigned int curlfds;
struct pollfd *ufds = NULL;
+ bool ufds_malloc = FALSE;
long timeout_internal;
int retcode = 0;
+ struct pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
@@ -1024,9 +1016,14 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi,
nfds += extra_nfds; /* add the externally provided ones */
if(nfds || extra_nfds) {
- ufds = malloc(nfds * sizeof(struct pollfd));
- if(!ufds)
- return CURLM_OUT_OF_MEMORY;
+ if(nfds > NUM_POLLS_ON_STACK) {
+ ufds = malloc(nfds * sizeof(struct pollfd));
+ if(!ufds)
+ return CURLM_OUT_OF_MEMORY;
+ ufds_malloc = TRUE;
+ }
+ else
+ ufds = &a_few_on_stack[0];
}
nfds = 0;
@@ -1104,7 +1101,8 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi,
}
}
- free(ufds);
+ if(ufds_malloc)
+ free(ufds);
if(ret)
*ret = retcode;
return CURLM_OK;
@@ -1307,6 +1305,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
CURLcode result = CURLE_OK;
struct SingleRequest *k;
time_t timeout_ms;
+ time_t recv_timeout_ms;
+ time_t send_timeout_ms;
int control;
if(!GOOD_EASY_HANDLE(data))
@@ -1432,7 +1432,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multistate(data, CURLM_STATE_CONNECT_PEND);
/* add this handle to the list of connect-pending handles */
- if(!Curl_llist_insert_next(multi->pending, multi->pending->tail, data))
+ if(!Curl_llist_insert_next(&multi->pending, multi->pending.tail, data))
result = CURLE_OUT_OF_MEMORY;
else
result = CURLE_OK;
@@ -1477,8 +1477,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
struct connectdata *conn = data->easy_conn;
const char *hostname;
- if(conn->bits.proxy)
- hostname = conn->proxy.name;
+ if(conn->bits.httpproxy)
+ hostname = conn->http_proxy.host.name;
else if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
else
@@ -1826,19 +1826,30 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
else
result = Curl_speedcheck(data, now);
- if(( (data->set.max_send_speed == 0) ||
- (Curl_pgrsLimitWaitTime(data->progress.uploaded,
- data->progress.ul_limit_size,
- data->set.max_send_speed,
- data->progress.ul_limit_start,
- now) <= 0)) &&
- ( (data->set.max_recv_speed == 0) ||
- (Curl_pgrsLimitWaitTime(data->progress.downloaded,
- data->progress.dl_limit_size,
- data->set.max_recv_speed,
- data->progress.dl_limit_start,
- now) <= 0)))
- multistate(data, CURLM_STATE_PERFORM);
+ if(!result) {
+ send_timeout_ms = 0;
+ if(data->set.max_send_speed > 0)
+ send_timeout_ms = Curl_pgrsLimitWaitTime(data->progress.uploaded,
+ data->progress.ul_limit_size,
+ data->set.max_send_speed,
+ data->progress.ul_limit_start,
+ now);
+
+ recv_timeout_ms = 0;
+ if(data->set.max_recv_speed > 0)
+ recv_timeout_ms = Curl_pgrsLimitWaitTime(data->progress.downloaded,
+ data->progress.dl_limit_size,
+ data->set.max_recv_speed,
+ data->progress.dl_limit_start,
+ now);
+
+ if(send_timeout_ms <= 0 && recv_timeout_ms <= 0)
+ multistate(data, CURLM_STATE_PERFORM);
+ else if(send_timeout_ms >= recv_timeout_ms)
+ Curl_expire_latest(data, send_timeout_ms);
+ else
+ Curl_expire_latest(data, recv_timeout_ms);
+ }
break;
case CURLM_STATE_PERFORM:
@@ -1848,31 +1859,30 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
bool comeback = FALSE;
/* check if over send speed */
- if(data->set.max_send_speed > 0) {
- timeout_ms = Curl_pgrsLimitWaitTime(data->progress.uploaded,
- data->progress.ul_limit_size,
- data->set.max_send_speed,
- data->progress.ul_limit_start,
- now);
- if(timeout_ms > 0) {
- multistate(data, CURLM_STATE_TOOFAST);
- Curl_expire_latest(data, timeout_ms);
- break;
- }
- }
+ send_timeout_ms = 0;
+ if(data->set.max_send_speed > 0)
+ send_timeout_ms = Curl_pgrsLimitWaitTime(data->progress.uploaded,
+ data->progress.ul_limit_size,
+ data->set.max_send_speed,
+ data->progress.ul_limit_start,
+ now);
/* check if over recv speed */
- if(data->set.max_recv_speed > 0) {
- timeout_ms = Curl_pgrsLimitWaitTime(data->progress.downloaded,
- data->progress.dl_limit_size,
- data->set.max_recv_speed,
- data->progress.dl_limit_start,
- now);
- if(timeout_ms > 0) {
- multistate(data, CURLM_STATE_TOOFAST);
- Curl_expire_latest(data, timeout_ms);
- break;
- }
+ recv_timeout_ms = 0;
+ if(data->set.max_recv_speed > 0)
+ recv_timeout_ms = Curl_pgrsLimitWaitTime(data->progress.downloaded,
+ data->progress.dl_limit_size,
+ data->set.max_recv_speed,
+ data->progress.dl_limit_start,
+ now);
+
+ if(send_timeout_ms > 0 || recv_timeout_ms > 0) {
+ multistate(data, CURLM_STATE_TOOFAST);
+ if(send_timeout_ms >= recv_timeout_ms)
+ Curl_expire_latest(data, send_timeout_ms);
+ else
+ Curl_expire_latest(data, recv_timeout_ms);
+ break;
}
/* read/write data if it is ready to do so */
@@ -1928,11 +1938,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
Curl_posttransfer(data);
/* we're no longer receiving */
- Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe);
+ Curl_removeHandleFromPipeline(data, &data->easy_conn->recv_pipe);
/* expire the new receiving pipeline head */
- if(data->easy_conn->recv_pipe->head)
- Curl_expire_latest(data->easy_conn->recv_pipe->head->ptr, 0);
+ if(data->easy_conn->recv_pipe.head)
+ Curl_expire_latest(data->easy_conn->recv_pipe.head->ptr, 0);
/* Check if we can move pending requests to send pipe */
Curl_multi_process_pending_handles(multi);
@@ -1997,7 +2007,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
CURLcode res;
/* Remove ourselves from the receive pipeline, if we are there. */
- Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe);
+ Curl_removeHandleFromPipeline(data, &data->easy_conn->recv_pipe);
/* Check if we can move pending requests to send pipe */
Curl_multi_process_pending_handles(multi);
@@ -2073,8 +2083,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* if this has a connection, unsubscribe from the pipelines */
Curl_pipeline_leave_write(data->easy_conn);
Curl_pipeline_leave_read(data->easy_conn);
- Curl_removeHandleFromPipeline(data, data->easy_conn->send_pipe);
- Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe);
+ Curl_removeHandleFromPipeline(data, &data->easy_conn->send_pipe);
+ Curl_removeHandleFromPipeline(data, &data->easy_conn->recv_pipe);
if(stream_error) {
/* Don't attempt to send data over a connection that timed out */
@@ -2229,8 +2239,8 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
Curl_hash_destroy(&multi->sockhash);
Curl_conncache_destroy(&multi->conn_cache);
- Curl_llist_destroy(multi->msglist, NULL);
- Curl_llist_destroy(multi->pending, NULL);
+ Curl_llist_destroy(&multi->msglist, NULL);
+ Curl_llist_destroy(&multi->pending, NULL);
/* remove all easy handles */
data = multi->easyp;
@@ -2262,8 +2272,7 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
return CURLM_OK;
}
- else
- return CURLM_BAD_HANDLE;
+ return CURLM_BAD_HANDLE;
}
/*
@@ -2282,24 +2291,23 @@ CURLMsg *curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue)
*msgs_in_queue = 0; /* default to none */
- if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(multi->msglist)) {
+ if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(&multi->msglist)) {
/* there is one or more messages in the list */
struct curl_llist_element *e;
/* extract the head of the list to return */
- e = multi->msglist->head;
+ e = multi->msglist.head;
msg = e->ptr;
/* remove the extracted entry */
- Curl_llist_remove(multi->msglist, e, NULL);
+ Curl_llist_remove(&multi->msglist, e, NULL);
- *msgs_in_queue = curlx_uztosi(Curl_llist_count(multi->msglist));
+ *msgs_in_queue = curlx_uztosi(Curl_llist_count(&multi->msglist));
return &msg->extmsg;
}
- else
- return NULL;
+ return NULL;
}
/*
@@ -2394,7 +2402,7 @@ static void singlesocket(struct Curl_multi *multi,
removed. */
struct connectdata *easy_conn = data->easy_conn;
if(easy_conn) {
- if(easy_conn->recv_pipe && easy_conn->recv_pipe->size > 1) {
+ if(easy_conn->recv_pipe.size > 1) {
/* the handle should not be removed from the pipe yet */
remove_sock_from_hash = FALSE;
@@ -2403,12 +2411,12 @@ static void singlesocket(struct Curl_multi *multi,
isn't already) */
if(entry->easy == data) {
if(Curl_recvpipe_head(data, easy_conn))
- entry->easy = easy_conn->recv_pipe->head->next->ptr;
+ entry->easy = easy_conn->recv_pipe.head->next->ptr;
else
- entry->easy = easy_conn->recv_pipe->head->ptr;
+ entry->easy = easy_conn->recv_pipe.head->ptr;
}
}
- if(easy_conn->send_pipe && easy_conn->send_pipe->size > 1) {
+ if(easy_conn->send_pipe.size > 1) {
/* the handle should not be removed from the pipe yet */
remove_sock_from_hash = FALSE;
@@ -2417,9 +2425,9 @@ static void singlesocket(struct Curl_multi *multi,
isn't already) */
if(entry->easy == data) {
if(Curl_sendpipe_head(data, easy_conn))
- entry->easy = easy_conn->send_pipe->head->next->ptr;
+ entry->easy = easy_conn->send_pipe.head->next->ptr;
else
- entry->easy = easy_conn->send_pipe->head->ptr;
+ entry->easy = easy_conn->send_pipe.head->ptr;
}
}
/* Don't worry about overwriting recv_pipe head with send_pipe_head,
@@ -2494,7 +2502,7 @@ static CURLMcode add_next_timeout(struct timeval now,
struct Curl_easy *d)
{
struct timeval *tv = &d->state.expiretime;
- struct curl_llist *list = d->state.timeoutlist;
+ struct curl_llist *list = &d->state.timeoutlist;
struct curl_llist_element *e;
/* move over the timeout list for this specific handle and remove all
@@ -2560,7 +2568,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
/* or should we fall-through and do the timer-based stuff? */
return result;
}
- else if(s != CURL_SOCKET_TIMEOUT) {
+ if(s != CURL_SOCKET_TIMEOUT) {
struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s);
@@ -2585,13 +2593,11 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
head. If we should read from the socket, take the recv_pipe head. */
if(data->easy_conn) {
if((ev_bitmask & CURL_POLL_OUT) &&
- data->easy_conn->send_pipe &&
- data->easy_conn->send_pipe->head)
- data = data->easy_conn->send_pipe->head->ptr;
+ data->easy_conn->send_pipe.head)
+ data = data->easy_conn->send_pipe.head->ptr;
else if((ev_bitmask & CURL_POLL_IN) &&
- data->easy_conn->recv_pipe &&
- data->easy_conn->recv_pipe->head)
- data = data->easy_conn->recv_pipe->head->ptr;
+ data->easy_conn->recv_pipe.head)
+ data = data->easy_conn->recv_pipe.head->ptr;
}
if(data->easy_conn &&
@@ -2928,7 +2934,7 @@ void Curl_expire(struct Curl_easy *data, time_t milli)
set = Curl_tvnow();
set.tv_sec += (long)(milli/1000);
- set.tv_usec += (milli%1000)*1000;
+ set.tv_usec += (long)(milli%1000)*1000;
if(set.tv_usec >= 1000000) {
set.tv_sec++;
@@ -2943,13 +2949,13 @@ void Curl_expire(struct Curl_easy *data, time_t milli)
if(diff > 0) {
/* the new expire time was later so just add it to the queue
and get out */
- multi_addtimeout(data->state.timeoutlist, &set);
+ multi_addtimeout(&data->state.timeoutlist, &set);
return;
}
/* the new time is newer than the presently set one, so add the current
to the queue and update the head */
- multi_addtimeout(data->state.timeoutlist, nowp);
+ multi_addtimeout(&data->state.timeoutlist, nowp);
/* Since this is an updated time, we must remove the previous entry from
the splay tree first and then re-add the new value */
@@ -2985,7 +2991,7 @@ void Curl_expire_latest(struct Curl_easy *data, time_t milli)
set = Curl_tvnow();
set.tv_sec += (long)(milli / 1000);
- set.tv_usec += (milli % 1000) * 1000;
+ set.tv_usec += (long)(milli % 1000) * 1000;
if(set.tv_usec >= 1000000) {
set.tv_sec++;
@@ -2995,11 +3001,14 @@ void Curl_expire_latest(struct Curl_easy *data, time_t milli)
if(expire->tv_sec || expire->tv_usec) {
/* This means that the struct is added as a node in the splay tree.
Compare if the new time is earlier, and only remove-old/add-new if it
- is. */
+ is. */
time_t diff = curlx_tvdiff(set, *expire);
- if(diff > 0)
- /* the new expire time was later than the top time, so just skip this */
+ if((diff > 0) && (diff < milli)) {
+ /* if the new expire time is later than the top time, skip it, but not
+ if the diff is larger than the new offset since then the previous
+ time is already expired! */
return;
+ }
}
/* Just add the timeout like normal */
@@ -3026,7 +3035,7 @@ void Curl_expire_clear(struct Curl_easy *data)
if(nowp->tv_sec || nowp->tv_usec) {
/* Since this is an cleared time, we must remove the previous entry from
the splay tree */
- struct curl_llist *list = data->state.timeoutlist;
+ struct curl_llist *list = &data->state.timeoutlist;
rc = Curl_splayremovebyaddr(multi->timetree,
&data->state.timenode,
@@ -3086,17 +3095,17 @@ curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi)
struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi)
{
- return multi->pipelining_site_bl;
+ return &multi->pipelining_site_bl;
}
struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi)
{
- return multi->pipelining_server_bl;
+ return &multi->pipelining_server_bl;
}
void Curl_multi_process_pending_handles(struct Curl_multi *multi)
{
- struct curl_llist_element *e = multi->pending->head;
+ struct curl_llist_element *e = multi->pending.head;
while(e) {
struct Curl_easy *data = e->ptr;
@@ -3106,7 +3115,7 @@ void Curl_multi_process_pending_handles(struct Curl_multi *multi)
multistate(data, CURLM_STATE_CONNECT);
/* Remove this node from the list */
- Curl_llist_remove(multi->pending, e, NULL);
+ Curl_llist_remove(&multi->pending, e, NULL);
/* Make sure that the handle will be processed soonish. */
Curl_expire_latest(data, 0);
diff --git a/Utilities/cmcurl/lib/multihandle.h b/Utilities/cmcurl/lib/multihandle.h
index 0b78de9..915b857 100644
--- a/Utilities/cmcurl/lib/multihandle.h
+++ b/Utilities/cmcurl/lib/multihandle.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -80,10 +80,10 @@ struct Curl_multi {
int num_alive; /* amount of easy handles that are added but have not yet
reached COMPLETE state */
- struct curl_llist *msglist; /* a list of messages from completed transfers */
+ struct curl_llist msglist; /* a list of messages from completed transfers */
- struct curl_llist *pending; /* Curl_easys that are in the
- CURLM_STATE_CONNECT_PEND state */
+ struct curl_llist pending; /* Curl_easys that are in the
+ CURLM_STATE_CONNECT_PEND state */
/* callback function and user data pointer for the *socket() API */
curl_socket_callback socket_cb;
@@ -138,11 +138,11 @@ struct Curl_multi {
bigger than this is not
considered for pipelining */
- struct curl_llist *pipelining_site_bl; /* List of sites that are blacklisted
- from pipelining */
+ struct curl_llist pipelining_site_bl; /* List of sites that are blacklisted
+ from pipelining */
- struct curl_llist *pipelining_server_bl; /* List of server types that are
- blacklisted from pipelining */
+ struct curl_llist pipelining_server_bl; /* List of server types that are
+ blacklisted from pipelining */
/* timer callback and user data pointer for the *socket() API */
curl_multi_timer_callback timer_cb;
diff --git a/Utilities/cmcurl/lib/nonblock.c b/Utilities/cmcurl/lib/nonblock.c
index b764278..5959281 100644
--- a/Utilities/cmcurl/lib/nonblock.c
+++ b/Utilities/cmcurl/lib/nonblock.c
@@ -58,8 +58,7 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
flags = sfcntl(sockfd, F_GETFL, 0);
if(nonblock)
return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
- else
- return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
+ return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
#elif defined(HAVE_IOCTL_FIONBIO)
diff --git a/Utilities/cmcurl/lib/pingpong.c b/Utilities/cmcurl/lib/pingpong.c
index 7a99357..b833fcd 100644
--- a/Utilities/cmcurl/lib/pingpong.c
+++ b/Utilities/cmcurl/lib/pingpong.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -152,7 +152,7 @@ void Curl_pp_init(struct pingpong *pp)
*
* Curl_pp_vsendf()
*
- * Send the formated string as a command to a pingpong server. Note that
+ * Send the formatted string as a command to a pingpong server. Note that
* the string should not have any CRLF appended, as this function will
* append the necessary things itself.
*
@@ -239,7 +239,7 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
*
* Curl_pp_sendf()
*
- * Send the formated string as a command to a pingpong server. Note that
+ * Send the formatted string as a command to a pingpong server. Note that
* the string should not have any CRLF appended, as this function will
* append the necessary things itself.
*
diff --git a/Utilities/cmcurl/lib/pingpong.h b/Utilities/cmcurl/lib/pingpong.h
index 500100a..ee1a59b 100644
--- a/Utilities/cmcurl/lib/pingpong.h
+++ b/Utilities/cmcurl/lib/pingpong.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -95,7 +95,7 @@ time_t Curl_pp_state_timeout(struct pingpong *pp);
*
* Curl_pp_sendf()
*
- * Send the formated string as a command to a pingpong server. Note that
+ * Send the formatted string as a command to a pingpong server. Note that
* the string should not have any CRLF appended, as this function will
* append the necessary things itself.
*
@@ -108,7 +108,7 @@ CURLcode Curl_pp_sendf(struct pingpong *pp,
*
* Curl_pp_vsendf()
*
- * Send the formated string as a command to a pingpong server. Note that
+ * Send the formatted string as a command to a pingpong server. Note that
* the string should not have any CRLF appended, as this function will
* append the necessary things itself.
*
diff --git a/Utilities/cmcurl/lib/pipeline.c b/Utilities/cmcurl/lib/pipeline.c
index 40a5e82..4a14fdd 100644
--- a/Utilities/cmcurl/lib/pipeline.c
+++ b/Utilities/cmcurl/lib/pipeline.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2013, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2013-2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2013 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -69,8 +69,8 @@ bool Curl_pipeline_penalized(struct Curl_easy *data,
curl_off_t recv_size = -2; /* Make it easy to spot in the log */
/* Find the head of the recv pipe, if any */
- if(conn->recv_pipe && conn->recv_pipe->head) {
- struct Curl_easy *recv_handle = conn->recv_pipe->head->ptr;
+ if(conn->recv_pipe.head) {
+ struct Curl_easy *recv_handle = conn->recv_pipe.head->ptr;
recv_size = recv_handle->req.size;
@@ -103,18 +103,18 @@ static CURLcode addHandleToPipeline(struct Curl_easy *data,
CURLcode Curl_add_handle_to_pipeline(struct Curl_easy *handle,
struct connectdata *conn)
{
- struct curl_llist_element *sendhead = conn->send_pipe->head;
+ struct curl_llist_element *sendhead = conn->send_pipe.head;
struct curl_llist *pipeline;
CURLcode result;
- pipeline = conn->send_pipe;
+ pipeline = &conn->send_pipe;
result = addHandleToPipeline(handle, pipeline);
- if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) {
+ if(pipeline == &conn->send_pipe && sendhead != conn->send_pipe.head) {
/* this is a new one as head, expire it */
Curl_pipeline_leave_write(conn); /* not in use yet */
- Curl_expire(conn->send_pipe->head->ptr, 0);
+ Curl_expire(conn->send_pipe.head->ptr, 0);
}
#if 0 /* enable for pipeline debugging */
@@ -135,21 +135,21 @@ void Curl_move_handle_from_send_to_recv_pipe(struct Curl_easy *handle,
{
struct curl_llist_element *curr;
- curr = conn->send_pipe->head;
+ curr = conn->send_pipe.head;
while(curr) {
if(curr->ptr == handle) {
- Curl_llist_move(conn->send_pipe, curr,
- conn->recv_pipe, conn->recv_pipe->tail);
+ Curl_llist_move(&conn->send_pipe, curr,
+ &conn->recv_pipe, conn->recv_pipe.tail);
- if(conn->send_pipe->head) {
+ if(conn->send_pipe.head) {
/* Since there's a new easy handle at the start of the send pipeline,
set its timeout value to 1ms to make it trigger instantly */
Curl_pipeline_leave_write(conn); /* not used now */
#ifdef DEBUGBUILD
infof(conn->data, "%p is at send pipe head B!\n",
- (void *)conn->send_pipe->head->ptr);
+ (void *)conn->send_pipe.head->ptr);
#endif
- Curl_expire(conn->send_pipe->head->ptr, 0);
+ Curl_expire(conn->send_pipe.head->ptr, 0);
}
/* The receiver's list is not really interesting here since either this
@@ -191,15 +191,14 @@ bool Curl_pipeline_site_blacklisted(struct Curl_easy *handle,
}
CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
- struct curl_llist **list_ptr)
+ struct curl_llist *list)
{
- struct curl_llist *old_list = *list_ptr;
- struct curl_llist *new_list = NULL;
+ /* Free the old list */
+ if(list->size)
+ Curl_llist_destroy(list, NULL);
if(sites) {
- new_list = Curl_llist_alloc((curl_llist_dtor) site_blacklist_llist_dtor);
- if(!new_list)
- return CURLM_OUT_OF_MEMORY;
+ Curl_llist_init(list, (curl_llist_dtor) site_blacklist_llist_dtor);
/* Parse the URLs and populate the list */
while(*sites) {
@@ -209,14 +208,14 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
hostname = strdup(*sites);
if(!hostname) {
- Curl_llist_destroy(new_list, NULL);
+ Curl_llist_destroy(list, NULL);
return CURLM_OUT_OF_MEMORY;
}
entry = malloc(sizeof(struct site_blacklist_entry));
if(!entry) {
free(hostname);
- Curl_llist_destroy(new_list, NULL);
+ Curl_llist_destroy(list, NULL);
return CURLM_OUT_OF_MEMORY;
}
@@ -233,9 +232,9 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
entry->hostname = hostname;
- if(!Curl_llist_insert_next(new_list, new_list->tail, entry)) {
+ if(!Curl_llist_insert_next(list, list->tail, entry)) {
site_blacklist_llist_dtor(NULL, entry);
- Curl_llist_destroy(new_list, NULL);
+ Curl_llist_destroy(list, NULL);
return CURLM_OUT_OF_MEMORY;
}
@@ -243,14 +242,6 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
}
}
- /* Free the old list */
- if(old_list) {
- Curl_llist_destroy(old_list, NULL);
- }
-
- /* This might be NULL if sites == NULL, i.e the blacklist is cleared */
- *list_ptr = new_list;
-
return CURLM_OK;
}
@@ -284,15 +275,14 @@ bool Curl_pipeline_server_blacklisted(struct Curl_easy *handle,
}
CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
- struct curl_llist **list_ptr)
+ struct curl_llist *list)
{
- struct curl_llist *old_list = *list_ptr;
- struct curl_llist *new_list = NULL;
+ /* Free the old list */
+ if(list->size)
+ Curl_llist_destroy(list, NULL);
if(servers) {
- new_list = Curl_llist_alloc((curl_llist_dtor) server_blacklist_llist_dtor);
- if(!new_list)
- return CURLM_OUT_OF_MEMORY;
+ Curl_llist_init(list, (curl_llist_dtor) server_blacklist_llist_dtor);
/* Parse the URLs and populate the list */
while(*servers) {
@@ -300,12 +290,12 @@ CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
server_name = strdup(*servers);
if(!server_name) {
- Curl_llist_destroy(new_list, NULL);
+ Curl_llist_destroy(list, NULL);
return CURLM_OUT_OF_MEMORY;
}
- if(!Curl_llist_insert_next(new_list, new_list->tail, server_name)) {
- Curl_llist_destroy(new_list, NULL);
+ if(!Curl_llist_insert_next(list, list->tail, server_name)) {
+ Curl_llist_destroy(list, NULL);
Curl_safefree(server_name);
return CURLM_OUT_OF_MEMORY;
}
@@ -314,13 +304,6 @@ CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
}
}
- /* Free the old list */
- if(old_list) {
- Curl_llist_destroy(old_list, NULL);
- }
-
- /* This might be NULL if sites == NULL, i.e the blacklist is cleared */
- *list_ptr = new_list;
return CURLM_OK;
}
@@ -340,14 +323,14 @@ static bool pipe_head(struct Curl_easy *data,
bool Curl_recvpipe_head(struct Curl_easy *data,
struct connectdata *conn)
{
- return pipe_head(data, conn->recv_pipe);
+ return pipe_head(data, &conn->recv_pipe);
}
/* returns TRUE if the given handle is head of the send pipe */
bool Curl_sendpipe_head(struct Curl_easy *data,
struct connectdata *conn)
{
- return pipe_head(data, conn->send_pipe);
+ return pipe_head(data, &conn->send_pipe);
}
diff --git a/Utilities/cmcurl/lib/pipeline.h b/Utilities/cmcurl/lib/pipeline.h
index a64f710..413ba31 100644
--- a/Utilities/cmcurl/lib/pipeline.h
+++ b/Utilities/cmcurl/lib/pipeline.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2013 - 2014, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
@@ -34,13 +34,13 @@ bool Curl_pipeline_site_blacklisted(struct Curl_easy *handle,
struct connectdata *conn);
CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
- struct curl_llist **list_ptr);
+ struct curl_llist *list_ptr);
bool Curl_pipeline_server_blacklisted(struct Curl_easy *handle,
char *server_name);
CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
- struct curl_llist **list_ptr);
+ struct curl_llist *list_ptr);
bool Curl_pipeline_checkget_write(struct Curl_easy *data,
struct connectdata *conn);
diff --git a/Utilities/cmcurl/lib/pop3.c b/Utilities/cmcurl/lib/pop3.c
index 9bb691c..3feb3be 100644
--- a/Utilities/cmcurl/lib/pop3.c
+++ b/Utilities/cmcurl/lib/pop3.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -127,7 +127,8 @@ const struct Curl_handler Curl_handler_pop3 = {
ZERO_NULL, /* readwrite */
PORT_POP3, /* defport */
CURLPROTO_POP3, /* protocol */
- PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */
+ PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY | /* flags */
+ PROTOPT_URLOPTIONS
};
#ifdef USE_SSL
@@ -153,7 +154,7 @@ const struct Curl_handler Curl_handler_pop3s = {
PORT_POP3S, /* defport */
CURLPROTO_POP3S, /* protocol */
PROTOPT_CLOSEACTION | PROTOPT_SSL
- | PROTOPT_NOURLQUERY /* flags */
+ | PROTOPT_NOURLQUERY | PROTOPT_URLOPTIONS /* flags */
};
#endif
@@ -799,7 +800,7 @@ static CURLcode pop3_state_starttls_resp(struct connectdata *conn,
if(pop3code != '+') {
if(data->set.use_ssl != CURLUSESSL_TRY) {
- failf(data, "STARTTLS denied. %c", pop3code);
+ failf(data, "STARTTLS denied");
result = CURLE_USE_SSL_FAILED;
}
else
diff --git a/Utilities/cmcurl/lib/progress.c b/Utilities/cmcurl/lib/progress.c
index 60627b2..cfaf404 100644
--- a/Utilities/cmcurl/lib/progress.c
+++ b/Utilities/cmcurl/lib/progress.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -229,16 +229,16 @@ void Curl_pgrsStartNow(struct Curl_easy *data)
* need to wait until we're back under the speed limit, if needed.
*
* The way it works is by having a "starting point" (time & amount of data
- * transfered by then) used in the speed computation, to be used instead of the
- * start of the transfer.
- * This starting point is regularly moved as transfer goes on, to keep getting
- * accurate values (instead of average over the entire tranfer).
+ * transferred by then) used in the speed computation, to be used instead of
+ * the start of the transfer. This starting point is regularly moved as
+ * transfer goes on, to keep getting accurate values (instead of average over
+ * the entire transfer).
*
- * This function takes the current amount of data transfered, the amount at the
- * starting point, the limit (in bytes/s), the time of the starting point and
- * the current time.
+ * This function takes the current amount of data transferred, the amount at
+ * the starting point, the limit (in bytes/s), the time of the starting point
+ * and the current time.
*
- * Returns -1 if no waiting is needed (not enough data transfered since
+ * Returns -1 if no waiting is needed (not enough data transferred since
* starting point yet), 0 when no waiting is needed but the starting point
* should be reset (to current), or the number of milliseconds to wait to get
* back under the speed limit.
@@ -267,8 +267,8 @@ long Curl_pgrsLimitWaitTime(curl_off_t cursize,
if(actual < minimum)
/* this is a conversion on some systems (64bit time_t => 32bit long) */
return (long)(minimum - actual);
- else
- return 0;
+
+ return 0;
}
void Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size)
@@ -454,7 +454,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
failf(data, "Callback aborted");
return result;
}
- else if(data->set.fprogress) {
+ if(data->set.fprogress) {
/* The older deprecated callback is set, call that */
result= data->set.fprogress(data->set.progress_client,
(double)data->progress.size_dl,
diff --git a/Utilities/cmcurl/lib/rand.c b/Utilities/cmcurl/lib/rand.c
index a51951c..8a14084 100644
--- a/Utilities/cmcurl/lib/rand.c
+++ b/Utilities/cmcurl/lib/rand.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,7 +22,9 @@
#include "curl_setup.h"
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#endif
#include <curl/curl.h>
#include "vtls/vtls.h"
@@ -61,7 +63,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
/* data may be NULL! */
result = Curl_ssl_random(data, (unsigned char *)rnd, sizeof(*rnd));
if(result != CURLE_NOT_BUILT_IN)
- /* only if there is no random funtion in the TLS backend do the non crypto
+ /* only if there is no random function in the TLS backend do the non crypto
version, otherwise return result */
return result;
diff --git a/Utilities/cmcurl/lib/rtsp.c b/Utilities/cmcurl/lib/rtsp.c
index 65c6c3b..1810cda 100644
--- a/Utilities/cmcurl/lib/rtsp.c
+++ b/Utilities/cmcurl/lib/rtsp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -216,7 +216,7 @@ static CURLcode rtsp_done(struct connectdata *conn,
CSeq_sent, CSeq_recv);
return CURLE_RTSP_CSEQ_ERROR;
}
- else if(data->set.rtspreq == RTSPREQ_RECEIVE &&
+ if(data->set.rtspreq == RTSPREQ_RECEIVE &&
(conn->proto.rtspc.rtp_channel == -1)) {
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
/* TODO CPC: Server -> Client logic here */
@@ -648,31 +648,29 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*readmore = TRUE;
break;
}
- else {
- /* We have the full RTP interleaved packet
- * Write out the header including the leading '$' */
- DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n",
- rtspc->rtp_channel, rtp_length));
- result = rtp_client_write(conn, &rtp[0], rtp_length + 4);
- if(result) {
- failf(data, "Got an error writing an RTP packet");
- *readmore = FALSE;
- Curl_safefree(rtspc->rtp_buf);
- rtspc->rtp_buf = NULL;
- rtspc->rtp_bufsize = 0;
- return result;
- }
+ /* We have the full RTP interleaved packet
+ * Write out the header including the leading '$' */
+ DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n",
+ rtspc->rtp_channel, rtp_length));
+ result = rtp_client_write(conn, &rtp[0], rtp_length + 4);
+ if(result) {
+ failf(data, "Got an error writing an RTP packet");
+ *readmore = FALSE;
+ Curl_safefree(rtspc->rtp_buf);
+ rtspc->rtp_buf = NULL;
+ rtspc->rtp_bufsize = 0;
+ return result;
+ }
- /* Move forward in the buffer */
- rtp_dataleft -= rtp_length + 4;
- rtp += rtp_length + 4;
+ /* Move forward in the buffer */
+ rtp_dataleft -= rtp_length + 4;
+ rtp += rtp_length + 4;
- if(data->set.rtspreq == RTSPREQ_RECEIVE) {
- /* If we are in a passive receive, give control back
- * to the app as often as we can.
- */
- k->keepon &= ~KEEP_RECV;
- }
+ if(data->set.rtspreq == RTSPREQ_RECEIVE) {
+ /* If we are in a passive receive, give control back
+ * to the app as often as we can.
+ */
+ k->keepon &= ~KEEP_RECV;
}
}
else {
@@ -703,20 +701,18 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*nread = 0;
return CURLE_OK;
}
- else {
- /* Fix up k->str to point just after the last RTP packet */
- k->str += *nread - rtp_dataleft;
+ /* Fix up k->str to point just after the last RTP packet */
+ k->str += *nread - rtp_dataleft;
- /* either all of the data has been read or...
- * rtp now points at the next byte to parse
- */
- if(rtp_dataleft > 0)
- DEBUGASSERT(k->str[0] == rtp[0]);
+ /* either all of the data has been read or...
+ * rtp now points at the next byte to parse
+ */
+ if(rtp_dataleft > 0)
+ DEBUGASSERT(k->str[0] == rtp[0]);
- DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */
+ DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */
- *nread = rtp_dataleft;
- }
+ *nread = rtp_dataleft;
/* If we get here, we have finished with the leftover/merge buffer */
Curl_safefree(rtspc->rtp_buf);
@@ -797,7 +793,7 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
/* If the Session ID is not set, and we find it in a response, then set
* it.
*
- * Allow any non whitespace content, up to the field seperator or end of
+ * Allow any non whitespace content, up to the field separator or end of
* line. RFC 2326 isn't 100% clear on the session ID and for example
* gstreamer does url-encoded session ID's not covered by the standard.
*/
diff --git a/Utilities/cmcurl/lib/security.c b/Utilities/cmcurl/lib/security.c
index 4a8f444..f4a8763 100644
--- a/Utilities/cmcurl/lib/security.c
+++ b/Utilities/cmcurl/lib/security.c
@@ -367,6 +367,10 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
size_t decoded_sz = 0;
CURLcode error;
+ if(!conn->mech)
+ /* not inititalized, return error */
+ return -1;
+
DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);
diff --git a/Utilities/cmcurl/lib/select.c b/Utilities/cmcurl/lib/select.c
index 6bb0ab1..4430072 100644
--- a/Utilities/cmcurl/lib/select.c
+++ b/Utilities/cmcurl/lib/select.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -129,7 +129,7 @@ int Curl_wait_ms(int timeout_ms)
* and a file descriptor is too large for FD_SETSIZE.
*
* A negative timeout value makes this function wait indefinitely,
- * unles no valid file descriptor is given, when this happens the
+ * unless no valid file descriptor is given, when this happens the
* negative timeout is ignored and the function times out immediately.
*
* Return values:
@@ -164,7 +164,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
int r;
int ret;
-#if SIZEOF_LONG != SIZEOF_INT
+#if SIZEOF_TIME_T != SIZEOF_INT
/* wrap-around precaution */
if(timeout_ms >= INT_MAX)
timeout_ms = INT_MAX;
@@ -380,7 +380,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
* select() is used instead. An error is returned if select() is
* being used and a file descriptor is too large for FD_SETSIZE.
* A negative timeout value makes this function wait indefinitely,
- * unles no valid file descriptor is given, when this happens the
+ * unless no valid file descriptor is given, when this happens the
* negative timeout is ignored and the function times out immediately.
*
* Return values:
diff --git a/Utilities/cmcurl/lib/select.h b/Utilities/cmcurl/lib/select.h
index e247bd9..4ed5dd2 100644
--- a/Utilities/cmcurl/lib/select.h
+++ b/Utilities/cmcurl/lib/select.h
@@ -24,10 +24,10 @@
#include "curl_setup.h"
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#elif defined(HAVE_POLL_H)
+#ifdef HAVE_POLL_H
#include <poll.h>
+#elif defined(HAVE_SYS_POLL_H)
+#include <sys/poll.h>
#endif
/*
diff --git a/Utilities/cmcurl/lib/sendf.c b/Utilities/cmcurl/lib/sendf.c
index 7601697..84b6b4b 100644
--- a/Utilities/cmcurl/lib/sendf.c
+++ b/Utilities/cmcurl/lib/sendf.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -33,6 +33,7 @@
#include "non-ascii.h"
#include "strerror.h"
#include "select.h"
+#include "strdup.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -262,7 +263,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
va_end(ap);
}
-/* Curl_sendf() sends formated data to the server */
+/* Curl_sendf() sends formatted data to the server */
CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
const char *fmt, ...)
{
@@ -474,21 +475,58 @@ static CURLcode pausewrite(struct Curl_easy *data,
we want to send we need to dup it to save a copy for when the sending
is again enabled */
struct SingleRequest *k = &data->req;
- char *dupl = malloc(len);
- if(!dupl)
- return CURLE_OUT_OF_MEMORY;
+ struct UrlState *s = &data->state;
+ char *dupl;
+ unsigned int i;
+ bool newtype = TRUE;
+
+ if(s->tempcount) {
+ for(i=0; i< s->tempcount; i++) {
+ if(s->tempwrite[i].type == type) {
+ /* data for this type exists */
+ newtype = FALSE;
+ break;
+ }
+ }
+ DEBUGASSERT(i < 3);
+ }
+ else
+ i = 0;
+
+ if(!newtype) {
+ /* append new data to old data */
+
+ /* figure out the new size of the data to save */
+ size_t newlen = len + s->tempwrite[i].len;
+ /* allocate the new memory area */
+ char *newptr = realloc(s->tempwrite[i].buf, newlen);
+ if(!newptr)
+ return CURLE_OUT_OF_MEMORY;
+ /* copy the new data to the end of the new area */
+ memcpy(newptr + s->tempwrite[i].len, ptr, len);
+
+ /* update the pointer and the size */
+ s->tempwrite[i].buf = newptr;
+ s->tempwrite[i].len = newlen;
+ }
+ else {
+ dupl = Curl_memdup(ptr, len);
+ if(!dupl)
+ return CURLE_OUT_OF_MEMORY;
- memcpy(dupl, ptr, len);
+ /* store this information in the state struct for later use */
+ s->tempwrite[i].buf = dupl;
+ s->tempwrite[i].len = len;
+ s->tempwrite[i].type = type;
- /* store this information in the state struct for later use */
- data->state.tempwrite = dupl;
- data->state.tempwritesize = len;
- data->state.tempwritetype = type;
+ if(newtype)
+ s->tempcount++;
+ }
/* mark the connection as RECV paused */
k->keepon |= KEEP_RECV_PAUSE;
- DEBUGF(infof(data, "Pausing with %zu bytes in buffer for type %02x\n",
+ DEBUGF(infof(data, "Paused %zu bytes in buffer for type %02x\n",
len, type));
return CURLE_OK;
@@ -511,31 +549,10 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
if(!len)
return CURLE_OK;
- /* If reading is actually paused, we're forced to append this chunk of data
- to the already held data, but only if it is the same type as otherwise it
- can't work and it'll return error instead. */
- if(data->req.keepon & KEEP_RECV_PAUSE) {
- size_t newlen;
- char *newptr;
- if(type != data->state.tempwritetype)
- /* major internal confusion */
- return CURLE_RECV_ERROR;
-
- DEBUGASSERT(data->state.tempwrite);
-
- /* figure out the new size of the data to save */
- newlen = len + data->state.tempwritesize;
- /* allocate the new memory area */
- newptr = realloc(data->state.tempwrite, newlen);
- if(!newptr)
- return CURLE_OUT_OF_MEMORY;
- /* copy the new data to the end of the new area */
- memcpy(newptr + data->state.tempwritesize, ptr, len);
- /* update the pointer and the size */
- data->state.tempwrite = newptr;
- data->state.tempwritesize = newlen;
- return CURLE_OK;
- }
+ /* If reading is paused, append this data to the already held data for this
+ type. */
+ if(data->req.keepon & KEEP_RECV_PAUSE)
+ return pausewrite(data, type, ptr, len);
/* Determine the callback(s) to use. */
if(type & CLIENTWRITE_BODY)
@@ -565,10 +582,9 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
failf(data, "Write callback asked for PAUSE when not supported!");
return CURLE_WRITE_ERROR;
}
- else
- return pausewrite(data, type, ptr, len);
+ return pausewrite(data, type, ptr, len);
}
- else if(wrote != chunklen) {
+ if(wrote != chunklen) {
failf(data, "Failed writing body (%zu != %zu)", wrote, chunklen);
return CURLE_WRITE_ERROR;
}
@@ -616,6 +632,8 @@ CURLcode Curl_client_write(struct connectdata *conn,
if(0 == len)
len = strlen(ptr);
+ DEBUGASSERT(type <= 3);
+
/* FTP data may need conversion. */
if((type & CLIENTWRITE_BODY) &&
(conn->handler->protocol & PROTO_FAMILY_FTP) &&
@@ -652,8 +670,7 @@ CURLcode Curl_read_plain(curl_socket_t sockfd,
#endif
if(return_error)
return CURLE_AGAIN;
- else
- return CURLE_RECV_ERROR;
+ return CURLE_RECV_ERROR;
}
/* we only return number of bytes read when we return OK */
diff --git a/Utilities/cmcurl/lib/smb.c b/Utilities/cmcurl/lib/smb.c
index f197fe1..51b3434 100644
--- a/Utilities/cmcurl/lib/smb.c
+++ b/Utilities/cmcurl/lib/smb.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014, Bill Nagel <wnagel@tycoint.com>, Exacq Technologies
- * Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2016-2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -23,8 +23,8 @@
#include "curl_setup.h"
-#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
- (CURL_SIZEOF_CURL_OFF_T > 4)
+#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
+ (CURL_SIZEOF_CURL_OFF_T > 4)
#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)
@@ -32,8 +32,12 @@
#ifdef HAVE_PROCESS_H
#include <process.h>
+#ifdef CURL_WINDOWS_APP
+#define getpid GetCurrentProcessId
+#else
#define getpid _getpid
#endif
+#endif
#include "smb.h"
#include "urldata.h"
@@ -117,18 +121,18 @@ const struct Curl_handler Curl_handler_smbs = {
#define SERVICENAME "?????"
/* Append a string to an SMB message */
-#define MSGCAT(str) \
- strcpy(p, (str)); \
+#define MSGCAT(str) \
+ strcpy(p, (str)); \
p += strlen(str);
/* Append a null-terminated string to an SMB message */
-#define MSGCATNULL(str) \
- strcpy(p, (str)); \
+#define MSGCATNULL(str) \
+ strcpy(p, (str)); \
p += strlen(str) + 1;
/* SMB is mostly little endian */
#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
- defined(__OS400__)
+ defined(__OS400__)
static unsigned short smb_swap16(unsigned short x)
{
return (unsigned short) ((x << 8) | ((x >> 8) & 0xff));
@@ -137,20 +141,20 @@ static unsigned short smb_swap16(unsigned short x)
static unsigned int smb_swap32(unsigned int x)
{
return (x << 24) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) |
- ((x >> 24) & 0xff);
+ ((x >> 24) & 0xff);
}
#ifdef HAVE_LONGLONG
static unsigned long long smb_swap64(unsigned long long x)
{
return ((unsigned long long) smb_swap32((unsigned int) x) << 32) |
- smb_swap32((unsigned int) (x >> 32));
+ smb_swap32((unsigned int) (x >> 32));
}
#else
static unsigned __int64 smb_swap64(unsigned __int64 x)
{
return ((unsigned __int64) smb_swap32((unsigned int) x) << 32) |
- smb_swap32((unsigned int) (x >> 32));
+ smb_swap32((unsigned int) (x >> 32));
}
#endif
#else
@@ -197,7 +201,7 @@ static void conn_state(struct connectdata *conn, enum smb_conn_state newstate)
if(smb->state != newstate)
infof(conn->data, "SMB conn %p state change from %s to %s\n",
- (void *)smb, names[smb->state], names[newstate]);
+ (void *)smb, names[smb->state], names[newstate]);
#endif
smb->state = newstate;
@@ -223,7 +227,7 @@ static void request_state(struct connectdata *conn,
if(req->state != newstate)
infof(conn->data, "SMB request %p state change from %s to %s\n",
- (void *)req, names[req->state], names[newstate]);
+ (void *)req, names[req->state], names[newstate]);
#endif
req->state = newstate;
@@ -308,8 +312,9 @@ static CURLcode smb_recv_message(struct connectdata *conn, void **msg)
if(smbc->got < sizeof(unsigned int))
return CURLE_OK;
- nbt_size = Curl_read16_be((const unsigned char *)(buf +
- sizeof(unsigned short))) + sizeof(unsigned int);
+ nbt_size = Curl_read16_be((const unsigned char *)
+ (buf + sizeof(unsigned short))) +
+ sizeof(unsigned int);
if(smbc->got < nbt_size)
return CURLE_OK;
@@ -320,7 +325,7 @@ static CURLcode smb_recv_message(struct connectdata *conn, void **msg)
if(nbt_size >= msg_size + sizeof(unsigned short)) {
/* Add the byte count */
msg_size += sizeof(unsigned short) +
- Curl_read16_le((const unsigned char *)&buf[msg_size]);
+ Curl_read16_le((const unsigned char *)&buf[msg_size]);
if(nbt_size < msg_size)
return CURLE_READ_ERROR;
}
@@ -441,7 +446,7 @@ static CURLcode smb_send_setup(struct connectdata *conn)
Curl_ntlm_core_mk_lm_hash(conn->data, conn->passwd, lm_hash);
Curl_ntlm_core_lm_resp(lm_hash, smbc->challenge, lm);
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
Curl_ntlm_core_mk_nt_hash(conn->data, conn->passwd, nt_hash);
Curl_ntlm_core_lm_resp(nt_hash, smbc->challenge, nt);
#else
@@ -603,7 +608,7 @@ static CURLcode smb_send_and_recv(struct connectdata *conn, void **msg)
/* Check if there is data in the transfer buffer */
if(!smbc->send_size && smbc->upload_size) {
int nread = smbc->upload_size > BUFSIZE ? BUFSIZE :
- (int) smbc->upload_size;
+ (int) smbc->upload_size;
conn->data->req.upload_fromhere = conn->data->state.uploadbuffer;
result = Curl_fillreadbuffer(conn, nread, &nread);
if(result && result != CURLE_AGAIN)
diff --git a/Utilities/cmcurl/lib/smtp.c b/Utilities/cmcurl/lib/smtp.c
index ff8e80d..adc346a 100644
--- a/Utilities/cmcurl/lib/smtp.c
+++ b/Utilities/cmcurl/lib/smtp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -126,7 +126,8 @@ const struct Curl_handler Curl_handler_smtp = {
ZERO_NULL, /* readwrite */
PORT_SMTP, /* defport */
CURLPROTO_SMTP, /* protocol */
- PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */
+ PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY | /* flags */
+ PROTOPT_URLOPTIONS
};
#ifdef USE_SSL
@@ -152,7 +153,7 @@ const struct Curl_handler Curl_handler_smtps = {
PORT_SMTPS, /* defport */
CURLPROTO_SMTPS, /* protocol */
PROTOPT_CLOSEACTION | PROTOPT_SSL
- | PROTOPT_NOURLQUERY /* flags */
+ | PROTOPT_NOURLQUERY | PROTOPT_URLOPTIONS /* flags */
};
#endif
@@ -692,7 +693,7 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
if(smtpcode != 220) {
if(data->set.use_ssl != CURLUSESSL_TRY) {
- failf(data, "STARTTLS denied. %c", smtpcode);
+ failf(data, "STARTTLS denied, code %d", smtpcode);
result = CURLE_USE_SSL_FAILED;
}
else
diff --git a/Utilities/cmcurl/lib/socks.c b/Utilities/cmcurl/lib/socks.c
index 774fb20..97a44b2 100644
--- a/Utilities/cmcurl/lib/socks.c
+++ b/Utilities/cmcurl/lib/socks.c
@@ -73,7 +73,7 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
result = Curl_read_plain(sockfd, buf, buffersize, &nread);
if(CURLE_AGAIN == result)
continue;
- else if(result)
+ if(result)
break;
if(buffersize == nread) {
@@ -416,7 +416,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5: no connection here");
return CURLE_COULDNT_CONNECT;
}
- else if(0 == result) {
+ if(0 == result) {
failf(conn->data, "SOCKS5: connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
@@ -457,7 +457,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5 nothing to read");
return CURLE_COULDNT_CONNECT;
}
- else if(0 == result) {
+ if(0 == result) {
failf(conn->data, "SOCKS5 read timeout");
return CURLE_OPERATION_TIMEDOUT;
}
@@ -553,7 +553,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
"SOCKS5 GSSAPI per-message authentication is not supported.");
return CURLE_COULDNT_CONNECT;
}
- else if(socksreq[1] == 255) {
+ if(socksreq[1] == 255) {
#endif
if(!proxy_name || !*proxy_name) {
failf(data,
@@ -772,9 +772,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
}
return CURLE_COULDNT_CONNECT;
}
- else {
- infof(data, "SOCKS5 request granted.\n");
- }
+ infof(data, "SOCKS5 request granted.\n");
(void)curlx_nonblock(sock, TRUE);
return CURLE_OK; /* Proxy was successful! */
diff --git a/Utilities/cmcurl/lib/speedcheck.c b/Utilities/cmcurl/lib/speedcheck.c
index bc15d97..f0daf82 100644
--- a/Utilities/cmcurl/lib/speedcheck.c
+++ b/Utilities/cmcurl/lib/speedcheck.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -33,42 +33,41 @@ void Curl_speedinit(struct Curl_easy *data)
memset(&data->state.keeps_speed, 0, sizeof(struct timeval));
}
+/*
+ * @unittest: 1606
+ */
CURLcode Curl_speedcheck(struct Curl_easy *data,
struct timeval now)
{
- if((data->progress.current_speed >= 0) &&
- data->set.low_speed_time &&
- (Curl_tvlong(data->state.keeps_speed) != 0) &&
- (data->progress.current_speed < data->set.low_speed_limit)) {
- time_t howlong = Curl_tvdiff(now, data->state.keeps_speed);
- time_t nextcheck = (data->set.low_speed_time * 1000) - howlong;
+ if((data->progress.current_speed >= 0) && data->set.low_speed_time) {
+ if(data->progress.current_speed < data->set.low_speed_limit) {
+ if(!data->state.keeps_speed.tv_sec)
+ /* under the limit at this very moment */
+ data->state.keeps_speed = now;
+ else {
+ /* how long has it been under the limit */
+ time_t howlong = Curl_tvdiff(now, data->state.keeps_speed);
- /* We are now below the "low speed limit". If we are below it
- for "low speed time" seconds we consider that enough reason
- to abort the download. */
- if(nextcheck <= 0) {
- /* we have been this slow for long enough, now die */
- failf(data,
- "Operation too slow. "
- "Less than %ld bytes/sec transferred the last %ld seconds",
- data->set.low_speed_limit,
- data->set.low_speed_time);
- return CURLE_OPERATION_TIMEDOUT;
- }
- else {
- /* wait complete low_speed_time */
- Curl_expire_latest(data, nextcheck);
+ if(howlong >= data->set.low_speed_time * 1000) {
+ /* too long */
+ failf(data,
+ "Operation too slow. "
+ "Less than %ld bytes/sec transferred the last %ld seconds",
+ data->set.low_speed_limit,
+ data->set.low_speed_time);
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+ }
}
+ else
+ /* faster right now */
+ data->state.keeps_speed.tv_sec = 0;
}
- else {
- /* we keep up the required speed all right */
- data->state.keeps_speed = now;
- if(data->set.low_speed_limit)
- /* if there is a low speed limit enabled, we set the expire timer to
- make this connection's speed get checked again no later than when
- this time is up */
- Curl_expire_latest(data, data->set.low_speed_time*1000);
- }
+ if(data->set.low_speed_limit)
+ /* if low speed limit is enabled, set the expire timer to make this
+ connection's speed get checked again in a second */
+ Curl_expire_latest(data, 1000);
+
return CURLE_OK;
}
diff --git a/Utilities/cmcurl/lib/splay.c b/Utilities/cmcurl/lib/splay.c
index 7aa2e4b..1b301f9 100644
--- a/Utilities/cmcurl/lib/splay.c
+++ b/Utilities/cmcurl/lib/splay.c
@@ -110,22 +110,17 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
t = Curl_splay(i, t);
if(compare(i, t->key)==0) {
/* There already exists a node in the tree with the very same key. Build
- a linked list of nodes. We make the new 'node' struct the new master
- node and make the previous node the first one in the 'same' list. */
+ a doubly-linked circular list of nodes. We add the new 'node' struct
+ to the end of this list. */
- node->same = t;
- node->key = i;
- node->smaller = t->smaller;
- node->larger = t->larger;
-
- t->smaller = node; /* in the sub node for this same key, we use the
- smaller pointer to point back to the master
- node */
-
- t->key = KEY_NOTUSED; /* and we set the key in the sub node to NOTUSED
+ node->key = KEY_NOTUSED; /* we set the key in the sub node to NOTUSED
to quickly identify this node as a subnode */
+ node->samen = t;
+ node->samep = t->samep;
+ t->samep->samen = node;
+ t->samep = node;
- return node; /* new root node */
+ return t; /* the root node always stays the same */
}
}
@@ -145,16 +140,20 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
}
node->key = i;
- node->same = NULL; /* no identical node (yet) */
+ /* no identical nodes (yet), we are the only one in the list of nodes */
+ node->samen = node;
+ node->samep = node;
return node;
}
/* Finds and deletes the best-fit node from the tree. Return a pointer to the
- resulting tree. best-fit means the node with the given or lower key */
+ resulting tree. best-fit means the smallest node if it is not larger than
+ the key */
struct Curl_tree *Curl_splaygetbest(struct timeval i,
- struct Curl_tree *t,
- struct Curl_tree **removed)
+ struct Curl_tree *t,
+ struct Curl_tree **removed)
{
+ static struct timeval tv_zero = {0, 0};
struct Curl_tree *x;
if(!t) {
@@ -162,49 +161,36 @@ struct Curl_tree *Curl_splaygetbest(struct timeval i,
return NULL;
}
- t = Curl_splay(i, t);
+ /* find smallest */
+ t = Curl_splay(tv_zero, t);
if(compare(i, t->key) < 0) {
- /* too big node, try the smaller chain */
- if(t->smaller)
- t=Curl_splay(t->smaller->key, t);
- else {
- /* fail */
- *removed = NULL;
- return t;
- }
+ /* even the smallest is too big */
+ *removed = NULL;
+ return t;
}
- if(compare(i, t->key) >= 0) { /* found it */
- /* FIRST! Check if there is a list with identical keys */
- x = t->same;
- if(x) {
- /* there is, pick one from the list */
+ /* FIRST! Check if there is a list with identical keys */
+ x = t->samen;
+ if(x != t) {
+ /* there is, pick one from the list */
- /* 'x' is the new root node */
+ /* 'x' is the new root node */
- x->key = t->key;
- x->larger = t->larger;
- x->smaller = t->smaller;
-
- *removed = t;
- return x; /* new root */
- }
+ x->key = t->key;
+ x->larger = t->larger;
+ x->smaller = t->smaller;
+ x->samep = t->samep;
+ t->samep->samen = x;
- if(t->smaller == NULL) {
- x = t->larger;
- }
- else {
- x = Curl_splay(i, t->smaller);
- x->larger = t->larger;
- }
*removed = t;
-
- return x;
- }
- else {
- *removed = NULL; /* no match */
- return t; /* It wasn't there */
+ return x; /* new root */
}
+
+ /* we splayed the tree to the smallest element, there is no smaller */
+ x = t->larger;
+ *removed = t;
+
+ return x;
}
@@ -231,19 +217,17 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
if(compare(KEY_NOTUSED, removenode->key) == 0) {
/* Key set to NOTUSED means it is a subnode within a 'same' linked list
- and thus we can unlink it easily. The 'smaller' link of a subnode
- links to the parent node. */
- if(removenode->smaller == NULL)
+ and thus we can unlink it easily. */
+ if(removenode->samen == removenode)
+ /* A non-subnode should never be set to KEY_NOTUSED */
return 3;
- removenode->smaller->same = removenode->same;
- if(removenode->same)
- removenode->same->smaller = removenode->smaller;
+ removenode->samep->samen = removenode->samen;
+ removenode->samen->samep = removenode->samep;
/* Ensures that double-remove gets caught. */
- removenode->smaller = NULL;
+ removenode->samen = removenode;
- /* voila, we're done! */
*newroot = t; /* return the same root */
return 0;
}
@@ -262,14 +246,16 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
/* Check if there is a list with identical sizes, as then we're trying to
remove the root node of a list of nodes with identical keys. */
- x = t->same;
- if(x) {
+ x = t->samen;
+ if(x != t) {
/* 'x' is the new root node, we just make it use the root node's
smaller/larger links */
x->key = t->key;
x->larger = t->larger;
x->smaller = t->smaller;
+ x->samep = t->samep;
+ t->samep->samen = x;
}
else {
/* Remove the root node */
diff --git a/Utilities/cmcurl/lib/splay.h b/Utilities/cmcurl/lib/splay.h
index 427bfc8..da81894 100644
--- a/Utilities/cmcurl/lib/splay.h
+++ b/Utilities/cmcurl/lib/splay.h
@@ -26,7 +26,8 @@
struct Curl_tree {
struct Curl_tree *smaller; /* smaller node */
struct Curl_tree *larger; /* larger node */
- struct Curl_tree *same; /* points to a node with identical key */
+ struct Curl_tree *samen; /* points to the next node with identical key */
+ struct Curl_tree *samep; /* points to the prev node with identical key */
struct timeval key; /* this node's "sort" key */
void *payload; /* data the splay code doesn't care about */
};
diff --git a/Utilities/cmcurl/lib/ssh.c b/Utilities/cmcurl/lib/ssh.c
index 5ed036a..72fa06a 100644
--- a/Utilities/cmcurl/lib/ssh.c
+++ b/Utilities/cmcurl/lib/ssh.c
@@ -688,14 +688,11 @@ static CURLcode ssh_check_fingerprint(struct connectdata *conn)
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
- else {
- infof(data, "MD5 checksum match!\n");
- /* as we already matched, we skip the check for known hosts */
- return CURLE_OK;
- }
+ infof(data, "MD5 checksum match!\n");
+ /* as we already matched, we skip the check for known hosts */
+ return CURLE_OK;
}
- else
- return ssh_knownhost(conn);
+ return ssh_knownhost(conn);
}
/*
@@ -738,7 +735,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc) {
+ if(rc) {
failf(data, "Failure establishing ssh session");
state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT;
@@ -782,16 +779,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_AUTH_DONE);
break;
}
+ err = libssh2_session_last_errno(sshc->ssh_session);
+ if(err == LIBSSH2_ERROR_EAGAIN)
+ rc = LIBSSH2_ERROR_EAGAIN;
else {
- err = libssh2_session_last_errno(sshc->ssh_session);
- if(err == LIBSSH2_ERROR_EAGAIN)
- rc = LIBSSH2_ERROR_EAGAIN;
- else {
- state(conn, SSH_SESSION_FREE);
- sshc->actualcode = libssh2_session_error_to_CURLE(err);
- }
- break;
+ state(conn, SSH_SESSION_FREE);
+ sshc->actualcode = libssh2_session_error_to_CURLE(err);
}
+ break;
}
infof(data, "SSH authentication methods available: %s\n",
sshc->authlist);
@@ -918,6 +913,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
&err_msg, NULL, 0);
infof(data, "SSH public key authentication failed: %s\n", err_msg);
state(conn, SSH_AUTH_PASS_INIT);
+ rc = 0; /* clear rc and continue */
}
break;
@@ -928,6 +924,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
else {
state(conn, SSH_AUTH_HOST_INIT);
+ rc = 0; /* clear rc and continue */
}
break;
@@ -940,7 +937,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc == 0) {
+ if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized password authentication\n");
state(conn, SSH_AUTH_DONE);
@@ -989,6 +986,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc < 0) {
infof(data, "Failure connecting to agent\n");
state(conn, SSH_AUTH_KEY_INIT);
+ rc = 0; /* clear rc and continue */
}
else {
state(conn, SSH_AUTH_AGENT_LIST);
@@ -1008,6 +1006,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc < 0) {
infof(data, "Failure requesting identities to agent\n");
state(conn, SSH_AUTH_KEY_INIT);
+ rc = 0; /* clear rc and continue */
}
else {
state(conn, SSH_AUTH_AGENT);
@@ -1077,7 +1076,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc == 0) {
+ if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized keyboard interactive authentication\n");
}
@@ -1116,21 +1115,19 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);
if(!sshc->sftp_session) {
+ char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- else {
- char *err_msg;
- (void)libssh2_session_last_error(sshc->ssh_session,
- &err_msg, NULL, 0);
- failf(data, "Failure initializing sftp session: %s", err_msg);
- state(conn, SSH_SESSION_FREE);
- sshc->actualcode = CURLE_FAILED_INIT;
- break;
- }
+ (void)libssh2_session_last_error(sshc->ssh_session,
+ &err_msg, NULL, 0);
+ failf(data, "Failure initializing sftp session: %s", err_msg);
+ state(conn, SSH_SESSION_FREE);
+ sshc->actualcode = CURLE_FAILED_INIT;
+ break;
}
state(conn, SSH_SFTP_REALPATH);
break;
@@ -1147,7 +1144,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc > 0) {
+ if(rc > 0) {
/* It seems that this string is not always NULL terminated */
tempHome[rc] = '\0';
sshc->homedir = strdup(tempHome);
@@ -1261,7 +1258,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_NEXT_QUOTE);
break;
}
- else if(cmd) {
+ if(cmd) {
/*
* the arguments following the command must be separated from the
* command with a space so we can check for it unconditionally
@@ -1321,7 +1318,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_QUOTE_STAT);
break;
}
- else if(strncasecompare(cmd, "ln ", 3) ||
+ if(strncasecompare(cmd, "ln ", 3) ||
strncasecompare(cmd, "symlink ", 8)) {
/* symbolic linking */
/* sshc->quote_path1 is the source */
@@ -1443,7 +1440,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
+ if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@@ -1514,7 +1511,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@@ -1537,7 +1534,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@@ -1558,7 +1555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
@@ -1582,7 +1579,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@@ -1601,7 +1598,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
@@ -1619,7 +1616,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
@@ -1642,7 +1639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc != 0 && !sshc->acceptfail) {
+ if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "statvfs command failed: %s", sftp_libssh2_strerror(err));
@@ -1705,7 +1702,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc == 0) {
+ if(rc == 0) {
data->info.filetime = (long)attrs.mtime;
}
@@ -1743,7 +1740,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc) {
+ if(rc) {
data->state.resume_from = 0;
}
else {
@@ -1778,47 +1775,47 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(LIBSSH2_ERROR_EAGAIN == rc)
break;
- else {
- if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
- /* only when there was an SFTP protocol error can we extract
- the sftp error! */
- err = sftp_libssh2_last_error(sshc->sftp_session);
- else
- err = -1; /* not an sftp error at all */
- if(sshc->secondCreateDirs) {
- state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = err>= LIBSSH2_FX_OK?
- sftp_libssh2_error_to_CURLE(err):CURLE_SSH;
- failf(data, "Creating the dir/file failed: %s",
- sftp_libssh2_strerror(err));
- break;
- }
- else if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
- (err == LIBSSH2_FX_FAILURE) ||
- (err == LIBSSH2_FX_NO_SUCH_PATH)) &&
- (data->set.ftp_create_missing_dirs &&
- (strlen(sftp_scp->path) > 1))) {
- /* try to create the path remotely */
- sshc->secondCreateDirs = 1;
- state(conn, SSH_SFTP_CREATE_DIRS_INIT);
- break;
- }
+ if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
+ /* only when there was an SFTP protocol error can we extract
+ the sftp error! */
+ err = sftp_libssh2_last_error(sshc->sftp_session);
+ else
+ err = -1; /* not an sftp error at all */
+
+ if(sshc->secondCreateDirs) {
state(conn, SSH_SFTP_CLOSE);
sshc->actualcode = err>= LIBSSH2_FX_OK?
sftp_libssh2_error_to_CURLE(err):CURLE_SSH;
- if(!sshc->actualcode) {
- /* Sometimes, for some reason libssh2_sftp_last_error() returns
- zero even though libssh2_sftp_open() failed previously! We need
- to work around that! */
- sshc->actualcode = CURLE_SSH;
- err=-1;
- }
- failf(data, "Upload failed: %s (%d/%d)",
- err>= LIBSSH2_FX_OK?sftp_libssh2_strerror(err):"ssh error",
- err, rc);
+ failf(data, "Creating the dir/file failed: %s",
+ sftp_libssh2_strerror(err));
+ break;
+ }
+ if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
+ (err == LIBSSH2_FX_FAILURE) ||
+ (err == LIBSSH2_FX_NO_SUCH_PATH)) &&
+ (data->set.ftp_create_missing_dirs &&
+ (strlen(sftp_scp->path) > 1))) {
+ /* try to create the path remotely */
+ rc = 0; /* clear rc and continue */
+ sshc->secondCreateDirs = 1;
+ state(conn, SSH_SFTP_CREATE_DIRS_INIT);
break;
}
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->actualcode = err>= LIBSSH2_FX_OK?
+ sftp_libssh2_error_to_CURLE(err):CURLE_SSH;
+ if(!sshc->actualcode) {
+ /* Sometimes, for some reason libssh2_sftp_last_error() returns
+ zero even though libssh2_sftp_open() failed previously! We need
+ to work around that! */
+ sshc->actualcode = CURLE_SSH;
+ err=-1;
+ }
+ failf(data, "Upload failed: %s (%d/%d)",
+ err>= LIBSSH2_FX_OK?sftp_libssh2_strerror(err):"ssh error",
+ err, rc);
+ break;
}
/* If we have a restart point then we need to seek to the correct
@@ -1831,32 +1828,30 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
if(seekerr != CURL_SEEKFUNC_OK) {
+ curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST;
}
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
- else {
- curl_off_t passed=0;
- do {
- size_t readthisamountnow =
- (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
- BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
-
- size_t actuallyread =
- data->state.fread_func(data->state.buffer, 1,
- readthisamountnow, data->state.in);
-
- passed += actuallyread;
- if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
- /* this checks for greater-than only to make sure that the
- CURL_READFUNC_ABORT return code still aborts */
- failf(data, "Failed to read data");
- return CURLE_FTP_COULDNT_USE_REST;
- }
- } while(passed < data->state.resume_from);
- }
+ do {
+ size_t readthisamountnow =
+ (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
+ BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
+
+ size_t actuallyread =
+ data->state.fread_func(data->state.buffer, 1,
+ readthisamountnow, data->state.in);
+
+ passed += actuallyread;
+ if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Failed to read data");
+ return CURLE_FTP_COULDNT_USE_REST;
+ }
+ } while(passed < data->state.resume_from);
}
/* now, decrease the size of the read */
@@ -1921,9 +1916,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_CREATE_DIRS_MKDIR);
break;
}
- else {
- state(conn, SSH_SFTP_UPLOAD_INIT);
- }
+ state(conn, SSH_SFTP_UPLOAD_INIT);
break;
case SSH_SFTP_CREATE_DIRS_MKDIR:
@@ -1936,7 +1929,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
*sshc->slash_pos = '/';
++sshc->slash_pos;
- if(rc == -1) {
+ if(rc < 0) {
/*
* Abort if failure wasn't that the dir already exists or the
* permission was denied (creation might succeed further down the
@@ -1951,6 +1944,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH;
break;
}
+ rc = 0; /* clear rc and continue */
}
state(conn, SSH_SFTP_CREATE_DIRS);
break;
@@ -1977,15 +1971,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- else {
- err = sftp_libssh2_last_error(sshc->sftp_session);
- failf(data, "Could not open directory for reading: %s",
- sftp_libssh2_strerror(err));
- state(conn, SSH_SFTP_CLOSE);
- result = sftp_libssh2_error_to_CURLE(err);
- sshc->actualcode = result?result:CURLE_SSH;
- break;
- }
+ err = sftp_libssh2_last_error(sshc->sftp_session);
+ failf(data, "Could not open directory for reading: %s",
+ sftp_libssh2_strerror(err));
+ state(conn, SSH_SFTP_CLOSE);
+ result = sftp_libssh2_error_to_CURLE(err);
+ sshc->actualcode = result?result:CURLE_SSH;
+ break;
}
sshc->readdir_filename = malloc(PATH_MAX+1);
if(!sshc->readdir_filename) {
@@ -2192,15 +2184,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- else {
- err = sftp_libssh2_last_error(sshc->sftp_session);
- failf(data, "Could not open remote file for reading: %s",
- sftp_libssh2_strerror(err));
- state(conn, SSH_SFTP_CLOSE);
- result = sftp_libssh2_error_to_CURLE(err);
- sshc->actualcode = result?result:CURLE_SSH;
- break;
- }
+ err = sftp_libssh2_last_error(sshc->sftp_session);
+ failf(data, "Could not open remote file for reading: %s",
+ sftp_libssh2_strerror(err));
+ state(conn, SSH_SFTP_CLOSE);
+ result = sftp_libssh2_error_to_CURLE(err);
+ sshc->actualcode = result?result:CURLE_SSH;
+ break;
}
state(conn, SSH_SFTP_DOWNLOAD_STAT);
break;
@@ -2215,7 +2205,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc ||
+ if(rc ||
!(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) ||
(attrs.filesize == 0)) {
/*
@@ -2313,18 +2303,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_STOP);
break;
}
- else {
- Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
- FALSE, NULL, -1, NULL);
+ Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
+ FALSE, NULL, -1, NULL);
- /* not set by Curl_setup_transfer to preserve keepon bits */
- conn->writesockfd = conn->sockfd;
+ /* not set by Curl_setup_transfer to preserve keepon bits */
+ conn->writesockfd = conn->sockfd;
+
+ /* we want to use the _receiving_ function even when the socket turns
+ out writableable as the underlying libssh2 recv function will deal
+ with both accordingly */
+ conn->cselect_bits = CURL_CSELECT_IN;
- /* we want to use the _receiving_ function even when the socket turns
- out writableable as the underlying libssh2 recv function will deal
- with both accordingly */
- conn->cselect_bits = CURL_CSELECT_IN;
- }
if(result) {
/* this should never occur; the close state should be entered
at the time the error occurs */
@@ -2342,7 +2331,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
}
sshc->sftp_handle = NULL;
@@ -2376,7 +2365,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
}
sshc->sftp_handle = NULL;
@@ -2386,7 +2375,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to stop libssh2 sftp subsystem\n");
}
sshc->sftp_session = NULL;
@@ -2431,22 +2420,21 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
data->state.infilesize);
if(!sshc->ssh_channel) {
+ int ssh_err;
+ char *err_msg;
+
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- else {
- int ssh_err;
- char *err_msg;
- ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
- &err_msg, NULL, 0));
- failf(conn->data, "%s", err_msg);
- state(conn, SSH_SCP_CHANNEL_FREE);
- sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
- break;
- }
+ ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
+ &err_msg, NULL, 0));
+ failf(conn->data, "%s", err_msg);
+ state(conn, SSH_SCP_CHANNEL_FREE);
+ sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
+ break;
}
/* upload data */
@@ -2501,22 +2489,22 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
#endif
if(!sshc->ssh_channel) {
+ int ssh_err;
+ char *err_msg;
+
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- else {
- int ssh_err;
- char *err_msg;
- ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
- &err_msg, NULL, 0));
- failf(conn->data, "%s", err_msg);
- state(conn, SSH_SCP_CHANNEL_FREE);
- sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
- break;
- }
+
+ ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
+ &err_msg, NULL, 0));
+ failf(conn->data, "%s", err_msg);
+ state(conn, SSH_SCP_CHANNEL_FREE);
+ sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
+ break;
}
/* download data */
@@ -2554,7 +2542,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc) {
+ if(rc) {
infof(data, "Failed to send libssh2 channel EOF\n");
}
}
@@ -2567,7 +2555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc) {
+ if(rc) {
infof(data, "Failed to get channel EOF: %d\n", rc);
}
}
@@ -2580,7 +2568,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc) {
+ if(rc) {
infof(data, "Channel failed to close: %d\n", rc);
}
}
@@ -2593,7 +2581,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
}
sshc->ssh_channel = NULL;
@@ -2615,7 +2603,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
}
sshc->ssh_channel = NULL;
@@ -2626,7 +2614,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to disconnect libssh2 session\n");
}
}
@@ -2651,7 +2639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n");
}
libssh2_agent_free(sshc->ssh_agent);
@@ -2669,7 +2657,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- else if(rc < 0) {
+ if(rc < 0) {
infof(data, "Failed to free libssh2 session\n");
}
sshc->ssh_session = NULL;
@@ -2834,7 +2822,8 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
while((sshc->state != SSH_STOP) && !result) {
bool block;
- long left;
+ time_t left;
+ struct timeval now = Curl_tvnow();
result = ssh_statemach_act(conn, &block);
if(result)
@@ -2842,12 +2831,10 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
if(Curl_pgrsUpdate(conn))
return CURLE_ABORTED_BY_CALLBACK;
- else {
- struct timeval now = Curl_tvnow();
- result = Curl_speedcheck(data, now);
- if(result)
- break;
- }
+
+ result = Curl_speedcheck(data, now);
+ if(result)
+ break;
left = Curl_timeleft(data, NULL, duringconnect);
if(left < 0) {
diff --git a/Utilities/cmcurl/lib/strcase.c b/Utilities/cmcurl/lib/strcase.c
index a750f7b..a74a4be 100644
--- a/Utilities/cmcurl/lib/strcase.c
+++ b/Utilities/cmcurl/lib/strcase.c
@@ -125,9 +125,9 @@ int Curl_safe_strcasecompare(const char *first, const char *second)
if(first && second)
/* both pointers point to something then compare them */
return Curl_strcasecompare(first, second);
- else
- /* if both pointers are NULL then treat them as equal */
- return (NULL == first && NULL == second);
+
+ /* if both pointers are NULL then treat them as equal */
+ return (NULL == first && NULL == second);
}
/*
diff --git a/Utilities/cmcurl/lib/system_win32.c b/Utilities/cmcurl/lib/system_win32.c
index 7873759..cfbbf32 100644
--- a/Utilities/cmcurl/lib/system_win32.c
+++ b/Utilities/cmcurl/lib/system_win32.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2016, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2016 - 2017, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -68,7 +68,7 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD);
*
* majorVersion [in] - The major version number.
* minorVersion [in] - The minor version number.
- * platform [in] - The optional platform identifer.
+ * platform [in] - The optional platform identifier.
* condition [in] - The test condition used to specifier whether we are
* checking a version less then, equal to or greater than
* what is specified in the major and minor version
diff --git a/Utilities/cmcurl/lib/telnet.c b/Utilities/cmcurl/lib/telnet.c
index 551af60..5cceed2 100644
--- a/Utilities/cmcurl/lib/telnet.c
+++ b/Utilities/cmcurl/lib/telnet.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -872,7 +872,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
continue;
}
- /* Window Size */
+ /* Window Size */
if(strcasecompare(option_keyword, "WS")) {
if(sscanf(option_arg, "%hu%*[xX]%hu",
&tn->subopt_wsx, &tn->subopt_wsy) == 2)
@@ -899,11 +899,9 @@ static CURLcode check_telnet_options(struct connectdata *conn)
result = CURLE_UNKNOWN_TELNET_OPTION;
break;
}
- else {
- failf(data, "Syntax error in telnet option: %s", head->data);
- result = CURLE_TELNET_OPTION_SYNTAX;
- break;
- }
+ failf(data, "Syntax error in telnet option: %s", head->data);
+ result = CURLE_TELNET_OPTION_SYNTAX;
+ break;
}
if(result) {
@@ -1016,7 +1014,7 @@ static void sendsuboption(struct connectdata *conn, int option)
CURL_SB_ACCUM(tn, CURL_IAC);
CURL_SB_ACCUM(tn, CURL_SB);
CURL_SB_ACCUM(tn, CURL_TELOPT_NAWS);
- /* We must deal either with litte or big endien processors */
+ /* We must deal either with litte or big endian processors */
/* Window size must be sent according to the 'network order' */
x=htons(tn->subopt_wsx);
y=htons(tn->subopt_wsy);
@@ -1186,7 +1184,7 @@ CURLcode telrcv(struct connectdata *conn,
* IAC SE was left off, or another option got inserted into the
* suboption are all possibilities. If we assume that the IAC was
* not doubled, and really the IAC SE was left off, we could get
- * into an infinate loop here. So, instead, we terminate the
+ * into an infinite loop here. So, instead, we terminate the
* suboption, and process the partial suboption if we can.
*/
CURL_SB_ACCUM(tn, CURL_IAC);
@@ -1326,7 +1324,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
#ifdef USE_WINSOCK
/*
** This functionality only works with WinSock >= 2.0. So,
- ** make sure have it.
+ ** make sure we have it.
*/
result = check_wsock2(data);
if(result)
@@ -1416,28 +1414,29 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
/* Keep on listening and act on events */
while(keepon) {
+ const DWORD buf_size = (DWORD)CURL_BUFSIZE(data->set.buffer_size);
waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout);
switch(waitret) {
case WAIT_TIMEOUT:
{
for(;;) {
if(data->set.is_fread_set) {
+ size_t n;
/* read from user-supplied method */
- result = (int)data->state.fread_func(buf, 1, BUFSIZE - 1,
- data->state.in);
- if(result == CURL_READFUNC_ABORT) {
+ n = data->state.fread_func(buf, 1, BUFSIZE - 1, data->state.in);
+ if(n == CURL_READFUNC_ABORT) {
keepon = FALSE;
result = CURLE_READ_ERROR;
break;
}
- if(result == CURL_READFUNC_PAUSE)
+ if(n == CURL_READFUNC_PAUSE)
break;
- if(result == 0) /* no bytes */
+ if(n == 0) /* no bytes */
break;
- readfile_read = result; /* fall thru with number of bytes read */
+ readfile_read = (DWORD)n; /* fall thru with number of bytes read */
}
else {
/* read from stdin */
@@ -1451,7 +1450,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(!readfile_read)
break;
- if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
+ if(!ReadFile(stdin_handle, buf, buf_size,
&readfile_read, NULL)) {
keepon = FALSE;
result = CURLE_READ_ERROR;
@@ -1470,7 +1469,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
case WAIT_OBJECT_0 + 1:
{
- if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
+ if(!ReadFile(stdin_handle, buf, buf_size,
&readfile_read, NULL)) {
keepon = FALSE;
result = CURLE_READ_ERROR;
@@ -1593,7 +1592,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(result == CURLE_AGAIN)
break;
/* returned not-zero, this an error */
- else if(result) {
+ if(result) {
keepon = FALSE;
break;
}
diff --git a/Utilities/cmcurl/lib/tftp.c b/Utilities/cmcurl/lib/tftp.c
index f2f8347..098b1bb 100644
--- a/Utilities/cmcurl/lib/tftp.c
+++ b/Utilities/cmcurl/lib/tftp.c
@@ -359,7 +359,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
failf(data, "invalid blocksize value in OACK packet");
return CURLE_TFTP_ILLEGAL;
}
- else if(blksize > TFTP_BLKSIZE_MAX) {
+ if(blksize > TFTP_BLKSIZE_MAX) {
failf(data, "%s (%d)", "blksize is larger than max supported",
TFTP_BLKSIZE_MAX);
return CURLE_TFTP_ILLEGAL;
@@ -1189,7 +1189,7 @@ static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event)
state->state = TFTP_STATE_FIN;
return 0;
}
- else if(current > state->rx_time+state->retry_time) {
+ if(current > state->rx_time+state->retry_time) {
if(event)
*event = TFTP_EVENT_TIMEOUT;
time(&state->rx_time); /* update even though we received nothing */
@@ -1223,7 +1223,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
failf(data, "TFTP response timeout");
return CURLE_OPERATION_TIMEDOUT;
}
- else if(event != TFTP_EVENT_NONE) {
+ if(event != TFTP_EVENT_NONE) {
result = tftp_state_machine(state, event);
if(result)
return result;
diff --git a/Utilities/cmcurl/lib/timeval.c b/Utilities/cmcurl/lib/timeval.c
index f3b207a..0d6036b 100644
--- a/Utilities/cmcurl/lib/timeval.c
+++ b/Utilities/cmcurl/lib/timeval.c
@@ -139,8 +139,7 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older)
if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0;
- else
- return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
+ return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
}
/* return the number of seconds in the given input timeval struct */
diff --git a/Utilities/cmcurl/lib/transfer.c b/Utilities/cmcurl/lib/transfer.c
index 750fb04..1f6d26d 100644
--- a/Utilities/cmcurl/lib/transfer.c
+++ b/Utilities/cmcurl/lib/transfer.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -117,7 +117,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
*nreadp = 0;
return CURLE_ABORTED_BY_CALLBACK;
}
- else if(nread == CURL_READFUNC_PAUSE) {
+ if(nread == CURL_READFUNC_PAUSE) {
+ struct SingleRequest *k = &data->req;
if(conn->handler->flags & PROTOPT_NONETWORK) {
/* protocols that work without network cannot be paused. This is
@@ -126,16 +127,15 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
failf(data, "Read callback asked for PAUSE when not supported!");
return CURLE_READ_ERROR;
}
- else {
- struct SingleRequest *k = &data->req;
- /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
- k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
- if(data->req.upload_chunky) {
+
+ /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
+ k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
+ if(data->req.upload_chunky) {
/* Back out the preallocation done above */
- data->req.upload_fromhere -= (8 + 2);
- }
- *nreadp = 0;
+ data->req.upload_fromhere -= (8 + 2);
}
+ *nreadp = 0;
+
return CURLE_OK; /* nothing was read */
}
else if((size_t)nread > buffersize) {
@@ -642,7 +642,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
return CURLE_RECV_ERROR;
}
- else if(CHUNKE_STOP == res) {
+ if(CHUNKE_STOP == res) {
size_t dataleft;
/* we're done reading chunks! */
k->keepon &= ~KEEP_RECV; /* read no more */
@@ -918,7 +918,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
/* this is a paused transfer */
break;
}
- else if(nread<=0) {
+ if(nread<=0) {
result = done_sending(conn, k);
if(result)
return result;
@@ -1192,7 +1192,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->size - k->bytecount);
return CURLE_PARTIAL_FILE;
}
- else if(!(data->set.opt_no_body) &&
+ if(!(data->set.opt_no_body) &&
k->chunk &&
(conn->chunk.state != CHUNK_STOP)) {
/*
@@ -1356,13 +1356,12 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
if(data->set.wildcardmatch) {
struct WildcardData *wc = &data->wildcard;
- if(!wc->filelist) {
+ if(wc->state < CURLWC_INIT) {
result = Curl_wildcard_init(wc); /* init wildcard structures */
if(result)
return CURLE_OUT_OF_MEMORY;
}
}
-
}
return result;
@@ -1795,7 +1794,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
break;
case 303: /* See Other */
- /* Disable both types of POSTs, unless the user explicitely
+ /* Disable both types of POSTs, unless the user explicitly
asks for POST after POST */
if(data->set.httpreq != HTTPREQ_GET
&& !(data->set.keep_post & CURL_REDIR_POST_303)) {
@@ -1843,12 +1842,17 @@ CURLcode Curl_retry_request(struct connectdata *conn,
return CURLE_OK;
if((data->req.bytecount + data->req.headerbytecount == 0) &&
- conn->bits.reuse &&
- (data->set.rtspreq != RTSPREQ_RECEIVE)) {
- /* We didn't get a single byte when we attempted to re-use a
- connection. This might happen if the connection was left alive when we
- were done using it before, but that was closed when we wanted to use it
- again. Bad luck. Retry the same request on a fresh connect! */
+ conn->bits.reuse &&
+ (!data->set.opt_no_body
+ || (conn->handler->protocol & PROTO_FAMILY_HTTP)) &&
+ (data->set.rtspreq != RTSPREQ_RECEIVE)) {
+ /* We got no data, we attempted to re-use a connection. For HTTP this
+ can be a retry so we try again regardless if we expected a body.
+ For other protocols we only try again only if we expected a body.
+
+ This might happen if the connection was left alive when we were
+ done using it before, but that was closed when we wanted to read from
+ it again. Bad luck. Retry the same request on a fresh connect! */
infof(conn->data, "Connection died, retrying a fresh connect\n");
*url = strdup(conn->data->change.url);
if(!*url)
diff --git a/Utilities/cmcurl/lib/url.c b/Utilities/cmcurl/lib/url.c
index 7944d7b..caa28f5 100644
--- a/Utilities/cmcurl/lib/url.c
+++ b/Utilities/cmcurl/lib/url.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -411,10 +411,7 @@ CURLcode Curl_close(struct Curl_easy *data)
/* Destroy the timeout list that is held in the easy handle. It is
/normally/ done by curl_multi_remove_handle() but this is "just in
case" */
- if(data->state.timeoutlist) {
- Curl_llist_destroy(data->state.timeoutlist, NULL);
- data->state.timeoutlist = NULL;
- }
+ Curl_llist_destroy(&data->state.timeoutlist, NULL);
data->magic = 0; /* force a clear AFTER the possibly enforced removal from
the multi handle, since that function uses the magic
@@ -452,6 +449,7 @@ CURLcode Curl_close(struct Curl_easy *data)
}
data->change.url = NULL;
+ Curl_safefree(data->state.buffer);
Curl_safefree(data->state.headerbuff);
Curl_flush_cookies(data, 1);
@@ -548,7 +546,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
#endif
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
- set->general_ssl.sessionid = TRUE; /* session ID caching enabled by
+ set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by
default */
set->proxy_ssl = set->ssl;
@@ -576,14 +574,19 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
result = setstropt(&set->str[STRING_SSL_CAFILE_ORIG], CURL_CA_BUNDLE);
if(result)
return result;
+
+ result = setstropt(&set->str[STRING_SSL_CAFILE_PROXY], CURL_CA_BUNDLE);
+ if(result)
+ return result;
#endif
#if defined(CURL_CA_PATH)
result = setstropt(&set->str[STRING_SSL_CAPATH_ORIG], CURL_CA_PATH);
if(result)
return result;
- result = setstropt(&set->str[STRING_SSL_CAPATH_PROXY],
- (char *) CURL_CA_PATH);
+ result = setstropt(&set->str[STRING_SSL_CAPATH_PROXY], CURL_CA_PATH);
+ if(result)
+ return result;
#endif
set->wildcardmatch = FALSE;
@@ -641,6 +644,12 @@ CURLcode Curl_open(struct Curl_easy **curl)
/* We do some initial setup here, all those fields that can't be just 0 */
+ data->state.buffer = malloc(BUFSIZE + 1);
+ if(!data->state.buffer) {
+ DEBUGF(fprintf(stderr, "Error: malloc of buffer failed\n"));
+ result = CURLE_OUT_OF_MEMORY;
+ }
+
data->state.headerbuff = malloc(HEADERSIZE);
if(!data->state.headerbuff) {
DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n"));
@@ -660,9 +669,6 @@ CURLcode Curl_open(struct Curl_easy **curl)
data->progress.flags |= PGRS_HIDE;
data->state.current_speed = -1; /* init to negative == impossible */
-
- data->wildcard.state = CURLWC_INIT;
- data->wildcard.filelist = NULL;
data->set.fnmatch = ZERO_NULL;
data->set.maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
@@ -671,6 +677,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
if(result) {
Curl_resolver_cleanup(data->state.resolver);
+ free(data->state.buffer);
free(data->state.headerbuff);
Curl_freeset(data);
free(data);
@@ -682,6 +689,9 @@ CURLcode Curl_open(struct Curl_easy **curl)
return result;
}
+#define C_SSLVERSION_VALUE(x) (x & 0xffff)
+#define C_SSLVERSION_MAX_VALUE(x) (x & 0xffff0000)
+
CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
va_list param)
{
@@ -914,7 +924,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
* implementations are lame.
*/
#ifdef USE_SSL
- data->set.ssl.primary.version = va_arg(param, long);
+ arg = va_arg(param, long);
+ data->set.ssl.primary.version = C_SSLVERSION_VALUE(arg);
+ data->set.ssl.primary.version_max = C_SSLVERSION_MAX_VALUE(arg);
#else
result = CURLE_UNKNOWN_OPTION;
#endif
@@ -925,7 +937,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
* implementations are lame.
*/
#ifdef USE_SSL
- data->set.proxy_ssl.primary.version = va_arg(param, long);
+ arg = va_arg(param, long);
+ data->set.proxy_ssl.primary.version = C_SSLVERSION_VALUE(arg);
+ data->set.proxy_ssl.primary.version_max = C_SSLVERSION_MAX_VALUE(arg);
#else
result = CURLE_UNKNOWN_OPTION;
#endif
@@ -2217,8 +2231,12 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
/* This does not work on windows. */
result = setstropt(&data->set.str[STRING_SSL_CAPATH_ORIG],
va_arg(param, char *));
+#else
+ result = CURLE_NOT_BUILT_IN;
+#endif
break;
case CURLOPT_PROXY_CAPATH:
+#ifdef have_curlssl_ca_path /* not supported by all backends */
/*
* Set CA path info for SSL connection proxy. Specify directory name of the
* CA certificates which have been prepared using openssl c_rehash utility.
@@ -2268,9 +2286,20 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
*/
data->set.buffer_size = va_arg(param, long);
- if((data->set.buffer_size> (BUFSIZE -1)) ||
- (data->set.buffer_size < 1))
- data->set.buffer_size = 0; /* huge internal default */
+ if(data->set.buffer_size > MAX_BUFSIZE)
+ data->set.buffer_size = MAX_BUFSIZE; /* huge internal default */
+ else if(data->set.buffer_size < 1)
+ data->set.buffer_size = BUFSIZE;
+
+ /* Resize only if larger than default buffer size. */
+ if(data->set.buffer_size > BUFSIZE) {
+ data->state.buffer = realloc(data->state.buffer,
+ data->set.buffer_size + 1);
+ if(!data->state.buffer) {
+ DEBUGF(fprintf(stderr, "Error: realloc of buffer failed\n"));
+ result = CURLE_OUT_OF_MEMORY;
+ }
+ }
break;
@@ -2470,8 +2499,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
break;
case CURLOPT_SSL_SESSIONID_CACHE:
- data->set.general_ssl.sessionid = (0 != va_arg(param, long)) ?
+ data->set.ssl.primary.sessionid = (0 != va_arg(param, long)) ?
TRUE : FALSE;
+ data->set.proxy_ssl.primary.sessionid = data->set.ssl.primary.sessionid;
break;
#ifdef USE_LIBSSH2
@@ -2814,6 +2844,12 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
#ifdef USE_UNIX_SOCKETS
case CURLOPT_UNIX_SOCKET_PATH:
+ data->set.abstract_unix_socket = FALSE;
+ result = setstropt(&data->set.str[STRING_UNIX_SOCKET_PATH],
+ va_arg(param, char *));
+ break;
+ case CURLOPT_ABSTRACT_UNIX_SOCKET:
+ data->set.abstract_unix_socket = TRUE;
result = setstropt(&data->set.str[STRING_UNIX_SOCKET_PATH],
va_arg(param, char *));
break;
@@ -2853,6 +2889,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
case CURLOPT_CONNECT_TO:
data->set.connect_to = va_arg(param, struct curl_slist *);
break;
+ case CURLOPT_SUPPRESS_CONNECT_HEADERS:
+ data->set.suppress_connect_headers = (0 != va_arg(param, long))?TRUE:FALSE;
+ break;
default:
/* unknown tag and its companion, just ignore: */
result = CURLE_UNKNOWN_OPTION;
@@ -2957,11 +2996,8 @@ static void conn_free(struct connectdata *conn)
conn_reset_all_postponed_data(conn);
- Curl_llist_destroy(conn->send_pipe, NULL);
- Curl_llist_destroy(conn->recv_pipe, NULL);
-
- conn->send_pipe = NULL;
- conn->recv_pipe = NULL;
+ Curl_llist_destroy(&conn->send_pipe, NULL);
+ Curl_llist_destroy(&conn->recv_pipe, NULL);
Curl_safefree(conn->localdev);
Curl_free_primary_ssl_config(&conn->ssl_config);
@@ -3001,9 +3037,9 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
* are other users of it
*/
if(!conn->bits.close &&
- (conn->send_pipe->size + conn->recv_pipe->size)) {
+ (conn->send_pipe.size + conn->recv_pipe.size)) {
DEBUGF(infof(data, "Curl_disconnect, usecounter: %d\n",
- conn->send_pipe->size + conn->recv_pipe->size));
+ conn->send_pipe.size + conn->recv_pipe.size));
return CURLE_OK;
}
@@ -3029,7 +3065,6 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
free_fixed_hostname(&conn->host);
free_fixed_hostname(&conn->conn_to_host);
- free_fixed_hostname(&conn->proxy);
free_fixed_hostname(&conn->http_proxy.host);
free_fixed_hostname(&conn->socks_proxy.host);
@@ -3037,8 +3072,8 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
/* Indicate to all handles on the pipe that we're dead */
if(Curl_pipeline_wanted(data->multi, CURLPIPE_ANY)) {
- signalPipeClose(conn->send_pipe, TRUE);
- signalPipeClose(conn->recv_pipe, TRUE);
+ signalPipeClose(&conn->send_pipe, TRUE);
+ signalPipeClose(&conn->recv_pipe, TRUE);
}
conn_free(conn);
@@ -3143,9 +3178,9 @@ void Curl_getoff_all_pipelines(struct Curl_easy *data,
bool send_head = (conn->writechannel_inuse &&
Curl_sendpipe_head(data, conn));
- if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) && recv_head)
+ if(Curl_removeHandleFromPipeline(data, &conn->recv_pipe) && recv_head)
Curl_pipeline_leave_read(conn);
- if(Curl_removeHandleFromPipeline(data, conn->send_pipe) && send_head)
+ if(Curl_removeHandleFromPipeline(data, &conn->send_pipe) && send_head)
Curl_pipeline_leave_write(conn);
}
@@ -3206,7 +3241,7 @@ Curl_oldest_idle_connection(struct Curl_easy *data)
bundle = he->ptr;
- curr = bundle->conn_list->head;
+ curr = bundle->conn_list.head;
while(curr) {
conn = curr->ptr;
@@ -3234,9 +3269,7 @@ proxy_info_matches(const struct proxy_info* data,
{
if((data->proxytype == needle->proxytype) &&
(data->port == needle->port) &&
- Curl_safe_strcasecompare(data->host.name, needle->host.name) &&
- Curl_safe_strcasecompare(data->user, needle->user) &&
- Curl_safe_strcasecompare(data->passwd, needle->passwd))
+ Curl_safe_strcasecompare(data->host.name, needle->host.name))
return TRUE;
return FALSE;
@@ -3265,7 +3298,7 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data,
now = Curl_tvnow();
- curr = bundle->conn_list->head;
+ curr = bundle->conn_list.head;
while(curr) {
conn = curr->ptr;
@@ -3293,7 +3326,7 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data,
static bool disconnect_if_dead(struct connectdata *conn,
struct Curl_easy *data)
{
- size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size;
+ size_t pipeLen = conn->send_pipe.size + conn->recv_pipe.size;
if(!pipeLen && !conn->inuse) {
/* The check for a dead socket makes sense only if there are no
handles in pipeline and the connection isn't already marked in
@@ -3406,19 +3439,14 @@ ConnectionExists(struct Curl_easy *data,
max_pipeline_length(data->multi):0;
size_t best_pipe_len = max_pipe_len;
struct curl_llist_element *curr;
- const char *hostname;
-
- if(needle->bits.conn_to_host)
- hostname = needle->conn_to_host.name;
- else
- hostname = needle->host.name;
infof(data, "Found bundle for host %s: %p [%s]\n",
- hostname, (void *)bundle,
- (bundle->multiuse== BUNDLE_PIPELINING?
- "can pipeline":
- (bundle->multiuse== BUNDLE_MULTIPLEX?
- "can multiplex":"serially")));
+ (needle->bits.conn_to_host ? needle->conn_to_host.name :
+ needle->host.name), (void *)bundle,
+ (bundle->multiuse == BUNDLE_PIPELINING ?
+ "can pipeline" :
+ (bundle->multiuse == BUNDLE_MULTIPLEX ?
+ "can multiplex" : "serially")));
/* We can't pipe if we don't know anything about the server */
if(canPipeline) {
@@ -3445,7 +3473,7 @@ ConnectionExists(struct Curl_easy *data,
}
}
- curr = bundle->conn_list->head;
+ curr = bundle->conn_list.head;
while(curr) {
bool match = FALSE;
size_t pipeLen;
@@ -3460,7 +3488,7 @@ ConnectionExists(struct Curl_easy *data,
if(disconnect_if_dead(check, data))
continue;
- pipeLen = check->send_pipe->size + check->recv_pipe->size;
+ pipeLen = check->send_pipe.size + check->recv_pipe.size;
if(canPipeline) {
if(check->bits.protoconnstart && check->bits.close)
@@ -3468,8 +3496,8 @@ ConnectionExists(struct Curl_easy *data,
if(!check->bits.multiplex) {
/* If not multiplexing, make sure the pipe has only GET requests */
- struct Curl_easy* sh = gethandleathead(check->send_pipe);
- struct Curl_easy* rh = gethandleathead(check->recv_pipe);
+ struct Curl_easy* sh = gethandleathead(&check->send_pipe);
+ struct Curl_easy* rh = gethandleathead(&check->recv_pipe);
if(sh) {
if(!IsPipeliningPossible(sh, check))
continue;
@@ -3507,7 +3535,7 @@ ConnectionExists(struct Curl_easy *data,
infof(data, "Connection #%ld isn't open enough, can't reuse\n",
check->connection_id);
#ifdef DEBUGBUILD
- if(check->recv_pipe->size > 0) {
+ if(check->recv_pipe.size > 0) {
infof(data,
"BAD! Unconnected #%ld has a non-empty recv pipeline!\n",
check->connection_id);
@@ -3523,6 +3551,8 @@ ConnectionExists(struct Curl_easy *data,
continue;
if(strcmp(needle->unix_domain_socket, check->unix_domain_socket))
continue;
+ if(needle->abstract_unix_socket != check->abstract_unix_socket)
+ continue;
}
else if(check->unix_domain_socket)
continue;
@@ -3644,7 +3674,7 @@ ConnectionExists(struct Curl_easy *data,
check->connection_id));
continue;
}
- else if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {
+ if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {
foundPendingCandidate = TRUE;
DEBUGF(infof(data,
"Connection #%ld has not started SSL connect, "
@@ -3797,17 +3827,19 @@ CURLcode Curl_connected_proxy(struct connectdata *conn, int sockindex)
if(conn->bits.socksproxy) {
#ifndef CURL_DISABLE_PROXY
- const char * const host = conn->bits.conn_to_host ?
- conn->conn_to_host.name :
- conn->bits.httpproxy ?
+ /* for the secondary socket (FTP), use the "connect to host"
+ * but ignore the "connect to port" (use the secondary port)
+ */
+ const char * const host = conn->bits.httpproxy ?
conn->http_proxy.host.name :
+ conn->bits.conn_to_host ?
+ conn->conn_to_host.name :
sockindex == SECONDARYSOCKET ?
conn->secondaryhostname : conn->host.name;
- const int port = conn->bits.conn_to_port ? conn->conn_to_port :
- conn->bits.httpproxy ?
- (int)conn->http_proxy.port :
- sockindex == SECONDARYSOCKET ?
- conn->secondary_port : conn->remote_port;
+ const int port = conn->bits.httpproxy ? (int)conn->http_proxy.port :
+ sockindex == SECONDARYSOCKET ? conn->secondary_port :
+ conn->bits.conn_to_port ? conn->conn_to_port :
+ conn->remote_port;
conn->bits.socksproxy_connecting = TRUE;
switch(conn->socks_proxy.proxytype) {
case CURLPROXY_SOCKS5:
@@ -3845,7 +3877,8 @@ void Curl_verboseconnect(struct connectdata *conn)
infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n",
conn->bits.socksproxy ? conn->socks_proxy.host.dispname :
conn->bits.httpproxy ? conn->http_proxy.host.dispname :
- conn->host.dispname,
+ conn->bits.conn_to_host ? conn->conn_to_host.dispname :
+ conn->host.dispname,
conn->ip_addr_str, conn->port, conn->connection_id);
}
#endif
@@ -3968,7 +4001,7 @@ CURLcode Curl_protocol_connect(struct connectdata *conn,
}
/*
- * Helpers for IDNA convertions.
+ * Helpers for IDNA conversions.
*/
static bool is_ASCII_name(const char *hostname)
{
@@ -4010,7 +4043,15 @@ static void fix_hostname(struct connectdata *conn, struct hostname *host)
#ifdef USE_LIBIDN2
if(idn2_check_version(IDN2_VERSION)) {
char *ace_hostname = NULL;
- int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, 0);
+#if IDN2_VERSION_NUMBER >= 0x00140000
+ /* IDN2_NFC_INPUT: Normalize input string using normalization form C.
+ IDN2_NONTRANSITIONAL: Perform Unicode TR46 non-transitional
+ processing. */
+ int flags = IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL;
+#else
+ int flags = IDN2_NFC_INPUT;
+#endif
+ int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags);
if(rc == IDN2_OK) {
host->encalloc = (char *)ace_hostname;
/* change the name pointer to point to the encoded hostname */
@@ -4084,7 +4125,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->tempsock[1] = CURL_SOCKET_BAD; /* no file descriptor */
conn->connection_id = -1; /* no ID */
conn->port = -1; /* unknown at this point */
- conn->remote_port = -1; /* unknown */
+ conn->remote_port = -1; /* unknown at this point */
#if defined(USE_RECV_BEFORE_SEND_WORKAROUND) && defined(DEBUGBUILD)
conn->postponed[0].bindsock = CURL_SOCKET_BAD; /* no file descriptor */
conn->postponed[1].bindsock = CURL_SOCKET_BAD; /* no file descriptor */
@@ -4141,8 +4182,11 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
+ conn->ssl_config.verifystatus = data->set.ssl.primary.verifystatus;
conn->ssl_config.verifypeer = data->set.ssl.primary.verifypeer;
conn->ssl_config.verifyhost = data->set.ssl.primary.verifyhost;
+ conn->proxy_ssl_config.verifystatus =
+ data->set.proxy_ssl.primary.verifystatus;
conn->proxy_ssl_config.verifypeer = data->set.proxy_ssl.primary.verifypeer;
conn->proxy_ssl_config.verifyhost = data->set.proxy_ssl.primary.verifyhost;
@@ -4165,10 +4209,8 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
}
/* Initialize the pipeline lists */
- conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
- conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
- if(!conn->send_pipe || !conn->recv_pipe)
- goto error;
+ Curl_llist_init(&conn->send_pipe, (curl_llist_dtor) llist_dtor);
+ Curl_llist_init(&conn->recv_pipe, (curl_llist_dtor) llist_dtor);
#ifdef HAVE_GSSAPI
conn->data_prot = PROT_CLEAR;
@@ -4191,11 +4233,8 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
return conn;
error:
- Curl_llist_destroy(conn->send_pipe, NULL);
- Curl_llist_destroy(conn->recv_pipe, NULL);
-
- conn->send_pipe = NULL;
- conn->recv_pipe = NULL;
+ Curl_llist_destroy(&conn->send_pipe, NULL);
+ Curl_llist_destroy(&conn->recv_pipe, NULL);
free(conn->master_buffer);
free(conn->localdev);
@@ -4258,11 +4297,13 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
char *fragment;
char *path = data->state.path;
char *query;
+ int i;
int rc;
- char protobuf[16] = "";
const char *protop = "";
CURLcode result;
bool rebuild_url = FALSE;
+ bool url_has_scheme = FALSE;
+ char protobuf[16];
*prot_missing = FALSE;
@@ -4281,10 +4322,47 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
* proxy -- and we don't know if we will need to use SSL until we parse the
* url ...
************************************************************/
- if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]",
- protobuf, path)) &&
- strcasecompare(protobuf, "file")) {
- if(path[0] == '/' && path[1] == '/') {
+ if(data->change.url[0] == ':') {
+ failf(data, "Bad URL, colon is first character");
+ return CURLE_URL_MALFORMAT;
+ }
+
+ /* Make sure we don't mistake a drive letter for a scheme, for example:
+ curld --proto-default file c:/foo/bar.txt */
+ if((('a' <= data->change.url[0] && data->change.url[0] <= 'z') ||
+ ('A' <= data->change.url[0] && data->change.url[0] <= 'Z')) &&
+ data->change.url[1] == ':' && data->set.str[STRING_DEFAULT_PROTOCOL] &&
+ strcasecompare(data->set.str[STRING_DEFAULT_PROTOCOL], "file")) {
+ ; /* do nothing */
+ }
+ else { /* check for a scheme */
+ for(i = 0; i < 16 && data->change.url[i]; ++i) {
+ if(data->change.url[i] == '/')
+ break;
+ if(data->change.url[i] == ':') {
+ url_has_scheme = TRUE;
+ break;
+ }
+ }
+ }
+
+ /* handle the file: scheme */
+ if((url_has_scheme && strncasecompare(data->change.url, "file:", 5)) ||
+ (!url_has_scheme && data->set.str[STRING_DEFAULT_PROTOCOL] &&
+ strcasecompare(data->set.str[STRING_DEFAULT_PROTOCOL], "file"))) {
+ bool path_has_drive = FALSE;
+
+ if(url_has_scheme)
+ rc = sscanf(data->change.url, "%*15[^\n/:]:%[^\n]", path);
+ else
+ rc = sscanf(data->change.url, "%[^\n]", path);
+
+ if(rc != 1) {
+ failf(data, "Bad URL");
+ return CURLE_URL_MALFORMAT;
+ }
+
+ if(url_has_scheme && path[0] == '/' && path[1] == '/') {
/* Allow omitted hostname (e.g. file:/<path>). This is not strictly
* speaking a valid file: URL by RFC 1738, but treating file:/<path> as
* file://localhost/<path> is similar to how other schemes treat missing
@@ -4294,18 +4372,25 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
memory areas overlap! */
memmove(path, path + 2, strlen(path + 2)+1);
}
+
+ /* the path may start with a drive letter. for backwards compatibility
+ we skip some processing on those paths. */
+ path_has_drive = (('a' <= path[0] && path[0] <= 'z') ||
+ ('A' <= path[0] && path[0] <= 'Z')) && path[1] == ':';
+
/*
* we deal with file://<host>/<path> differently since it supports no
* hostname other than "localhost" and "127.0.0.1", which is unique among
* the URL protocols specified in RFC 1738
*/
- if(path[0] != '/') {
+ if(path[0] != '/' && !path_has_drive) {
/* the URL includes a host name, it must match "localhost" or
"127.0.0.1" to be valid */
char *ptr;
if(!checkprefix("localhost/", path) &&
!checkprefix("127.0.0.1/", path)) {
- failf(data, "Valid host name with slash missing in URL");
+ failf(data, "Invalid file://hostname/, "
+ "expected localhost or 127.0.0.1 or none");
return CURLE_URL_MALFORMAT;
}
ptr = &path[9]; /* now points to the slash after the host */
@@ -4332,7 +4417,17 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
/* This cannot be made with strcpy, as the memory chunks overlap! */
memmove(path, ptr, strlen(ptr)+1);
+
+ path_has_drive = (('a' <= path[0] && path[0] <= 'z') ||
+ ('A' <= path[0] && path[0] <= 'Z')) && path[1] == ':';
+ }
+
+#if !defined(MSDOS) && !defined(WIN32) && !defined(__CYGWIN__)
+ if(path_has_drive) {
+ failf(data, "File drive letters are only accepted in MSDOS/Windows.");
+ return CURLE_URL_MALFORMAT;
}
+#endif
protop = "file"; /* protocol string */
}
@@ -4342,7 +4437,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
path[0]=0;
rc = sscanf(data->change.url,
- "%15[^\n:]:%3[/]%[^\n/?#]%[^\n]",
+ "%15[^\n/:]:%3[/]%[^\n/?#]%[^\n]",
protobuf, slashbuf, conn->host.name, path);
if(2 == rc) {
failf(data, "Bad URL");
@@ -4527,6 +4622,10 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
data->change.url_alloc = TRUE; /* free this later */
}
+ result = findprotocol(data, conn, protop);
+ if(result)
+ return result;
+
/*
* Parse the login details from the URL and strip them out of
* the host name
@@ -4613,8 +4712,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
* conn->host.name is B
* data->state.path is /C
*/
-
- return findprotocol(data, conn, protop);
+ return CURLE_OK;
}
/*
@@ -4783,6 +4881,7 @@ static bool check_noproxy(const char *name, const char *no_proxy)
return FALSE;
}
+#ifndef CURL_DISABLE_HTTP
/****************************************************************
* Detect what (if any) proxy to use. Remember that this selects a host
* name and is not limited to HTTP proxies only.
@@ -4792,7 +4891,6 @@ static char *detect_proxy(struct connectdata *conn)
{
char *proxy = NULL;
-#ifndef CURL_DISABLE_HTTP
/* If proxy was not specified, we check for default proxy environment
* variables, to enable i.e Lynx compliance:
*
@@ -4810,65 +4908,50 @@ static char *detect_proxy(struct connectdata *conn)
* For compatibility, the all-uppercase versions of these variables are
* checked if the lowercase versions don't exist.
*/
- char *no_proxy=NULL;
char proxy_env[128];
+ const char *protop = conn->handler->scheme;
+ char *envp = proxy_env;
+ char *prox;
- no_proxy=curl_getenv("no_proxy");
- if(!no_proxy)
- no_proxy=curl_getenv("NO_PROXY");
-
- if(!check_noproxy(conn->host.name, no_proxy)) {
- /* It was not listed as without proxy */
- const char *protop = conn->handler->scheme;
- char *envp = proxy_env;
- char *prox;
+ /* Now, build <protocol>_proxy and check for such a one to use */
+ while(*protop)
+ *envp++ = (char)tolower((int)*protop++);
- /* Now, build <protocol>_proxy and check for such a one to use */
- while(*protop)
- *envp++ = (char)tolower((int)*protop++);
+ /* append _proxy */
+ strcpy(envp, "_proxy");
- /* append _proxy */
- strcpy(envp, "_proxy");
+ /* read the protocol proxy: */
+ prox=curl_getenv(proxy_env);
- /* read the protocol proxy: */
+ /*
+ * We don't try the uppercase version of HTTP_PROXY because of
+ * security reasons:
+ *
+ * When curl is used in a webserver application
+ * environment (cgi or php), this environment variable can
+ * be controlled by the web server user by setting the
+ * http header 'Proxy:' to some value.
+ *
+ * This can cause 'internal' http/ftp requests to be
+ * arbitrarily redirected by any external attacker.
+ */
+ if(!prox && !strcasecompare("http_proxy", proxy_env)) {
+ /* There was no lowercase variable, try the uppercase version: */
+ Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
prox=curl_getenv(proxy_env);
+ }
- /*
- * We don't try the uppercase version of HTTP_PROXY because of
- * security reasons:
- *
- * When curl is used in a webserver application
- * environment (cgi or php), this environment variable can
- * be controlled by the web server user by setting the
- * http header 'Proxy:' to some value.
- *
- * This can cause 'internal' http/ftp requests to be
- * arbitrarily redirected by any external attacker.
- */
- if(!prox && !strcasecompare("http_proxy", proxy_env)) {
- /* There was no lowercase variable, try the uppercase version: */
- Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
- prox=curl_getenv(proxy_env);
- }
-
- if(prox)
- proxy = prox; /* use this */
- else {
- proxy = curl_getenv("all_proxy"); /* default proxy to use */
- if(!proxy)
- proxy=curl_getenv("ALL_PROXY");
- }
- } /* if(!check_noproxy(conn->host.name, no_proxy)) - it wasn't specified
- non-proxy */
- free(no_proxy);
-
-#else /* !CURL_DISABLE_HTTP */
-
- (void)conn;
-#endif /* CURL_DISABLE_HTTP */
+ if(prox)
+ proxy = prox; /* use this */
+ else {
+ proxy = curl_getenv("all_proxy"); /* default proxy to use */
+ if(!proxy)
+ proxy=curl_getenv("ALL_PROXY");
+ }
return proxy;
}
+#endif /* CURL_DISABLE_HTTP */
/*
* If this is supposed to use a proxy, we need to figure out the proxy
@@ -5032,15 +5115,19 @@ static CURLcode parse_proxy(struct Curl_easy *data,
with reserved characters like ':' in them. */
Curl_safefree(proxyinfo->user);
proxyinfo->user = curl_easy_unescape(data, proxyuser, 0, NULL);
+ Curl_safefree(proxyuser);
- if(!proxyinfo->user)
+ if(!proxyinfo->user) {
+ Curl_safefree(proxypasswd);
return CURLE_OUT_OF_MEMORY;
+ }
Curl_safefree(proxyinfo->passwd);
if(proxypasswd && strlen(proxypasswd) < MAX_CURL_PASSWORD_LENGTH)
proxyinfo->passwd = curl_easy_unescape(data, proxypasswd, 0, NULL);
else
proxyinfo->passwd = strdup("");
+ Curl_safefree(proxypasswd);
if(!proxyinfo->passwd)
return CURLE_OUT_OF_MEMORY;
@@ -5097,6 +5184,168 @@ static CURLcode parse_proxy_auth(struct Curl_easy *data,
NULL, FALSE);
return result;
}
+
+/* create_conn helper to parse and init proxy values. to be called after unix
+ socket init but before any proxy vars are evaluated. */
+static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
+{
+ char *proxy = NULL;
+ char *socksproxy = NULL;
+ char *no_proxy = NULL;
+ CURLcode result = CURLE_OK;
+ struct Curl_easy *data = conn->data;
+
+ /*************************************************************
+ * Extract the user and password from the authentication string
+ *************************************************************/
+ if(conn->bits.proxy_user_passwd) {
+ result = parse_proxy_auth(data, conn);
+ if(result)
+ goto out;
+ }
+
+ /*************************************************************
+ * Detect what (if any) proxy to use
+ *************************************************************/
+ if(data->set.str[STRING_PROXY]) {
+ proxy = strdup(data->set.str[STRING_PROXY]);
+ /* if global proxy is set, this is it */
+ if(NULL == proxy) {
+ failf(data, "memory shortage");
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
+ }
+ }
+
+ if(data->set.str[STRING_PRE_PROXY]) {
+ socksproxy = strdup(data->set.str[STRING_PRE_PROXY]);
+ /* if global socks proxy is set, this is it */
+ if(NULL == socksproxy) {
+ failf(data, "memory shortage");
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
+ }
+ }
+
+ no_proxy = curl_getenv("no_proxy");
+ if(!no_proxy)
+ no_proxy = curl_getenv("NO_PROXY");
+
+ if(check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY]) ||
+ (!data->set.str[STRING_NOPROXY] &&
+ check_noproxy(conn->host.name, no_proxy))) {
+ Curl_safefree(proxy);
+ Curl_safefree(socksproxy);
+ }
+ else if(!proxy && !socksproxy)
+#ifndef CURL_DISABLE_HTTP
+ /* if the host is not in the noproxy list, detect proxy. */
+ proxy = detect_proxy(conn);
+#else /* !CURL_DISABLE_HTTP */
+ proxy = NULL;
+#endif /* CURL_DISABLE_HTTP */
+
+ Curl_safefree(no_proxy);
+
+#ifdef USE_UNIX_SOCKETS
+ /* For the time being do not mix proxy and unix domain sockets. See #1274 */
+ if(proxy && conn->unix_domain_socket) {
+ free(proxy);
+ proxy = NULL;
+ }
+#endif
+
+ if(proxy && (!*proxy || (conn->handler->flags & PROTOPT_NONETWORK))) {
+ free(proxy); /* Don't bother with an empty proxy string or if the
+ protocol doesn't work with network */
+ proxy = NULL;
+ }
+ if(socksproxy && (!*socksproxy ||
+ (conn->handler->flags & PROTOPT_NONETWORK))) {
+ free(socksproxy); /* Don't bother with an empty socks proxy string or if
+ the protocol doesn't work with network */
+ socksproxy = NULL;
+ }
+
+ /***********************************************************************
+ * If this is supposed to use a proxy, we need to figure out the proxy host
+ * name, proxy type and port number, so that we can re-use an existing
+ * connection that may exist registered to the same proxy host.
+ ***********************************************************************/
+ if(proxy || socksproxy) {
+ if(proxy) {
+ result = parse_proxy(data, conn, proxy, conn->http_proxy.proxytype);
+ Curl_safefree(proxy); /* parse_proxy copies the proxy string */
+ if(result)
+ goto out;
+ }
+
+ if(socksproxy) {
+ result = parse_proxy(data, conn, socksproxy,
+ conn->socks_proxy.proxytype);
+ /* parse_proxy copies the socks proxy string */
+ Curl_safefree(socksproxy);
+ if(result)
+ goto out;
+ }
+
+ if(conn->http_proxy.host.rawalloc) {
+#ifdef CURL_DISABLE_HTTP
+ /* asking for a HTTP proxy is a bit funny when HTTP is disabled... */
+ result = CURLE_UNSUPPORTED_PROTOCOL;
+ goto out;
+#else
+ /* force this connection's protocol to become HTTP if not already
+ compatible - if it isn't tunneling through */
+ if(!(conn->handler->protocol & PROTO_FAMILY_HTTP) &&
+ !conn->bits.tunnel_proxy)
+ conn->handler = &Curl_handler_http;
+
+ conn->bits.httpproxy = TRUE;
+#endif
+ }
+ else {
+ conn->bits.httpproxy = FALSE; /* not a HTTP proxy */
+ conn->bits.tunnel_proxy = FALSE; /* no tunneling if not HTTP */
+ }
+
+ if(conn->socks_proxy.host.rawalloc) {
+ if(!conn->http_proxy.host.rawalloc) {
+ /* once a socks proxy */
+ if(!conn->socks_proxy.user) {
+ conn->socks_proxy.user = conn->http_proxy.user;
+ conn->http_proxy.user = NULL;
+ Curl_safefree(conn->socks_proxy.passwd);
+ conn->socks_proxy.passwd = conn->http_proxy.passwd;
+ conn->http_proxy.passwd = NULL;
+ }
+ }
+ conn->bits.socksproxy = TRUE;
+ }
+ else
+ conn->bits.socksproxy = FALSE; /* not a socks proxy */
+ }
+ else {
+ conn->bits.socksproxy = FALSE;
+ conn->bits.httpproxy = FALSE;
+ }
+ conn->bits.proxy = conn->bits.httpproxy || conn->bits.socksproxy;
+
+ if(!conn->bits.proxy) {
+ /* we aren't using the proxy after all... */
+ conn->bits.proxy = FALSE;
+ conn->bits.httpproxy = FALSE;
+ conn->bits.socksproxy = FALSE;
+ conn->bits.proxy_user_passwd = FALSE;
+ conn->bits.tunnel_proxy = FALSE;
+ }
+
+out:
+
+ free(socksproxy);
+ free(proxy);
+ return result;
+}
#endif /* CURL_DISABLE_PROXY */
/*
@@ -5137,6 +5386,7 @@ static CURLcode parse_url_login(struct Curl_easy *data,
DEBUGASSERT(!**user);
DEBUGASSERT(!**passwd);
DEBUGASSERT(!**options);
+ DEBUGASSERT(conn->handler);
if(!ptr)
goto out;
@@ -5155,9 +5405,12 @@ static CURLcode parse_url_login(struct Curl_easy *data,
if(data->set.use_netrc == CURL_NETRC_REQUIRED)
goto out;
- /* We could use the login information in the URL so extract it */
+ /* We could use the login information in the URL so extract it. Only parse
+ options if the handler says we should. */
result = parse_login_details(login, ptr - login - 1,
- &userp, &passwdp, &optionsp);
+ &userp, &passwdp,
+ (conn->handler->flags & PROTOPT_URLOPTIONS)?
+ &optionsp:NULL);
if(result)
goto out;
@@ -5387,7 +5640,7 @@ static CURLcode parse_remote_port(struct Curl_easy *data,
}
#endif
- portptr = strrchr(conn->host.name, ':');
+ portptr = strchr(conn->host.name, ':');
}
if(data->set.use_port && data->state.allow_port) {
@@ -5442,15 +5695,16 @@ static CURLcode parse_remote_port(struct Curl_easy *data,
return CURLE_URL_MALFORMAT;
}
- else if(rest != &portptr[1]) {
+ if(rest[0]) {
+ failf(data, "Port number ended with '%c'", rest[0]);
+ return CURLE_URL_MALFORMAT;
+ }
+
+ if(rest != &portptr[1]) {
*portptr = '\0'; /* cut off the name there */
conn->remote_port = curlx_ultous(port);
}
else {
- if(rest[0]) {
- failf(data, "Illegal port number");
- return CURLE_URL_MALFORMAT;
- }
/* Browser behavior adaptation. If there's a colon with no digits after,
just cut off the name there which makes us ignore the colon and just
use the default port. Firefox and Chrome both do that. */
@@ -5584,6 +5838,10 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
char *portptr;
int port = -1;
+#if defined(CURL_DISABLE_VERBOSE_STRINGS)
+ (void) data;
+#endif
+
*hostname_result = NULL;
*port_result = -1;
@@ -5749,14 +6007,11 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
return result;
if(host && *host) {
- bool ipv6host;
conn->conn_to_host.rawalloc = host;
conn->conn_to_host.name = host;
conn->bits.conn_to_host = TRUE;
- ipv6host = strchr(host, ':') != NULL;
- infof(data, "Connecting to hostname: %s%s%s\n",
- ipv6host ? "[" : "", host, ipv6host ? "]" : "");
+ infof(data, "Connecting to hostname: %s\n", host);
}
else {
/* no "connect to host" */
@@ -5816,8 +6071,9 @@ static CURLcode resolve_server(struct Curl_easy *data,
if(!hostaddr)
result = CURLE_OUT_OF_MEMORY;
else {
- int longpath=0;
- hostaddr->addr = Curl_unix2addr(path, &longpath);
+ bool longpath = FALSE;
+ hostaddr->addr = Curl_unix2addr(path, &longpath,
+ conn->abstract_unix_socket);
if(hostaddr->addr)
hostaddr->inuse++;
else {
@@ -5847,7 +6103,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
if(conn->bits.conn_to_port)
conn->port = conn->conn_to_port;
else
- conn->port = conn->remote_port; /* it is the same port */
+ conn->port = conn->remote_port;
/* Resolve target host right on */
rc = Curl_resolv_timeout(conn, connhost->name, (int)conn->port,
@@ -5903,11 +6159,9 @@ static void reuse_conn(struct connectdata *old_conn,
{
free_fixed_hostname(&old_conn->http_proxy.host);
free_fixed_hostname(&old_conn->socks_proxy.host);
- free_fixed_hostname(&old_conn->proxy);
free(old_conn->http_proxy.host.rawalloc);
free(old_conn->socks_proxy.host.rawalloc);
- free(old_conn->proxy.rawalloc);
/* free the SSL config struct from this connection struct as this was
allocated in vain and is targeted for destruction */
@@ -5962,7 +6216,6 @@ static void reuse_conn(struct connectdata *old_conn,
Curl_persistconninfo(conn);
conn_reset_all_postponed_data(old_conn); /* free buffers */
- conn_reset_all_postponed_data(conn); /* reset unprocessed data */
/* re-use init */
conn->bits.reuse = TRUE; /* yes, we're re-using here */
@@ -5975,11 +6228,8 @@ static void reuse_conn(struct connectdata *old_conn,
Curl_safefree(old_conn->socks_proxy.passwd);
Curl_safefree(old_conn->localdev);
- Curl_llist_destroy(old_conn->send_pipe, NULL);
- Curl_llist_destroy(old_conn->recv_pipe, NULL);
-
- old_conn->send_pipe = NULL;
- old_conn->recv_pipe = NULL;
+ Curl_llist_destroy(&old_conn->send_pipe, NULL);
+ Curl_llist_destroy(&old_conn->recv_pipe, NULL);
Curl_safefree(old_conn->master_buffer);
@@ -6016,8 +6266,6 @@ static CURLcode create_conn(struct Curl_easy *data,
char *passwd = NULL;
char *options = NULL;
bool reuse;
- char *proxy = NULL;
- char *socksproxy = NULL;
bool prot_missing = FALSE;
bool connections_available = TRUE;
bool force_reuse = FALSE;
@@ -6161,147 +6409,24 @@ static CURLcode create_conn(struct Curl_easy *data,
}
}
-#ifndef CURL_DISABLE_PROXY
- /*************************************************************
- * Extract the user and password from the authentication string
- *************************************************************/
- if(conn->bits.proxy_user_passwd) {
- result = parse_proxy_auth(data, conn);
- if(result)
- goto out;
- }
-
- /*************************************************************
- * Detect what (if any) proxy to use
- *************************************************************/
- if(data->set.str[STRING_PROXY]) {
- proxy = strdup(data->set.str[STRING_PROXY]);
- /* if global proxy is set, this is it */
- if(NULL == proxy) {
- failf(data, "memory shortage");
- result = CURLE_OUT_OF_MEMORY;
- goto out;
- }
- }
-
- if(data->set.str[STRING_PRE_PROXY]) {
- socksproxy = strdup(data->set.str[STRING_PRE_PROXY]);
- /* if global socks proxy is set, this is it */
- if(NULL == socksproxy) {
- failf(data, "memory shortage");
- result = CURLE_OUT_OF_MEMORY;
- goto out;
- }
- }
-
- if(data->set.str[STRING_NOPROXY] &&
- check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY])) {
- Curl_safefree(proxy);
- Curl_safefree(socksproxy);
- }
- else if(!proxy && !socksproxy)
- proxy = detect_proxy(conn);
-
#ifdef USE_UNIX_SOCKETS
if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
- if(proxy) {
- free(proxy); /* Unix domain sockets cannot be proxied, so disable it */
- proxy = NULL;
- }
conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
if(conn->unix_domain_socket == NULL) {
result = CURLE_OUT_OF_MEMORY;
goto out;
}
+ conn->abstract_unix_socket = data->set.abstract_unix_socket;
}
#endif
- if(proxy && (!*proxy || (conn->handler->flags & PROTOPT_NONETWORK))) {
- free(proxy); /* Don't bother with an empty proxy string or if the
- protocol doesn't work with network */
- proxy = NULL;
- }
- if(socksproxy && (!*socksproxy ||
- (conn->handler->flags & PROTOPT_NONETWORK))) {
- free(socksproxy); /* Don't bother with an empty socks proxy string or if
- the protocol doesn't work with network */
- socksproxy = NULL;
- }
-
- /***********************************************************************
- * If this is supposed to use a proxy, we need to figure out the proxy host
- * name, proxy type and port number, so that we can re-use an existing
- * connection that may exist registered to the same proxy host.
- ***********************************************************************/
- if(proxy || socksproxy) {
- if(proxy) {
- result = parse_proxy(data, conn, proxy, conn->http_proxy.proxytype);
- Curl_safefree(proxy); /* parse_proxy copies the proxy string */
- if(result)
- goto out;
- }
-
- if(socksproxy) {
- result = parse_proxy(data, conn, socksproxy,
- conn->socks_proxy.proxytype);
- /* parse_proxy copies the socks proxy string */
- Curl_safefree(socksproxy);
- if(result)
- goto out;
- }
-
- if(conn->http_proxy.host.rawalloc) {
-#ifdef CURL_DISABLE_HTTP
- /* asking for a HTTP proxy is a bit funny when HTTP is disabled... */
- result = CURLE_UNSUPPORTED_PROTOCOL;
- goto out;
-#else
- /* force this connection's protocol to become HTTP if not already
- compatible - if it isn't tunneling through */
- if(!(conn->handler->protocol & PROTO_FAMILY_HTTP) &&
- !conn->bits.tunnel_proxy)
- conn->handler = &Curl_handler_http;
-
- conn->bits.httpproxy = TRUE;
+ /* After the unix socket init but before the proxy vars are used, parse and
+ initialize the proxy vars */
+#ifndef CURL_DISABLE_PROXY
+ result = create_conn_helper_init_proxy(conn);
+ if(result)
+ goto out;
#endif
- }
- else {
- conn->bits.httpproxy = FALSE; /* not a HTTP proxy */
- conn->bits.tunnel_proxy = FALSE; /* no tunneling if not HTTP */
- }
-
- if(conn->socks_proxy.host.rawalloc) {
- if(!conn->http_proxy.host.rawalloc) {
- /* once a socks proxy */
- if(!conn->socks_proxy.user) {
- conn->socks_proxy.user = conn->http_proxy.user;
- conn->http_proxy.user = NULL;
- Curl_safefree(conn->socks_proxy.passwd);
- conn->socks_proxy.passwd = conn->http_proxy.passwd;
- conn->http_proxy.passwd = NULL;
- }
- }
- conn->bits.socksproxy = TRUE;
- }
- else
- conn->bits.socksproxy = FALSE; /* not a socks proxy */
- }
- else {
- conn->bits.socksproxy = FALSE;
- conn->bits.httpproxy = FALSE;
- }
- conn->bits.proxy = conn->bits.httpproxy || conn->bits.socksproxy;
-
- if(!conn->bits.proxy) {
- /* we aren't using the proxy after all... */
- conn->bits.proxy = FALSE;
- conn->bits.httpproxy = FALSE;
- conn->bits.socksproxy = FALSE;
- conn->bits.proxy_user_passwd = FALSE;
- conn->bits.tunnel_proxy = FALSE;
- }
-
-#endif /* CURL_DISABLE_PROXY */
/*************************************************************
* If the protocol is using SSL and HTTP proxy is used, we set
@@ -6340,12 +6465,14 @@ static CURLcode create_conn(struct Curl_easy *data,
fix_hostname(conn, &conn->host);
if(conn->bits.conn_to_host)
fix_hostname(conn, &conn->conn_to_host);
- if(conn->proxy.name && *conn->proxy.name)
- fix_hostname(conn, &conn->proxy);
+ if(conn->bits.httpproxy)
+ fix_hostname(conn, &conn->http_proxy.host);
+ if(conn->bits.socksproxy)
+ fix_hostname(conn, &conn->socks_proxy.host);
/*************************************************************
* Check whether the host and the "connect to host" are equal.
- * Do this after the hostnames have been IDN-fixed .
+ * Do this after the hostnames have been IDN-fixed.
*************************************************************/
if(conn->bits.conn_to_host &&
strcasecompare(conn->conn_to_host.name, conn->host.name)) {
@@ -6501,7 +6628,7 @@ static CURLcode create_conn(struct Curl_easy *data,
/* If we found a reusable connection, we may still want to
open a new connection if we are pipelining. */
if(reuse && !force_reuse && IsPipeliningPossible(data, conn_temp)) {
- size_t pipelen = conn_temp->send_pipe->size + conn_temp->recv_pipe->size;
+ size_t pipelen = conn_temp->send_pipe.size + conn_temp->recv_pipe.size;
if(pipelen > 0) {
infof(data, "Found connection %ld, with requests in the pipe (%zu)\n",
conn_temp->connection_id, pipelen);
@@ -6661,13 +6788,11 @@ static CURLcode create_conn(struct Curl_easy *data,
*************************************************************/
result = resolve_server(data, conn, async);
- out:
+out:
free(options);
free(passwd);
free(user);
- free(socksproxy);
- free(proxy);
return result;
}
@@ -6771,7 +6896,7 @@ CURLcode Curl_connect(struct Curl_easy *data,
if(!result) {
/* no error */
- if((*in_connect)->send_pipe->size || (*in_connect)->recv_pipe->size)
+ if((*in_connect)->send_pipe.size || (*in_connect)->recv_pipe.size)
/* pipelining */
*protocol_done = TRUE;
else if(!*asyncp) {
diff --git a/Utilities/cmcurl/lib/urldata.h b/Utilities/cmcurl/lib/urldata.h
index 0271d26..3c94553 100644
--- a/Utilities/cmcurl/lib/urldata.h
+++ b/Utilities/cmcurl/lib/urldata.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -136,8 +136,10 @@
#undef realloc
#endif /* USE_AXTLS */
-#ifdef USE_SCHANNEL
+#if defined(USE_SCHANNEL) || defined(USE_WINDOWS_SSPI)
#include "curl_sspi.h"
+#endif
+#ifdef USE_SCHANNEL
#include <schnlsp.h>
#include <schannel.h>
#endif
@@ -201,6 +203,9 @@
/* Download buffer size, keep it fairly big for speed reasons */
#undef BUFSIZE
#define BUFSIZE CURL_MAX_WRITE_SIZE
+#undef MAX_BUFSIZE
+#define MAX_BUFSIZE CURL_MAX_READ_SIZE
+#define CURL_BUFSIZE(x) ((x)?(x):(BUFSIZE))
/* Initial size of the buffer to store headers in, it'll be enlarged in case
of need. */
@@ -311,7 +316,7 @@ struct ssl_connect_data {
PRFileDesc *handle;
char *client_nickname;
struct Curl_easy *data;
- struct curl_llist *obj_list;
+ struct curl_llist obj_list;
PK11GenericObject *obj_clicert;
#elif defined(USE_GSKIT)
gsk_handle handle;
@@ -345,6 +350,7 @@ struct ssl_connect_data {
struct ssl_primary_config {
long version; /* what version the client wants to use */
+ long version_max; /* max supported version the client wants to use*/
bool verifypeer; /* set TRUE if this is desired */
bool verifyhost; /* set TRUE if CN/SAN must match hostname */
bool verifystatus; /* set TRUE if certificate status must be checked */
@@ -354,6 +360,7 @@ struct ssl_primary_config {
char *random_file; /* path to file containing "random" data */
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
+ bool sessionid; /* cache session IDs or not */
};
struct ssl_config_data {
@@ -383,7 +390,6 @@ struct ssl_config_data {
};
struct ssl_general_config {
- bool sessionid; /* cache session IDs or not */
size_t max_ssl_sessions; /* SSL session id cache size */
};
@@ -405,6 +411,7 @@ struct digestdata {
#if defined(USE_WINDOWS_SSPI)
BYTE *input_token;
size_t input_token_len;
+ CtxtHandle *http_context;
#else
char *nonce;
char *cnonce;
@@ -842,6 +849,8 @@ struct Curl_handler {
request instead of per connection */
#define PROTOPT_ALPN_NPN (1<<8) /* set ALPN and/or NPN for this */
#define PROTOPT_STREAM (1<<9) /* a protocol with individual logical streams */
+#define PROTOPT_URLOPTIONS (1<<10) /* allow options part in the userinfo field
+ of the URL */
/* return the count of bytes sent, or -1 on error */
typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */
@@ -931,7 +940,6 @@ struct connectdata {
char *secondaryhostname; /* secondary socket host name (ftp) */
struct hostname conn_to_host; /* the host to connect to. valid only if
bits.conn_to_host is set */
- struct hostname proxy;
struct proxy_info socks_proxy;
struct proxy_info http_proxy;
@@ -1050,10 +1058,10 @@ struct connectdata {
handle */
bool writechannel_inuse; /* whether the write channel is in use by an easy
handle */
- struct curl_llist *send_pipe; /* List of handles waiting to
- send on this pipeline */
- struct curl_llist *recv_pipe; /* List of handles waiting to read
- their responses on this pipeline */
+ struct curl_llist send_pipe; /* List of handles waiting to send on this
+ pipeline */
+ struct curl_llist recv_pipe; /* List of handles waiting to read their
+ responses on this pipeline */
char *master_buffer; /* The master buffer allocated on-demand;
used for pipelining. */
size_t read_pos; /* Current read position in the master buffer */
@@ -1133,6 +1141,7 @@ struct connectdata {
#ifdef USE_UNIX_SOCKETS
char *unix_domain_socket;
+ bool abstract_unix_socket;
#endif
};
@@ -1274,8 +1283,8 @@ struct auth {
this resource */
bool done; /* TRUE when the auth phase is done and ready to do the *actual*
request */
- bool multi; /* TRUE if this is not yet authenticated but within the auth
- multipass negotiation */
+ bool multipass; /* TRUE if this is not yet authenticated but within the
+ auth multipass negotiation */
bool iestyle; /* TRUE if digest should be done IE-style or FALSE if it should
be RFC compliant */
};
@@ -1285,6 +1294,19 @@ struct Curl_http2_dep {
struct Curl_easy *data;
};
+/*
+ * This struct is for holding data that was attemped to get sent to the user's
+ * callback but is held due to pausing. One instance per type (BOTH, HEADER,
+ * BODY).
+ */
+struct tempbuf {
+ char *buf; /* allocated buffer to keep data in when a write callback
+ returns to make the connection paused */
+ size_t len; /* size of the 'tempwrite' allocated buffer */
+ int type; /* type of the 'tempwrite' buffer as a bitmask that is used with
+ Curl_client_write() */
+};
+
struct UrlState {
/* Points to the connection cache */
@@ -1303,9 +1325,9 @@ struct UrlState {
char *headerbuff; /* allocated buffer to store headers in */
size_t headersize; /* size of the allocation */
- char buffer[BUFSIZE+1]; /* download buffer */
+ char *buffer; /* download buffer */
char uploadbuffer[BUFSIZE+1]; /* upload buffer */
- curl_off_t current_speed; /* the ProgressShow() funcion sets this,
+ curl_off_t current_speed; /* the ProgressShow() function sets this,
bytes / second */
bool this_is_a_follow; /* this is a followed Location: request */
@@ -1318,11 +1340,8 @@ struct UrlState {
int first_remote_port; /* remote port of the first (not followed) request */
struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
long sessionage; /* number of the most recent session */
- char *tempwrite; /* allocated buffer to keep data in when a write
- callback returns to make the connection paused */
- size_t tempwritesize; /* size of the 'tempwrite' allocated buffer */
- int tempwritetype; /* type of the 'tempwrite' buffer as a bitmask that is
- used with Curl_client_write() */
+ unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
+ struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */
char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */
bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
This must be set to FALSE every time _easy_perform() is
@@ -1355,7 +1374,7 @@ struct UrlState {
#endif /* USE_OPENSSL */
struct timeval expiretime; /* set this with Curl_expire() only */
struct Curl_tree timenode; /* for the splay stuff */
- struct curl_llist *timeoutlist; /* list of pending timeouts */
+ struct curl_llist timeoutlist; /* list of pending timeouts */
/* a place to store the most recently set FTP entrypath */
char *most_recent_ftp_entrypath;
@@ -1638,7 +1657,6 @@ struct UserDefined {
struct ssl_config_data proxy_ssl; /* user defined SSL stuff for proxy */
struct ssl_general_config general_ssl; /* general user defined SSL stuff */
curl_proxytype proxytype; /* what kind of proxy that is in use */
- curl_proxytype socks_proxytype; /* what kind of socks proxy that is in use */
long dns_cache_timeout; /* DNS cache timeout */
long buffer_size; /* size of receive buffer to use */
void *private_data; /* application-private data */
@@ -1748,12 +1766,16 @@ struct UserDefined {
bool pipewait; /* wait for pipe/multiplex status before starting a
new connection */
long expect_100_timeout; /* in milliseconds */
+ bool suppress_connect_headers; /* suppress proxy CONNECT response headers
+ from user callbacks */
struct Curl_easy *stream_depends_on;
bool stream_depends_e; /* set or don't set the Exclusive bit */
int stream_weight;
struct Curl_http2_dep *stream_dependents;
+
+ bool abstract_unix_socket;
};
struct Names {
diff --git a/Utilities/cmcurl/lib/vauth/digest.c b/Utilities/cmcurl/lib/vauth/digest.c
index 7d9200a..31d25cf 100644
--- a/Utilities/cmcurl/lib/vauth/digest.c
+++ b/Utilities/cmcurl/lib/vauth/digest.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -237,7 +237,7 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
* auth_decode_digest_md5_message()
*
* This is used internally to decode an already encoded DIGEST-MD5 challenge
- * message into the seperate attributes.
+ * message into the separate attributes.
*
* Parameters:
*
@@ -366,7 +366,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
char qop[] = DIGEST_QOP_VALUE_STRING_AUTH;
char *spn = NULL;
- /* Decode the challange message */
+ /* Decode the challenge message */
result = auth_decode_digest_md5_message(chlg64, nonce, sizeof(nonce),
realm, sizeof(realm),
algorithm, sizeof(algorithm),
@@ -502,7 +502,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
/*
* Curl_auth_decode_digest_http_message()
*
- * This is used to decode a HTTP DIGEST challenge message into the seperate
+ * This is used to decode a HTTP DIGEST challenge message into the separate
* attributes.
*
* Parameters:
diff --git a/Utilities/cmcurl/lib/vauth/digest_sspi.c b/Utilities/cmcurl/lib/vauth/digest_sspi.c
index b9ceb12..0bd9444 100644
--- a/Utilities/cmcurl/lib/vauth/digest_sspi.c
+++ b/Utilities/cmcurl/lib/vauth/digest_sspi.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
- * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -320,7 +320,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg,
/*
* Curl_auth_decode_digest_http_message()
*
- * This is used to decode a HTTP DIGEST challenge message into the seperate
+ * This is used to decode a HTTP DIGEST challenge message into the separate
* attributes.
*
* Parameters:
@@ -335,13 +335,44 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
{
size_t chlglen = strlen(chlg);
- /* We had an input token before and we got another one now. This means we
- provided bad credentials in the previous request. */
- if(digest->input_token)
- return CURLE_BAD_CONTENT_ENCODING;
+ /* We had an input token before so if there's another one now that means we
+ provided bad credentials in the previous request or it's stale. */
+ if(digest->input_token) {
+ bool stale = false;
+ const char *p = chlg;
+
+ /* Check for the 'stale' directive */
+ for(;;) {
+ char value[DIGEST_MAX_VALUE_LENGTH];
+ char content[DIGEST_MAX_CONTENT_LENGTH];
+
+ while(*p && ISSPACE(*p))
+ p++;
+
+ if(!Curl_auth_digest_get_pair(p, value, content, &p))
+ break;
+
+ if(Curl_strcasecompare(value, "stale")
+ && Curl_strcasecompare(content, "true")) {
+ stale = true;
+ break;
+ }
+
+ while(*p && ISSPACE(*p))
+ p++;
+
+ if(',' == *p)
+ p++;
+ }
+
+ if(stale)
+ Curl_auth_digest_cleanup(digest);
+ else
+ return CURLE_LOGIN_DENIED;
+ }
- /* Simply store the challenge for use later */
- digest->input_token = (BYTE *) Curl_memdup(chlg, chlglen);
+ /* Store the challenge for use later */
+ digest->input_token = (BYTE *) Curl_memdup(chlg, chlglen + 1);
if(!digest->input_token)
return CURLE_OUT_OF_MEMORY;
@@ -379,21 +410,13 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
char **outptr, size_t *outlen)
{
size_t token_max;
- CredHandle credentials;
- CtxtHandle context;
char *resp;
BYTE *output_token;
+ size_t output_token_len = 0;
PSecPkgInfo SecurityPackage;
- SEC_WINNT_AUTH_IDENTITY identity;
- SEC_WINNT_AUTH_IDENTITY *p_identity;
- SecBuffer chlg_buf[3];
- SecBuffer resp_buf;
+ SecBuffer chlg_buf[5];
SecBufferDesc chlg_desc;
- SecBufferDesc resp_desc;
SECURITY_STATUS status;
- unsigned long attrs;
- TimeStamp expiry; /* For Windows 9x compatibility of SSPI calls */
- TCHAR *spn;
(void) data;
@@ -408,123 +431,168 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
/* Release the package buffer as it is not required anymore */
s_pSecFn->FreeContextBuffer(SecurityPackage);
- if(userp && *userp) {
- /* Populate our identity structure */
- if(Curl_create_sspi_identity(userp, passwdp, &identity))
- return CURLE_OUT_OF_MEMORY;
-
- /* Populate our identity domain */
- if(Curl_override_sspi_http_realm((const char *) digest->input_token,
- &identity))
- return CURLE_OUT_OF_MEMORY;
+ /* Allocate the output buffer according to the max token size as indicated
+ by the security package */
+ output_token = malloc(token_max);
+ if(!output_token) {
+ return CURLE_OUT_OF_MEMORY;
+ }
- /* Allow proper cleanup of the identity structure */
- p_identity = &identity;
+ if(digest->http_context) {
+ chlg_desc.ulVersion = SECBUFFER_VERSION;
+ chlg_desc.cBuffers = 5;
+ chlg_desc.pBuffers = chlg_buf;
+ chlg_buf[0].BufferType = SECBUFFER_TOKEN;
+ chlg_buf[0].pvBuffer = NULL;
+ chlg_buf[0].cbBuffer = 0;
+ chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
+ chlg_buf[1].pvBuffer = (void *) request;
+ chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
+ chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
+ chlg_buf[2].pvBuffer = (void *) uripath;
+ chlg_buf[2].cbBuffer = curlx_uztoul(strlen((const char *) uripath));
+ chlg_buf[3].BufferType = SECBUFFER_PKG_PARAMS;
+ chlg_buf[3].pvBuffer = NULL;
+ chlg_buf[3].cbBuffer = 0;
+ chlg_buf[4].BufferType = SECBUFFER_PADDING;
+ chlg_buf[4].pvBuffer = output_token;
+ chlg_buf[4].cbBuffer = curlx_uztoul(token_max);
+
+ status = s_pSecFn->MakeSignature(digest->http_context, 0, &chlg_desc, 0);
+ if(status == SEC_E_OK)
+ output_token_len = chlg_buf[4].cbBuffer;
+ else { /* delete the context so a new one can be made */
+ infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx\n",
+ (long)status);
+ s_pSecFn->DeleteSecurityContext(digest->http_context);
+ Curl_safefree(digest->http_context);
+ }
}
- else
- /* Use the current Windows user */
- p_identity = NULL;
- /* Acquire our credentials handle */
- status = s_pSecFn->AcquireCredentialsHandle(NULL,
- (TCHAR *) TEXT(SP_NAME_DIGEST),
- SECPKG_CRED_OUTBOUND, NULL,
- p_identity, NULL, NULL,
- &credentials, &expiry);
- if(status != SEC_E_OK) {
- Curl_sspi_free_identity(p_identity);
+ if(!digest->http_context) {
+ CredHandle credentials;
+ SEC_WINNT_AUTH_IDENTITY identity;
+ SEC_WINNT_AUTH_IDENTITY *p_identity;
+ SecBuffer resp_buf;
+ SecBufferDesc resp_desc;
+ unsigned long attrs;
+ TimeStamp expiry; /* For Windows 9x compatibility of SSPI calls */
+ TCHAR *spn;
+
+ if(userp && *userp) {
+ /* Populate our identity structure */
+ if(Curl_create_sspi_identity(userp, passwdp, &identity)) {
+ free(output_token);
+ return CURLE_OUT_OF_MEMORY;
+ }
- return CURLE_LOGIN_DENIED;
- }
+ /* Populate our identity domain */
+ if(Curl_override_sspi_http_realm((const char *) digest->input_token,
+ &identity)) {
+ free(output_token);
+ return CURLE_OUT_OF_MEMORY;
+ }
- /* Allocate the output buffer according to the max token size as indicated
- by the security package */
- output_token = malloc(token_max);
- if(!output_token) {
- s_pSecFn->FreeCredentialsHandle(&credentials);
+ /* Allow proper cleanup of the identity structure */
+ p_identity = &identity;
+ }
+ else
+ /* Use the current Windows user */
+ p_identity = NULL;
+
+ /* Acquire our credentials handle */
+ status = s_pSecFn->AcquireCredentialsHandle(NULL,
+ (TCHAR *) TEXT(SP_NAME_DIGEST),
+ SECPKG_CRED_OUTBOUND, NULL,
+ p_identity, NULL, NULL,
+ &credentials, &expiry);
+ if(status != SEC_E_OK) {
+ Curl_sspi_free_identity(p_identity);
+ free(output_token);
- Curl_sspi_free_identity(p_identity);
+ return CURLE_LOGIN_DENIED;
+ }
- return CURLE_OUT_OF_MEMORY;
- }
+ /* Setup the challenge "input" security buffer if present */
+ chlg_desc.ulVersion = SECBUFFER_VERSION;
+ chlg_desc.cBuffers = 3;
+ chlg_desc.pBuffers = chlg_buf;
+ chlg_buf[0].BufferType = SECBUFFER_TOKEN;
+ chlg_buf[0].pvBuffer = digest->input_token;
+ chlg_buf[0].cbBuffer = curlx_uztoul(digest->input_token_len);
+ chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
+ chlg_buf[1].pvBuffer = (void *) request;
+ chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
+ chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
+ chlg_buf[2].pvBuffer = NULL;
+ chlg_buf[2].cbBuffer = 0;
+
+ /* Setup the response "output" security buffer */
+ resp_desc.ulVersion = SECBUFFER_VERSION;
+ resp_desc.cBuffers = 1;
+ resp_desc.pBuffers = &resp_buf;
+ resp_buf.BufferType = SECBUFFER_TOKEN;
+ resp_buf.pvBuffer = output_token;
+ resp_buf.cbBuffer = curlx_uztoul(token_max);
+
+ spn = Curl_convert_UTF8_to_tchar((char *) uripath);
+ if(!spn) {
+ s_pSecFn->FreeCredentialsHandle(&credentials);
+
+ Curl_sspi_free_identity(p_identity);
+ free(output_token);
- /* Setup the challenge "input" security buffer if present */
- chlg_desc.ulVersion = SECBUFFER_VERSION;
- chlg_desc.cBuffers = 3;
- chlg_desc.pBuffers = chlg_buf;
- chlg_buf[0].BufferType = SECBUFFER_TOKEN;
- chlg_buf[0].pvBuffer = digest->input_token;
- chlg_buf[0].cbBuffer = curlx_uztoul(digest->input_token_len);
- chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
- chlg_buf[1].pvBuffer = (void *) request;
- chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
- chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
- chlg_buf[2].pvBuffer = NULL;
- chlg_buf[2].cbBuffer = 0;
+ return CURLE_OUT_OF_MEMORY;
+ }
- /* Setup the response "output" security buffer */
- resp_desc.ulVersion = SECBUFFER_VERSION;
- resp_desc.cBuffers = 1;
- resp_desc.pBuffers = &resp_buf;
- resp_buf.BufferType = SECBUFFER_TOKEN;
- resp_buf.pvBuffer = output_token;
- resp_buf.cbBuffer = curlx_uztoul(token_max);
+ /* Allocate our new context handle */
+ digest->http_context = calloc(1, sizeof(CtxtHandle));
+ if(!digest->http_context)
+ return CURLE_OUT_OF_MEMORY;
- spn = Curl_convert_UTF8_to_tchar((char *) uripath);
- if(!spn) {
- s_pSecFn->FreeCredentialsHandle(&credentials);
+ /* Generate our response message */
+ status = s_pSecFn->InitializeSecurityContext(&credentials, NULL,
+ spn,
+ ISC_REQ_USE_HTTP_STYLE, 0, 0,
+ &chlg_desc, 0,
+ digest->http_context,
+ &resp_desc, &attrs, &expiry);
+ Curl_unicodefree(spn);
+
+ if(status == SEC_I_COMPLETE_NEEDED ||
+ status == SEC_I_COMPLETE_AND_CONTINUE)
+ s_pSecFn->CompleteAuthToken(&credentials, &resp_desc);
+ else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
+ s_pSecFn->FreeCredentialsHandle(&credentials);
+
+ Curl_sspi_free_identity(p_identity);
+ free(output_token);
- Curl_sspi_free_identity(p_identity);
- free(output_token);
+ Curl_safefree(digest->http_context);
- return CURLE_OUT_OF_MEMORY;
- }
+ return CURLE_OUT_OF_MEMORY;
+ }
- /* Generate our reponse message */
- status = s_pSecFn->InitializeSecurityContext(&credentials, NULL,
- spn,
- ISC_REQ_USE_HTTP_STYLE, 0, 0,
- &chlg_desc, 0, &context,
- &resp_desc, &attrs, &expiry);
- Curl_unicodefree(spn);
+ output_token_len = resp_buf.cbBuffer;
- if(status == SEC_I_COMPLETE_NEEDED ||
- status == SEC_I_COMPLETE_AND_CONTINUE)
- s_pSecFn->CompleteAuthToken(&credentials, &resp_desc);
- else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
s_pSecFn->FreeCredentialsHandle(&credentials);
-
Curl_sspi_free_identity(p_identity);
- free(output_token);
-
- return CURLE_OUT_OF_MEMORY;
}
- resp = malloc(resp_buf.cbBuffer + 1);
+ resp = malloc(output_token_len + 1);
if(!resp) {
- s_pSecFn->DeleteSecurityContext(&context);
- s_pSecFn->FreeCredentialsHandle(&credentials);
-
- Curl_sspi_free_identity(p_identity);
free(output_token);
return CURLE_OUT_OF_MEMORY;
}
- /* Copy the generated reponse */
- memcpy(resp, resp_buf.pvBuffer, resp_buf.cbBuffer);
- resp[resp_buf.cbBuffer] = 0x00;
+ /* Copy the generated response */
+ memcpy(resp, output_token, output_token_len);
+ resp[output_token_len] = 0;
/* Return the response */
*outptr = resp;
- *outlen = resp_buf.cbBuffer;
-
- /* Free our handles */
- s_pSecFn->DeleteSecurityContext(&context);
- s_pSecFn->FreeCredentialsHandle(&credentials);
-
- /* Free the identity structure */
- Curl_sspi_free_identity(p_identity);
+ *outlen = output_token_len;
/* Free the response buffer */
free(output_token);
@@ -549,6 +617,12 @@ void Curl_auth_digest_cleanup(struct digestdata *digest)
/* Reset any variables */
digest->input_token_len = 0;
+
+ /* Delete security context */
+ if(digest->http_context) {
+ s_pSecFn->DeleteSecurityContext(digest->http_context);
+ Curl_safefree(digest->http_context);
+ }
}
#endif /* USE_WINDOWS_SSPI && !CURL_DISABLE_CRYPTO_AUTH */
diff --git a/Utilities/cmcurl/lib/vauth/krb5_gssapi.c b/Utilities/cmcurl/lib/vauth/krb5_gssapi.c
index c754fae..560ecc5 100644
--- a/Utilities/cmcurl/lib/vauth/krb5_gssapi.c
+++ b/Utilities/cmcurl/lib/vauth/krb5_gssapi.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2014 - 2017, Steve Holme, <steve_holme@hotmail.com>.
* Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
@@ -68,7 +68,7 @@ bool Curl_auth_is_gssapi_supported(void)
* passdwp [in] - The user's password.
* service [in] - The service type such as http, smtp, pop or imap.
* host [in[ - The host name.
- * mutual_auth [in] - Flag specifing whether or not mutual authentication
+ * mutual_auth [in] - Flag specifying whether or not mutual authentication
* is enabled.
* chlg64 [in] - Pointer to the optional base64 encoded challenge
* message.
diff --git a/Utilities/cmcurl/lib/vauth/krb5_sspi.c b/Utilities/cmcurl/lib/vauth/krb5_sspi.c
index 151794e..1b4cef4 100644
--- a/Utilities/cmcurl/lib/vauth/krb5_sspi.c
+++ b/Utilities/cmcurl/lib/vauth/krb5_sspi.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2014 - 2017, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -74,7 +74,7 @@ bool Curl_auth_is_gssapi_supported(void)
* passdwp [in] - The user's password.
* service [in] - The service type such as http, smtp, pop or imap.
* host [in] - The host name.
- * mutual_auth [in] - Flag specifing whether or not mutual authentication
+ * mutual_auth [in] - Flag specifying whether or not mutual authentication
* is enabled.
* chlg64 [in] - The optional base64 encoded challenge message.
* krb5 [in/out] - The Kerberos 5 data struct being used and modified.
diff --git a/Utilities/cmcurl/lib/vauth/ntlm.c b/Utilities/cmcurl/lib/vauth/ntlm.c
index b4d345d..d02eec4 100644
--- a/Utilities/cmcurl/lib/vauth/ntlm.c
+++ b/Utilities/cmcurl/lib/vauth/ntlm.c
@@ -27,7 +27,7 @@
/*
* NTLM details:
*
- * http://davenport.sourceforge.net/ntlm.html
+ * https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
@@ -394,7 +394,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(const char *userp,
/* Clean up any former leftovers and initialise to defaults */
Curl_auth_ntlm_cleanup(ntlm);
-#if USE_NTRESPONSES && USE_NTLM2SESSION
+#if defined(USE_NTRESPONSES) && defined(USE_NTLM2SESSION)
#define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY
#else
#define NTLM2FLAG 0
@@ -509,7 +509,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
unsigned char ntlmbuf[NTLM_BUFSIZE];
int lmrespoff;
unsigned char lmresp[24]; /* fixed-size */
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
int ntrespoff;
unsigned int ntresplen = 24;
unsigned char ntresp[24]; /* fixed-size */
@@ -552,7 +552,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
hostlen = strlen(host);
}
-#if USE_NTRESPONSES && USE_NTLM_V2
+#if defined(USE_NTRESPONSES) && defined(USE_NTLM_V2)
if(ntlm->target_info_len) {
unsigned char ntbuffer[0x18];
unsigned int entropy[2];
@@ -590,7 +590,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
else
#endif
-#if USE_NTRESPONSES && USE_NTLM2SESSION
+#if defined(USE_NTRESPONSES) && defined(USE_NTLM2SESSION)
/* We don't support NTLM2 if we don't have USE_NTRESPONSES */
if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) {
unsigned char ntbuffer[0x18];
@@ -630,12 +630,12 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
#endif
{
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
unsigned char ntbuffer[0x18];
#endif
unsigned char lmbuffer[0x18];
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer);
if(result)
return result;
@@ -651,7 +651,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
/* A safer but less compatible alternative is:
* Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp);
- * See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */
+ * See https://davenport.sourceforge.io/ntlm.html#ntlmVersion2 */
}
if(unicode) {
@@ -661,7 +661,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
}
lmrespoff = 64; /* size of the message header */
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
ntrespoff = lmrespoff + 0x18;
domoff = ntrespoff + ntresplen;
#else
@@ -721,7 +721,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
SHORTPAIR(lmrespoff),
0x0, 0x0,
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
SHORTPAIR(ntresplen), /* NT-response length, twice */
SHORTPAIR(ntresplen),
SHORTPAIR(ntrespoff),
@@ -768,7 +768,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
ntlm_print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18);
});
-#if USE_NTRESPONSES
+#ifdef USE_NTRESPONSES
if(size < (NTLM_BUFSIZE - ntresplen)) {
DEBUGASSERT(size == (size_t)ntrespoff);
memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen);
diff --git a/Utilities/cmcurl/lib/vauth/ntlm.h b/Utilities/cmcurl/lib/vauth/ntlm.h
index b14e7a5..f906a3c 100644
--- a/Utilities/cmcurl/lib/vauth/ntlm.h
+++ b/Utilities/cmcurl/lib/vauth/ntlm.h
@@ -32,7 +32,7 @@
/* Stuff only required for curl_ntlm_msgs.c */
#ifdef BUILDING_CURL_NTLM_MSGS_C
-/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */
+/* Flag bits definitions based on https://davenport.sourceforge.io/ntlm.html */
#define NTLMFLAG_NEGOTIATE_UNICODE (1<<0)
/* Indicates that Unicode strings are supported for use in security buffer
diff --git a/Utilities/cmcurl/lib/vauth/spnego_sspi.c b/Utilities/cmcurl/lib/vauth/spnego_sspi.c
index 5fa95e2..a6797cd 100644
--- a/Utilities/cmcurl/lib/vauth/spnego_sspi.c
+++ b/Utilities/cmcurl/lib/vauth/spnego_sspi.c
@@ -34,6 +34,7 @@
#include "warnless.h"
#include "curl_multibyte.h"
#include "sendf.h"
+#include "strerror.h"
/* The last #include files should be: */
#include "curl_memory.h"
@@ -224,6 +225,8 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
free(chlg);
if(GSS_ERROR(nego->status)) {
+ failf(data, "InitializeSecurityContext failed: %s",
+ Curl_sspi_strerror(data->easy_conn, nego->status));
return CURLE_OUT_OF_MEMORY;
}
diff --git a/Utilities/cmcurl/lib/vtls/axtls.c b/Utilities/cmcurl/lib/vtls/axtls.c
index ff4634e..f0e3766 100644
--- a/Utilities/cmcurl/lib/vtls/axtls.c
+++ b/Utilities/cmcurl/lib/vtls/axtls.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010, DirecTV, Contact: Eric Hu, <ehu@directv.com>.
- * Copyright (C) 2010 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -156,6 +156,12 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex)
same connection */
return CURLE_OK;
+ if(SSL_CONN_CONFIG(version_max) != CURL_SSLVERSION_MAX_NONE) {
+ failf(data, "axtls does not support CURL_SSLVERSION_MAX");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+
+
/* axTLS only supports TLSv1 */
/* check to see if we've been told to use an explicit SSL/TLS version */
switch(SSL_CONN_CONFIG(version)) {
@@ -256,7 +262,7 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex)
* 2) setting up callbacks. these seem gnutls specific
*/
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
const uint8_t *ssl_sessionid;
size_t ssl_idsize;
@@ -267,13 +273,13 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex)
/* we got a session id, use it! */
infof(data, "SSL re-using session ID\n");
ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex],
- ssl_sessionid, (uint8_t)ssl_idsize);
+ ssl_sessionid, (uint8_t)ssl_idsize, NULL);
}
Curl_ssl_sessionid_unlock(conn);
}
if(!ssl)
- ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex], NULL, 0);
+ ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex], NULL, 0, NULL);
conn->ssl[sockindex].ssl = ssl;
return CURLE_OK;
@@ -386,9 +392,9 @@ static CURLcode connect_finish(struct connectdata *conn, int sockindex)
conn->send[sockindex] = axtls_send;
/* Put our freshly minted SSL session in cache */
- if(data->set.general_ssl.sessionid) {
- const uint8_t *ssl_sessionid = ssl_get_session_id_size(ssl);
- size_t ssl_idsize = ssl_get_session_id(ssl);
+ if(SSL_SET_OPTION(primary.sessionid)) {
+ const uint8_t *ssl_sessionid = ssl_get_session_id(ssl);
+ size_t ssl_idsize = ssl_get_session_id_size(ssl);
Curl_ssl_sessionid_lock(conn);
if(Curl_ssl_addsessionid(conn, (void *) ssl_sessionid, ssl_idsize,
sockindex) != CURLE_OK)
@@ -680,9 +686,9 @@ size_t Curl_axtls_version(char *buffer, size_t size)
return snprintf(buffer, size, "axTLS/%s", ssl_version());
}
-int Curl_axtls_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length)
+CURLcode Curl_axtls_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length)
{
static bool ssl_seeded = FALSE;
(void)data;
@@ -694,7 +700,7 @@ int Curl_axtls_random(struct Curl_easy *data,
RNG_initialize();
}
get_random((int)length, entropy);
- return 0;
+ return CURLE_OK;
}
#endif /* USE_AXTLS */
diff --git a/Utilities/cmcurl/lib/vtls/axtls.h b/Utilities/cmcurl/lib/vtls/axtls.h
index b16d051..53797ea 100644
--- a/Utilities/cmcurl/lib/vtls/axtls.h
+++ b/Utilities/cmcurl/lib/vtls/axtls.h
@@ -8,7 +8,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010, DirecTV, Contact: Eric Hu <ehu@directv.com>
- * Copyright (C) 2010 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -42,9 +42,9 @@ void Curl_axtls_session_free(void *ptr);
size_t Curl_axtls_version(char *buffer, size_t size);
int Curl_axtls_shutdown(struct connectdata *conn, int sockindex);
int Curl_axtls_check_cxn(struct connectdata *conn);
-int Curl_axtls_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length);
+CURLcode Curl_axtls_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length);
/* Set the API backend definition to axTLS */
#define CURL_SSL_BACKEND CURLSSLBACKEND_AXTLS
diff --git a/Utilities/cmcurl/lib/vtls/cyassl.c b/Utilities/cmcurl/lib/vtls/cyassl.c
index fc4dde4..5f51ad5 100644
--- a/Utilities/cmcurl/lib/vtls/cyassl.c
+++ b/Utilities/cmcurl/lib/vtls/cyassl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -134,6 +134,7 @@ cyassl_connect_step1(struct connectdata *conn,
int sockindex)
{
char error_buffer[CYASSL_MAX_ERROR_SZ];
+ char *ciphers;
struct Curl_easy *data = conn->data;
struct ssl_connect_data* conssl = &conn->ssl[sockindex];
SSL_METHOD* req_method = NULL;
@@ -148,6 +149,11 @@ cyassl_connect_step1(struct connectdata *conn,
if(conssl->state == ssl_connection_complete)
return CURLE_OK;
+ if(SSL_CONN_CONFIG(version_max) != CURL_SSLVERSION_MAX_NONE) {
+ failf(data, "CyaSSL does not support to set maximum SSL/TLS version");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+
/* check to see if we've been told to use an explicit SSL/TLS version */
switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_DEFAULT:
@@ -229,6 +235,15 @@ cyassl_connect_step1(struct connectdata *conn,
break;
}
+ ciphers = SSL_CONN_CONFIG(cipher_list);
+ if(ciphers) {
+ if(!SSL_CTX_set_cipher_list(conssl->ctx, ciphers)) {
+ failf(data, "failed setting cipher list: %s", ciphers);
+ return CURLE_SSL_CIPHER;
+ }
+ infof(data, "Cipher selection: %s\n", ciphers);
+ }
+
#ifndef NO_FILESYSTEM
/* load trusted cacert */
if(SSL_CONN_CONFIG(CAfile)) {
@@ -383,7 +398,7 @@ cyassl_connect_step1(struct connectdata *conn,
#endif /* HAVE_ALPN */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -581,7 +596,13 @@ cyassl_connect_step2(struct connectdata *conn,
#endif /* HAVE_ALPN */
conssl->connecting_state = ssl_connect_3;
+#if (LIBCYASSL_VERSION_HEX >= 0x03009010)
+ infof(data, "SSL connection using %s / %s\n",
+ wolfSSL_get_version(conssl->handle),
+ wolfSSL_get_cipher_name(conssl->handle));
+#else
infof(data, "SSL connected\n");
+#endif
return CURLE_OK;
}
@@ -597,7 +618,7 @@ cyassl_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
@@ -720,7 +741,9 @@ void Curl_cyassl_session_free(void *ptr)
size_t Curl_cyassl_version(char *buffer, size_t size)
{
-#ifdef WOLFSSL_VERSION
+#if LIBCYASSL_VERSION_HEX >= 0x03006000
+ return snprintf(buffer, size, "wolfSSL/%s", wolfSSL_lib_version());
+#elif defined(WOLFSSL_VERSION)
return snprintf(buffer, size, "wolfSSL/%s", WOLFSSL_VERSION);
#elif defined(CYASSL_VERSION)
return snprintf(buffer, size, "CyaSSL/%s", CYASSL_VERSION);
@@ -772,7 +795,7 @@ cyassl_connect_common(struct connectdata *conn,
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
- long timeout_ms;
+ time_t timeout_ms;
int what;
/* check if the connection has already been established */
@@ -901,19 +924,19 @@ Curl_cyassl_connect(struct connectdata *conn,
return CURLE_OK;
}
-int Curl_cyassl_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length)
+CURLcode Curl_cyassl_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length)
{
RNG rng;
(void)data;
if(InitRng(&rng))
- return 1;
+ return CURLE_FAILED_INIT;
if(length > UINT_MAX)
- return 1;
+ return CURLE_FAILED_INIT;
if(RNG_GenerateBlock(&rng, entropy, (unsigned)length))
- return 1;
- return 0;
+ return CURLE_FAILED_INIT;
+ return CURLE_OK;
}
void Curl_cyassl_sha256sum(const unsigned char *tmp, /* input */
diff --git a/Utilities/cmcurl/lib/vtls/cyassl.h b/Utilities/cmcurl/lib/vtls/cyassl.h
index 508dfaa..f47719e 100644
--- a/Utilities/cmcurl/lib/vtls/cyassl.h
+++ b/Utilities/cmcurl/lib/vtls/cyassl.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -51,15 +51,15 @@ int Curl_cyassl_init(void);
CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,
int sockindex,
bool *done);
-int Curl_cyassl_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length);
+CURLcode Curl_cyassl_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length);
void Curl_cyassl_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum, /* output */
size_t unused);
-/* Set the API backend definition to Schannel */
+/* Set the API backend definition to CyaSSL */
#define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL
/* this backend supports CURLOPT_SSL_CTX_* */
diff --git a/Utilities/cmcurl/lib/vtls/darwinssl.c b/Utilities/cmcurl/lib/vtls/darwinssl.c
index a43e391..5533dfe 100644
--- a/Utilities/cmcurl/lib/vtls/darwinssl.c
+++ b/Utilities/cmcurl/lib/vtls/darwinssl.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2014, Nick Zitzmann, <nickzman@gmail.com>.
- * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -219,6 +219,7 @@ static OSStatus SocketWrite(SSLConnectionRef connection,
return ortn;
}
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
CF_INLINE const char *SSLCipherNameForNumber(SSLCipherSuite cipher)
{
switch(cipher) {
@@ -776,6 +777,7 @@ CF_INLINE const char *TLSCipherNameForNumber(SSLCipherSuite cipher)
}
return "TLS_NULL_WITH_NULL_NULL";
}
+#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
#if CURL_BUILD_MAC
CF_INLINE void GetDarwinVersionNumber(int *major, int *minor)
@@ -885,12 +887,13 @@ static OSStatus CopyIdentityWithLabel(char *label,
SecIdentityRef *out_cert_and_key)
{
OSStatus status = errSecItemNotFound;
+
+#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
CFArrayRef keys_list;
CFIndex keys_list_count;
CFIndex i;
CFStringRef common_name;
-#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
/* SecItemCopyMatching() was introduced in iOS and Snow Leopard.
kSecClassIdentity was introduced in Lion. If both exist, let's use them
to find the certificate. */
@@ -929,28 +932,35 @@ static OSStatus CopyIdentityWithLabel(char *label,
if(status == noErr) {
keys_list_count = CFArrayGetCount(keys_list);
*out_cert_and_key = NULL;
+ status = 1;
for(i=0; i<keys_list_count; i++) {
OSStatus err = noErr;
SecCertificateRef cert = NULL;
- *out_cert_and_key =
+ SecIdentityRef identity =
(SecIdentityRef) CFArrayGetValueAtIndex(keys_list, i);
- err = SecIdentityCopyCertificate(*out_cert_and_key, &cert);
+ err = SecIdentityCopyCertificate(identity, &cert);
if(err == noErr) {
+#if CURL_BUILD_IOS
+ common_name = SecCertificateCopySubjectSummary(cert);
+#elif CURL_BUILD_MAC_10_7
SecCertificateCopyCommonName(cert, &common_name);
+#endif
if(CFStringCompare(common_name, label_cf, 0) == kCFCompareEqualTo) {
CFRelease(cert);
CFRelease(common_name);
+ CFRetain(identity);
+ *out_cert_and_key = identity;
status = noErr;
break;
}
CFRelease(common_name);
}
- *out_cert_and_key = NULL;
- status = 1;
CFRelease(cert);
}
}
+ if(keys_list)
+ CFRelease(keys_list);
CFRelease(query_dict);
CFRelease(label_cf);
}
@@ -1034,6 +1044,109 @@ CF_INLINE bool is_file(const char *filename)
return false;
}
+#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
+static CURLcode darwinssl_version_from_curl(long *darwinver, long ssl_version)
+{
+ switch(ssl_version) {
+ case CURL_SSLVERSION_TLSv1_0:
+ *darwinver = kTLSProtocol1;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1:
+ *darwinver = kTLSProtocol11;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2:
+ *darwinver = kTLSProtocol12;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3:
+ break;
+ }
+ return CURLE_SSL_CONNECT_ERROR;
+}
+#endif
+
+static CURLcode
+set_ssl_version_min_max(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+
+ switch(ssl_version) {
+ case CURL_SSLVERSION_DEFAULT:
+ case CURL_SSLVERSION_TLSv1:
+ ssl_version = CURL_SSLVERSION_TLSv1_0;
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version << 16;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
+ if(SSLSetProtocolVersionMax != NULL) {
+ SSLProtocol darwin_ver_min = kTLSProtocol1;
+ SSLProtocol darwin_ver_max = kTLSProtocol1;
+ CURLcode result = darwinssl_version_from_curl(&darwin_ver_min,
+ ssl_version);
+ if(result) {
+ failf(data, "unsupported min version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+ result = darwinssl_version_from_curl(&darwin_ver_max,
+ ssl_version_max >> 16);
+ if(result) {
+ failf(data, "unsupported max version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+
+ (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, darwin_ver_min);
+ (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, darwin_ver_max);
+ return result;
+ }
+ else {
+#if CURL_SUPPORT_MAC_10_8
+ long i = ssl_version;
+ (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
+ kSSLProtocolAll,
+ false);
+ for(; i <= (ssl_version_max >> 16); i++) {
+ switch(i) {
+ case CURL_SSLVERSION_TLSv1_0:
+ (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
+ kTLSProtocol1,
+ true);
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
+ kTLSProtocol11,
+ true);
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
+ kTLSProtocol12,
+ true);
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ failf(data, "DarwinSSL: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ }
+ return CURLE_OK;
+#endif /* CURL_SUPPORT_MAC_10_8 */
+ }
+#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */
+ failf(data, "DarwinSSL: cannot set SSL protocol");
+ return CURLE_SSL_CONNECT_ERROR;
+}
+
+
static CURLcode darwinssl_connect_step1(struct connectdata *conn,
int sockindex)
{
@@ -1103,20 +1216,15 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
(void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol12);
break;
case CURL_SSLVERSION_TLSv1_0:
- (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kTLSProtocol1);
- (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol1);
- break;
case CURL_SSLVERSION_TLSv1_1:
- (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kTLSProtocol11);
- (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol11);
- break;
case CURL_SSLVERSION_TLSv1_2:
- (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kTLSProtocol12);
- (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kTLSProtocol12);
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "DarwinSSL: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(conn, sockindex);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv3:
err = SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol3);
if(err != noErr) {
@@ -1157,23 +1265,15 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
true);
break;
case CURL_SSLVERSION_TLSv1_0:
- (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
- kTLSProtocol1,
- true);
- break;
case CURL_SSLVERSION_TLSv1_1:
- (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
- kTLSProtocol11,
- true);
- break;
case CURL_SSLVERSION_TLSv1_2:
- (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
- kTLSProtocol12,
- true);
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "DarwinSSL: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(conn, sockindex);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv3:
err = SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
kSSLProtocol3,
@@ -1199,6 +1299,11 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
#endif /* CURL_SUPPORT_MAC_10_8 */
}
#else
+ if(conn->ssl_config.version_max != CURL_SSLVERSION_MAX_NONE) {
+ failf(data, "Your version of the OS does not support to set maximum"
+ " SSL/TLS version");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
(void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocolAll, false);
switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT:
@@ -1385,18 +1490,13 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
}
#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */
- if(ssl_cafile) {
+ if(ssl_cafile && verifypeer) {
bool is_cert_file = is_file(ssl_cafile);
if(!is_cert_file) {
failf(data, "SSL: can't load CA certificate file %s", ssl_cafile);
return CURLE_SSL_CACERT_BADFILE;
}
- if(!verifypeer) {
- failf(data, "SSL: CA certificate set, but certificate verification "
- "is disabled");
- return CURLE_SSL_CONNECT_ERROR;
- }
}
/* Configure hostname check. SNI is used if available.
@@ -1420,6 +1520,9 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
"the OS.\n");
}
}
+ else {
+ infof(data, "WARNING: disabling hostname validation also disables SNI.\n");
+ }
/* Disable cipher suites that ST supports but are not safe. These ciphers
are unlikely to be used in any case since ST gives other ciphers a much
@@ -1541,7 +1644,7 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
char *ssl_sessionid;
size_t ssl_sessionid_len;
@@ -1921,7 +2024,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
/* The below is errSSLServerAuthCompleted; it's not defined in
Leopard's headers */
case -9841:
- if(SSL_CONN_CONFIG(CAfile)) {
+ if(SSL_CONN_CONFIG(CAfile) && SSL_CONN_CONFIG(verifypeer)) {
int res = verify_cert(SSL_CONN_CONFIG(CAfile), data,
connssl->ssl_ctx);
if(res != CURLE_OK)
@@ -2034,9 +2137,11 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
}
}
-static CURLcode
-darwinssl_connect_step3(struct connectdata *conn,
- int sockindex)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+/* This should be called during step3 of the connection at the earliest */
+static void
+show_verbose_server_cert(struct connectdata *conn,
+ int sockindex)
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
@@ -2048,9 +2153,9 @@ darwinssl_connect_step3(struct connectdata *conn,
CFIndex i, count;
SecTrustRef trust = NULL;
- /* There is no step 3!
- * Well, okay, if verbose mode is on, let's print the details of the
- * server certificates. */
+ if(!connssl->ssl_ctx)
+ return;
+
#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
#if CURL_BUILD_IOS
#pragma unused(server_certs)
@@ -2147,6 +2252,23 @@ darwinssl_connect_step3(struct connectdata *conn,
CFRelease(server_certs);
}
#endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */
+}
+#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
+
+static CURLcode
+darwinssl_connect_step3(struct connectdata *conn,
+ int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+
+ /* There is no step 3!
+ * Well, okay, if verbose mode is on, let's print the details of the
+ * server certificates. */
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+ if(data->set.verbose)
+ show_verbose_server_cert(conn, sockindex);
+#endif
connssl->connecting_state = ssl_connect_done;
return CURLE_OK;
@@ -2424,8 +2546,8 @@ bool Curl_darwinssl_data_pending(const struct connectdata *conn,
return false;
}
-int Curl_darwinssl_random(unsigned char *entropy,
- size_t length)
+CURLcode Curl_darwinssl_random(unsigned char *entropy,
+ size_t length)
{
/* arc4random_buf() isn't available on cats older than Lion, so let's
do this manually for the benefit of the older cats. */
@@ -2439,7 +2561,7 @@ int Curl_darwinssl_random(unsigned char *entropy,
random_number >>= 8;
}
i = random_number = 0;
- return 0;
+ return CURLE_OK;
}
void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */
diff --git a/Utilities/cmcurl/lib/vtls/darwinssl.h b/Utilities/cmcurl/lib/vtls/darwinssl.h
index 8b185b6..4bd41ca 100644
--- a/Utilities/cmcurl/lib/vtls/darwinssl.h
+++ b/Utilities/cmcurl/lib/vtls/darwinssl.h
@@ -8,7 +8,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2014, Nick Zitzmann, <nickzman@gmail.com>.
- * Copyright (C) 2012 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -42,8 +42,8 @@ int Curl_darwinssl_check_cxn(struct connectdata *conn);
bool Curl_darwinssl_data_pending(const struct connectdata *conn,
int connindex);
-int Curl_darwinssl_random(unsigned char *entropy,
- size_t length);
+CURLcode Curl_darwinssl_random(unsigned char *entropy,
+ size_t length);
void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *md5sum, /* output */
diff --git a/Utilities/cmcurl/lib/vtls/gskit.c b/Utilities/cmcurl/lib/vtls/gskit.c
index a0d462b..bf75bdd 100644
--- a/Utilities/cmcurl/lib/vtls/gskit.c
+++ b/Utilities/cmcurl/lib/vtls/gskit.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -320,7 +320,7 @@ static CURLcode set_ciphers(struct connectdata *conn,
/* We allocate GSKit buffers of the same size as the input string: since
GSKit tokens are always shorter than their cipher names, allocated buffers
- will always be large enough to accomodate the result. */
+ will always be large enough to accommodate the result. */
l = strlen(cipherlist) + 1;
memset((char *) ciphers, 0, sizeof ciphers);
for(i = 0; i < CURL_GSKPROTO_LAST; i++) {
@@ -748,6 +748,40 @@ static ssize_t gskit_recv(struct connectdata *conn, int num, char *buf,
return (ssize_t) nread;
}
+static CURLcode
+set_ssl_version_min_max(unsigned int *protoflags, struct connectdata *conn)
+{
+ struct Curl_easy *data = conn->data;
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ long i = ssl_version;
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_TLSv1_2;
+ break;
+ }
+ for(; i <= (ssl_version_max >> 16); ++i) {
+ switch(i) {
+ case CURL_SSLVERSION_TLSv1_0:
+ *protoflags |= CURL_GSKPROTO_TLSV10_MASK;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ *protoflags |= CURL_GSKPROTO_TLSV11_MASK;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ *protoflags |= CURL_GSKPROTO_TLSV11_MASK;
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ failf(data, "GSKit: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ }
+
+ return CURLE_OK;
+}
static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
{
@@ -764,7 +798,7 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
const char * const hostname = SSL_IS_PROXY()? conn->http_proxy.host.name:
conn->host.name;
const char *sni;
- unsigned int protoflags;
+ unsigned int protoflags = 0;
long timeout;
Qso_OverlappedIO_t commarea;
int sockpair[2];
@@ -849,17 +883,13 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK;
break;
case CURL_SSLVERSION_TLSv1_0:
- protoflags = CURL_GSKPROTO_TLSV10_MASK;
- break;
case CURL_SSLVERSION_TLSv1_1:
- protoflags = CURL_GSKPROTO_TLSV11_MASK;
- break;
case CURL_SSLVERSION_TLSv1_2:
- protoflags = CURL_GSKPROTO_TLSV12_MASK;
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "GSKit: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ result = set_ssl_version_min_max(&protoflags, conn);
+ if(result != CURLE_OK)
+ return result;
+ break;
default:
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
return CURLE_SSL_CONNECT_ERROR;
diff --git a/Utilities/cmcurl/lib/vtls/gtls.c b/Utilities/cmcurl/lib/vtls/gtls.c
index 0e308cb..0230778 100644
--- a/Utilities/cmcurl/lib/vtls/gtls.c
+++ b/Utilities/cmcurl/lib/vtls/gtls.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -92,11 +92,11 @@ static bool gtls_inited = FALSE;
# define GNUTLS_MAPS_WINSOCK_ERRORS 1
# endif
-# if (GNUTLS_VERSION_NUMBER >= 0x030200)
+# if HAVE_GNUTLS_ALPN_SET_PROTOCOLS
# define HAS_ALPN
# endif
-# if (GNUTLS_VERSION_NUMBER >= 0x03020d)
+# if HAVE_GNUTLS_OCSP_REQ_INIT
# define HAS_OCSP
# endif
@@ -278,7 +278,7 @@ static CURLcode handshake(struct connectdata *conn,
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
gnutls_session_t session = conn->ssl[sockindex].session;
curl_socket_t sockfd = conn->sock[sockindex];
- long timeout_ms;
+ time_t timeout_ms;
int rc;
int what;
@@ -314,7 +314,7 @@ static CURLcode handshake(struct connectdata *conn,
return CURLE_OK;
else if(timeout_ms) {
/* timeout */
- failf(data, "SSL connection timeout at %ld", timeout_ms);
+ failf(data, "SSL connection timeout at %ld", (long)timeout_ms);
return CURLE_OPERATION_TIMEDOUT;
}
}
@@ -375,11 +375,106 @@ static gnutls_x509_crt_fmt_t do_file_type(const char *type)
return -1;
}
+#ifndef USE_GNUTLS_PRIORITY_SET_DIRECT
+static CURLcode
+set_ssl_version_min_max(int *list, size_t list_size, struct connectdata *conn)
+{
+ struct Curl_easy *data = conn->data;
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ long i = ssl_version;
+ long protocol_priority_idx = 0;
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version << 16;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ for(; i <= (ssl_version_max >> 16) &&
+ protocol_priority_idx < list_size; ++i) {
+ switch(i) {
+ case CURL_SSLVERSION_TLSv1_0:
+ protocol_priority[protocol_priority_idx++] = GNUTLS_TLS1_0;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ protocol_priority[protocol_priority_idx++] = GNUTLS_TLS1_1;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ protocol_priority[protocol_priority_idx++] = GNUTLS_TLS1_2;
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ failf(data, "GnuTLS: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ }
+ return CURLE_OK;
+}
+#else
+#define GNUTLS_CIPHERS "NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"
+/* If GnuTLS was compiled without support for SRP it will error out if SRP is
+ requested in the priority string, so treat it specially
+ */
+#define GNUTLS_SRP "+SRP"
+
+static CURLcode
+set_ssl_version_min_max(const char **prioritylist, struct connectdata *conn)
+{
+ struct Curl_easy *data = conn->data;
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ if(ssl_version == CURL_SSLVERSION_TLSv1_3 ||
+ ssl_version_max == CURL_SSLVERSION_MAX_TLSv1_3) {
+ failf(data, "GnuTLS: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ if(ssl_version_max == CURL_SSLVERSION_MAX_NONE) {
+ ssl_version_max = ssl_version << 16;
+ }
+ switch(ssl_version | ssl_version_max) {
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_0:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:" GNUTLS_SRP;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_1:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:+VERS-TLS1.1:" GNUTLS_SRP;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_2:
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2:" GNUTLS_SRP;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_1:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.1:" GNUTLS_SRP;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_2:
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.1:+VERS-TLS1.2:" GNUTLS_SRP;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_2:
+ case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.2:" GNUTLS_SRP;
+ return CURLE_OK;
+ }
+
+ failf(data, "GnuTLS: cannot set ssl protocol");
+ return CURLE_SSL_CONNECT_ERROR;
+}
+#endif
+
static CURLcode
gtls_connect_step1(struct connectdata *conn,
int sockindex)
{
struct Curl_easy *data = conn->data;
+ unsigned int init_flags;
gnutls_session_t session;
int rc;
bool sni = TRUE; /* default is SNI enabled */
@@ -405,13 +500,8 @@ gtls_connect_step1(struct connectdata *conn,
GNUTLS_CIPHER_3DES_CBC,
};
static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
- static int protocol_priority[] = { 0, 0, 0, 0 };
+ int protocol_priority[] = { 0, 0, 0, 0 };
#else
-#define GNUTLS_CIPHERS "NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"
-/* If GnuTLS was compiled without support for SRP it will error out if SRP is
- requested in the priority string, so treat it specially
- */
-#define GNUTLS_SRP "+SRP"
const char *prioritylist;
const char *err = NULL;
#endif
@@ -526,7 +616,14 @@ gtls_connect_step1(struct connectdata *conn,
}
/* Initialize TLS session as a client */
- rc = gnutls_init(&conn->ssl[sockindex].session, GNUTLS_CLIENT);
+ init_flags = GNUTLS_CLIENT;
+
+#if defined(GNUTLS_NO_TICKETS)
+ /* Disable TLS session tickets */
+ init_flags |= GNUTLS_NO_TICKETS;
+#endif
+
+ rc = gnutls_init(&conn->ssl[sockindex].session, init_flags);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_init() failed: %d", rc);
return CURLE_SSL_CONNECT_ERROR;
@@ -568,7 +665,7 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
}
- switch(SSL_CONN_CONFIG(version) {
+ switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_SSLv3:
protocol_priority[0] = GNUTLS_SSL3;
break;
@@ -579,17 +676,16 @@ gtls_connect_step1(struct connectdata *conn,
protocol_priority[2] = GNUTLS_TLS1_2;
break;
case CURL_SSLVERSION_TLSv1_0:
- protocol_priority[0] = GNUTLS_TLS1_0;
- break;
case CURL_SSLVERSION_TLSv1_1:
- protocol_priority[0] = GNUTLS_TLS1_1;
- break;
case CURL_SSLVERSION_TLSv1_2:
- protocol_priority[0] = GNUTLS_TLS1_2;
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "GnuTLS: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(protocol_priority,
+ sizeof(protocol_priority)/sizeof(protocol_priority[0]), conn);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv2:
failf(data, "GnuTLS does not support SSLv2");
return CURLE_SSL_CONNECT_ERROR;
@@ -617,20 +713,15 @@ gtls_connect_step1(struct connectdata *conn,
prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:" GNUTLS_SRP;
break;
case CURL_SSLVERSION_TLSv1_0:
- prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.0:" GNUTLS_SRP;
- break;
case CURL_SSLVERSION_TLSv1_1:
- prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.1:" GNUTLS_SRP;
- break;
case CURL_SSLVERSION_TLSv1_2:
- prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.2:" GNUTLS_SRP;
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "GnuTLS: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(&prioritylist, conn);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv2:
failf(data, "GnuTLS does not support SSLv2");
return CURLE_SSL_CONNECT_ERROR;
@@ -782,7 +873,7 @@ gtls_connect_step1(struct connectdata *conn,
/* This might be a reconnect, so we check for a session ID in the cache
to speed up things */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid;
size_t ssl_idsize;
@@ -882,7 +973,9 @@ gtls_connect_step3(struct connectdata *conn,
gnutls_datum_t proto;
#endif
CURLcode result = CURLE_OK;
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
gnutls_protocol_t version = gnutls_protocol_get_version(session);
+#endif
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
@@ -1311,7 +1404,7 @@ gtls_connect_step3(struct connectdata *conn,
conn->recv[sockindex] = gtls_recv;
conn->send[sockindex] = gtls_send;
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
/* we always unconditionally get the session id here, as even if we
already got it from the cache and asked to use it in the connection, it
might've been rejected and then a new one is in use now and we need to
@@ -1625,19 +1718,21 @@ static int Curl_gtls_seed(struct Curl_easy *data)
#endif
/* data might be NULL! */
-int Curl_gtls_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length)
+CURLcode Curl_gtls_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length)
{
#if defined(USE_GNUTLS_NETTLE)
+ int rc;
(void)data;
- gnutls_rnd(GNUTLS_RND_RANDOM, entropy, length);
+ rc = gnutls_rnd(GNUTLS_RND_RANDOM, entropy, length);
+ return rc?CURLE_FAILED_INIT:CURLE_OK;
#elif defined(USE_GNUTLS)
if(data)
Curl_gtls_seed(data); /* Initiate the seed if not already done */
gcry_randomize(entropy, length, GCRY_STRONG_RANDOM);
#endif
- return 0;
+ return CURLE_OK;
}
void Curl_gtls_md5sum(unsigned char *tmp, /* input */
diff --git a/Utilities/cmcurl/lib/vtls/gtls.h b/Utilities/cmcurl/lib/vtls/gtls.h
index 6531201..462c048 100644
--- a/Utilities/cmcurl/lib/vtls/gtls.h
+++ b/Utilities/cmcurl/lib/vtls/gtls.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -43,9 +43,9 @@ void Curl_gtls_close(struct connectdata *conn, int sockindex);
void Curl_gtls_session_free(void *ptr);
size_t Curl_gtls_version(char *buffer, size_t size);
int Curl_gtls_shutdown(struct connectdata *conn, int sockindex);
-int Curl_gtls_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length);
+CURLcode Curl_gtls_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length);
void Curl_gtls_md5sum(unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *md5sum, /* output */
diff --git a/Utilities/cmcurl/lib/vtls/mbedtls.c b/Utilities/cmcurl/lib/vtls/mbedtls.c
index 8bcaddd..3ffa957 100644
--- a/Utilities/cmcurl/lib/vtls/mbedtls.c
+++ b/Utilities/cmcurl/lib/vtls/mbedtls.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010 - 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
- * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -157,6 +157,71 @@ const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_fr =
static Curl_recv mbed_recv;
static Curl_send mbed_send;
+static CURLcode mbedtls_version_from_curl(int *mbedver, long version)
+{
+ switch(version) {
+ case CURL_SSLVERSION_TLSv1_0:
+ *mbedver = MBEDTLS_SSL_MINOR_VERSION_1;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1:
+ *mbedver = MBEDTLS_SSL_MINOR_VERSION_2;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2:
+ *mbedver = MBEDTLS_SSL_MINOR_VERSION_3;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3:
+ break;
+ }
+ return CURLE_SSL_CONNECT_ERROR;
+}
+
+static CURLcode
+set_ssl_version_min_max(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ int mbedtls_ver_min = MBEDTLS_SSL_MINOR_VERSION_1;
+ int mbedtls_ver_max = MBEDTLS_SSL_MINOR_VERSION_1;
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ CURLcode result = CURLE_OK;
+
+ switch(ssl_version) {
+ case CURL_SSLVERSION_DEFAULT:
+ case CURL_SSLVERSION_TLSv1:
+ ssl_version = CURL_SSLVERSION_TLSv1_0;
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version << 16;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ result = mbedtls_version_from_curl(&mbedtls_ver_min, ssl_version);
+ if(result) {
+ failf(data, "unsupported min version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+ result = mbedtls_version_from_curl(&mbedtls_ver_max, ssl_version_max >> 16);
+ if(result) {
+ failf(data, "unsupported max version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+
+ mbedtls_ssl_conf_min_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ver_min);
+ mbedtls_ssl_conf_max_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ver_max);
+
+ return result;
+}
+
static CURLcode
mbed_connect_step1(struct connectdata *conn,
int sockindex)
@@ -333,29 +398,15 @@ mbed_connect_step1(struct connectdata *conn,
infof(data, "mbedTLS: Set SSL version to SSLv3\n");
break;
case CURL_SSLVERSION_TLSv1_0:
- mbedtls_ssl_conf_min_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_1);
- mbedtls_ssl_conf_max_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_1);
- infof(data, "mbedTLS: Set SSL version to TLS 1.0\n");
- break;
case CURL_SSLVERSION_TLSv1_1:
- mbedtls_ssl_conf_min_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_2);
- mbedtls_ssl_conf_max_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_2);
- infof(data, "mbedTLS: Set SSL version to TLS 1.1\n");
- break;
case CURL_SSLVERSION_TLSv1_2:
- mbedtls_ssl_conf_min_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_3);
- mbedtls_ssl_conf_max_version(&connssl->config, MBEDTLS_SSL_MAJOR_VERSION_3,
- MBEDTLS_SSL_MINOR_VERSION_3);
- infof(data, "mbedTLS: Set SSL version to TLS 1.2\n");
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "mbedTLS: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(conn, sockindex);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
default:
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
return CURLE_SSL_CONNECT_ERROR;
@@ -373,8 +424,13 @@ mbed_connect_step1(struct connectdata *conn,
mbedtls_ssl_conf_ciphersuites(&connssl->config,
mbedtls_ssl_list_ciphersuites());
+#if defined(MBEDTLS_SSL_SESSION_TICKETS)
+ mbedtls_ssl_conf_session_tickets(&connssl->config,
+ MBEDTLS_SSL_SESSION_TICKETS_DISABLED);
+#endif
+
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -439,6 +495,16 @@ mbed_connect_step1(struct connectdata *conn,
mbedtls_debug_set_threshold(4);
#endif
+ /* give application a chance to interfere with mbedTLS set up. */
+ if(data->set.ssl.fsslctx) {
+ ret = (*data->set.ssl.fsslctx)(data, &connssl->config,
+ data->set.ssl.fsslctxp);
+ if(ret) {
+ failf(data, "error signaled by ssl ctx callback");
+ return ret;
+ }
+ }
+
connssl->connecting_state = ssl_connect_2;
return CURLE_OK;
@@ -618,7 +684,7 @@ mbed_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
mbedtls_ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
@@ -631,6 +697,7 @@ mbed_connect_step3(struct connectdata *conn,
ret = mbedtls_ssl_get_session(&connssl->ssl, our_ssl_sessionid);
if(ret) {
+ free(our_ssl_sessionid);
failf(data, "mbedtls_ssl_get_session returned -0x%x", -ret);
return CURLE_SSL_CONNECT_ERROR;
}
@@ -729,6 +796,55 @@ size_t Curl_mbedtls_version(char *buffer, size_t size)
(version>>16)&0xff, (version>>8)&0xff);
}
+CURLcode Curl_mbedtls_random(struct Curl_easy *data, unsigned char *entropy,
+ size_t length)
+{
+#if defined(MBEDTLS_CTR_DRBG_C)
+ int ret = -1;
+ char errorbuf[128];
+ mbedtls_entropy_context ctr_entropy;
+ mbedtls_ctr_drbg_context ctr_drbg;
+ mbedtls_entropy_init(&ctr_entropy);
+ mbedtls_ctr_drbg_init(&ctr_drbg);
+ errorbuf[0]=0;
+
+ ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
+ &ctr_entropy, NULL, 0);
+
+ if(ret) {
+#ifdef MBEDTLS_ERROR_C
+ mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
+#endif /* MBEDTLS_ERROR_C */
+ failf(data, "Failed - mbedTLS: ctr_drbg_seed returned (-0x%04X) %s\n",
+ -ret, errorbuf);
+ }
+ else {
+ ret = mbedtls_ctr_drbg_random(&ctr_drbg, entropy, length);
+
+ if(ret) {
+#ifdef MBEDTLS_ERROR_C
+ mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
+#endif /* MBEDTLS_ERROR_C */
+ failf(data, "mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n",
+ -ret, errorbuf);
+ }
+ }
+
+ mbedtls_ctr_drbg_free(&ctr_drbg);
+ mbedtls_entropy_free(&ctr_entropy);
+
+ return ret == 0 ? CURLE_OK : CURLE_FAILED_INIT;
+#elif defined(MBEDTLS_HAVEGE_C)
+ mbedtls_havege_state hs;
+ mbedtls_havege_init(&hs);
+ mbedtls_havege_random(&hs, entropy, length);
+ mbedtls_havege_free(&hs);
+ return CURLE_OK;
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
+}
+
static CURLcode
mbed_connect_common(struct connectdata *conn,
int sockindex,
@@ -883,9 +999,7 @@ void Curl_mbedtls_cleanup(void)
int Curl_mbedtls_data_pending(const struct connectdata *conn, int sockindex)
{
- mbedtls_ssl_context *ssl =
- (mbedtls_ssl_context *)&conn->ssl[sockindex].ssl;
- return ssl->in_msglen != 0;
+ return mbedtls_ssl_get_bytes_avail(&conn->ssl[sockindex].ssl) != 0;
}
#endif /* USE_MBEDTLS */
diff --git a/Utilities/cmcurl/lib/vtls/mbedtls.h b/Utilities/cmcurl/lib/vtls/mbedtls.h
index 1021d54..71d17a4 100644
--- a/Utilities/cmcurl/lib/vtls/mbedtls.h
+++ b/Utilities/cmcurl/lib/vtls/mbedtls.h
@@ -50,9 +50,15 @@ void Curl_mbedtls_session_free(void *ptr);
size_t Curl_mbedtls_version(char *buffer, size_t size);
int Curl_mbedtls_shutdown(struct connectdata *conn, int sockindex);
+CURLcode Curl_mbedtls_random(struct Curl_easy *data, unsigned char *entropy,
+ size_t length);
+
/* this backends supports CURLOPT_PINNEDPUBLICKEY */
#define have_curlssl_pinnedpubkey 1
+/* this backend supports CURLOPT_SSL_CTX_* */
+#define have_curlssl_ssl_ctx 1
+
/* API setup for mbedTLS */
#define curlssl_init() Curl_mbedtls_init()
#define curlssl_cleanup() Curl_mbedtls_cleanup()
@@ -70,11 +76,7 @@ int Curl_mbedtls_shutdown(struct connectdata *conn, int sockindex);
#define curlssl_data_pending(x,y) Curl_mbedtls_data_pending(x, y)
#define CURL_SSL_BACKEND CURLSSLBACKEND_MBEDTLS
#define curlssl_sha256sum(a,b,c,d) mbedtls_sha256(a,b,c,0)
-
-/* This might cause libcurl to use a weeker random!
- TODO: implement proper use of Polarssl's CTR-DRBG or HMAC-DRBG and use that
-*/
-#define curlssl_random(x,y,z) (x=x, y=y, z=z, CURLE_NOT_BUILT_IN)
+#define curlssl_random(x,y,z) Curl_mbedtls_random(x, y, z)
#endif /* USE_MBEDTLS */
#endif /* HEADER_CURL_MBEDTLS_H */
diff --git a/Utilities/cmcurl/lib/vtls/nss.c b/Utilities/cmcurl/lib/vtls/nss.c
index ba8d582..89a16d3 100644
--- a/Utilities/cmcurl/lib/vtls/nss.c
+++ b/Utilities/cmcurl/lib/vtls/nss.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -56,7 +56,8 @@
#include <base64.h>
#include <cert.h>
#include <prerror.h>
-#include <keyhi.h> /* for SECKEY_DestroyPublicKey() */
+#include <keyhi.h> /* for SECKEY_DestroyPublicKey() */
+#include <private/pprio.h> /* for PR_ImportTCPSocket */
#define NSSVERNUM ((NSS_VMAJOR<<16)|(NSS_VMINOR<<8)|NSS_VPATCH)
@@ -77,11 +78,10 @@
/* enough to fit the string "PEM Token #[0|1]" */
#define SLOTSIZE 13
-PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd);
static PRLock *nss_initlock = NULL;
static PRLock *nss_crllock = NULL;
static PRLock *nss_findslot_lock = NULL;
-static struct curl_llist *nss_crl_list = NULL;
+static struct curl_llist nss_crl_list;
static NSSInitContext *nss_context = NULL;
static volatile int initialized = 0;
@@ -365,9 +365,9 @@ static char *dup_nickname(struct Curl_easy *data, const char *str)
static PK11SlotInfo* nss_find_slot_by_name(const char *slot_name)
{
PK11SlotInfo *slot;
- PR_Lock(nss_initlock);
+ PR_Lock(nss_findslot_lock);
slot = PK11_FindSlotByName(slot_name);
- PR_Unlock(nss_initlock);
+ PR_Unlock(nss_findslot_lock);
return slot;
}
@@ -401,7 +401,7 @@ static CURLcode nss_create_object(struct ssl_connect_data *ssl,
PK11_SETATTRS(attrs, attr_cnt, CKA_CLASS, &obj_class, sizeof(obj_class));
PK11_SETATTRS(attrs, attr_cnt, CKA_TOKEN, &cktrue, sizeof(CK_BBOOL));
PK11_SETATTRS(attrs, attr_cnt, CKA_LABEL, (unsigned char *)filename,
- strlen(filename) + 1);
+ (CK_ULONG)strlen(filename) + 1);
if(CKO_CERTIFICATE == obj_class) {
CK_BBOOL *pval = (cacert) ? (&cktrue) : (&ckfalse);
@@ -413,7 +413,7 @@ static CURLcode nss_create_object(struct ssl_connect_data *ssl,
if(!obj)
return result;
- if(!Curl_llist_insert_next(ssl->obj_list, ssl->obj_list->tail, obj)) {
+ if(!Curl_llist_insert_next(&ssl->obj_list, ssl->obj_list.tail, obj)) {
PK11_DestroyGenericObject(obj);
return CURLE_OUT_OF_MEMORY;
}
@@ -496,7 +496,7 @@ static CURLcode nss_cache_crl(SECItem *crl_der)
PR_Lock(nss_crllock);
/* store the CRL item so that we can free it in Curl_nss_cleanup() */
- if(!Curl_llist_insert_next(nss_crl_list, nss_crl_list->tail, crl_der)) {
+ if(!Curl_llist_insert_next(&nss_crl_list, nss_crl_list.tail, crl_der)) {
SECITEM_FreeItem(crl_der, PR_TRUE);
PR_Unlock(nss_crllock);
return CURLE_OUT_OF_MEMORY;
@@ -1227,9 +1227,7 @@ static CURLcode nss_init(struct Curl_easy *data)
return CURLE_OK;
/* list of all CRL items we need to destroy in Curl_nss_cleanup() */
- nss_crl_list = Curl_llist_alloc(nss_destroy_crl_item);
- if(!nss_crl_list)
- return CURLE_OUT_OF_MEMORY;
+ Curl_llist_init(&nss_crl_list, nss_destroy_crl_item);
/* First we check if $SSL_DIR points to a valid dir */
cert_dir = getenv("SSL_DIR");
@@ -1336,8 +1334,7 @@ void Curl_nss_cleanup(void)
}
/* destroy all CRL items */
- Curl_llist_destroy(nss_crl_list, NULL);
- nss_crl_list = NULL;
+ Curl_llist_destroy(&nss_crl_list, NULL);
PR_Unlock(nss_initlock);
@@ -1385,8 +1382,7 @@ static void nss_close(struct ssl_connect_data *connssl)
connssl->client_nickname = NULL;
/* destroy all NSS objects in order to avoid failure of NSS shutdown */
- Curl_llist_destroy(connssl->obj_list, NULL);
- connssl->obj_list = NULL;
+ Curl_llist_destroy(&connssl->obj_list, NULL);
connssl->obj_clicert = NULL;
if(connssl->handle) {
@@ -1512,78 +1508,108 @@ static CURLcode nss_load_ca_certificates(struct connectdata *conn,
return CURLE_OK;
}
-static CURLcode nss_init_sslver(SSLVersionRange *sslver,
- struct Curl_easy *data,
- struct connectdata *conn)
+static CURLcode nss_sslver_from_curl(PRUint16 *nssver, long version)
{
- switch(SSL_CONN_CONFIG(version)) {
- case CURL_SSLVERSION_DEFAULT:
- /* map CURL_SSLVERSION_DEFAULT to NSS default */
- if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess)
- return CURLE_SSL_CONNECT_ERROR;
- /* ... but make sure we use at least TLSv1.0 according to libcurl API */
- if(sslver->min < SSL_LIBRARY_VERSION_TLS_1_0)
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
- return CURLE_OK;
-
+ switch(version) {
case CURL_SSLVERSION_TLSv1:
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
/* TODO: set sslver->max to SSL_LIBRARY_VERSION_TLS_1_3 once stable */
#ifdef SSL_LIBRARY_VERSION_TLS_1_2
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_2;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_2;
#elif defined SSL_LIBRARY_VERSION_TLS_1_1
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_1;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_1;
#else
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_0;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_0;
#endif
return CURLE_OK;
case CURL_SSLVERSION_SSLv2:
- sslver->min = SSL_LIBRARY_VERSION_2;
- sslver->max = SSL_LIBRARY_VERSION_2;
+ *nssver = SSL_LIBRARY_VERSION_2;
return CURLE_OK;
case CURL_SSLVERSION_SSLv3:
- sslver->min = SSL_LIBRARY_VERSION_3_0;
- sslver->max = SSL_LIBRARY_VERSION_3_0;
+ *nssver = SSL_LIBRARY_VERSION_3_0;
return CURLE_OK;
case CURL_SSLVERSION_TLSv1_0:
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_0;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_0;
return CURLE_OK;
case CURL_SSLVERSION_TLSv1_1:
#ifdef SSL_LIBRARY_VERSION_TLS_1_1
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_1;
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_1;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_1;
return CURLE_OK;
+#else
+ return CURLE_SSL_CONNECT_ERROR;
#endif
- break;
case CURL_SSLVERSION_TLSv1_2:
#ifdef SSL_LIBRARY_VERSION_TLS_1_2
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_2;
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_2;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_2;
return CURLE_OK;
+#else
+ return CURLE_SSL_CONNECT_ERROR;
#endif
- break;
case CURL_SSLVERSION_TLSv1_3:
#ifdef SSL_LIBRARY_VERSION_TLS_1_3
- sslver->min = SSL_LIBRARY_VERSION_TLS_1_3;
- sslver->max = SSL_LIBRARY_VERSION_TLS_1_3;
+ *nssver = SSL_LIBRARY_VERSION_TLS_1_3;
return CURLE_OK;
+#else
+ return CURLE_SSL_CONNECT_ERROR;
#endif
- break;
default:
- failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
return CURLE_SSL_CONNECT_ERROR;
}
+}
+
+static CURLcode nss_init_sslver(SSLVersionRange *sslver,
+ struct Curl_easy *data,
+ struct connectdata *conn)
+{
+ CURLcode result;
+ const long min = SSL_CONN_CONFIG(version);
+ const long max = SSL_CONN_CONFIG(version_max);
+
+ /* map CURL_SSLVERSION_DEFAULT to NSS default */
+ if(min == CURL_SSLVERSION_DEFAULT || max == CURL_SSLVERSION_MAX_DEFAULT) {
+ /* map CURL_SSLVERSION_DEFAULT to NSS default */
+ if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess)
+ return CURLE_SSL_CONNECT_ERROR;
+ /* ... but make sure we use at least TLSv1.0 according to libcurl API */
+ if(sslver->min < SSL_LIBRARY_VERSION_TLS_1_0)
+ sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
+ }
+
+ switch(min) {
+ case CURL_SSLVERSION_DEFAULT:
+ break;
+ case CURL_SSLVERSION_TLSv1:
+ sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
+ break;
+ default:
+ result = nss_sslver_from_curl(&sslver->min, min);
+ if(result) {
+ failf(data, "unsupported min version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+ if(max == CURL_SSLVERSION_MAX_NONE)
+ sslver->max = sslver->min;
+ }
+
+ switch(max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ break;
+ default:
+ result = nss_sslver_from_curl(&sslver->max, max >> 16);
+ if(result) {
+ failf(data, "unsupported max version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+ }
- failf(data, "TLS minor version cannot be set");
- return CURLE_SSL_CONNECT_ERROR;
+ return CURLE_OK;
}
static CURLcode nss_fail_connect(struct ssl_connect_data *connssl,
@@ -1606,19 +1632,19 @@ static CURLcode nss_fail_connect(struct ssl_connect_data *connssl,
}
/* cleanup on connection failure */
- Curl_llist_destroy(connssl->obj_list, NULL);
- connssl->obj_list = NULL;
+ Curl_llist_destroy(&connssl->obj_list, NULL);
return curlerr;
}
-/* Switch the SSL socket into non-blocking mode. */
-static CURLcode nss_set_nonblock(struct ssl_connect_data *connssl,
- struct Curl_easy *data)
+/* Switch the SSL socket into blocking or non-blocking mode. */
+static CURLcode nss_set_blocking(struct ssl_connect_data *connssl,
+ struct Curl_easy *data,
+ bool blocking)
{
static PRSocketOptionData sock_opt;
sock_opt.option = PR_SockOpt_Nonblocking;
- sock_opt.value.non_blocking = PR_TRUE;
+ sock_opt.value.non_blocking = !blocking;
if(PR_SetSocketOption(connssl->handle, &sock_opt) != PR_SUCCESS)
return nss_fail_connect(connssl, data, CURLE_SSL_CONNECT_ERROR);
@@ -1647,9 +1673,7 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
connssl->data = data;
/* list of all NSS objects we need to destroy in Curl_nss_close() */
- connssl->obj_list = Curl_llist_alloc(nss_destroy_object);
- if(!connssl->obj_list)
- return CURLE_OUT_OF_MEMORY;
+ Curl_llist_init(&connssl->obj_list, nss_destroy_object);
/* FIXME. NSS doesn't support multiple databases open at the same time. */
PR_Lock(nss_initlock);
@@ -1696,7 +1720,7 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
goto error;
/* do not use SSL cache if disabled or we are not going to verify peer */
- ssl_no_cache = (data->set.general_ssl.sessionid
+ ssl_no_cache = (SSL_SET_OPTION(primary.sessionid)
&& SSL_CONN_CONFIG(verifypeer)) ? PR_FALSE : PR_TRUE;
if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess)
goto error;
@@ -1746,9 +1770,12 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
if(SSL_HandshakeCallback(model, HandshakeCallback, conn) != SECSuccess)
goto error;
- if(SSL_CONN_CONFIG(verifypeer)) {
+ {
const CURLcode rv = nss_load_ca_certificates(conn, sockindex);
- if(rv) {
+ if((rv == CURLE_SSL_CACERT_BADFILE) && !SSL_CONN_CONFIG(verifypeer))
+ /* not a fatal error because we are not going to verify the peer */
+ infof(data, "warning: CA certificates failed to load\n");
+ else if(rv) {
result = rv;
goto error;
}
@@ -1933,8 +1960,8 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
/* check timeout situation */
- const long time_left = Curl_timeleft(data, NULL, TRUE);
- if(time_left < 0L) {
+ const time_t time_left = Curl_timeleft(data, NULL, TRUE);
+ if(time_left < 0) {
failf(data, "timed out before SSL handshake");
result = CURLE_OPERATION_TIMEDOUT;
goto error;
@@ -2007,16 +2034,14 @@ static CURLcode nss_connect_common(struct connectdata *conn, int sockindex,
/* we do not expect CURLE_AGAIN from nss_setup_connect() */
return result;
- if(!blocking) {
- /* in non-blocking mode, set NSS non-blocking mode before handshake */
- result = nss_set_nonblock(connssl, data);
- if(result)
- return result;
- }
-
connssl->connecting_state = ssl_connect_2;
}
+ /* enable/disable blocking mode before handshake */
+ result = nss_set_blocking(connssl, data, blocking);
+ if(result)
+ return result;
+
result = nss_do_connect(conn, sockindex);
switch(result) {
case CURLE_OK:
@@ -2032,7 +2057,7 @@ static CURLcode nss_connect_common(struct connectdata *conn, int sockindex,
if(blocking) {
/* in blocking mode, set NSS non-blocking mode _after_ SSL handshake */
- result = nss_set_nonblock(connssl, data);
+ result = nss_set_blocking(connssl, data, /* blocking */ FALSE);
if(result)
return result;
}
@@ -2138,17 +2163,17 @@ int Curl_nss_seed(struct Curl_easy *data)
}
/* data might be NULL */
-int Curl_nss_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length)
+CURLcode Curl_nss_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length)
{
Curl_nss_seed(data); /* Initiate the seed if not already done */
if(SECSuccess != PK11_GenerateRandom(entropy, curlx_uztosi(length)))
/* signal a failure */
- return -1;
+ return CURLE_FAILED_INIT;
- return 0;
+ return CURLE_OK;
}
void Curl_nss_md5sum(unsigned char *tmp, /* input */
diff --git a/Utilities/cmcurl/lib/vtls/nssg.h b/Utilities/cmcurl/lib/vtls/nssg.h
index fd94003..8c46929 100644
--- a/Utilities/cmcurl/lib/vtls/nssg.h
+++ b/Utilities/cmcurl/lib/vtls/nssg.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -47,9 +47,9 @@ int Curl_nss_seed(struct Curl_easy *data);
/* initialize NSS library if not already */
CURLcode Curl_nss_force_init(struct Curl_easy *data);
-int Curl_nss_random(struct Curl_easy *data,
- unsigned char *entropy,
- size_t length);
+CURLcode Curl_nss_random(struct Curl_easy *data,
+ unsigned char *entropy,
+ size_t length);
void Curl_nss_md5sum(unsigned char *tmp, /* input */
size_t tmplen,
diff --git a/Utilities/cmcurl/lib/vtls/openssl.c b/Utilities/cmcurl/lib/vtls/openssl.c
index d92e713..58a014a 100644
--- a/Utilities/cmcurl/lib/vtls/openssl.c
+++ b/Utilities/cmcurl/lib/vtls/openssl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -55,7 +55,9 @@
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/x509v3.h>
+#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
+#endif
#include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/md5.h>
@@ -156,10 +158,56 @@ static unsigned long OpenSSL_version_num(void)
* Number of bytes to read from the random number seed file. This must be
* a finite value (because some entropy "files" like /dev/urandom have
* an infinite length), but must be large enough to provide enough
- * entopy to properly seed OpenSSL's PRNG.
+ * entropy to properly seed OpenSSL's PRNG.
*/
#define RAND_LOAD_LENGTH 1024
+static const char *SSL_ERROR_to_str(int err)
+{
+ switch(err) {
+ case SSL_ERROR_NONE:
+ return "SSL_ERROR_NONE";
+ case SSL_ERROR_SSL:
+ return "SSL_ERROR_SSL";
+ case SSL_ERROR_WANT_READ:
+ return "SSL_ERROR_WANT_READ";
+ case SSL_ERROR_WANT_WRITE:
+ return "SSL_ERROR_WANT_WRITE";
+ case SSL_ERROR_WANT_X509_LOOKUP:
+ return "SSL_ERROR_WANT_X509_LOOKUP";
+ case SSL_ERROR_SYSCALL:
+ return "SSL_ERROR_SYSCALL";
+ case SSL_ERROR_ZERO_RETURN:
+ return "SSL_ERROR_ZERO_RETURN";
+ case SSL_ERROR_WANT_CONNECT:
+ return "SSL_ERROR_WANT_CONNECT";
+ case SSL_ERROR_WANT_ACCEPT:
+ return "SSL_ERROR_WANT_ACCEPT";
+#if defined(SSL_ERROR_WANT_ASYNC)
+ case SSL_ERROR_WANT_ASYNC:
+ return "SSL_ERROR_WANT_ASYNC";
+#endif
+#if defined(SSL_ERROR_WANT_ASYNC_JOB)
+ case SSL_ERROR_WANT_ASYNC_JOB:
+ return "SSL_ERROR_WANT_ASYNC_JOB";
+#endif
+#if defined(SSL_ERROR_WANT_EARLY)
+ case SSL_ERROR_WANT_EARLY:
+ return "SSL_ERROR_WANT_EARLY";
+#endif
+ default:
+ return "SSL_ERROR unknown";
+ }
+}
+
+/* Return error string for last OpenSSL error
+ */
+static char *ossl_strerror(unsigned long error, char *buf, size_t size)
+{
+ ERR_error_string_n(error, buf, size);
+ return buf;
+}
+
static int passwd_callback(char *buf, int num, int encrypting,
void *global_passwd)
{
@@ -335,6 +383,7 @@ int cert_stuff(struct connectdata *conn,
char *key_passwd)
{
struct Curl_easy *data = conn->data;
+ char error_buffer[256];
int file_type = do_file_type(cert_type);
@@ -360,7 +409,8 @@ int cert_stuff(struct connectdata *conn,
"could not load PEM client certificate, " OSSL_PACKAGE
" error %s, "
"(no key found, wrong pass phrase, or wrong file format?)",
- ERR_error_string(ERR_get_error(), NULL) );
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
return 0;
}
break;
@@ -376,7 +426,8 @@ int cert_stuff(struct connectdata *conn,
"could not load ASN1 client certificate, " OSSL_PACKAGE
" error %s, "
"(no key found, wrong pass phrase, or wrong file format?)",
- ERR_error_string(ERR_get_error(), NULL) );
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
return 0;
}
break;
@@ -405,7 +456,8 @@ int cert_stuff(struct connectdata *conn,
0, &params, NULL, 1)) {
failf(data, "ssl engine cannot load client cert with id"
" '%s' [%s]", cert_file,
- ERR_error_string(ERR_get_error(), NULL));
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)));
return 0;
}
@@ -461,7 +513,8 @@ int cert_stuff(struct connectdata *conn,
failf(data,
"could not parse PKCS12 file, check password, " OSSL_PACKAGE
" error %s",
- ERR_error_string(ERR_get_error(), NULL) );
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
PKCS12_free(p12);
return 0;
}
@@ -472,7 +525,8 @@ int cert_stuff(struct connectdata *conn,
failf(data,
"could not load PKCS12 client certificate, " OSSL_PACKAGE
" error %s",
- ERR_error_string(ERR_get_error(), NULL) );
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
goto fail;
}
@@ -493,21 +547,19 @@ int cert_stuff(struct connectdata *conn,
/*
* Note that sk_X509_pop() is used below to make sure the cert is
* removed from the stack properly before getting passed to
- * SSL_CTX_add_extra_chain_cert(). Previously we used
- * sk_X509_value() instead, but then we'd clean it in the subsequent
- * sk_X509_pop_free() call.
+ * SSL_CTX_add_extra_chain_cert(), which takes ownership. Previously
+ * we used sk_X509_value() instead, but then we'd clean it in the
+ * subsequent sk_X509_pop_free() call.
*/
X509 *x = sk_X509_pop(ca);
- if(!SSL_CTX_add_extra_chain_cert(ctx, x)) {
+ if(!SSL_CTX_add_client_CA(ctx, x)) {
X509_free(x);
- failf(data, "cannot add certificate to certificate chain");
+ failf(data, "cannot add certificate to client CA list");
goto fail;
}
- /* SSL_CTX_add_client_CA() seems to work with either sk_* function,
- * presumably because it duplicates what we pass to it.
- */
- if(!SSL_CTX_add_client_CA(ctx, x)) {
- failf(data, "cannot add certificate to client CA list");
+ if(!SSL_CTX_add_extra_chain_cert(ctx, x)) {
+ X509_free(x);
+ failf(data, "cannot add certificate to certificate chain");
goto fail;
}
}
@@ -541,6 +593,7 @@ int cert_stuff(struct connectdata *conn,
if(!key_file)
/* cert & key can only be in PEM case in the same file */
key_file=cert_file;
+ /* FALLTHROUGH */
case SSL_FILETYPE_ASN1:
if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) {
failf(data, "unable to set private key file: '%s' type %s",
@@ -664,17 +717,6 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
#endif
}
-/* Return error string for last OpenSSL error
- */
-static char *ossl_strerror(unsigned long error, char *buf, size_t size)
-{
- /* OpenSSL 0.9.6 and later has a function named
- ERR_error_string_n() that takes the size of the buffer as a
- third argument */
- ERR_error_string_n(error, buf, size);
- return buf;
-}
-
/**
* Global SSL init
*
@@ -776,7 +818,7 @@ int Curl_ossl_check_cxn(struct connectdata *conn)
(RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK);
if(nread == 0)
return 0; /* connection has been closed */
- else if(nread == 1)
+ if(nread == 1)
return 1; /* connection still in place */
else if(nread == -1) {
int err = SOCKERRNO;
@@ -981,8 +1023,10 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
default:
/* openssl/ssl.h says "look at error stack/return value/errno" */
sslerror = ERR_get_error();
- failf(conn->data, OSSL_PACKAGE " SSL read: %s, errno %d",
- ossl_strerror(sslerror, buf, sizeof(buf)),
+ failf(conn->data, OSSL_PACKAGE " SSL_read on shutdown: %s, errno %d",
+ (sslerror ?
+ ossl_strerror(sslerror, buf, sizeof(buf)) :
+ SSL_ERROR_to_str(err)),
SOCKERRNO);
done = 1;
break;
@@ -1609,7 +1653,7 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type,
#ifdef HAS_NPN
/*
- * in is a list of lenght prefixed strings. this function has to select
+ * in is a list of length prefixed strings. this function has to select
* the protocol we want to use from the list and write its string into out.
*/
@@ -1693,6 +1737,85 @@ get_ssl_version_txt(SSL *ssl)
return "unknown";
}
+static CURLcode
+set_ssl_version_min_max(long *ctx_options, struct connectdata *conn,
+ int sockindex)
+{
+#if (OPENSSL_VERSION_NUMBER < 0x1000100FL) || !defined(TLS1_3_VERSION)
+ /* convoluted #if condition just to avoid compiler warnings on unused
+ variable */
+ struct Curl_easy *data = conn->data;
+#endif
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+
+ if(ssl_version_max == CURL_SSLVERSION_MAX_NONE) {
+ ssl_version_max = ssl_version << 16;
+ }
+
+ switch(ssl_version) {
+ case CURL_SSLVERSION_TLSv1_3:
+#ifdef TLS1_3_VERSION
+ {
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ SSL_CTX_set_max_proto_version(connssl->ctx, TLS1_3_VERSION);
+ *ctx_options |= SSL_OP_NO_TLSv1_2;
+ }
+#else
+ (void)sockindex;
+ failf(data, OSSL_PACKAGE " was built without TLS 1.3 support");
+ return CURLE_NOT_BUILT_IN;
+#endif
+ case CURL_SSLVERSION_TLSv1_2:
+#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
+ *ctx_options |= SSL_OP_NO_TLSv1_1;
+#else
+ failf(data, OSSL_PACKAGE " was built without TLS 1.2 support");
+ return CURLE_NOT_BUILT_IN;
+#endif
+ /* FALLTHROUGH */
+ case CURL_SSLVERSION_TLSv1_1:
+#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
+ *ctx_options |= SSL_OP_NO_TLSv1;
+#else
+ failf(data, OSSL_PACKAGE " was built without TLS 1.1 support");
+ return CURLE_NOT_BUILT_IN;
+#endif
+ /* FALLTHROUGH */
+ case CURL_SSLVERSION_TLSv1_0:
+ *ctx_options |= SSL_OP_NO_SSLv2;
+ *ctx_options |= SSL_OP_NO_SSLv3;
+ break;
+ }
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_TLSv1_0:
+#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
+ *ctx_options |= SSL_OP_NO_TLSv1_1;
+#endif
+ /* FALLTHROUGH */
+ case CURL_SSLVERSION_MAX_TLSv1_1:
+#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
+ *ctx_options |= SSL_OP_NO_TLSv1_2;
+#endif
+ /* FALLTHROUGH */
+ case CURL_SSLVERSION_MAX_TLSv1_2:
+ case CURL_SSLVERSION_MAX_DEFAULT:
+#ifdef TLS1_3_VERSION
+ *ctx_options |= SSL_OP_NO_TLSv1_3;
+#endif
+ break;
+ case CURL_SSLVERSION_MAX_TLSv1_3:
+#ifdef TLS1_3_VERSION
+ break;
+#else
+ failf(data, OSSL_PACKAGE " was built without TLS 1.3 support");
+ return CURLE_NOT_BUILT_IN;
+#endif
+ }
+ return CURLE_OK;
+}
+
static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
{
CURLcode result = CURLE_OK;
@@ -1702,9 +1825,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
X509_LOOKUP *lookup = NULL;
curl_socket_t sockfd = conn->sock[sockindex];
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- long ctx_options;
+ long ctx_options = 0;
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
bool sni;
+ const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
+ conn->host.name;
#ifdef ENABLE_IPV6
struct in6_addr addr;
#else
@@ -1723,8 +1848,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
- conn->host.name;
+ char error_buffer[256];
DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);
@@ -1790,7 +1914,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
if(!connssl->ctx) {
failf(data, "SSL: couldn't create a context: %s",
- ERR_error_string(ERR_peek_error(), NULL));
+ ossl_strerror(ERR_peek_error(), error_buffer, sizeof(error_buffer)));
return CURLE_OUT_OF_MEMORY;
}
@@ -1889,60 +2013,13 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
break;
case CURL_SSLVERSION_TLSv1_0:
- ctx_options |= SSL_OP_NO_SSLv2;
- ctx_options |= SSL_OP_NO_SSLv3;
-#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
- ctx_options |= SSL_OP_NO_TLSv1_1;
- ctx_options |= SSL_OP_NO_TLSv1_2;
-#ifdef TLS1_3_VERSION
- ctx_options |= SSL_OP_NO_TLSv1_3;
-#endif
-#endif
- break;
-
case CURL_SSLVERSION_TLSv1_1:
-#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
- ctx_options |= SSL_OP_NO_SSLv2;
- ctx_options |= SSL_OP_NO_SSLv3;
- ctx_options |= SSL_OP_NO_TLSv1;
- ctx_options |= SSL_OP_NO_TLSv1_2;
-#ifdef TLS1_3_VERSION
- ctx_options |= SSL_OP_NO_TLSv1_3;
-#endif
- break;
-#else
- failf(data, OSSL_PACKAGE " was built without TLS 1.1 support");
- return CURLE_NOT_BUILT_IN;
-#endif
-
case CURL_SSLVERSION_TLSv1_2:
-#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
- ctx_options |= SSL_OP_NO_SSLv2;
- ctx_options |= SSL_OP_NO_SSLv3;
- ctx_options |= SSL_OP_NO_TLSv1;
- ctx_options |= SSL_OP_NO_TLSv1_1;
-#ifdef TLS1_3_VERSION
- ctx_options |= SSL_OP_NO_TLSv1_3;
-#endif
- break;
-#else
- failf(data, OSSL_PACKAGE " was built without TLS 1.2 support");
- return CURLE_NOT_BUILT_IN;
-#endif
-
case CURL_SSLVERSION_TLSv1_3:
-#ifdef TLS1_3_VERSION
- SSL_CTX_set_max_proto_version(connssl->ctx, TLS1_3_VERSION);
- ctx_options |= SSL_OP_NO_SSLv2;
- ctx_options |= SSL_OP_NO_SSLv3;
- ctx_options |= SSL_OP_NO_TLSv1;
- ctx_options |= SSL_OP_NO_TLSv1_1;
- ctx_options |= SSL_OP_NO_TLSv1_2;
+ result = set_ssl_version_min_max(&ctx_options, conn, sockindex);
+ if(result != CURLE_OK)
+ return result;
break;
-#else
- failf(data, OSSL_PACKAGE " was built without TLS 1.3 support");
- return CURLE_NOT_BUILT_IN;
-#endif
case CURL_SSLVERSION_SSLv2:
#ifndef OPENSSL_NO_SSL2
@@ -2056,12 +2133,10 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
ssl_capath ? ssl_capath : "none");
return CURLE_SSL_CACERT_BADFILE;
}
- else {
- /* Just continue with a warning if no strict certificate verification
- is required. */
- infof(data, "error setting certificate verify locations,"
- " continuing anyway:\n");
- }
+ /* Just continue with a warning if no strict certificate verification
+ is required. */
+ infof(data, "error setting certificate verify locations,"
+ " continuing anyway:\n");
}
else {
/* Everything is fine. */
@@ -2091,12 +2166,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
failf(data, "error loading CRL file: %s", ssl_crlfile);
return CURLE_SSL_CRL_BADFILE;
}
- else {
- /* Everything is fine. */
- infof(data, "successfully load CRL file:\n");
- X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx),
- X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
- }
+ /* Everything is fine. */
+ infof(data, "successfully load CRL file:\n");
+ X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx),
+ X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
+
infof(data, " CRLfile: %s\n", ssl_crlfile);
}
@@ -2161,7 +2235,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
#endif
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -2170,7 +2244,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
if(!SSL_set_session(connssl->handle, ssl_sessionid)) {
Curl_ssl_sessionid_unlock(conn);
failf(data, "SSL: SSL_set_session failed: %s",
- ERR_error_string(ERR_get_error(), NULL));
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)));
return CURLE_SSL_CONNECT_ERROR;
}
/* Informational message */
@@ -2190,7 +2265,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
else if(!SSL_set_fd(connssl->handle, (int)sockfd)) {
/* pass the raw socket into the SSL layers */
failf(data, "SSL: SSL_set_fd failed: %s",
- ERR_error_string(ERR_get_error(), NULL));
+ ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)));
return CURLE_SSL_CONNECT_ERROR;
}
@@ -2224,15 +2299,14 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
connssl->connecting_state = ssl_connect_2_reading;
return CURLE_OK;
}
- else if(SSL_ERROR_WANT_WRITE == detail) {
+ if(SSL_ERROR_WANT_WRITE == detail) {
connssl->connecting_state = ssl_connect_2_writing;
return CURLE_OK;
}
else {
/* untreated error */
unsigned long errdetail;
- char error_buffer[256]=""; /* OpenSSL documents that this must be at
- least 256 bytes long. */
+ char error_buffer[256]="";
CURLcode result;
long lerr;
int lib;
@@ -2280,8 +2354,8 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
const char * const hostname = SSL_IS_PROXY() ?
conn->http_proxy.host.name : conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
- failf(data, "Unknown SSL protocol error in connection to %s:%ld ",
- hostname, port);
+ failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ",
+ SSL_ERROR_to_str(detail), hostname, port);
return result;
}
@@ -2554,44 +2628,25 @@ static CURLcode get_cert_chain(struct connectdata *conn,
{
const BIGNUM *n;
const BIGNUM *e;
- const BIGNUM *d;
- const BIGNUM *p;
- const BIGNUM *q;
- const BIGNUM *dmp1;
- const BIGNUM *dmq1;
- const BIGNUM *iqmp;
- RSA_get0_key(rsa, &n, &e, &d);
- RSA_get0_factors(rsa, &p, &q);
- RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
+ RSA_get0_key(rsa, &n, &e, NULL);
BN_print(mem, n);
push_certinfo("RSA Public Key", i);
print_pubkey_BN(rsa, n, i);
print_pubkey_BN(rsa, e, i);
- print_pubkey_BN(rsa, d, i);
- print_pubkey_BN(rsa, p, i);
- print_pubkey_BN(rsa, q, i);
- print_pubkey_BN(rsa, dmp1, i);
- print_pubkey_BN(rsa, dmq1, i);
- print_pubkey_BN(rsa, iqmp, i);
}
#else
BIO_printf(mem, "%d", BN_num_bits(rsa->n));
push_certinfo("RSA Public Key", i);
print_pubkey_BN(rsa, n, i);
print_pubkey_BN(rsa, e, i);
- print_pubkey_BN(rsa, d, i);
- print_pubkey_BN(rsa, p, i);
- print_pubkey_BN(rsa, q, i);
- print_pubkey_BN(rsa, dmp1, i);
- print_pubkey_BN(rsa, dmq1, i);
- print_pubkey_BN(rsa, iqmp, i);
#endif
break;
}
case EVP_PKEY_DSA:
{
+#ifndef OPENSSL_NO_DSA
DSA *dsa;
#ifdef HAVE_OPAQUE_EVP_PKEY
dsa = EVP_PKEY_get0_DSA(pubkey);
@@ -2603,25 +2658,23 @@ static CURLcode get_cert_chain(struct connectdata *conn,
const BIGNUM *p;
const BIGNUM *q;
const BIGNUM *g;
- const BIGNUM *priv_key;
const BIGNUM *pub_key;
DSA_get0_pqg(dsa, &p, &q, &g);
- DSA_get0_key(dsa, &pub_key, &priv_key);
+ DSA_get0_key(dsa, &pub_key, NULL);
print_pubkey_BN(dsa, p, i);
print_pubkey_BN(dsa, q, i);
print_pubkey_BN(dsa, g, i);
- print_pubkey_BN(dsa, priv_key, i);
print_pubkey_BN(dsa, pub_key, i);
}
#else
print_pubkey_BN(dsa, p, i);
print_pubkey_BN(dsa, q, i);
print_pubkey_BN(dsa, g, i);
- print_pubkey_BN(dsa, priv_key, i);
print_pubkey_BN(dsa, pub_key, i);
#endif
+#endif /* !OPENSSL_NO_DSA */
break;
}
case EVP_PKEY_DH:
@@ -2637,20 +2690,17 @@ static CURLcode get_cert_chain(struct connectdata *conn,
const BIGNUM *p;
const BIGNUM *q;
const BIGNUM *g;
- const BIGNUM *priv_key;
const BIGNUM *pub_key;
DH_get0_pqg(dh, &p, &q, &g);
- DH_get0_key(dh, &pub_key, &priv_key);
+ DH_get0_key(dh, &pub_key, NULL);
print_pubkey_BN(dh, p, i);
print_pubkey_BN(dh, q, i);
print_pubkey_BN(dh, g, i);
- print_pubkey_BN(dh, priv_key, i);
print_pubkey_BN(dh, pub_key, i);
}
#else
print_pubkey_BN(dh, p, i);
print_pubkey_BN(dh, g, i);
- print_pubkey_BN(dh, priv_key, i);
print_pubkey_BN(dh, pub_key, i);
#endif
break;
@@ -2915,7 +2965,7 @@ static CURLcode ossl_connect_step3(struct connectdata *conn, int sockindex)
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
@@ -3037,16 +3087,14 @@ static CURLcode ossl_connect_common(struct connectdata *conn,
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
return CURLE_SSL_CONNECT_ERROR;
}
- else if(0 == what) {
+ if(0 == what) {
if(nonblocking) {
*done = FALSE;
return CURLE_OK;
}
- else {
- /* timeout */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEDOUT;
- }
+ /* timeout */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
}
/* socket is readable or writable */
}
@@ -3116,8 +3164,7 @@ bool Curl_ossl_data_pending(const struct connectdata *conn, int connindex)
(conn->proxy_ssl[connindex].handle &&
0 != SSL_pending(conn->proxy_ssl[connindex].handle))) ?
TRUE : FALSE;
- else
- return FALSE;
+ return FALSE;
}
static ssize_t ossl_send(struct connectdata *conn,
@@ -3129,8 +3176,7 @@ static ssize_t ossl_send(struct connectdata *conn,
/* SSL_write() is said to return 'int' while write() and send() returns
'size_t' */
int err;
- char error_buffer[256]; /* OpenSSL documents that this must be at least 256
- bytes long. */
+ char error_buffer[256];
unsigned long sslerror;
int memlen;
int rc;
@@ -3176,7 +3222,8 @@ static ssize_t ossl_send(struct connectdata *conn,
return -1;
}
/* a true error */
- failf(conn->data, "SSL_write() return error %d", err);
+ failf(conn->data, OSSL_PACKAGE " SSL_write: %s, errno %d",
+ SSL_ERROR_to_str(err), SOCKERRNO);
*curlcode = CURLE_SEND_ERROR;
return -1;
}
@@ -3190,8 +3237,7 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
size_t buffersize, /* max amount to read */
CURLcode *curlcode)
{
- char error_buffer[256]; /* OpenSSL documents that this must be at
- least 256 bytes long. */
+ char error_buffer[256];
unsigned long sslerror;
ssize_t nread;
int buffsize;
@@ -3221,8 +3267,10 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
if((nread < 0) || sslerror) {
/* If the return code was negative or there actually is an error in the
queue */
- failf(conn->data, "SSL read: %s, errno %d",
- ossl_strerror(sslerror, error_buffer, sizeof(error_buffer)),
+ failf(conn->data, OSSL_PACKAGE " SSL_read: %s, errno %d",
+ (sslerror ?
+ ossl_strerror(sslerror, error_buffer, sizeof(error_buffer)) :
+ SSL_ERROR_to_str(err)),
SOCKERRNO);
*curlcode = CURLE_RECV_ERROR;
return -1;
@@ -3272,19 +3320,21 @@ size_t Curl_ossl_version(char *buffer, size_t size)
}
/* can be called with data == NULL */
-int Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
- size_t length)
+CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
+ size_t length)
{
+ int rc;
if(data) {
if(Curl_ossl_seed(data)) /* Initiate the seed if not already done */
- return 1; /* couldn't seed for some reason */
+ return CURLE_FAILED_INIT; /* couldn't seed for some reason */
}
else {
if(!rand_enough())
- return 1;
+ return CURLE_FAILED_INIT;
}
- RAND_bytes(entropy, curlx_uztosi(length));
- return 0; /* 0 as in no problem */
+ /* RAND_bytes() returns 1 on success, 0 otherwise. */
+ rc = RAND_bytes(entropy, curlx_uztosi(length));
+ return (rc == 1 ? CURLE_OK : CURLE_FAILED_INIT);
}
void Curl_ossl_md5sum(unsigned char *tmp, /* input */
diff --git a/Utilities/cmcurl/lib/vtls/openssl.h b/Utilities/cmcurl/lib/vtls/openssl.h
index cff1e90..b9648d5 100644
--- a/Utilities/cmcurl/lib/vtls/openssl.h
+++ b/Utilities/cmcurl/lib/vtls/openssl.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -66,8 +66,8 @@ bool Curl_ossl_data_pending(const struct connectdata *conn,
int connindex);
/* return 0 if a find random is filled in */
-int Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
- size_t length);
+CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
+ size_t length);
void Curl_ossl_md5sum(unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *md5sum /* output */,
diff --git a/Utilities/cmcurl/lib/vtls/polarssl.c b/Utilities/cmcurl/lib/vtls/polarssl.c
index 4bba3e3..669091c 100644
--- a/Utilities/cmcurl/lib/vtls/polarssl.c
+++ b/Utilities/cmcurl/lib/vtls/polarssl.c
@@ -140,6 +140,68 @@ static void polarssl_debug(void *context, int level, const char *line)
static Curl_recv polarssl_recv;
static Curl_send polarssl_send;
+static CURLcode polarssl_version_from_curl(int *polarver, long ssl_version)
+{
+ switch(ssl_version) {
+ case CURL_SSLVERSION_TLSv1_0:
+ *polarver = SSL_MINOR_VERSION_1;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1:
+ *polarver = SSL_MINOR_VERSION_2;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2:
+ *polarver = SSL_MINOR_VERSION_3;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3:
+ break;
+ }
+ return CURLE_SSL_CONNECT_ERROR;
+}
+
+static CURLcode
+set_ssl_version_min_max(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data* connssl = &conn->ssl[sockindex];
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ int ssl_min_ver = SSL_MINOR_VERSION_1;
+ int ssl_max_ver = SSL_MINOR_VERSION_1;
+ CURLcode result = CURLE_OK;
+
+ switch(ssl_version) {
+ case CURL_SSLVERSION_DEFAULT:
+ case CURL_SSLVERSION_TLSv1:
+ ssl_version = CURL_SSLVERSION_TLSv1_0;
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version << 16;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+
+ result = polarssl_version_from_curl(&ssl_min_ver, ssl_version);
+ if(result) {
+ failf(data, "unsupported min version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+ result = polarssl_version_from_curl(&ssl_max_ver, ssl_version_max >> 16);
+ if(result) {
+ failf(data, "unsupported max version passed via CURLOPT_SSLVERSION");
+ return result;
+ }
+
+ ssl_set_min_version(&connssl->ssl, SSL_MAJOR_VERSION_3, ssl_min_ver);
+ ssl_set_max_version(&connssl->ssl, SSL_MAJOR_VERSION_3, ssl_max_ver);
+
+ return result;
+}
static CURLcode
polarssl_connect_step1(struct connectdata *conn,
@@ -287,29 +349,15 @@ polarssl_connect_step1(struct connectdata *conn,
infof(data, "PolarSSL: Forced min. SSL Version to be SSLv3\n");
break;
case CURL_SSLVERSION_TLSv1_0:
- ssl_set_min_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_1);
- ssl_set_max_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_1);
- infof(data, "PolarSSL: Forced min. SSL Version to be TLS 1.0\n");
- break;
case CURL_SSLVERSION_TLSv1_1:
- ssl_set_min_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_2);
- ssl_set_max_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_2);
- infof(data, "PolarSSL: Forced min. SSL Version to be TLS 1.1\n");
- break;
case CURL_SSLVERSION_TLSv1_2:
- ssl_set_min_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_3);
- ssl_set_max_version(&connssl->ssl, SSL_MAJOR_VERSION_3,
- SSL_MINOR_VERSION_3);
- infof(data, "PolarSSL: Forced min. SSL Version to be TLS 1.2\n");
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "PolarSSL: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ CURLcode result = set_ssl_version_min_max(conn, sockindex);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
default:
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
return CURLE_SSL_CONNECT_ERROR;
@@ -327,7 +375,7 @@ polarssl_connect_step1(struct connectdata *conn,
ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -555,7 +603,7 @@ polarssl_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
@@ -564,7 +612,7 @@ polarssl_connect_step3(struct connectdata *conn,
if(!our_ssl_sessionid)
return CURLE_OUT_OF_MEMORY;
- ssl_session_init(our_ssl_sessionid);
+ memset(our_ssl_sessionid, 0, sizeof(ssl_session));
ret = ssl_get_session(&connssl->ssl, our_ssl_sessionid);
if(ret) {
@@ -816,4 +864,10 @@ void Curl_polarssl_cleanup(void)
(void)Curl_polarsslthreadlock_thread_cleanup();
}
+
+int Curl_polarssl_data_pending(const struct connectdata *conn, int sockindex)
+{
+ return ssl_get_bytes_avail(&conn->ssl[sockindex].ssl) != 0;
+}
+
#endif /* USE_POLARSSL */
diff --git a/Utilities/cmcurl/lib/vtls/polarssl.h b/Utilities/cmcurl/lib/vtls/polarssl.h
index 7098b24..47af7b4 100644
--- a/Utilities/cmcurl/lib/vtls/polarssl.h
+++ b/Utilities/cmcurl/lib/vtls/polarssl.h
@@ -31,6 +31,7 @@
/* Called on first use PolarSSL, setup threading if supported */
int Curl_polarssl_init(void);
void Curl_polarssl_cleanup(void);
+int Curl_polarssl_data_pending(const struct connectdata *conn, int sockindex);
CURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex);
@@ -69,7 +70,7 @@ int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex);
#define curlssl_engines_list(x) ((void)x, (struct curl_slist *)NULL)
#define curlssl_version Curl_polarssl_version
#define curlssl_check_cxn(x) ((void)x, -1)
-#define curlssl_data_pending(x,y) ((void)x, (void)y, 0)
+#define curlssl_data_pending(x,y) Curl_polarssl_data_pending(x, y)
#define curlssl_sha256sum(a,b,c,d) sha256(a,b,c,0)
/* This might cause libcurl to use a weeker random!
diff --git a/Utilities/cmcurl/lib/vtls/schannel.c b/Utilities/cmcurl/lib/vtls/schannel.c
index ac8b705..c9b5132 100644
--- a/Utilities/cmcurl/lib/vtls/schannel.c
+++ b/Utilities/cmcurl/lib/vtls/schannel.c
@@ -7,7 +7,7 @@
*
* Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de>
* Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>
- * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -103,6 +103,41 @@ static void InitSecBufferDesc(SecBufferDesc *desc, SecBuffer *BufArr,
}
static CURLcode
+set_ssl_version_min_max(SCHANNEL_CRED *schannel_cred, struct connectdata *conn)
+{
+ struct Curl_easy *data = conn->data;
+ long ssl_version = SSL_CONN_CONFIG(version);
+ long ssl_version_max = SSL_CONN_CONFIG(version_max);
+ long i = ssl_version;
+
+ switch(ssl_version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ ssl_version_max = ssl_version << 16;
+ break;
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
+ }
+ for(; i <= (ssl_version_max >> 16); ++i) {
+ switch(i) {
+ case CURL_SSLVERSION_TLSv1_0:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_0_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_1_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_2_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ failf(data, "Schannel: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ }
+ return CURLE_OK;
+}
+
+static CURLcode
schannel_connect_step1(struct connectdata *conn, int sockindex)
{
ssize_t written = -1;
@@ -124,12 +159,20 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
#endif
TCHAR *host_name;
CURLcode result;
- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
+ char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
infof(data, "schannel: SSL/TLS connection with %s port %hu (step 1/3)\n",
hostname, conn->remote_port);
+ if(Curl_verify_windows_version(5, 1, PLATFORM_WINNT,
+ VERSION_LESS_THAN_EQUAL)) {
+ /* SChannel in Windows XP (OS version 5.1) uses legacy handshakes and
+ algorithms that may not be supported by all servers. */
+ infof(data, "schannel: WinSSL version is old and may not be able to "
+ "connect to some servers due to lack of SNI, algorithms, etc.\n");
+ }
+
#ifdef HAS_ALPN
/* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above.
Also it doesn't seem to be supported for Wine, see curl bug #983. */
@@ -145,7 +188,7 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
connssl->cred = NULL;
/* check for an existing re-usable credential handle */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL, sockindex)) {
connssl->cred = old_cred;
@@ -197,7 +240,7 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
schannel_cred.dwFlags |= SCH_CRED_NO_SERVERNAME_CHECK;
infof(data, "schannel: verifyhost setting prevents Schannel from "
"comparing the supplied target name with the subject "
- "names in server certificates. Also disables SNI.\n");
+ "names in server certificates.\n");
}
switch(conn->ssl_config.version) {
@@ -208,17 +251,15 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
SP_PROT_TLS1_2_CLIENT;
break;
case CURL_SSLVERSION_TLSv1_0:
- schannel_cred.grbitEnabledProtocols = SP_PROT_TLS1_0_CLIENT;
- break;
case CURL_SSLVERSION_TLSv1_1:
- schannel_cred.grbitEnabledProtocols = SP_PROT_TLS1_1_CLIENT;
- break;
case CURL_SSLVERSION_TLSv1_2:
- schannel_cred.grbitEnabledProtocols = SP_PROT_TLS1_2_CLIENT;
- break;
case CURL_SSLVERSION_TLSv1_3:
- failf(data, "Schannel: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ {
+ result = set_ssl_version_min_max(&schannel_cred, conn);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv3:
schannel_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT;
break;
@@ -415,7 +456,7 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
TCHAR *host_name;
CURLcode result;
bool doread;
- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
+ char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE;
@@ -649,8 +690,10 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
SECURITY_STATUS sspi_status = SEC_E_OK;
CERT_CONTEXT *ccert_context = NULL;
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
+#endif
#ifdef HAS_ALPN
SecPkgContext_ApplicationProtocol alpn_result;
#endif
@@ -714,7 +757,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
#endif
/* save the current session data for possible re-use */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
struct curl_schannel_cred *old_cred = NULL;
@@ -1391,7 +1434,7 @@ int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
*/
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
+ char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
infof(data, "schannel: shutting down SSL/TLS connection with %s port %hu\n",
@@ -1516,21 +1559,21 @@ size_t Curl_schannel_version(char *buffer, size_t size)
return size;
}
-int Curl_schannel_random(unsigned char *entropy, size_t length)
+CURLcode Curl_schannel_random(unsigned char *entropy, size_t length)
{
HCRYPTPROV hCryptProv = 0;
if(!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
- return 1;
+ return CURLE_FAILED_INIT;
if(!CryptGenRandom(hCryptProv, (DWORD)length, entropy)) {
CryptReleaseContext(hCryptProv, 0UL);
- return 1;
+ return CURLE_FAILED_INIT;
}
CryptReleaseContext(hCryptProv, 0UL);
- return 0;
+ return CURLE_OK;
}
#ifdef _WIN32_WCE
diff --git a/Utilities/cmcurl/lib/vtls/schannel.h b/Utilities/cmcurl/lib/vtls/schannel.h
index 8a4991e..8627c63 100644
--- a/Utilities/cmcurl/lib/vtls/schannel.h
+++ b/Utilities/cmcurl/lib/vtls/schannel.h
@@ -8,7 +8,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al.
- * Copyright (C) 2012 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -92,7 +92,7 @@ int Curl_schannel_init(void);
void Curl_schannel_cleanup(void);
size_t Curl_schannel_version(char *buffer, size_t size);
-int Curl_schannel_random(unsigned char *entropy, size_t length);
+CURLcode Curl_schannel_random(unsigned char *entropy, size_t length);
/* Set the API backend definition to Schannel */
#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL
diff --git a/Utilities/cmcurl/lib/vtls/vtls.c b/Utilities/cmcurl/lib/vtls/vtls.c
index b808e1c..d5d0971 100644
--- a/Utilities/cmcurl/lib/vtls/vtls.c
+++ b/Utilities/cmcurl/lib/vtls/vtls.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -95,6 +95,7 @@ Curl_ssl_config_matches(struct ssl_primary_config* data,
struct ssl_primary_config* needle)
{
if((data->version == needle->version) &&
+ (data->version_max == needle->version_max) &&
(data->verifypeer == needle->verifypeer) &&
(data->verifyhost == needle->verifyhost) &&
Curl_safe_strcasecompare(data->CApath, needle->CApath) &&
@@ -113,6 +114,7 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
dest->verifyhost = source->verifyhost;
dest->verifypeer = source->verifypeer;
dest->version = source->version;
+ dest->version_max = source->version_max;
CLONE_STRING(CAfile);
CLONE_STRING(CApath);
@@ -120,6 +122,9 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
CLONE_STRING(egdsocket);
CLONE_STRING(random_file);
CLONE_STRING(clientcert);
+
+ /* Disable dest sessionid cache if a client cert is used, CVE-2016-5419. */
+ dest->sessionid = (dest->clientcert ? false : source->sessionid);
return TRUE;
}
@@ -173,11 +178,24 @@ void Curl_ssl_cleanup(void)
static bool ssl_prefs_check(struct Curl_easy *data)
{
/* check for CURLOPT_SSLVERSION invalid parameter value */
- if((data->set.ssl.primary.version < 0)
- || (data->set.ssl.primary.version >= CURL_SSLVERSION_LAST)) {
+ const long sslver = data->set.ssl.primary.version;
+ if((sslver < 0) || (sslver >= CURL_SSLVERSION_LAST)) {
failf(data, "Unrecognized parameter value passed via CURLOPT_SSLVERSION");
return FALSE;
}
+
+ switch(data->set.ssl.primary.version_max) {
+ case CURL_SSLVERSION_MAX_NONE:
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ break;
+
+ default:
+ if((data->set.ssl.primary.version_max >> 16) < sslver) {
+ failf(data, "CURL_SSLVERSION_MAX incompatible with CURL_SSLVERSION");
+ return FALSE;
+ }
+ }
+
return TRUE;
}
@@ -286,16 +304,16 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
const bool isProxy = CONNECT_PROXY_SSL();
struct ssl_primary_config * const ssl_config = isProxy ?
- &conn->proxy_ssl_config :
- &conn->ssl_config;
+ &conn->proxy_ssl_config :
+ &conn->ssl_config;
const char * const name = isProxy ? conn->http_proxy.host.name :
- conn->host.name;
+ conn->host.name;
int port = isProxy ? (int)conn->port : conn->remote_port;
*ssl_sessionid = NULL;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
- if(!data->set.general_ssl.sessionid)
+ if(!SSL_SET_OPTION(primary.sessionid))
/* session ID re-use is disabled */
return TRUE;
@@ -394,10 +412,10 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
long *general_age;
const bool isProxy = CONNECT_PROXY_SSL();
struct ssl_primary_config * const ssl_config = isProxy ?
- &conn->proxy_ssl_config :
- &conn->ssl_config;
+ &conn->proxy_ssl_config :
+ &conn->ssl_config;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
clone_host = strdup(isProxy ? conn->http_proxy.host.name : conn->host.name);
if(!clone_host)
@@ -447,7 +465,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
store->sessionid = ssl_sessionid;
store->idsize = idsize;
store->age = *general_age; /* set current age */
- /* free it if there's one already present */
+ /* free it if there's one already present */
free(store->name);
free(store->conn_to_host);
store->name = clone_host; /* clone host name */
@@ -484,9 +502,9 @@ void Curl_ssl_close_all(struct Curl_easy *data)
curlssl_close_all(data);
}
-#if defined(USE_SSLEAY) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \
- defined(USE_DARWINSSL) || defined(USE_NSS)
-/* This function is for OpenSSL, GnuTLS, darwinssl, and schannel only. */
+#if defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \
+ defined(USE_DARWINSSL) || defined(USE_POLARSSL) || defined(USE_NSS) || \
+ defined(USE_MBEDTLS)
int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
int numsocks)
{
@@ -500,7 +518,7 @@ int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_WRITESOCK(0);
}
- else if(connssl->connecting_state == ssl_connect_2_reading) {
+ if(connssl->connecting_state == ssl_connect_2_reading) {
/* read mode */
socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_READSOCK(0);
@@ -510,15 +528,15 @@ int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
}
#else
int Curl_ssl_getsock(struct connectdata *conn,
- curl_socket_t *socks,
- int numsocks)
+ curl_socket_t *socks,
+ int numsocks)
{
(void)conn;
(void)socks;
(void)numsocks;
return GETSOCK_BLANK;
}
-/* USE_SSLEAY || USE_GNUTLS || USE_SCHANNEL || USE_DARWINSSL || USE_NSS */
+/* USE_OPENSSL || USE_GNUTLS || USE_SCHANNEL || USE_DARWINSSL || USE_NSS */
#endif
void Curl_ssl_close(struct connectdata *conn, int sockindex)
@@ -703,12 +721,7 @@ CURLcode Curl_ssl_random(struct Curl_easy *data,
unsigned char *entropy,
size_t length)
{
- int rc = curlssl_random(data, entropy, length);
- if(rc) {
- failf(data, "PRNG seeding failed");
- return CURLE_FAILED_INIT; /* possibly weird return code */
- }
- return CURLE_OK;
+ return curlssl_random(data, entropy, length);
}
/*
diff --git a/Utilities/cmcurl/lib/warnless.c b/Utilities/cmcurl/lib/warnless.c
index 0c4472e..fb085c8 100644
--- a/Utilities/cmcurl/lib/warnless.c
+++ b/Utilities/cmcurl/lib/warnless.c
@@ -183,12 +183,15 @@ curl_off_t curlx_uztoso(size_t uznum)
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
+#elif defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4310) /* cast truncates constant value */
#endif
DEBUGASSERT(uznum <= (size_t) CURL_MASK_SCOFFT);
return (curl_off_t)(uznum & (size_t) CURL_MASK_SCOFFT);
-#ifdef __INTEL_COMPILER
+#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
# pragma warning(pop)
#endif
}
diff --git a/Utilities/cmcurl/lib/wildcard.c b/Utilities/cmcurl/lib/wildcard.c
index dbbe45f..af45c79 100644
--- a/Utilities/cmcurl/lib/wildcard.c
+++ b/Utilities/cmcurl/lib/wildcard.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -32,13 +32,9 @@
CURLcode Curl_wildcard_init(struct WildcardData *wc)
{
- DEBUGASSERT(wc->filelist == NULL);
- /* now allocate only wc->filelist, everything else
- will be allocated if it is needed. */
- wc->filelist = Curl_llist_alloc(Curl_fileinfo_dtor);
- if(!wc->filelist) {;
- return CURLE_OUT_OF_MEMORY;
- }
+ Curl_llist_init(&wc->filelist, Curl_fileinfo_dtor);
+ wc->state = CURLWC_INIT;
+
return CURLE_OK;
}
@@ -54,10 +50,8 @@ void Curl_wildcard_dtor(struct WildcardData *wc)
}
DEBUGASSERT(wc->tmp == NULL);
- if(wc->filelist) {
- Curl_llist_destroy(wc->filelist, NULL);
- wc->filelist = NULL;
- }
+ Curl_llist_destroy(&wc->filelist, NULL);
+
free(wc->path);
wc->path = NULL;
diff --git a/Utilities/cmcurl/lib/wildcard.h b/Utilities/cmcurl/lib/wildcard.h
index 7f61cd1..8a5e4b7 100644
--- a/Utilities/cmcurl/lib/wildcard.h
+++ b/Utilities/cmcurl/lib/wildcard.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2010 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -24,9 +24,12 @@
#include <curl/curl.h>
+#include "llist.h"
+
/* list of wildcard process states */
typedef enum {
- CURLWC_INIT = 0,
+ CURLWC_CLEAR = 0,
+ CURLWC_INIT = 1,
CURLWC_MATCHING, /* library is trying to get list of addresses for
downloading */
CURLWC_DOWNLOADING,
@@ -44,7 +47,7 @@ struct WildcardData {
curl_wildcard_states state;
char *path; /* path to the directory, where we trying wildcard-match */
char *pattern; /* wildcard pattern */
- struct curl_llist *filelist; /* llist with struct Curl_fileinfo */
+ struct curl_llist filelist; /* llist with struct Curl_fileinfo */
void *tmp; /* pointer to protocol specific temporary data */
curl_wildcard_tmp_dtor tmp_dtor;
void *customptr; /* for CURLOPT_CHUNK_DATA pointer */
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt
index d0114e7..bc9076e 100644
--- a/Utilities/cmjsoncpp/CMakeLists.txt
+++ b/Utilities/cmjsoncpp/CMakeLists.txt
@@ -24,3 +24,4 @@ include_directories(
add_library(cmjsoncpp ${JSONCPP_SOURCES})
target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES})
+set_property(TARGET cmjsoncpp PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
index e806680..bb3b8a7 100644
--- a/Utilities/cmliblzma/CMakeLists.txt
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -15,11 +15,11 @@ CHECK_C_SOURCE_COMPILES(
HAVE___RESTRICT)
CHECK_C_SOURCE_COMPILES(
- "inline int test (void) {return 0;}\nint main (void) {return test();}"
+ "static inline int test (void) {return 0;}\nint main (void) {return test();}"
HAVE_INLINE)
CHECK_C_SOURCE_COMPILES (
- "__inline int test (void) {return 0;}\nint main (void) {return test();}"
+ "static __inline int test (void) {return 0;}\nint main (void) {return test();}"
HAVE___INLINE)
CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index 6632a1e..618f79d 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -143,6 +143,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
_DARWIN_UNLIMITED_SELECT=1
)
list(APPEND uv_sources
+ src/unix/bsd-ifaddrs.c
src/unix/darwin.c
src/unix/darwin-proctitle.c
src/unix/fsevents.c
@@ -175,8 +176,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
include/uv-bsd.h
)
list(APPEND uv_sources
+ src/unix/bsd-ifaddrs.c
src/unix/freebsd.c
src/unix/kqueue.c
+ src/unix/posix-hrtime.c
)
endif()
@@ -188,8 +191,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
include/uv-bsd.h
)
list(APPEND uv_sources
+ src/unix/bsd-ifaddrs.c
src/unix/netbsd.c
src/unix/kqueue.c
+ src/unix/posix-hrtime.c
)
endif()
@@ -201,8 +206,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
include/uv-bsd.h
)
list(APPEND uv_sources
+ src/unix/bsd-ifaddrs.c
src/unix/openbsd.c
src/unix/kqueue.c
+ src/unix/posix-hrtime.c
)
endif()
@@ -221,13 +228,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
__EXTENSIONS__
)
if(CMAKE_SYSTEM_VERSION STREQUAL "5.10")
+ set(CMAKE_C_STANDARD 90)
+ if(CMAKE_VERSION VERSION_LESS 3.8.20170504 AND CMAKE_C_COMPILER_ID STREQUAL "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.14)
+ # The running version of CMake does not know how to add this flag.
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90")
+ endif()
list(APPEND uv_defines
_XOPEN_SOURCE=500
)
- if(CMAKE_C_STANDARD)
- set(CMAKE_C_STANDARD 90)
- endif()
else()
+ if(NOT CMAKE_C_STANDARD OR CMAKE_C_STANDARD EQUAL 90)
+ set(CMAKE_C_STANDARD 11)
+ endif()
+ if(CMAKE_VERSION VERSION_LESS 3.8.20170505 AND CMAKE_C_COMPILER_ID STREQUAL "SunPro" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 5.14)
+ # The running version of CMake does not know how to add this flag.
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xc99")
+ endif()
list(APPEND uv_defines
_XOPEN_SOURCE=600
)
diff --git a/Utilities/cmlibuv/include/uv-unix.h b/Utilities/cmlibuv/include/uv-unix.h
index 3030f71..5440729 100644
--- a/Utilities/cmlibuv/include/uv-unix.h
+++ b/Utilities/cmlibuv/include/uv-unix.h
@@ -79,7 +79,6 @@
#endif
struct uv__io_s;
-struct uv__async;
struct uv_loop_s;
typedef void (*uv__io_cb)(struct uv_loop_s* loop,
@@ -97,16 +96,6 @@ struct uv__io_s {
UV_IO_PRIVATE_PLATFORM_FIELDS
};
-typedef void (*uv__async_cb)(struct uv_loop_s* loop,
- struct uv__async* w,
- unsigned int nevents);
-
-struct uv__async {
- uv__async_cb cb;
- uv__io_t io_watcher;
- int wfd;
-};
-
#ifndef UV_PLATFORM_SEM_T
# define UV_PLATFORM_SEM_T sem_t
#endif
@@ -216,7 +205,9 @@ typedef struct {
void* check_handles[2]; \
void* idle_handles[2]; \
void* async_handles[2]; \
- struct uv__async async_watcher; \
+ void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \
+ uv__io_t async_io_watcher; \
+ int async_wfd; \
struct { \
void* min; \
unsigned int nelts; \
diff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h
index 5879764..ce04875 100644
--- a/Utilities/cmlibuv/include/uv.h
+++ b/Utilities/cmlibuv/include/uv.h
@@ -278,6 +278,7 @@ UV_EXTERN void uv_loop_delete(uv_loop_t*);
UV_EXTERN size_t uv_loop_size(void);
UV_EXTERN int uv_loop_alive(const uv_loop_t* loop);
UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...);
+UV_EXTERN int uv_loop_fork(uv_loop_t* loop);
UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode);
UV_EXTERN void uv_stop(uv_loop_t*);
@@ -1077,6 +1078,10 @@ UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
int count);
+UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
+UV_EXTERN int uv_os_setenv(const char* name, const char* value);
+UV_EXTERN int uv_os_unsetenv(const char* name);
+
typedef enum {
UV_FS_UNKNOWN = -1,
@@ -1328,6 +1333,9 @@ UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle);
UV_EXTERN int uv_signal_start(uv_signal_t* handle,
uv_signal_cb signal_cb,
int signum);
+UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum);
UV_EXTERN int uv_signal_stop(uv_signal_t* handle);
UV_EXTERN void uv_loadavg(double avg[3]);
diff --git a/Utilities/cmlibuv/src/threadpool.c b/Utilities/cmlibuv/src/threadpool.c
index 2c5152b..1089341 100644
--- a/Utilities/cmlibuv/src/threadpool.c
+++ b/Utilities/cmlibuv/src/threadpool.c
@@ -23,18 +23,6 @@
#if !defined(_WIN32)
# include "unix/internal.h"
-#else
-# include "win/req-inl.h"
-/* TODO(saghul): unify internal req functions */
-static void uv__req_init(uv_loop_t* loop,
- uv_req_t* req,
- uv_req_type type) {
- uv_req_init(loop, req);
- req->type = type;
- uv__req_register(loop, req);
-}
-# define uv__req_init(loop, req, type) \
- uv__req_init((loop), (uv_req_t*)(req), (type))
#endif
#include <stdlib.h>
@@ -139,7 +127,7 @@ UV_DESTRUCTOR(static void cleanup(void)) {
#endif
-static void init_once(void) {
+static void init_threads(void) {
unsigned int i;
const char* val;
@@ -177,6 +165,27 @@ static void init_once(void) {
}
+#ifndef _WIN32
+static void reset_once(void) {
+ uv_once_t child_once = UV_ONCE_INIT;
+ memcpy(&once, &child_once, sizeof(child_once));
+}
+#endif
+
+
+static void init_once(void) {
+#ifndef _WIN32
+ /* Re-initialize the threadpool after fork.
+ * Note that this discards the global mutex and condition as well
+ * as the work queue.
+ */
+ if (pthread_atfork(NULL, NULL, &reset_once))
+ abort();
+#endif
+ init_threads();
+}
+
+
void uv__work_submit(uv_loop_t* loop,
struct uv__work* w,
void (*work)(struct uv__work* w),
diff --git a/Utilities/cmlibuv/src/unix/aix.c b/Utilities/cmlibuv/src/unix/aix.c
index 1d2cd4a..388c9cc 100644
--- a/Utilities/cmlibuv/src/unix/aix.c
+++ b/Utilities/cmlibuv/src/unix/aix.c
@@ -96,6 +96,13 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
+int uv__io_fork(uv_loop_t* loop) {
+ uv__platform_loop_delete(loop);
+
+ return uv__platform_loop_init(loop);
+}
+
+
int uv__io_check_fd(uv_loop_t* loop, int fd) {
struct poll_ctl pc;
diff --git a/Utilities/cmlibuv/src/unix/async.c b/Utilities/cmlibuv/src/unix/async.c
index 393cdeb..45c088e 100644
--- a/Utilities/cmlibuv/src/unix/async.c
+++ b/Utilities/cmlibuv/src/unix/async.c
@@ -33,16 +33,15 @@
#include <string.h>
#include <unistd.h>
-static void uv__async_event(uv_loop_t* loop,
- struct uv__async* w,
- unsigned int nevents);
+static void uv__async_send(uv_loop_t* loop);
+static int uv__async_start(uv_loop_t* loop);
static int uv__async_eventfd(void);
int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
int err;
- err = uv__async_start(loop, &loop->async_watcher, uv__async_event);
+ err = uv__async_start(loop);
if (err)
return err;
@@ -63,7 +62,7 @@ int uv_async_send(uv_async_t* handle) {
return 0;
if (cmpxchgi(&handle->pending, 0, 1) == 0)
- uv__async_send(&handle->loop->async_watcher);
+ uv__async_send(handle->loop);
return 0;
}
@@ -75,44 +74,18 @@ void uv__async_close(uv_async_t* handle) {
}
-static void uv__async_event(uv_loop_t* loop,
- struct uv__async* w,
- unsigned int nevents) {
+static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
+ char buf[1024];
+ ssize_t r;
QUEUE queue;
QUEUE* q;
uv_async_t* h;
- QUEUE_MOVE(&loop->async_handles, &queue);
- while (!QUEUE_EMPTY(&queue)) {
- q = QUEUE_HEAD(&queue);
- h = QUEUE_DATA(q, uv_async_t, queue);
-
- QUEUE_REMOVE(q);
- QUEUE_INSERT_TAIL(&loop->async_handles, q);
-
- if (cmpxchgi(&h->pending, 1, 0) == 0)
- continue;
-
- if (h->async_cb == NULL)
- continue;
- h->async_cb(h);
- }
-}
-
+ assert(w == &loop->async_io_watcher);
-static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
- struct uv__async* wa;
- char buf[1024];
- unsigned n;
- ssize_t r;
-
- n = 0;
for (;;) {
r = read(w->fd, buf, sizeof(buf));
- if (r > 0)
- n += r;
-
if (r == sizeof(buf))
continue;
@@ -128,23 +101,26 @@ static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
abort();
}
- wa = container_of(w, struct uv__async, io_watcher);
+ QUEUE_MOVE(&loop->async_handles, &queue);
+ while (!QUEUE_EMPTY(&queue)) {
+ q = QUEUE_HEAD(&queue);
+ h = QUEUE_DATA(q, uv_async_t, queue);
+
+ QUEUE_REMOVE(q);
+ QUEUE_INSERT_TAIL(&loop->async_handles, q);
-#if defined(__linux__)
- if (wa->wfd == -1) {
- uint64_t val;
- assert(n == sizeof(val));
- memcpy(&val, buf, sizeof(val)); /* Avoid alignment issues. */
- wa->cb(loop, wa, val);
- return;
- }
-#endif
+ if (cmpxchgi(&h->pending, 1, 0) == 0)
+ continue;
+
+ if (h->async_cb == NULL)
+ continue;
- wa->cb(loop, wa, n);
+ h->async_cb(h);
+ }
}
-void uv__async_send(struct uv__async* wa) {
+static void uv__async_send(uv_loop_t* loop) {
const void* buf;
ssize_t len;
int fd;
@@ -152,14 +128,14 @@ void uv__async_send(struct uv__async* wa) {
buf = "";
len = 1;
- fd = wa->wfd;
+ fd = loop->async_wfd;
#if defined(__linux__)
if (fd == -1) {
static const uint64_t val = 1;
buf = &val;
len = sizeof(val);
- fd = wa->io_watcher.fd; /* eventfd */
+ fd = loop->async_io_watcher.fd; /* eventfd */
}
#endif
@@ -178,17 +154,11 @@ void uv__async_send(struct uv__async* wa) {
}
-void uv__async_init(struct uv__async* wa) {
- wa->io_watcher.fd = -1;
- wa->wfd = -1;
-}
-
-
-int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb) {
+static int uv__async_start(uv_loop_t* loop) {
int pipefd[2];
int err;
- if (wa->io_watcher.fd != -1)
+ if (loop->async_io_watcher.fd != -1)
return 0;
err = uv__async_eventfd();
@@ -222,32 +192,41 @@ int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb) {
if (err < 0)
return err;
- uv__io_init(&wa->io_watcher, uv__async_io, pipefd[0]);
- uv__io_start(loop, &wa->io_watcher, POLLIN);
- wa->wfd = pipefd[1];
- wa->cb = cb;
+ uv__io_init(&loop->async_io_watcher, uv__async_io, pipefd[0]);
+ uv__io_start(loop, &loop->async_io_watcher, POLLIN);
+ loop->async_wfd = pipefd[1];
return 0;
}
-void uv__async_stop(uv_loop_t* loop, struct uv__async* wa) {
- if (wa->io_watcher.fd == -1)
+int uv__async_fork(uv_loop_t* loop) {
+ if (loop->async_io_watcher.fd == -1) /* never started */
+ return 0;
+
+ uv__async_stop(loop);
+
+ return uv__async_start(loop);
+}
+
+
+void uv__async_stop(uv_loop_t* loop) {
+ if (loop->async_io_watcher.fd == -1)
return;
- if (wa->wfd != -1) {
- if (wa->wfd != wa->io_watcher.fd)
- uv__close(wa->wfd);
- wa->wfd = -1;
+ if (loop->async_wfd != -1) {
+ if (loop->async_wfd != loop->async_io_watcher.fd)
+ uv__close(loop->async_wfd);
+ loop->async_wfd = -1;
}
- uv__io_stop(loop, &wa->io_watcher, POLLIN);
- uv__close(wa->io_watcher.fd);
- wa->io_watcher.fd = -1;
+ uv__io_stop(loop, &loop->async_io_watcher, POLLIN);
+ uv__close(loop->async_io_watcher.fd);
+ loop->async_io_watcher.fd = -1;
}
-static int uv__async_eventfd() {
+static int uv__async_eventfd(void) {
#if defined(__linux__)
static int no_eventfd2;
static int no_eventfd;
diff --git a/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c b/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c
new file mode 100644
index 0000000..0b5653d
--- /dev/null
+++ b/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c
@@ -0,0 +1,133 @@
+/* Copyright libuv project contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+
+#include <errno.h>
+#include <stddef.h>
+
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+
+static int uv__ifaddr_exclude(struct ifaddrs *ent) {
+ if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
+ return 1;
+ if (ent->ifa_addr == NULL)
+ return 1;
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
+ /*
+ * On BSD getifaddrs returns information related to the raw underlying
+ * devices. We're not interested in this information.
+ */
+ if (ent->ifa_addr->sa_family == AF_LINK)
+ return 1;
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+ if (ent->ifa_addr->sa_family != PF_INET)
+ return 1;
+#endif
+ return 0;
+}
+
+int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+ struct ifaddrs* addrs;
+ struct ifaddrs* ent;
+ uv_interface_address_t* address;
+ int i;
+
+ if (getifaddrs(&addrs) != 0)
+ return -errno;
+
+ *count = 0;
+
+ /* Count the number of interfaces */
+ for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
+ if (uv__ifaddr_exclude(ent))
+ continue;
+ (*count)++;
+ }
+
+ *addresses = uv__malloc(*count * sizeof(**addresses));
+
+ if (*addresses == NULL) {
+ freeifaddrs(addrs);
+ return -ENOMEM;
+ }
+
+ address = *addresses;
+
+ for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
+ if (uv__ifaddr_exclude(ent))
+ continue;
+
+ address->name = uv__strdup(ent->ifa_name);
+
+ if (ent->ifa_addr->sa_family == AF_INET6) {
+ address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
+ } else {
+ address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
+ }
+
+ if (ent->ifa_netmask->sa_family == AF_INET6) {
+ address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
+ } else {
+ address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
+ }
+
+ address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
+
+ address++;
+ }
+
+ /* Fill in physical addresses for each interface */
+ for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
+ if (uv__ifaddr_exclude(ent))
+ continue;
+
+ address = *addresses;
+
+ for (i = 0; i < *count; i++) {
+ if (strcmp(address->name, ent->ifa_name) == 0) {
+ struct sockaddr_dl* sa_addr;
+ sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
+ memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
+ }
+ address++;
+ }
+ }
+
+ freeifaddrs(addrs);
+
+ return 0;
+}
+
+
+void uv_free_interface_addresses(uv_interface_address_t* addresses,
+ int count) {
+ int i;
+
+ for (i = 0; i < count; i++) {
+ uv__free(addresses[i].name);
+ }
+
+ uv__free(addresses);
+}
diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c
index 9ef7134..96495b8 100644
--- a/Utilities/cmlibuv/src/unix/core.c
+++ b/Utilities/cmlibuv/src/unix/core.c
@@ -1240,3 +1240,48 @@ int uv_translate_sys_error(int sys_errno) {
/* If < 0 then it's already a libuv error. */
return sys_errno <= 0 ? sys_errno : -sys_errno;
}
+
+
+int uv_os_getenv(const char* name, char* buffer, size_t* size) {
+ char* var;
+ size_t len;
+
+ if (name == NULL || buffer == NULL || size == NULL || *size == 0)
+ return -EINVAL;
+
+ var = getenv(name);
+
+ if (var == NULL)
+ return -ENOENT;
+
+ len = strlen(var);
+
+ if (len >= *size) {
+ *size = len + 1;
+ return -ENOBUFS;
+ }
+
+ memcpy(buffer, var, len + 1);
+ *size = len;
+
+ return 0;
+}
+
+
+int uv_os_setenv(const char* name, const char* value) {
+ if (name == NULL || value == NULL)
+ return -EINVAL;
+
+ if (setenv(name, value, 1) != 0)
+ return -errno;
+
+ return 0;
+}
+
+
+int uv_os_unsetenv(const char* name) {
+ if (unsetenv(name) != 0)
+ return -errno;
+
+ return 0;
+}
diff --git a/Utilities/cmlibuv/src/unix/darwin.c b/Utilities/cmlibuv/src/unix/darwin.c
index cf95da2..df6dd1c 100644
--- a/Utilities/cmlibuv/src/unix/darwin.c
+++ b/Utilities/cmlibuv/src/unix/darwin.c
@@ -25,10 +25,6 @@
#include <stdint.h>
#include <errno.h>
-#include <ifaddrs.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
@@ -233,103 +229,3 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
-
-
-int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
- struct ifaddrs *addrs, *ent;
- uv_interface_address_t* address;
- int i;
- struct sockaddr_dl *sa_addr;
-
- if (getifaddrs(&addrs))
- return -errno;
-
- *count = 0;
-
- /* Count the number of interfaces */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family == AF_LINK)) {
- continue;
- }
-
- (*count)++;
- }
-
- *addresses = uv__malloc(*count * sizeof(**addresses));
- if (!(*addresses)) {
- freeifaddrs(addrs);
- return -ENOMEM;
- }
-
- address = *addresses;
-
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
- continue;
-
- /*
- * On Mac OS X getifaddrs returns information related to Mac Addresses for
- * various devices, such as firewire, etc. These are not relevant here.
- */
- if (ent->ifa_addr->sa_family == AF_LINK)
- continue;
-
- address->name = uv__strdup(ent->ifa_name);
-
- if (ent->ifa_addr->sa_family == AF_INET6) {
- address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
- } else {
- address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
- }
-
- if (ent->ifa_netmask->sa_family == AF_INET6) {
- address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
- } else {
- address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
- }
-
- address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
-
- address++;
- }
-
- /* Fill in physical addresses for each interface */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != AF_LINK)) {
- continue;
- }
-
- address = *addresses;
-
- for (i = 0; i < (*count); i++) {
- if (strcmp(address->name, ent->ifa_name) == 0) {
- sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
- memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
- }
- address++;
- }
- }
-
- freeifaddrs(addrs);
-
- return 0;
-}
-
-
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- int i;
-
- for (i = 0; i < count; i++) {
- uv__free(addresses[i].name);
- }
-
- uv__free(addresses);
-}
diff --git a/Utilities/cmlibuv/src/unix/freebsd.c b/Utilities/cmlibuv/src/unix/freebsd.c
index cba44a3..e52ae99 100644
--- a/Utilities/cmlibuv/src/unix/freebsd.c
+++ b/Utilities/cmlibuv/src/unix/freebsd.c
@@ -25,10 +25,6 @@
#include <string.h>
#include <errno.h>
-#include <ifaddrs.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-
#include <kvm.h>
#include <paths.h>
#include <sys/user.h>
@@ -41,9 +37,6 @@
#include <unistd.h> /* sysconf */
#include <fcntl.h>
-#undef NANOSEC
-#define NANOSEC ((uint64_t) 1e9)
-
#ifndef CPUSTATES
# define CPUSTATES 5U
#endif
@@ -67,13 +60,6 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
-uint64_t uv__hrtime(uv_clocktype_t type) {
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
-}
-
-
#ifdef __DragonFly__
int uv_exepath(char* buffer, size_t* size) {
char abspath[PATH_MAX * 2 + 1];
@@ -358,103 +344,3 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
-
-
-int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
- struct ifaddrs *addrs, *ent;
- uv_interface_address_t* address;
- int i;
- struct sockaddr_dl *sa_addr;
-
- if (getifaddrs(&addrs))
- return -errno;
-
- *count = 0;
-
- /* Count the number of interfaces */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family == AF_LINK)) {
- continue;
- }
-
- (*count)++;
- }
-
- *addresses = uv__malloc(*count * sizeof(**addresses));
- if (!(*addresses)) {
- freeifaddrs(addrs);
- return -ENOMEM;
- }
-
- address = *addresses;
-
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
- continue;
-
- /*
- * On FreeBSD getifaddrs returns information related to the raw underlying
- * devices. We're not interested in this information yet.
- */
- if (ent->ifa_addr->sa_family == AF_LINK)
- continue;
-
- address->name = uv__strdup(ent->ifa_name);
-
- if (ent->ifa_addr->sa_family == AF_INET6) {
- address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
- } else {
- address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
- }
-
- if (ent->ifa_netmask->sa_family == AF_INET6) {
- address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
- } else {
- address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
- }
-
- address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
-
- address++;
- }
-
- /* Fill in physical addresses for each interface */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != AF_LINK)) {
- continue;
- }
-
- address = *addresses;
-
- for (i = 0; i < (*count); i++) {
- if (strcmp(address->name, ent->ifa_name) == 0) {
- sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
- memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
- }
- address++;
- }
- }
-
- freeifaddrs(addrs);
-
- return 0;
-}
-
-
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- int i;
-
- for (i = 0; i < count; i++) {
- uv__free(addresses[i].name);
- }
-
- uv__free(addresses);
-}
diff --git a/Utilities/cmlibuv/src/unix/internal.h b/Utilities/cmlibuv/src/unix/internal.h
index b48f8fa..2e3afa6 100644
--- a/Utilities/cmlibuv/src/unix/internal.h
+++ b/Utilities/cmlibuv/src/unix/internal.h
@@ -192,12 +192,12 @@ void uv__io_feed(uv_loop_t* loop, uv__io_t* w);
int uv__io_active(const uv__io_t* w, unsigned int events);
int uv__io_check_fd(uv_loop_t* loop, int fd);
void uv__io_poll(uv_loop_t* loop, int timeout); /* in milliseconds or -1 */
+int uv__io_fork(uv_loop_t* loop);
/* async */
-void uv__async_send(struct uv__async* wa);
-void uv__async_init(struct uv__async* wa);
-int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb);
-void uv__async_stop(uv_loop_t* loop, struct uv__async* wa);
+void uv__async_stop(uv_loop_t* loop);
+int uv__async_fork(uv_loop_t* loop);
+
/* loop */
void uv__run_idle(uv_loop_t* loop);
@@ -233,6 +233,7 @@ int uv__next_timeout(const uv_loop_t* loop);
void uv__signal_close(uv_signal_t* handle);
void uv__signal_global_once_init(void);
void uv__signal_loop_cleanup(uv_loop_t* loop);
+int uv__signal_loop_fork(uv_loop_t* loop);
/* platform specific */
uint64_t uv__hrtime(uv_clocktype_t type);
@@ -302,15 +303,6 @@ static const int kFSEventStreamEventFlagItemIsSymlink = 0x00040000;
#endif /* defined(__APPLE__) */
-UV_UNUSED(static void uv__req_init(uv_loop_t* loop,
- uv_req_t* req,
- uv_req_type type)) {
- req->type = type;
- uv__req_register(loop, req);
-}
-#define uv__req_init(loop, req, type) \
- uv__req_init((loop), (uv_req_t*)(req), (type))
-
UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) {
/* Use a fast time source if available. We only need millisecond precision.
*/
@@ -327,4 +319,8 @@ UV_UNUSED(static char* uv__basename_r(const char* path)) {
return s + 1;
}
+#if defined(__linux__)
+int uv__inotify_fork(uv_loop_t* loop, void* old_watchers);
+#endif
+
#endif /* UV_UNIX_INTERNAL_H_ */
diff --git a/Utilities/cmlibuv/src/unix/kqueue.c b/Utilities/cmlibuv/src/unix/kqueue.c
index fffd462..6bc60bb 100644
--- a/Utilities/cmlibuv/src/unix/kqueue.c
+++ b/Utilities/cmlibuv/src/unix/kqueue.c
@@ -48,6 +48,37 @@ int uv__kqueue_init(uv_loop_t* loop) {
}
+static int uv__has_forked_with_cfrunloop;
+
+int uv__io_fork(uv_loop_t* loop) {
+ int err;
+ uv__close(loop->backend_fd);
+ loop->backend_fd = -1;
+ err = uv__kqueue_init(loop);
+ if (err)
+ return err;
+
+#if defined(__APPLE__)
+ if (loop->cf_state != NULL) {
+ /* We cannot start another CFRunloop and/or thread in the child
+ process; CF aborts if you try or if you try to touch the thread
+ at all to kill it. So the best we can do is ignore it from now
+ on. This means we can't watch directories in the same way
+ anymore (like other BSDs). It also means we cannot properly
+ clean up the allocated resources; calling
+ uv__fsevents_loop_delete from uv_loop_close will crash the
+ process. So we sidestep the issue by pretending like we never
+ started it in the first place.
+ */
+ uv__has_forked_with_cfrunloop = 1;
+ uv__free(loop->cf_state);
+ loop->cf_state = NULL;
+ }
+#endif
+ return err;
+}
+
+
int uv__io_check_fd(uv_loop_t* loop, int fd) {
struct kevent ev;
int rc;
@@ -404,6 +435,9 @@ int uv_fs_event_start(uv_fs_event_t* handle,
handle->cb = cb;
#if defined(__APPLE__)
+ if (uv__has_forked_with_cfrunloop)
+ goto fallback;
+
/* Nullify field to perform checks later */
handle->cf_cb = NULL;
handle->realpath = NULL;
@@ -438,7 +472,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
uv__handle_stop(handle);
#if defined(__APPLE__)
- if (uv__fsevents_close(handle))
+ if (uv__has_forked_with_cfrunloop || uv__fsevents_close(handle))
#endif /* defined(__APPLE__) */
{
uv__io_close(handle->loop, &handle->event_watcher);
diff --git a/Utilities/cmlibuv/src/unix/linux-core.c b/Utilities/cmlibuv/src/unix/linux-core.c
index 58dd813..646be4f 100644
--- a/Utilities/cmlibuv/src/unix/linux-core.c
+++ b/Utilities/cmlibuv/src/unix/linux-core.c
@@ -107,6 +107,24 @@ int uv__platform_loop_init(uv_loop_t* loop) {
}
+int uv__io_fork(uv_loop_t* loop) {
+ int err;
+ void* old_watchers;
+
+ old_watchers = loop->inotify_watchers;
+
+ uv__close(loop->backend_fd);
+ loop->backend_fd = -1;
+ uv__platform_loop_delete(loop);
+
+ err = uv__platform_loop_init(loop);
+ if (err)
+ return err;
+
+ return uv__inotify_fork(loop, old_watchers);
+}
+
+
void uv__platform_loop_delete(uv_loop_t* loop) {
if (loop->inotify_fd == -1) return;
uv__io_stop(loop, &loop->inotify_read_watcher, POLLIN);
@@ -868,6 +886,19 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
+static int uv__ifaddr_exclude(struct ifaddrs *ent) {
+ if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
+ return 1;
+ if (ent->ifa_addr == NULL)
+ return 1;
+ /*
+ * On Linux getifaddrs returns information related to the raw underlying
+ * devices. We're not interested in this information yet.
+ */
+ if (ent->ifa_addr->sa_family == PF_PACKET)
+ return 1;
+ return 0;
+}
int uv_interface_addresses(uv_interface_address_t** addresses,
int* count) {
@@ -887,11 +918,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
/* Count the number of interfaces */
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family == PF_PACKET)) {
+ if (uv__ifaddr_exclude(ent))
continue;
- }
(*count)++;
}
@@ -908,17 +936,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
address = *addresses;
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
- continue;
-
- /*
- * On Linux getifaddrs returns information related to the raw underlying
- * devices. We're not interested in this information yet.
- */
- if (ent->ifa_addr->sa_family == PF_PACKET)
+ if (uv__ifaddr_exclude(ent))
continue;
address->name = uv__strdup(ent->ifa_name);
@@ -942,11 +960,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
/* Fill in physical addresses for each interface */
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != PF_PACKET)) {
+ if (uv__ifaddr_exclude(ent))
continue;
- }
address = *addresses;
diff --git a/Utilities/cmlibuv/src/unix/linux-inotify.c b/Utilities/cmlibuv/src/unix/linux-inotify.c
index 4708c05..5934c5d 100644
--- a/Utilities/cmlibuv/src/unix/linux-inotify.c
+++ b/Utilities/cmlibuv/src/unix/linux-inotify.c
@@ -61,6 +61,8 @@ static void uv__inotify_read(uv_loop_t* loop,
uv__io_t* w,
unsigned int revents);
+static void maybe_free_watcher_list(struct watcher_list* w,
+ uv_loop_t* loop);
static int new_inotify_fd(void) {
int err;
@@ -108,6 +110,71 @@ static int init_inotify(uv_loop_t* loop) {
}
+int uv__inotify_fork(uv_loop_t* loop, void* old_watchers) {
+ /* Open the inotify_fd, and re-arm all the inotify watchers. */
+ int err;
+ struct watcher_list* tmp_watcher_list_iter;
+ struct watcher_list* watcher_list;
+ struct watcher_list tmp_watcher_list;
+ QUEUE queue;
+ QUEUE* q;
+ uv_fs_event_t* handle;
+ char* tmp_path;
+
+ if (old_watchers != NULL) {
+ /* We must restore the old watcher list to be able to close items
+ * out of it.
+ */
+ loop->inotify_watchers = old_watchers;
+
+ QUEUE_INIT(&tmp_watcher_list.watchers);
+ /* Note that the queue we use is shared with the start and stop()
+ * functions, making QUEUE_FOREACH unsafe to use. So we use the
+ * QUEUE_MOVE trick to safely iterate. Also don't free the watcher
+ * list until we're done iterating. c.f. uv__inotify_read.
+ */
+ RB_FOREACH_SAFE(watcher_list, watcher_root,
+ CAST(&old_watchers), tmp_watcher_list_iter) {
+ watcher_list->iterating = 1;
+ QUEUE_MOVE(&watcher_list->watchers, &queue);
+ while (!QUEUE_EMPTY(&queue)) {
+ q = QUEUE_HEAD(&queue);
+ handle = QUEUE_DATA(q, uv_fs_event_t, watchers);
+ /* It's critical to keep a copy of path here, because it
+ * will be set to NULL by stop() and then deallocated by
+ * maybe_free_watcher_list
+ */
+ tmp_path = uv__strdup(handle->path);
+ assert(tmp_path != NULL);
+ QUEUE_REMOVE(q);
+ QUEUE_INSERT_TAIL(&watcher_list->watchers, q);
+ uv_fs_event_stop(handle);
+
+ QUEUE_INSERT_TAIL(&tmp_watcher_list.watchers, &handle->watchers);
+ handle->path = tmp_path;
+ }
+ watcher_list->iterating = 0;
+ maybe_free_watcher_list(watcher_list, loop);
+ }
+
+ QUEUE_MOVE(&tmp_watcher_list.watchers, &queue);
+ while (!QUEUE_EMPTY(&queue)) {
+ q = QUEUE_HEAD(&queue);
+ QUEUE_REMOVE(q);
+ handle = QUEUE_DATA(q, uv_fs_event_t, watchers);
+ tmp_path = handle->path;
+ handle->path = NULL;
+ err = uv_fs_event_start(handle, handle->cb, tmp_path, 0);
+ uv__free(tmp_path);
+ if (err)
+ return err;
+ }
+ }
+
+ return 0;
+}
+
+
static struct watcher_list* find_watcher(uv_loop_t* loop, int wd) {
struct watcher_list w;
w.wd = wd;
diff --git a/Utilities/cmlibuv/src/unix/loop.c b/Utilities/cmlibuv/src/unix/loop.c
index bd63c2f..bcd4924 100644
--- a/Utilities/cmlibuv/src/unix/loop.c
+++ b/Utilities/cmlibuv/src/unix/loop.c
@@ -54,7 +54,8 @@ int uv_loop_init(uv_loop_t* loop) {
loop->closing_handles = NULL;
uv__update_time(loop);
- uv__async_init(&loop->async_watcher);
+ loop->async_io_watcher.fd = -1;
+ loop->async_wfd = -1;
loop->signal_pipefd[0] = -1;
loop->signal_pipefd[1] = -1;
loop->backend_fd = -1;
@@ -108,10 +109,43 @@ fail_signal_init:
}
+int uv_loop_fork(uv_loop_t* loop) {
+ int err;
+ unsigned int i;
+ uv__io_t* w;
+
+ err = uv__io_fork(loop);
+ if (err)
+ return err;
+
+ err = uv__async_fork(loop);
+ if (err)
+ return err;
+
+ err = uv__signal_loop_fork(loop);
+ if (err)
+ return err;
+
+ /* Rearm all the watchers that aren't re-queued by the above. */
+ for (i = 0; i < loop->nwatchers; i++) {
+ w = loop->watchers[i];
+ if (w == NULL)
+ continue;
+
+ if (w->pevents != 0 && QUEUE_EMPTY(&w->watcher_queue)) {
+ w->events = 0; /* Force re-registration in uv__io_poll. */
+ QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
+ }
+ }
+
+ return 0;
+}
+
+
void uv__loop_close(uv_loop_t* loop) {
uv__signal_loop_cleanup(loop);
uv__platform_loop_delete(loop);
- uv__async_stop(loop, &loop->async_watcher);
+ uv__async_stop(loop);
if (loop->emfile_fd != -1) {
uv__close(loop->emfile_fd);
diff --git a/Utilities/cmlibuv/src/unix/netbsd.c b/Utilities/cmlibuv/src/unix/netbsd.c
index 4a9e6cb..9b5546b 100644
--- a/Utilities/cmlibuv/src/unix/netbsd.c
+++ b/Utilities/cmlibuv/src/unix/netbsd.c
@@ -27,14 +27,11 @@
#include <kvm.h>
#include <paths.h>
-#include <ifaddrs.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <fcntl.h>
-#include <net/if.h>
-#include <net/if_dl.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -43,9 +40,6 @@
#include <unistd.h>
#include <time.h>
-#undef NANOSEC
-#define NANOSEC ((uint64_t) 1e9)
-
static char *process_title;
@@ -58,13 +52,6 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
-uint64_t uv__hrtime(uv_clocktype_t type) {
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
-}
-
-
void uv_loadavg(double avg[3]) {
struct loadavg info;
size_t size = sizeof(info);
@@ -283,98 +270,3 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
-
-
-int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
- struct ifaddrs *addrs, *ent;
- uv_interface_address_t* address;
- int i;
- struct sockaddr_dl *sa_addr;
-
- if (getifaddrs(&addrs))
- return -errno;
-
- *count = 0;
-
- /* Count the number of interfaces */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != PF_INET)) {
- continue;
- }
- (*count)++;
- }
-
- *addresses = uv__malloc(*count * sizeof(**addresses));
-
- if (!(*addresses)) {
- freeifaddrs(addrs);
- return -ENOMEM;
- }
-
- address = *addresses;
-
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
- continue;
-
- if (ent->ifa_addr->sa_family != PF_INET)
- continue;
-
- address->name = uv__strdup(ent->ifa_name);
-
- if (ent->ifa_addr->sa_family == AF_INET6) {
- address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
- } else {
- address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
- }
-
- if (ent->ifa_netmask->sa_family == AF_INET6) {
- address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
- } else {
- address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
- }
-
- address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
-
- address++;
- }
-
- /* Fill in physical addresses for each interface */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != AF_LINK)) {
- continue;
- }
-
- address = *addresses;
-
- for (i = 0; i < (*count); i++) {
- if (strcmp(address->name, ent->ifa_name) == 0) {
- sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
- memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
- }
- address++;
- }
- }
-
- freeifaddrs(addrs);
-
- return 0;
-}
-
-
-void uv_free_interface_addresses(uv_interface_address_t* addresses, int count) {
- int i;
-
- for (i = 0; i < count; i++) {
- uv__free(addresses[i].name);
- }
-
- uv__free(addresses);
-}
diff --git a/Utilities/cmlibuv/src/unix/openbsd.c b/Utilities/cmlibuv/src/unix/openbsd.c
index ac28b69..7e4b253 100644
--- a/Utilities/cmlibuv/src/unix/openbsd.c
+++ b/Utilities/cmlibuv/src/unix/openbsd.c
@@ -28,10 +28,6 @@
#include <sys/time.h>
#include <sys/sysctl.h>
-#include <ifaddrs.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-
#include <errno.h>
#include <fcntl.h>
#include <kvm.h>
@@ -40,9 +36,6 @@
#include <string.h>
#include <unistd.h>
-#undef NANOSEC
-#define NANOSEC ((uint64_t) 1e9)
-
static char *process_title;
@@ -56,13 +49,6 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
-uint64_t uv__hrtime(uv_clocktype_t type) {
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
-}
-
-
void uv_loadavg(double avg[3]) {
struct loadavg info;
size_t size = sizeof(info);
@@ -297,100 +283,3 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
-
-
-int uv_interface_addresses(uv_interface_address_t** addresses,
- int* count) {
- struct ifaddrs *addrs, *ent;
- uv_interface_address_t* address;
- int i;
- struct sockaddr_dl *sa_addr;
-
- if (getifaddrs(&addrs) != 0)
- return -errno;
-
- *count = 0;
-
- /* Count the number of interfaces */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != PF_INET)) {
- continue;
- }
- (*count)++;
- }
-
- *addresses = uv__malloc(*count * sizeof(**addresses));
-
- if (!(*addresses)) {
- freeifaddrs(addrs);
- return -ENOMEM;
- }
-
- address = *addresses;
-
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
- continue;
-
- if (ent->ifa_addr->sa_family != PF_INET)
- continue;
-
- address->name = uv__strdup(ent->ifa_name);
-
- if (ent->ifa_addr->sa_family == AF_INET6) {
- address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
- } else {
- address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
- }
-
- if (ent->ifa_netmask->sa_family == AF_INET6) {
- address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
- } else {
- address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
- }
-
- address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
-
- address++;
- }
-
- /* Fill in physical addresses for each interface */
- for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family != AF_LINK)) {
- continue;
- }
-
- address = *addresses;
-
- for (i = 0; i < (*count); i++) {
- if (strcmp(address->name, ent->ifa_name) == 0) {
- sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
- memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
- }
- address++;
- }
- }
-
- freeifaddrs(addrs);
-
- return 0;
-}
-
-
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- int i;
-
- for (i = 0; i < count; i++) {
- uv__free(addresses[i].name);
- }
-
- uv__free(addresses);
-}
diff --git a/Utilities/cmlibuv/src/unix/os390-syscalls.c b/Utilities/cmlibuv/src/unix/os390-syscalls.c
index 2bf3b73..7edf235 100644
--- a/Utilities/cmlibuv/src/unix/os390-syscalls.c
+++ b/Utilities/cmlibuv/src/unix/os390-syscalls.c
@@ -120,7 +120,7 @@ static void maybe_resize(uv__os390_epoll* lst, unsigned int len) {
}
-static void epoll_init() {
+static void epoll_init(void) {
QUEUE_INIT(&global_epoll_queue);
if (uv_mutex_init(&global_epoll_lock))
abort();
diff --git a/Utilities/cmlibuv/src/unix/os390.c b/Utilities/cmlibuv/src/unix/os390.c
index be325a9..e9ba90c 100644
--- a/Utilities/cmlibuv/src/unix/os390.c
+++ b/Utilities/cmlibuv/src/unix/os390.c
@@ -863,3 +863,9 @@ update_timeout:
void uv__set_process_title(const char* title) {
/* do nothing */
}
+
+int uv__io_fork(uv_loop_t* loop) {
+ uv__platform_loop_delete(loop);
+
+ return uv__platform_loop_init(loop);
+}
diff --git a/Utilities/cmlibuv/src/unix/pipe.c b/Utilities/cmlibuv/src/unix/pipe.c
index 80f5e6f..023e965 100644
--- a/Utilities/cmlibuv/src/unix/pipe.c
+++ b/Utilities/cmlibuv/src/unix/pipe.c
@@ -73,7 +73,9 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
/* Convert ENOENT to EACCES for compatibility with Windows. */
if (err == -ENOENT)
err = -EACCES;
- goto err_bind;
+
+ uv__close(sockfd);
+ goto err_socket;
}
/* Success. */
@@ -82,9 +84,6 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
handle->io_watcher.fd = sockfd;
return 0;
-err_bind:
- uv__close(sockfd);
-
err_socket:
uv__free((void*)pipe_fname);
return err;
diff --git a/Utilities/cmlibuv/src/unix/posix-hrtime.c b/Utilities/cmlibuv/src/unix/posix-hrtime.c
new file mode 100644
index 0000000..323dfc2
--- /dev/null
+++ b/Utilities/cmlibuv/src/unix/posix-hrtime.c
@@ -0,0 +1,35 @@
+/* Copyright libuv project contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+
+#include <stdint.h>
+#include <time.h>
+
+#undef NANOSEC
+#define NANOSEC ((uint64_t) 1e9)
+
+uint64_t uv__hrtime(uv_clocktype_t type) {
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+}
diff --git a/Utilities/cmlibuv/src/unix/signal.c b/Utilities/cmlibuv/src/unix/signal.c
index dbd8f86..cb09ead 100644
--- a/Utilities/cmlibuv/src/unix/signal.c
+++ b/Utilities/cmlibuv/src/unix/signal.c
@@ -38,9 +38,14 @@ RB_HEAD(uv__signal_tree_s, uv_signal_s);
static int uv__signal_unlock(void);
+static int uv__signal_start(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum,
+ int oneshot);
static void uv__signal_event(uv_loop_t* loop, uv__io_t* w, unsigned int events);
static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2);
static void uv__signal_stop(uv_signal_t* handle);
+static void uv__signal_unregister_handler(int signum);
static uv_once_t uv__signal_global_init_guard = UV_ONCE_INIT;
@@ -53,8 +58,19 @@ RB_GENERATE_STATIC(uv__signal_tree_s,
uv_signal_s, tree_entry,
uv__signal_compare)
+static void uv__signal_global_reinit(void);
static void uv__signal_global_init(void) {
+ if (!uv__signal_lock_pipefd[0])
+ /* pthread_atfork can register before and after handlers, one
+ * for each child. This only registers one for the child. That
+ * state is both persistent and cumulative, so if we keep doing
+ * it the handler functions will be called multiple times. Thus
+ * we only want to do it once.
+ */
+ if (pthread_atfork(NULL, NULL, &uv__signal_global_reinit))
+ abort();
+
if (uv__make_pipe(uv__signal_lock_pipefd, 0))
abort();
@@ -63,6 +79,22 @@ static void uv__signal_global_init(void) {
}
+static void uv__signal_global_reinit(void) {
+ /* We can only use signal-safe functions here.
+ * That includes read/write and close, fortunately.
+ * We do all of this directly here instead of resetting
+ * uv__signal_global_init_guard because
+ * uv__signal_global_once_init is only called from uv_loop_init
+ * and this needs to function in existing loops.
+ */
+ uv__close(uv__signal_lock_pipefd[0]);
+ uv__signal_lock_pipefd[0] = -1;
+ uv__close(uv__signal_lock_pipefd[1]);
+ uv__signal_lock_pipefd[1] = -1;
+ uv__signal_global_init();
+}
+
+
void uv__signal_global_once_init(void) {
uv_once(&uv__signal_global_init_guard, uv__signal_global_init);
}
@@ -122,6 +154,7 @@ static uv_signal_t* uv__signal_first_handle(int signum) {
uv_signal_t* handle;
lookup.signum = signum;
+ lookup.flags = 0;
lookup.loop = NULL;
handle = RB_NFIND(uv__signal_tree_s, &uv__signal_tree, &lookup);
@@ -174,7 +207,7 @@ static void uv__signal_handler(int signum) {
}
-static int uv__signal_register_handler(int signum) {
+static int uv__signal_register_handler(int signum, int oneshot) {
/* When this function is called, the signal lock must be held. */
struct sigaction sa;
@@ -183,6 +216,7 @@ static int uv__signal_register_handler(int signum) {
if (sigfillset(&sa.sa_mask))
abort();
sa.sa_handler = uv__signal_handler;
+ sa.sa_flags = oneshot ? SA_RESETHAND : 0;
/* XXX save old action so we can restore it later on? */
if (sigaction(signum, &sa, NULL))
@@ -228,6 +262,16 @@ static int uv__signal_loop_once_init(uv_loop_t* loop) {
}
+int uv__signal_loop_fork(uv_loop_t* loop) {
+ uv__io_stop(loop, &loop->signal_io_watcher, POLLIN);
+ uv__close(loop->signal_pipefd[0]);
+ uv__close(loop->signal_pipefd[1]);
+ loop->signal_pipefd[0] = -1;
+ loop->signal_pipefd[1] = -1;
+ return uv__signal_loop_once_init(loop);
+}
+
+
void uv__signal_loop_cleanup(uv_loop_t* loop) {
QUEUE* q;
@@ -287,8 +331,24 @@ void uv__signal_close(uv_signal_t* handle) {
int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) {
+ return uv__signal_start(handle, signal_cb, signum, 0);
+}
+
+
+int uv_signal_start_oneshot(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum) {
+ return uv__signal_start(handle, signal_cb, signum, 1);
+}
+
+
+static int uv__signal_start(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum,
+ int oneshot) {
sigset_t saved_sigmask;
int err;
+ uv_signal_t* first_handle;
assert(!uv__is_closing(handle));
@@ -318,9 +378,12 @@ int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) {
/* If at this point there are no active signal watchers for this signum (in
* any of the loops), it's time to try and register a handler for it here.
+ * Also in case there's only one-shot handlers and a regular handler comes in.
*/
- if (uv__signal_first_handle(signum) == NULL) {
- err = uv__signal_register_handler(signum);
+ first_handle = uv__signal_first_handle(signum);
+ if (first_handle == NULL ||
+ (!oneshot && (first_handle->flags & UV__SIGNAL_ONE_SHOT))) {
+ err = uv__signal_register_handler(signum, oneshot);
if (err) {
/* Registering the signal handler failed. Must be an invalid signal. */
uv__signal_unlock_and_unblock(&saved_sigmask);
@@ -329,6 +392,9 @@ int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) {
}
handle->signum = signum;
+ if (oneshot)
+ handle->flags |= UV__SIGNAL_ONE_SHOT;
+
RB_INSERT(uv__signal_tree_s, &uv__signal_tree, handle);
uv__signal_unlock_and_unblock(&saved_sigmask);
@@ -390,6 +456,9 @@ static void uv__signal_event(uv_loop_t* loop,
handle->dispatched_signals++;
+ if (handle->flags & UV__SIGNAL_ONE_SHOT)
+ uv__signal_stop(handle);
+
/* If uv_close was called while there were caught signals that were not
* yet dispatched, the uv__finish_close was deferred. Make close pending
* now if this has happened.
@@ -414,12 +483,22 @@ static void uv__signal_event(uv_loop_t* loop,
static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) {
+ int f1;
+ int f2;
/* Compare signums first so all watchers with the same signnum end up
* adjacent.
*/
if (w1->signum < w2->signum) return -1;
if (w1->signum > w2->signum) return 1;
+ /* Handlers without UV__SIGNAL_ONE_SHOT set will come first, so if the first
+ * handler returned is a one-shot handler, the rest will be too.
+ */
+ f1 = w1->flags & UV__SIGNAL_ONE_SHOT;
+ f2 = w2->flags & UV__SIGNAL_ONE_SHOT;
+ if (f1 < f2) return -1;
+ if (f1 > f2) return 1;
+
/* Sort by loop pointer, so we can easily look up the first item after
* { .signum = x, .loop = NULL }.
*/
@@ -443,6 +522,10 @@ int uv_signal_stop(uv_signal_t* handle) {
static void uv__signal_stop(uv_signal_t* handle) {
uv_signal_t* removed_handle;
sigset_t saved_sigmask;
+ uv_signal_t* first_handle;
+ int rem_oneshot;
+ int first_oneshot;
+ int ret;
/* If the watcher wasn't started, this is a no-op. */
if (handle->signum == 0)
@@ -457,8 +540,17 @@ static void uv__signal_stop(uv_signal_t* handle) {
/* Check if there are other active signal watchers observing this signal. If
* not, unregister the signal handler.
*/
- if (uv__signal_first_handle(handle->signum) == NULL)
+ first_handle = uv__signal_first_handle(handle->signum);
+ if (first_handle == NULL) {
uv__signal_unregister_handler(handle->signum);
+ } else {
+ rem_oneshot = handle->flags & UV__SIGNAL_ONE_SHOT;
+ first_oneshot = first_handle->flags & UV__SIGNAL_ONE_SHOT;
+ if (first_oneshot && !rem_oneshot) {
+ ret = uv__signal_register_handler(handle->signum, 1);
+ assert(ret == 0);
+ }
+ }
uv__signal_unlock_and_unblock(&saved_sigmask);
diff --git a/Utilities/cmlibuv/src/unix/stream.c b/Utilities/cmlibuv/src/unix/stream.c
index 7059df1..dbd04f2 100644
--- a/Utilities/cmlibuv/src/unix/stream.c
+++ b/Utilities/cmlibuv/src/unix/stream.c
@@ -785,7 +785,12 @@ start:
struct msghdr msg;
struct cmsghdr *cmsg;
int fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle);
- char scratch[64] = {0};
+ union {
+ char data[64];
+ struct cmsghdr alias;
+ } scratch;
+
+ memset(&scratch, 0, sizeof(scratch));
assert(fd_to_send >= 0);
@@ -795,7 +800,7 @@ start:
msg.msg_iovlen = iovcnt;
msg.msg_flags = 0;
- msg.msg_control = (void*) scratch;
+ msg.msg_control = &scratch.alias;
msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send));
cmsg = CMSG_FIRSTHDR(&msg);
diff --git a/Utilities/cmlibuv/src/unix/sunos.c b/Utilities/cmlibuv/src/unix/sunos.c
index 14c58af..d100263 100644
--- a/Utilities/cmlibuv/src/unix/sunos.c
+++ b/Utilities/cmlibuv/src/unix/sunos.c
@@ -103,6 +103,18 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
+int uv__io_fork(uv_loop_t* loop) {
+#if defined(PORT_SOURCE_FILE)
+ if (loop->fs_fd != -1) {
+ /* stop the watcher before we blow away its fileno */
+ uv__io_stop(loop, &loop->fs_event_watcher, POLLIN);
+ }
+#endif
+ uv__platform_loop_delete(loop);
+ return uv__platform_loop_init(loop);
+}
+
+
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
struct port_event* events;
uintptr_t i;
@@ -473,8 +485,10 @@ int uv_fs_event_start(uv_fs_event_t* handle,
memset(&handle->fo, 0, sizeof handle->fo);
handle->fo.fo_name = handle->path;
err = uv__fs_event_rearm(handle);
- if (err != 0)
+ if (err != 0) {
+ uv_fs_event_stop(handle);
return err;
+ }
if (first_run) {
uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd);
@@ -750,6 +764,17 @@ static int uv__set_phys_addr(uv_interface_address_t* address,
return 0;
}
+
+static int uv__ifaddr_exclude(struct ifaddrs *ent) {
+ if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
+ return 1;
+ if (ent->ifa_addr == NULL)
+ return 1;
+ if (ent->ifa_addr->sa_family == PF_PACKET)
+ return 1;
+ return 0;
+}
+
int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
uv_interface_address_t* address;
struct ifaddrs* addrs;
@@ -763,12 +788,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
/* Count the number of interfaces */
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
- (ent->ifa_addr == NULL) ||
- (ent->ifa_addr->sa_family == PF_PACKET)) {
+ if (uv__ifaddr_exclude(ent))
continue;
- }
-
(*count)++;
}
@@ -781,10 +802,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
address = *addresses;
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
- if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
- continue;
-
- if (ent->ifa_addr == NULL)
+ if (uv__ifaddr_exclude(ent))
continue;
address->name = uv__strdup(ent->ifa_name);
diff --git a/Utilities/cmlibuv/src/unix/udp.c b/Utilities/cmlibuv/src/unix/udp.c
index 1cd4925..c556325 100644
--- a/Utilities/cmlibuv/src/unix/udp.c
+++ b/Utilities/cmlibuv/src/unix/udp.c
@@ -307,7 +307,7 @@ int uv__udp_bind(uv_udp_t* handle,
if (flags & UV_UDP_REUSEADDR) {
err = uv__set_reuse(fd);
if (err)
- goto out;
+ return err;
}
if (flags & UV_UDP_IPV6ONLY) {
@@ -315,11 +315,11 @@ int uv__udp_bind(uv_udp_t* handle,
yes = 1;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof yes) == -1) {
err = -errno;
- goto out;
+ return err;
}
#else
err = -ENOTSUP;
- goto out;
+ return err;
#endif
}
@@ -329,27 +329,25 @@ int uv__udp_bind(uv_udp_t* handle,
/* OSX, other BSDs and SunoS fail with EAFNOSUPPORT when binding a
* socket created with AF_INET to an AF_INET6 address or vice versa. */
err = -EINVAL;
- goto out;
+ return err;
}
if (addr->sa_family == AF_INET6)
handle->flags |= UV_HANDLE_IPV6;
handle->flags |= UV_HANDLE_BOUND;
-
return 0;
-
-out:
- uv__close(handle->io_watcher.fd);
- handle->io_watcher.fd = -1;
- return err;
}
static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
int domain,
unsigned int flags) {
- unsigned char taddr[sizeof(struct sockaddr_in6)];
+ union {
+ struct sockaddr_in6 in6;
+ struct sockaddr_in in;
+ struct sockaddr addr;
+ } taddr;
socklen_t addrlen;
if (handle->io_watcher.fd != -1)
@@ -358,7 +356,7 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
switch (domain) {
case AF_INET:
{
- struct sockaddr_in* addr = (void*)&taddr;
+ struct sockaddr_in* addr = &taddr.in;
memset(addr, 0, sizeof *addr);
addr->sin_family = AF_INET;
addr->sin_addr.s_addr = INADDR_ANY;
@@ -367,7 +365,7 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
}
case AF_INET6:
{
- struct sockaddr_in6* addr = (void*)&taddr;
+ struct sockaddr_in6* addr = &taddr.in6;
memset(addr, 0, sizeof *addr);
addr->sin6_family = AF_INET6;
addr->sin6_addr = in6addr_any;
@@ -379,7 +377,7 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
abort();
}
- return uv__udp_bind(handle, (const struct sockaddr*) &taddr, addrlen, flags);
+ return uv__udp_bind(handle, &taddr.addr, addrlen, flags);
}
@@ -429,6 +427,13 @@ int uv__udp_send(uv_udp_send_t* req,
if (empty_queue && !(handle->flags & UV_UDP_PROCESSING)) {
uv__udp_sendmsg(handle);
+
+ /* `uv__udp_sendmsg` may not be able to do non-blocking write straight
+ * away. In such cases the `io_watcher` has to be queued for asynchronous
+ * write.
+ */
+ if (!QUEUE_EMPTY(&handle->write_queue))
+ uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
} else {
uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
}
diff --git a/Utilities/cmlibuv/src/uv-common.h b/Utilities/cmlibuv/src/uv-common.h
index 27902fd..781a855 100644
--- a/Utilities/cmlibuv/src/uv-common.h
+++ b/Utilities/cmlibuv/src/uv-common.h
@@ -55,16 +55,19 @@ extern int snprintf(char*, size_t, const char*, ...);
#ifndef _WIN32
enum {
+ UV__SIGNAL_ONE_SHOT = 0x80000, /* On signal reception remove sighandler */
UV__HANDLE_INTERNAL = 0x8000,
UV__HANDLE_ACTIVE = 0x4000,
UV__HANDLE_REF = 0x2000,
UV__HANDLE_CLOSING = 0 /* no-op on unix */
};
#else
-# define UV__HANDLE_INTERNAL 0x80
-# define UV__HANDLE_ACTIVE 0x40
-# define UV__HANDLE_REF 0x20
-# define UV__HANDLE_CLOSING 0x01
+# define UV__SIGNAL_ONE_SHOT_DISPATCHED 0x200
+# define UV__SIGNAL_ONE_SHOT 0x100
+# define UV__HANDLE_INTERNAL 0x80
+# define UV__HANDLE_ACTIVE 0x40
+# define UV__HANDLE_REF 0x20
+# define UV__HANDLE_CLOSING 0x01
#endif
int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
@@ -215,6 +218,30 @@ void uv__fs_scandir_cleanup(uv_fs_t* req);
} \
while (0)
+/* Note: uses an open-coded version of SET_REQ_SUCCESS() because of
+ * a circular dependency between src/uv-common.h and src/win/internal.h.
+ */
+#if defined(_WIN32)
+# define UV_REQ_INIT(req, typ) \
+ do { \
+ (req)->type = (typ); \
+ (req)->u.io.overlapped.Internal = 0; /* SET_REQ_SUCCESS() */ \
+ } \
+ while (0)
+#else
+# define UV_REQ_INIT(req, typ) \
+ do { \
+ (req)->type = (typ); \
+ } \
+ while (0)
+#endif
+
+#define uv__req_init(loop, req, typ) \
+ do { \
+ UV_REQ_INIT(req, typ); \
+ uv__req_register(loop, req); \
+ } \
+ while (0)
/* Allocator prototypes */
void *uv__calloc(size_t count, size_t size);
diff --git a/Utilities/cmlibuv/src/win/async.c b/Utilities/cmlibuv/src/win/async.c
index ad240ab..0b636ed 100644
--- a/Utilities/cmlibuv/src/win/async.c
+++ b/Utilities/cmlibuv/src/win/async.c
@@ -45,8 +45,7 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
handle->async_cb = async_cb;
req = &handle->async_req;
- uv_req_init(loop, req);
- req->type = UV_WAKEUP;
+ UV_REQ_INIT(req, UV_WAKEUP);
req->data = handle;
uv__handle_start(handle);
diff --git a/Utilities/cmlibuv/src/win/atomicops-inl.h b/Utilities/cmlibuv/src/win/atomicops-inl.h
index 61e0060..6d8126f 100644
--- a/Utilities/cmlibuv/src/win/atomicops-inl.h
+++ b/Utilities/cmlibuv/src/win/atomicops-inl.h
@@ -23,6 +23,7 @@
#define UV_WIN_ATOMICOPS_INL_H_
#include "uv.h"
+#include "internal.h"
/* Atomic set operation on char */
@@ -34,7 +35,7 @@
/* target to be aligned. */
#pragma intrinsic(_InterlockedOr8)
-static char __declspec(inline) uv__atomic_exchange_set(char volatile* target) {
+static char INLINE uv__atomic_exchange_set(char volatile* target) {
return _InterlockedOr8(target, 1);
}
diff --git a/Utilities/cmlibuv/src/win/core.c b/Utilities/cmlibuv/src/win/core.c
index e84186d..9ed4e82 100644
--- a/Utilities/cmlibuv/src/win/core.c
+++ b/Utilities/cmlibuv/src/win/core.c
@@ -83,13 +83,8 @@ static int uv__loops_capacity;
#define UV__LOOPS_CHUNK_SIZE 8
static uv_mutex_t uv__loops_lock;
-static void uv__loops_init() {
+static void uv__loops_init(void) {
uv_mutex_init(&uv__loops_lock);
- uv__loops = uv__calloc(UV__LOOPS_CHUNK_SIZE, sizeof(uv_loop_t*));
- if (!uv__loops)
- uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
- uv__loops_size = 0;
- uv__loops_capacity = UV__LOOPS_CHUNK_SIZE;
}
static int uv__loops_add(uv_loop_t* loop) {
@@ -138,6 +133,13 @@ static void uv__loops_remove(uv_loop_t* loop) {
uv__loops[uv__loops_size - 1] = NULL;
--uv__loops_size;
+ if (uv__loops_size == 0) {
+ uv__loops_capacity = 0;
+ uv__free(uv__loops);
+ uv__loops = NULL;
+ goto loop_removed;
+ }
+
/* If we didn't grow to big skip downsizing */
if (uv__loops_capacity < 4 * UV__LOOPS_CHUNK_SIZE)
goto loop_removed;
@@ -156,7 +158,7 @@ loop_removed:
uv_mutex_unlock(&uv__loops_lock);
}
-void uv__wake_all_loops() {
+void uv__wake_all_loops(void) {
int i;
uv_loop_t* loop;
@@ -332,6 +334,11 @@ int uv_backend_fd(const uv_loop_t* loop) {
}
+int uv_loop_fork(uv_loop_t* loop) {
+ return UV_ENOSYS;
+}
+
+
int uv_backend_timeout(const uv_loop_t* loop) {
if (loop->stop_flag != 0)
return 0;
diff --git a/Utilities/cmlibuv/src/win/detect-wakeup.c b/Utilities/cmlibuv/src/win/detect-wakeup.c
index a12179f..72dfb7a 100644
--- a/Utilities/cmlibuv/src/win/detect-wakeup.c
+++ b/Utilities/cmlibuv/src/win/detect-wakeup.c
@@ -2,9 +2,9 @@
#include "internal.h"
#include "winapi.h"
-static void uv__register_system_resume_callback();
+static void uv__register_system_resume_callback(void);
-void uv__init_detect_system_wakeup() {
+void uv__init_detect_system_wakeup(void) {
/* Try registering system power event callback. This is the cleanest
* method, but it will only work on Win8 and above.
*/
@@ -20,7 +20,7 @@ static ULONG CALLBACK uv__system_resume_callback(PVOID Context,
return 0;
}
-static void uv__register_system_resume_callback() {
+static void uv__register_system_resume_callback(void) {
_DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient;
_HPOWERNOTIFY registration_handle;
diff --git a/Utilities/cmlibuv/src/win/fs-event.c b/Utilities/cmlibuv/src/win/fs-event.c
index 05fc1d0..95f843a 100644
--- a/Utilities/cmlibuv/src/win/fs-event.c
+++ b/Utilities/cmlibuv/src/win/fs-event.c
@@ -81,8 +81,17 @@ static void uv_relative_path(const WCHAR* filename,
static int uv_split_path(const WCHAR* filename, WCHAR** dir,
WCHAR** file) {
- int len = wcslen(filename);
- int i = len;
+ size_t len, i;
+
+ if (filename == NULL) {
+ if (dir != NULL)
+ *dir = NULL;
+ *file = NULL;
+ return 0;
+ }
+
+ len = wcslen(filename);
+ i = len;
while (i > 0 && filename[--i] != '\\' && filename[i] != '/');
if (i == 0) {
@@ -131,8 +140,7 @@ int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
handle->short_filew = NULL;
handle->dirw = NULL;
- uv_req_init(loop, (uv_req_t*)&handle->req);
- handle->req.type = UV_FS_EVENT_REQ;
+ UV_REQ_INIT(&handle->req, UV_FS_EVENT_REQ);
handle->req.data = handle;
return 0;
@@ -146,7 +154,8 @@ int uv_fs_event_start(uv_fs_event_t* handle,
int name_size, is_path_dir;
DWORD attr, last_error;
WCHAR* dir = NULL, *dir_to_watch, *pathw = NULL;
- WCHAR short_path[MAX_PATH];
+ WCHAR short_path_buffer[MAX_PATH];
+ WCHAR* short_path;
if (uv__is_active(handle))
return UV_EINVAL;
@@ -196,9 +205,9 @@ int uv_fs_event_start(uv_fs_event_t* handle,
*/
/* Convert to short path. */
+ short_path = short_path_buffer;
if (!GetShortPathNameW(pathw, short_path, ARRAY_SIZE(short_path))) {
- last_error = GetLastError();
- goto error;
+ short_path = NULL;
}
if (uv_split_path(pathw, &dir, &handle->filew) != 0) {
@@ -306,6 +315,9 @@ error:
handle->buffer = NULL;
}
+ if (uv__is_active(handle))
+ uv__handle_stop(handle);
+
return uv_translate_sys_error(last_error);
}
@@ -345,8 +357,11 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
}
-static int file_info_cmp(WCHAR* str, WCHAR* file_name, int file_name_len) {
- int str_len;
+static int file_info_cmp(WCHAR* str, WCHAR* file_name, size_t file_name_len) {
+ size_t str_len;
+
+ if (str == NULL)
+ return -1;
str_len = wcslen(str);
diff --git a/Utilities/cmlibuv/src/win/fs.c b/Utilities/cmlibuv/src/win/fs.c
index 6902d4f..2d72cdc 100644
--- a/Utilities/cmlibuv/src/win/fs.c
+++ b/Utilities/cmlibuv/src/win/fs.c
@@ -114,7 +114,7 @@ const WCHAR UNC_PATH_PREFIX[] = L"\\\\?\\UNC\\";
const WCHAR UNC_PATH_PREFIX_LEN = 8;
-void uv_fs_init() {
+void uv_fs_init(void) {
_fmode = _O_BINARY;
}
@@ -220,9 +220,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req,
uv_fs_type fs_type, const uv_fs_cb cb) {
- uv_req_init(loop, (uv_req_t*) req);
-
- req->type = UV_FS;
+ UV_REQ_INIT(req, UV_FS);
req->loop = loop;
req->flags = 0;
req->fs_type = fs_type;
@@ -1373,7 +1371,7 @@ static void fs__access(uv_fs_t* req) {
* - or it's a directory.
* (Directories cannot be read-only on Windows.)
*/
- if (!(req->flags & W_OK) ||
+ if (!(req->fs.info.mode & W_OK) ||
!(attr & FILE_ATTRIBUTE_READONLY) ||
(attr & FILE_ATTRIBUTE_DIRECTORY)) {
SET_REQ_RESULT(req, 0);
@@ -2400,7 +2398,7 @@ int uv_fs_access(uv_loop_t* loop,
if (err)
return uv_translate_sys_error(err);
- req->flags = flags;
+ req->fs.info.mode = flags;
if (cb) {
QUEUE_FS_TP_JOB(loop, req);
diff --git a/Utilities/cmlibuv/src/win/getaddrinfo.c b/Utilities/cmlibuv/src/win/getaddrinfo.c
index c13bfec..baab838 100644
--- a/Utilities/cmlibuv/src/win/getaddrinfo.c
+++ b/Utilities/cmlibuv/src/win/getaddrinfo.c
@@ -265,11 +265,9 @@ int uv_getaddrinfo(uv_loop_t* loop,
return UV_EINVAL;
}
- uv_req_init(loop, (uv_req_t*)req);
-
+ UV_REQ_INIT(req, UV_GETADDRINFO);
req->getaddrinfo_cb = getaddrinfo_cb;
req->addrinfo = NULL;
- req->type = UV_GETADDRINFO;
req->loop = loop;
req->retcode = 0;
diff --git a/Utilities/cmlibuv/src/win/getnameinfo.c b/Utilities/cmlibuv/src/win/getnameinfo.c
index 66b64b8..9f10cd2 100644
--- a/Utilities/cmlibuv/src/win/getnameinfo.c
+++ b/Utilities/cmlibuv/src/win/getnameinfo.c
@@ -127,12 +127,11 @@ int uv_getnameinfo(uv_loop_t* loop,
return UV_EINVAL;
}
- uv_req_init(loop, (uv_req_t*)req);
+ UV_REQ_INIT(req, UV_GETNAMEINFO);
uv__req_register(loop, req);
req->getnameinfo_cb = getnameinfo_cb;
req->flags = flags;
- req->type = UV_GETNAMEINFO;
req->loop = loop;
req->retcode = 0;
diff --git a/Utilities/cmlibuv/src/win/internal.h b/Utilities/cmlibuv/src/win/internal.h
index 8a17e94..83601d5 100644
--- a/Utilities/cmlibuv/src/win/internal.h
+++ b/Utilities/cmlibuv/src/win/internal.h
@@ -210,7 +210,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle);
/*
* TTY
*/
-void uv_console_init();
+void uv_console_init(void);
int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb,
uv_read_cb read_cb);
@@ -263,7 +263,7 @@ void uv_prepare_invoke(uv_loop_t* loop);
void uv_check_invoke(uv_loop_t* loop);
void uv_idle_invoke(uv_loop_t* loop);
-void uv__once_init();
+void uv__once_init(void);
/*
@@ -279,7 +279,7 @@ void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle,
/*
* Signal watcher
*/
-void uv_signals_init();
+void uv_signals_init(void);
int uv__signal_dispatch(int signum);
void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle);
@@ -306,7 +306,7 @@ int uv_translate_sys_error(int sys_errno);
/*
* FS
*/
-void uv_fs_init();
+void uv_fs_init(void);
/*
@@ -327,14 +327,15 @@ void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle);
/*
* Utilities.
*/
-void uv__util_init();
+void uv__util_init(void);
uint64_t uv__hrtime(double scale);
-int uv_parent_pid();
-int uv_current_pid();
+int uv_parent_pid(void);
+int uv_current_pid(void);
__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall);
int uv__getpwuid_r(uv_passwd_t* pwd);
int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8);
+int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16);
/*
@@ -353,13 +354,13 @@ HANDLE uv__stdio_handle(BYTE* buffer, int fd);
/*
* Winapi and ntapi utility functions
*/
-void uv_winapi_init();
+void uv_winapi_init(void);
/*
* Winsock utility functions
*/
-void uv_winsock_init();
+void uv_winsock_init(void);
int uv_ntstatus_to_winsock_error(NTSTATUS status);
@@ -388,11 +389,11 @@ extern struct sockaddr_in6 uv_addr_ip6_any_;
/*
* Wake all loops with fake message
*/
-void uv__wake_all_loops();
+void uv__wake_all_loops(void);
/*
* Init system wake-up detection
*/
-void uv__init_detect_system_wakeup();
+void uv__init_detect_system_wakeup(void);
#endif /* UV_WIN_INTERNAL_H_ */
diff --git a/Utilities/cmlibuv/src/win/pipe.c b/Utilities/cmlibuv/src/win/pipe.c
index 2442be7..edf3002 100644
--- a/Utilities/cmlibuv/src/win/pipe.c
+++ b/Utilities/cmlibuv/src/win/pipe.c
@@ -103,7 +103,7 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
handle->pipe.conn.non_overlapped_writes_tail = NULL;
handle->pipe.conn.readfile_thread = NULL;
- uv_req_init(loop, (uv_req_t*) &handle->pipe.conn.ipc_header_write_req);
+ UV_REQ_INIT(&handle->pipe.conn.ipc_header_write_req, UV_UNKNOWN_REQ);
return 0;
}
@@ -505,8 +505,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
for (i = 0; i < handle->pipe.serv.pending_instances; i++) {
req = &handle->pipe.serv.accept_reqs[i];
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_ACCEPT;
+ UV_REQ_INIT(req, UV_ACCEPT);
req->data = handle;
req->pipeHandle = INVALID_HANDLE_VALUE;
req->next_pending = NULL;
@@ -626,8 +625,7 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
HANDLE pipeHandle = INVALID_HANDLE_VALUE;
DWORD duplex_flags;
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_CONNECT;
+ UV_REQ_INIT(req, UV_CONNECT);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
@@ -962,7 +960,7 @@ static DWORD WINAPI uv_pipe_zero_readfile_thread_proc(void* parameter) {
uv_mutex_lock(m); /* mutex controls *setting* of readfile_thread */
if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &hThread,
- 0, TRUE, DUPLICATE_SAME_ACCESS)) {
+ 0, FALSE, DUPLICATE_SAME_ACCESS)) {
handle->pipe.conn.readfile_thread = hThread;
} else {
hThread = NULL;
@@ -1239,8 +1237,7 @@ static int uv_pipe_write_impl(uv_loop_t* loop,
assert(handle->handle != INVALID_HANDLE_VALUE);
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_WRITE;
+ UV_REQ_INIT(req, UV_WRITE);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
req->ipc_header = 0;
@@ -1301,8 +1298,7 @@ static int uv_pipe_write_impl(uv_loop_t* loop,
}
}
- uv_req_init(loop, (uv_req_t*) ipc_header_req);
- ipc_header_req->type = UV_WRITE;
+ UV_REQ_INIT(ipc_header_req, UV_WRITE);
ipc_header_req->handle = (uv_stream_t*) handle;
ipc_header_req->cb = NULL;
ipc_header_req->ipc_header = 1;
@@ -2076,7 +2072,6 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size)
buffer[addrlen] = '\0';
err = 0;
- goto cleanup;
error:
uv__free(name_info);
diff --git a/Utilities/cmlibuv/src/win/poll.c b/Utilities/cmlibuv/src/win/poll.c
index d479e52..a648ba7 100644
--- a/Utilities/cmlibuv/src/win/poll.c
+++ b/Utilities/cmlibuv/src/win/poll.c
@@ -61,13 +61,13 @@ static void uv__init_overlapped_dummy(void) {
}
-static OVERLAPPED* uv__get_overlapped_dummy() {
+static OVERLAPPED* uv__get_overlapped_dummy(void) {
uv_once(&overlapped_dummy_init_guard_, uv__init_overlapped_dummy);
return &overlapped_dummy_;
}
-static AFD_POLL_INFO* uv__get_afd_poll_info_dummy() {
+static AFD_POLL_INFO* uv__get_afd_poll_info_dummy(void) {
return &afd_poll_info_dummy_;
}
@@ -572,13 +572,11 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
/* Initialize 2 poll reqs. */
handle->submitted_events_1 = 0;
- uv_req_init(loop, (uv_req_t*) &(handle->poll_req_1));
- handle->poll_req_1.type = UV_POLL_REQ;
+ UV_REQ_INIT(&handle->poll_req_1, UV_POLL_REQ);
handle->poll_req_1.data = handle;
handle->submitted_events_2 = 0;
- uv_req_init(loop, (uv_req_t*) &(handle->poll_req_2));
- handle->poll_req_2.type = UV_POLL_REQ;
+ UV_REQ_INIT(&handle->poll_req_2, UV_POLL_REQ);
handle->poll_req_2.data = handle;
return 0;
diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c
index bdf88d2..d141601 100644
--- a/Utilities/cmlibuv/src/win/process.c
+++ b/Utilities/cmlibuv/src/win/process.c
@@ -148,8 +148,7 @@ static void uv_process_init(uv_loop_t* loop, uv_process_t* handle) {
handle->child_stdio_buffer = NULL;
handle->exit_cb_pending = 0;
- uv_req_init(loop, (uv_req_t*)&handle->exit_req);
- handle->exit_req.type = UV_PROCESS_EXIT;
+ UV_REQ_INIT(&handle->exit_req, UV_PROCESS_EXIT);
handle->exit_req.data = handle;
}
diff --git a/Utilities/cmlibuv/src/win/req-inl.h b/Utilities/cmlibuv/src/win/req-inl.h
index b5e502e..f2513b7 100644
--- a/Utilities/cmlibuv/src/win/req-inl.h
+++ b/Utilities/cmlibuv/src/win/req-inl.h
@@ -34,6 +34,9 @@
#define SET_REQ_ERROR(req, error) \
SET_REQ_STATUS((req), NTSTATUS_FROM_WIN32((error)))
+/* Note: used open-coded in UV_REQ_INIT() because of a circular dependency
+ * between src/uv-common.h and src/win/internal.h.
+ */
#define SET_REQ_SUCCESS(req) \
SET_REQ_STATUS((req), STATUS_SUCCESS)
@@ -79,12 +82,6 @@
}
-INLINE static void uv_req_init(uv_loop_t* loop, uv_req_t* req) {
- req->type = UV_UNKNOWN_REQ;
- SET_REQ_SUCCESS(req);
-}
-
-
INLINE static uv_req_t* uv_overlapped_to_req(OVERLAPPED* overlapped) {
return CONTAINING_RECORD(overlapped, uv_req_t, u.io.overlapped);
}
diff --git a/Utilities/cmlibuv/src/win/signal.c b/Utilities/cmlibuv/src/win/signal.c
index af7974c..7b42dd9 100644
--- a/Utilities/cmlibuv/src/win/signal.c
+++ b/Utilities/cmlibuv/src/win/signal.c
@@ -34,7 +34,12 @@ static CRITICAL_SECTION uv__signal_lock;
static BOOL WINAPI uv__signal_control_handler(DWORD type);
-void uv_signals_init() {
+int uv__signal_start(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum,
+ int oneshot);
+
+void uv_signals_init(void) {
InitializeCriticalSection(&uv__signal_lock);
if (!SetConsoleCtrlHandler(uv__signal_control_handler, TRUE))
abort();
@@ -70,7 +75,9 @@ RB_GENERATE_STATIC(uv_signal_tree_s, uv_signal_s, tree_entry, uv__signal_compare
int uv__signal_dispatch(int signum) {
uv_signal_t lookup;
uv_signal_t* handle;
- int dispatched = 0;
+ int dispatched;
+
+ dispatched = 0;
EnterCriticalSection(&uv__signal_lock);
@@ -83,11 +90,16 @@ int uv__signal_dispatch(int signum) {
unsigned long previous = InterlockedExchange(
(volatile LONG*) &handle->pending_signum, signum);
+ if (handle->flags & UV__SIGNAL_ONE_SHOT_DISPATCHED)
+ continue;
+
if (!previous) {
POST_COMPLETION_FOR_REQ(handle->loop, &handle->signal_req);
}
dispatched = 1;
+ if (handle->flags & UV__SIGNAL_ONE_SHOT)
+ handle->flags |= UV__SIGNAL_ONE_SHOT_DISPATCHED;
}
LeaveCriticalSection(&uv__signal_lock);
@@ -128,17 +140,13 @@ static BOOL WINAPI uv__signal_control_handler(DWORD type) {
int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle) {
- uv_req_t* req;
-
uv__handle_init(loop, (uv_handle_t*) handle, UV_SIGNAL);
handle->pending_signum = 0;
handle->signum = 0;
handle->signal_cb = NULL;
- req = &handle->signal_req;
- uv_req_init(loop, req);
- req->type = UV_SIGNAL_REQ;
- req->data = handle;
+ UV_REQ_INIT(&handle->signal_req, UV_SIGNAL_REQ);
+ handle->signal_req.data = handle;
return 0;
}
@@ -166,6 +174,21 @@ int uv_signal_stop(uv_signal_t* handle) {
int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) {
+ return uv__signal_start(handle, signal_cb, signum, 0);
+}
+
+
+int uv_signal_start_oneshot(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum) {
+ return uv__signal_start(handle, signal_cb, signum, 1);
+}
+
+
+int uv__signal_start(uv_signal_t* handle,
+ uv_signal_cb signal_cb,
+ int signum,
+ int oneshot) {
/* Test for invalid signal values. */
if (signum != SIGWINCH && (signum <= 0 || signum >= NSIG))
return UV_EINVAL;
@@ -189,6 +212,9 @@ int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) {
EnterCriticalSection(&uv__signal_lock);
handle->signum = signum;
+ if (oneshot)
+ handle->flags |= UV__SIGNAL_ONE_SHOT;
+
RB_INSERT(uv_signal_tree_s, &uv__signal_tree, handle);
LeaveCriticalSection(&uv__signal_lock);
@@ -217,6 +243,9 @@ void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle,
if (dispatched_signum == handle->signum)
handle->signal_cb(handle, dispatched_signum);
+ if (handle->flags & UV__SIGNAL_ONE_SHOT)
+ uv_signal_stop(handle);
+
if (handle->flags & UV__HANDLE_CLOSING) {
/* When it is closing, it must be stopped at this point. */
assert(handle->signum == 0);
diff --git a/Utilities/cmlibuv/src/win/stream-inl.h b/Utilities/cmlibuv/src/win/stream-inl.h
index b7a3c11..bf12148 100644
--- a/Utilities/cmlibuv/src/win/stream-inl.h
+++ b/Utilities/cmlibuv/src/win/stream-inl.h
@@ -43,10 +43,9 @@ INLINE static void uv_connection_init(uv_stream_t* handle) {
handle->flags |= UV_HANDLE_CONNECTION;
handle->stream.conn.write_reqs_pending = 0;
- uv_req_init(handle->loop, (uv_req_t*) &(handle->read_req));
+ UV_REQ_INIT(&handle->read_req, UV_READ);
handle->read_req.event_handle = NULL;
handle->read_req.wait_handle = INVALID_HANDLE_VALUE;
- handle->read_req.type = UV_READ;
handle->read_req.data = handle;
handle->stream.conn.shutdown_req = NULL;
diff --git a/Utilities/cmlibuv/src/win/stream.c b/Utilities/cmlibuv/src/win/stream.c
index a2466e5..13cbfdc 100644
--- a/Utilities/cmlibuv/src/win/stream.c
+++ b/Utilities/cmlibuv/src/win/stream.c
@@ -210,8 +210,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
return UV_EPIPE;
}
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_SHUTDOWN;
+ UV_REQ_INIT(req, UV_SHUTDOWN);
req->handle = handle;
req->cb = cb;
diff --git a/Utilities/cmlibuv/src/win/tcp.c b/Utilities/cmlibuv/src/win/tcp.c
index 0709696..972539f 100644
--- a/Utilities/cmlibuv/src/win/tcp.c
+++ b/Utilities/cmlibuv/src/win/tcp.c
@@ -555,7 +555,6 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) {
int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
- uv_loop_t* loop = handle->loop;
unsigned int i, simultaneous_accepts;
uv_tcp_accept_t* req;
int err;
@@ -612,8 +611,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
for (i = 0; i < simultaneous_accepts; i++) {
req = &handle->tcp.serv.accept_reqs[i];
- uv_req_init(loop, (uv_req_t*)req);
- req->type = UV_ACCEPT;
+ UV_REQ_INIT(req, UV_ACCEPT);
req->accept_socket = INVALID_SOCKET;
req->data = handle;
@@ -635,8 +633,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
/* try to clean up {uv_simultaneous_server_accepts} requests. */
for (i = simultaneous_accepts; i < uv_simultaneous_server_accepts; i++) {
req = &handle->tcp.serv.accept_reqs[i];
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_ACCEPT;
+ UV_REQ_INIT(req, UV_ACCEPT);
req->accept_socket = INVALID_SOCKET;
req->data = handle;
req->wait_handle = INVALID_HANDLE_VALUE;
@@ -779,8 +776,7 @@ static int uv_tcp_try_connect(uv_connect_t* req,
}
}
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_CONNECT;
+ UV_REQ_INIT(req, UV_CONNECT);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped));
@@ -863,8 +859,7 @@ int uv_tcp_write(uv_loop_t* loop,
int result;
DWORD bytes;
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_WRITE;
+ UV_REQ_INIT(req, UV_WRITE);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
diff --git a/Utilities/cmlibuv/src/win/tty.c b/Utilities/cmlibuv/src/win/tty.c
index 1b7adf6..a6f5839 100644
--- a/Utilities/cmlibuv/src/win/tty.c
+++ b/Utilities/cmlibuv/src/win/tty.c
@@ -138,7 +138,7 @@ typedef enum {
static uv_vtermstate_t uv__vterm_state = UV_UNCHECKED;
static void uv__determine_vterm_state(HANDLE handle);
-void uv_console_init() {
+void uv_console_init(void) {
if (uv_sem_init(&uv_tty_output_lock, 1))
abort();
}
@@ -2126,8 +2126,7 @@ int uv_tty_write(uv_loop_t* loop,
uv_write_cb cb) {
DWORD error;
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_WRITE;
+ UV_REQ_INIT(req, UV_WRITE);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
diff --git a/Utilities/cmlibuv/src/win/udp.c b/Utilities/cmlibuv/src/win/udp.c
index 9bf1453..2fd15cf 100644
--- a/Utilities/cmlibuv/src/win/udp.c
+++ b/Utilities/cmlibuv/src/win/udp.c
@@ -142,8 +142,7 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) {
handle->func_wsarecvfrom = WSARecvFrom;
handle->send_queue_size = 0;
handle->send_queue_count = 0;
- uv_req_init(loop, (uv_req_t*) &(handle->recv_req));
- handle->recv_req.type = UV_UDP_RECV;
+ UV_REQ_INIT(&handle->recv_req, UV_UDP_RECV);
handle->recv_req.data = handle;
/* If anything fails beyond this point we need to remove the handle from
@@ -417,8 +416,7 @@ static int uv__send(uv_udp_send_t* req,
uv_loop_t* loop = handle->loop;
DWORD result, bytes;
- uv_req_init(loop, (uv_req_t*) req);
- req->type = UV_UDP_SEND;
+ UV_REQ_INIT(req, UV_UDP_SEND);
req->handle = handle;
req->cb = cb;
memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped));
diff --git a/Utilities/cmlibuv/src/win/util.c b/Utilities/cmlibuv/src/win/util.c
index 050058a..1d64d4c 100644
--- a/Utilities/cmlibuv/src/win/util.c
+++ b/Utilities/cmlibuv/src/win/util.c
@@ -59,6 +59,9 @@
# define UNLEN 256
#endif
+/* Maximum environment variable size, including the terminating null */
+#define MAX_ENV_VAR_LENGTH 32767
+
/* Cached copy of the process title, plus a mutex guarding it. */
static char *process_title;
static CRITICAL_SECTION process_title_lock;
@@ -74,7 +77,7 @@ static double hrtime_interval_ = 0;
/*
* One-time initialization code for functionality defined in util.c.
*/
-void uv__util_init() {
+void uv__util_init(void) {
LARGE_INTEGER perf_frequency;
/* Initialize process title access mutex. */
@@ -320,7 +323,7 @@ uint64_t uv_get_total_memory(void) {
}
-int uv_parent_pid() {
+int uv_parent_pid(void) {
int parent_pid = -1;
HANDLE handle;
PROCESSENTRY32 pe;
@@ -343,7 +346,7 @@ int uv_parent_pid() {
}
-int uv_current_pid() {
+int uv_current_pid(void) {
if (current_pid == 0) {
current_pid = GetCurrentProcessId();
}
@@ -405,7 +408,7 @@ done:
}
-static int uv__get_process_title() {
+static int uv__get_process_title(void) {
WCHAR title_w[MAX_TITLE_LENGTH];
if (!GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR))) {
@@ -1322,6 +1325,47 @@ int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8) {
}
+/*
+ * Converts a UTF-8 string into a UTF-16 one. The resulting string is
+ * null-terminated.
+ *
+ * If utf8 is null terminated, utf8len can be set to -1, otherwise it must
+ * be specified.
+ */
+int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16) {
+ int bufsize;
+
+ if (utf8 == NULL)
+ return UV_EINVAL;
+
+ /* Check how much space we need */
+ bufsize = MultiByteToWideChar(CP_UTF8, 0, utf8, utf8len, NULL, 0);
+
+ if (bufsize == 0)
+ return uv_translate_sys_error(GetLastError());
+
+ /* Allocate the destination buffer adding an extra byte for the terminating
+ * NULL. If utf8len is not -1 MultiByteToWideChar will not add it, so
+ * we do it ourselves always, just in case. */
+ *utf16 = uv__malloc(sizeof(WCHAR) * (bufsize + 1));
+
+ if (*utf16 == NULL)
+ return UV_ENOMEM;
+
+ /* Convert to UTF-16 */
+ bufsize = MultiByteToWideChar(CP_UTF8, 0, utf8, utf8len, *utf16, bufsize);
+
+ if (bufsize == 0) {
+ uv__free(*utf16);
+ *utf16 = NULL;
+ return uv_translate_sys_error(GetLastError());
+ }
+
+ (*utf16)[bufsize] = '\0';
+ return 0;
+}
+
+
int uv__getpwuid_r(uv_passwd_t* pwd) {
HANDLE token;
wchar_t username[UNLEN + 1];
@@ -1387,3 +1431,112 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
int uv_os_get_passwd(uv_passwd_t* pwd) {
return uv__getpwuid_r(pwd);
}
+
+
+int uv_os_getenv(const char* name, char* buffer, size_t* size) {
+ wchar_t var[MAX_ENV_VAR_LENGTH];
+ wchar_t* name_w;
+ DWORD bufsize;
+ size_t len;
+ int r;
+
+ if (name == NULL || buffer == NULL || size == NULL || *size == 0)
+ return UV_EINVAL;
+
+ r = uv__convert_utf8_to_utf16(name, -1, &name_w);
+
+ if (r != 0)
+ return r;
+
+ len = GetEnvironmentVariableW(name_w, var, MAX_ENV_VAR_LENGTH);
+ uv__free(name_w);
+ assert(len < MAX_ENV_VAR_LENGTH); /* len does not include the null */
+
+ if (len == 0) {
+ r = GetLastError();
+
+ if (r == ERROR_ENVVAR_NOT_FOUND)
+ return UV_ENOENT;
+
+ return uv_translate_sys_error(r);
+ }
+
+ /* Check how much space we need */
+ bufsize = WideCharToMultiByte(CP_UTF8, 0, var, -1, NULL, 0, NULL, NULL);
+
+ if (bufsize == 0) {
+ return uv_translate_sys_error(GetLastError());
+ } else if (bufsize > *size) {
+ *size = bufsize;
+ return UV_ENOBUFS;
+ }
+
+ /* Convert to UTF-8 */
+ bufsize = WideCharToMultiByte(CP_UTF8,
+ 0,
+ var,
+ -1,
+ buffer,
+ *size,
+ NULL,
+ NULL);
+
+ if (bufsize == 0)
+ return uv_translate_sys_error(GetLastError());
+
+ *size = bufsize - 1;
+ return 0;
+}
+
+
+int uv_os_setenv(const char* name, const char* value) {
+ wchar_t* name_w;
+ wchar_t* value_w;
+ int r;
+
+ if (name == NULL || value == NULL)
+ return UV_EINVAL;
+
+ r = uv__convert_utf8_to_utf16(name, -1, &name_w);
+
+ if (r != 0)
+ return r;
+
+ r = uv__convert_utf8_to_utf16(value, -1, &value_w);
+
+ if (r != 0) {
+ uv__free(name_w);
+ return r;
+ }
+
+ r = SetEnvironmentVariableW(name_w, value_w);
+ uv__free(name_w);
+ uv__free(value_w);
+
+ if (r == 0)
+ return uv_translate_sys_error(GetLastError());
+
+ return 0;
+}
+
+
+int uv_os_unsetenv(const char* name) {
+ wchar_t* name_w;
+ int r;
+
+ if (name == NULL)
+ return UV_EINVAL;
+
+ r = uv__convert_utf8_to_utf16(name, -1, &name_w);
+
+ if (r != 0)
+ return r;
+
+ r = SetEnvironmentVariableW(name_w, NULL);
+ uv__free(name_w);
+
+ if (r == 0)
+ return uv_translate_sys_error(GetLastError());
+
+ return 0;
+}
diff --git a/Utilities/cmlibuv/src/win/winapi.c b/Utilities/cmlibuv/src/win/winapi.c
index 1fa179b..aa5d719 100644
--- a/Utilities/cmlibuv/src/win/winapi.c
+++ b/Utilities/cmlibuv/src/win/winapi.c
@@ -53,7 +53,7 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
-void uv_winapi_init() {
+void uv_winapi_init(void) {
HMODULE ntdll_module;
HMODULE kernel32_module;
HMODULE powrprof_module;
diff --git a/Utilities/cmlibuv/src/win/winsock.c b/Utilities/cmlibuv/src/win/winsock.c
index d2e667e..e86d76b 100644
--- a/Utilities/cmlibuv/src/win/winsock.c
+++ b/Utilities/cmlibuv/src/win/winsock.c
@@ -80,7 +80,7 @@ static int error_means_no_support(DWORD error) {
}
-void uv_winsock_init() {
+void uv_winsock_init(void) {
WSADATA wsa_data;
int errorno;
SOCKET dummy;
diff --git a/bootstrap b/bootstrap
index e957e82..e491cd8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -255,8 +255,6 @@ CMAKE_CXX_SOURCES="\
cmCPackPropertiesGenerator \
cmCacheManager \
cmCommand \
- cmCommandArgumentLexer \
- cmCommandArgumentParser \
cmCommandArgumentParserHelper \
cmCommandArgumentsHelper \
cmCommands \
@@ -276,6 +274,7 @@ CMAKE_CXX_SOURCES="\
cmDefinitions \
cmDepends \
cmDependsC \
+ cmDisallowedCommand \
cmDocumentationFormatter \
cmEnableLanguageCommand \
cmEnableTestingCommand \
@@ -288,8 +287,6 @@ CMAKE_CXX_SOURCES="\
cmExportSet \
cmExportSetMap \
cmExportTryCompileFileGenerator \
- cmExprLexer \
- cmExprParser \
cmExprParserHelper \
cmExternalMakefileProjectGenerator \
cmFileCommand \
@@ -416,9 +413,16 @@ if ${cmake_system_mingw}; then
cmGlobalMinGWMakefileGenerator"
fi
-CMAKE_C_SOURCES="\
+LexerParser_CXX_SOURCES="\
+ cmCommandArgumentLexer \
+ cmCommandArgumentParser \
+ cmExprLexer \
+ cmExprParser \
+"
+
+LexerParser_C_SOURCES="\
cmListFileLexer \
- "
+"
if ${cmake_system_mingw}; then
KWSYS_C_SOURCES="\
@@ -1342,6 +1346,8 @@ cmake_compiler_settings_comment="/*
*
* Sources:
* ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
+ * LexerParser Sources:
+ * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
* kwSys Sources:
* ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
*/
@@ -1403,7 +1409,7 @@ cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
# Generate Makefile
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs=""
-for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
+for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
objs="${objs} ${a}.o"
done
@@ -1422,6 +1428,7 @@ fi
cmake_c_flags_String="-DKWSYS_STRING_C"
if ${cmake_system_mingw}; then
cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
+ cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
fi
cmake_cxx_flags_SystemTools="
@@ -1431,9 +1438,15 @@ cmake_cxx_flags_SystemTools="
-DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
-DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
"
-cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+cmake_c_flags="${cmake_c_flags} \
+ -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
+ -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+ -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
-I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
-cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+cmake_cxx_flags="${cmake_cxx_flags} \
+ -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
+ -I`cmake_escape \"${cmake_source_dir}/Source\"` \
+ -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
-I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
@@ -1443,13 +1456,22 @@ for a in ${CMAKE_CXX_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
-echo "cmBootstrapCommands1.o : $cmBootstrapCommands1Deps" >> "${cmake_bootstrap_dir}/Makefile"
-echo "cmBootstrapCommands2.o : $cmBootstrapCommands2Deps" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_C_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
+for a in ${LexerParser_CXX_SOURCES}; do
+ src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
+ src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
+ echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
+done
+for a in ${LexerParser_C_SOURCES}; do
+ src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
+ echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
+done
for a in ${KWSYS_C_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
src_flags=`eval echo \\${cmake_c_flags_\${a}}`