summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt16
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx2
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx7
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx26
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx44
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx28
-rw-r--r--Source/CPack/cmCPackGenerator.h2
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx6
-rw-r--r--Source/CPack/cmCPackLog.cxx10
-rw-r--r--Source/CPack/cmCPackLog.h2
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx28
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h8
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx6
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx55
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h12
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestBatchTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx28
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h2
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx6
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx21
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx2
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx52
-rw-r--r--Source/CTest/cmCTestCurl.cxx282
-rw-r--r--Source/CTest/cmCTestCurl.h54
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx4
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx6
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx26
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx34
-rw-r--r--Source/CTest/cmCTestP4.cxx10
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx14
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx122
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h9
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx243
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h5
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx57
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx4
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h8
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx2
-rw-r--r--Source/CTest/cmCTestVC.cxx2
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx4
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.cxx48
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx6
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx2
-rw-r--r--Source/CTest/cmProcess.cxx4
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx21
-rw-r--r--Source/CursesDialog/cmCursesStandardIncludes.h19
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.ui2
-rw-r--r--Source/QtDialog/QMacInstallDialog.cxx6
-rw-r--r--Source/cmAddCustomCommandCommand.cxx8
-rw-r--r--Source/cmAddCustomTargetCommand.cxx6
-rw-r--r--Source/cmAddDependenciesCommand.cxx6
-rw-r--r--Source/cmAddExecutableCommand.cxx14
-rw-r--r--Source/cmAddLibraryCommand.cxx46
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx4
-rw-r--r--Source/cmAddTestCommand.cxx12
-rw-r--r--Source/cmArchiveWrite.cxx19
-rw-r--r--Source/cmArchiveWrite.h2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmBreakCommand.cxx4
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildNameCommand.cxx2
-rw-r--r--Source/cmCMakeMinimumRequired.cxx6
-rw-r--r--Source/cmCMakePolicyCommand.cxx8
-rw-r--r--Source/cmCPluginAPI.cxx2
-rw-r--r--Source/cmCTest.cxx57
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmCommand.h2
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx10
-rw-r--r--Source/cmCommandArgumentsHelper.cxx9
-rw-r--r--Source/cmComputeLinkDepends.cxx21
-rw-r--r--Source/cmComputeLinkInformation.cxx57
-rw-r--r--Source/cmComputeTargetDepends.cxx4
-rw-r--r--Source/cmConditionEvaluator.cxx16
-rw-r--r--Source/cmConfigure.cmake.h.in4
-rw-r--r--Source/cmConfigureFileCommand.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx26
-rw-r--r--Source/cmCreateTestSourceList.cxx8
-rw-r--r--Source/cmCurl.cxx64
-rw-r--r--Source/cmCurl.h (renamed from Source/cmStandardIncludes.cxx)13
-rw-r--r--Source/cmCustomCommand.cxx13
-rw-r--r--Source/cmDefinePropertyCommand.cxx4
-rw-r--r--Source/cmDepends.cxx8
-rw-r--r--Source/cmDependsC.cxx17
-rw-r--r--Source/cmDependsFortran.cxx10
-rw-r--r--Source/cmDependsJavaParserHelper.cxx10
-rw-r--r--Source/cmDocumentation.cxx11
-rw-r--r--Source/cmDocumentationFormatter.cxx6
-rw-r--r--Source/cmELF.cxx2
-rw-r--r--Source/cmExecProgramCommand.cxx12
-rw-r--r--Source/cmExecuteProcessCommand.cxx6
-rw-r--r--Source/cmExportBuildFileGenerator.cxx6
-rw-r--r--Source/cmExportCommand.cxx26
-rw-r--r--Source/cmExportFileGenerator.cxx20
-rw-r--r--Source/cmExportInstallFileGenerator.cxx8
-rw-r--r--Source/cmExportSet.cxx5
-rw-r--r--Source/cmExportSetMap.cxx7
-rw-r--r--Source/cmExprParserHelper.cxx2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx22
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx4
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx3
-rw-r--r--Source/cmExtraKateGenerator.cxx2
-rw-r--r--Source/cmFileCommand.cxx201
-rw-r--r--Source/cmFileLockPool.cxx17
-rw-r--r--Source/cmFindBase.cxx10
-rw-r--r--Source/cmFindPackageCommand.cxx37
-rw-r--r--Source/cmFindPathCommand.cxx6
-rw-r--r--Source/cmForEachCommand.cxx4
-rw-r--r--Source/cmFunctionCommand.cxx14
-rw-r--r--Source/cmGeneratedFileStream.h8
-rw-r--r--Source/cmGeneratorExpression.cxx18
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx10
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx6
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx78
-rw-r--r--Source/cmGeneratorExpressionParser.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx24
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx2
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.cxx12
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx7
-rw-r--r--Source/cmGlobalGenerator.cxx129
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx17
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx16
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx12
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx117
-rw-r--r--Source/cmGlobalXCodeGenerator.h13
-rw-r--r--Source/cmGraphVizWriter.cxx6
-rw-r--r--Source/cmIfCommand.cxx6
-rw-r--r--Source/cmIncludeCommand.cxx8
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx8
-rw-r--r--Source/cmInstallCommand.cxx97
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmInstallFilesCommand.cxx9
-rw-r--r--Source/cmInstallProgramsCommand.cxx6
-rw-r--r--Source/cmInstallTargetGenerator.cxx10
-rw-r--r--Source/cmInstalledFile.h6
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmListCommand.cxx56
-rw-r--r--Source/cmListFileCache.cxx16
-rw-r--r--Source/cmLoadCacheCommand.cxx9
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx69
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx34
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMacroCommand.cxx14
-rw-r--r--Source/cmMakeDepend.cxx13
-rw-r--r--Source/cmMakefile.cxx232
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx47
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx39
-rw-r--r--Source/cmNinjaTargetGenerator.cxx68
-rw-r--r--Source/cmNinjaTargetGenerator.h2
-rw-r--r--Source/cmOrderDirectories.cxx22
-rw-r--r--Source/cmPolicies.cxx24
-rw-r--r--Source/cmProjectCommand.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx89
-rw-r--r--Source/cmRST.cxx9
-rw-r--r--Source/cmRemoveCommand.cxx7
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx2
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmSetPropertyCommand.cxx20
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx2
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx2
-rw-r--r--Source/cmSiteNameCommand.cxx4
-rw-r--r--Source/cmSourceFile.cxx4
-rw-r--r--Source/cmSourceGroupCommand.cxx2
-rw-r--r--Source/cmStandardIncludes.h313
-rw-r--r--Source/cmStandardLexer.h6
-rw-r--r--Source/cmStringCommand.cxx18
-rw-r--r--Source/cmSystemTools.cxx58
-rw-r--r--Source/cmSystemTools.h17
-rw-r--r--Source/cmTarget.cxx163
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx4
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx14
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx14
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx14
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx12
-rw-r--r--Source/cmTargetSourcesCommand.cxx14
-rw-r--r--Source/cmTryRunCommand.cxx21
-rw-r--r--Source/cmUseMangledMesaCommand.cxx2
-rw-r--r--Source/cmUtilitySourceCommand.cxx2
-rw-r--r--Source/cmUuid.cxx2
-rw-r--r--Source/cmVariableWatch.cxx21
-rw-r--r--Source/cmVariableWatchCommand.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx19
-rw-r--r--Source/cmWhileCommand.cxx4
-rw-r--r--Source/cmXMLParser.cxx2
-rw-r--r--Source/cm_get_date.c16
-rw-r--r--Source/cm_get_date.h28
-rw-r--r--Source/cmake.cxx85
-rw-r--r--Source/cmakemain.cxx14
-rw-r--r--Source/cmcmd.cxx113
-rw-r--r--Source/ctest.cxx2
-rw-r--r--Source/kwsys/Base64.c24
-rw-r--r--Source/kwsys/Base64.h.in18
-rw-r--r--Source/kwsys/Directory.cxx5
-rw-r--r--Source/kwsys/EncodingC.c4
-rw-r--r--Source/kwsys/FStream.hxx.in10
-rw-r--r--Source/kwsys/ProcessUNIX.c4
-rw-r--r--Source/kwsys/ProcessWin32.c12
-rw-r--r--Source/kwsys/SystemInformation.cxx6
-rw-r--r--Source/kwsys/SystemTools.cxx17
-rw-r--r--Source/kwsys/Terminal.c1
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx4
228 files changed, 2621 insertions, 2285 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 97f57a3..07839f3 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -153,7 +153,6 @@ endif()
# Sources for CMakeLib
#
set(SRCS
- cmStandardIncludes.cxx
cmArchiveWrite.cxx
cmBootstrapCommands1.cxx
cmBootstrapCommands2.cxx
@@ -176,6 +175,8 @@ set(SRCS
cmCPackPropertiesGenerator.cxx
cmCryptoHash.cxx
cmCryptoHash.h
+ cmCurl.cxx
+ cmCurl.h
cmCustomCommand.cxx
cmCustomCommand.h
cmCustomCommandGenerator.cxx
@@ -336,6 +337,8 @@ set(SRCS
cmake.cxx
cmake.h
+ cm_get_date.h
+ cm_get_date.c
cm_sha2.h
cm_sha2.c
cm_utf8.h
@@ -496,12 +499,20 @@ if(WIN32 AND NOT CYGWIN)
install(TARGETS cmcldeps DESTINATION bin)
endif()
+foreach(v CURL_CA_BUNDLE CURL_CA_PATH)
+ if(${v})
+ set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}")
+ endif()
+endforeach()
+
# create a library used by the command line and the GUI
add_library(CMakeLib ${SRCS})
target_link_libraries(CMakeLib cmsys
${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
- ${CMAKE_CURL_LIBRARIES} )
+ ${CMAKE_CURL_LIBRARIES}
+ ${CMAKE_JSONCPP_LIBRARIES}
+ )
# On Apple we need CoreFoundation
if(APPLE)
@@ -534,6 +545,7 @@ set(CTEST_SRCS cmCTest.cxx
CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx
+ CTest/cmCTestCurl.cxx
CTest/cmParseMumpsCoverage.cxx
CTest/cmParseCacheCoverage.cxx
CTest/cmParseGTMCoverage.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 94fc7a4..dacbd20 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 1)
-set(CMake_VERSION_PATCH 20150107)
+set(CMake_VERSION_PATCH 20150203)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 0644ecb..4a99e50 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -24,7 +24,7 @@
#endif
#define cmCPackLogger(logType, msg) \
do { \
- cmOStringStream cmCPackLog_msg; \
+ std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
if(Generator) { \
Generator->Logger->Log(logType, __FILE__, __LINE__, \
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 3c45639..38cef87 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -25,7 +25,7 @@
#endif
#define cmCPackLogger(logType, msg) \
do { \
- cmOStringStream cmCPackLog_msg; \
+ std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
if(Generator) { \
Generator->Logger->Log(logType, __FILE__, __LINE__, \
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 7e00027..59c38e9 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -1150,12 +1150,7 @@ void cmCPackWIXGenerator::CollectExtensions(
std::vector<std::string> list;
cmSystemTools::ExpandListArgument(variableContent, list);
-
- for(std::vector<std::string>::const_iterator i = list.begin();
- i != list.end(); ++i)
- {
- extensions.insert(*i);
- }
+ extensions.insert(list.begin(), list.end());
}
void cmCPackWIXGenerator::AddCustomFlags(
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index fbd1d21..e751568 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -112,24 +112,24 @@ int cmCPackBundleGenerator::ConstructBundle()
// The staging directory contains everything that will end-up inside the
// final disk image ...
- cmOStringStream staging;
+ std::ostringstream staging;
staging << toplevel;
- cmOStringStream contents;
+ std::ostringstream contents;
contents << staging.str() << "/" << cpack_bundle_name
<< ".app/" << "Contents";
- cmOStringStream application;
+ std::ostringstream application;
application << contents.str() << "/" << "MacOS";
- cmOStringStream resources;
+ std::ostringstream resources;
resources << contents.str() << "/" << "Resources";
// Install a required, user-provided bundle metadata file ...
- cmOStringStream plist_source;
+ std::ostringstream plist_source;
plist_source << cpack_bundle_plist;
- cmOStringStream plist_target;
+ std::ostringstream plist_target;
plist_target << contents.str() << "/" << "Info.plist";
if(!this->CopyFile(plist_source, plist_target))
@@ -142,10 +142,10 @@ int cmCPackBundleGenerator::ConstructBundle()
}
// Install a user-provided bundle icon ...
- cmOStringStream icon_source;
+ std::ostringstream icon_source;
icon_source << cpack_bundle_icon;
- cmOStringStream icon_target;
+ std::ostringstream icon_target;
icon_target << resources.str() << "/" << cpack_bundle_name << ".icns";
if(!this->CopyFile(icon_source, icon_target))
@@ -161,10 +161,10 @@ int cmCPackBundleGenerator::ConstructBundle()
// executable or a script) ...
if(!cpack_bundle_startup_command.empty())
{
- cmOStringStream command_source;
+ std::ostringstream command_source;
command_source << cpack_bundle_startup_command;
- cmOStringStream command_target;
+ std::ostringstream command_target;
command_target << application.str() << "/" << cpack_bundle_name;
if(!this->CopyFile(command_source, command_target))
@@ -231,7 +231,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
for(std::vector<std::string>::iterator it = relFiles.begin();
it != relFiles.end(); ++it)
{
- cmOStringStream temp_sign_file_cmd;
+ std::ostringstream temp_sign_file_cmd;
temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app;
temp_sign_file_cmd << "\" -i ";
@@ -251,7 +251,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
}
// sign main binary
- cmOStringStream temp_sign_binary_cmd;
+ std::ostringstream temp_sign_binary_cmd;
temp_sign_binary_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
temp_sign_binary_cmd << " --deep -f -s \"" << cpack_apple_cert_app;
temp_sign_binary_cmd << "\" \"" << bundle_path << "\"";
@@ -266,7 +266,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
}
// sign app bundle
- cmOStringStream temp_codesign_cmd;
+ std::ostringstream temp_codesign_cmd;
temp_codesign_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
temp_codesign_cmd << " --deep -f -s \"" << cpack_apple_cert_app << "\"";
if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS"))
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 9f0a77e..5da9234 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -169,8 +169,8 @@ int cmCPackDragNDropGenerator::PackageFiles()
}
//----------------------------------------------------------------------
-bool cmCPackDragNDropGenerator::CopyFile(cmOStringStream& source,
- cmOStringStream& target)
+bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source,
+ std::ostringstream& target)
{
if(!cmSystemTools::CopyFileIfDifferent(
source.str().c_str(),
@@ -190,7 +190,7 @@ bool cmCPackDragNDropGenerator::CopyFile(cmOStringStream& source,
}
//----------------------------------------------------------------------
-bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command,
+bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command,
std::string* output)
{
int exit_code = 1;
@@ -255,12 +255,12 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// The staging directory contains everything that will end-up inside the
// final disk image ...
- cmOStringStream staging;
+ std::ostringstream staging;
staging << src_dir;
// Add a symlink to /Applications so users can drag-and-drop the bundle
// into it
- cmOStringStream application_link;
+ std::ostringstream application_link;
application_link << staging.str() << "/Applications";
cmSystemTools::CreateSymlink("/Applications",
application_link.str().c_str());
@@ -268,10 +268,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Optionally add a custom volume icon ...
if(!cpack_package_icon.empty())
{
- cmOStringStream package_icon_source;
+ std::ostringstream package_icon_source;
package_icon_source << cpack_package_icon;
- cmOStringStream package_icon_destination;
+ std::ostringstream package_icon_destination;
package_icon_destination << staging.str() << "/.VolumeIcon.icns";
if(!this->CopyFile(package_icon_source, package_icon_destination))
@@ -289,10 +289,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// (e.g. for setting background/layout) ...
if(!cpack_dmg_ds_store.empty())
{
- cmOStringStream package_settings_source;
+ std::ostringstream package_settings_source;
package_settings_source << cpack_dmg_ds_store;
- cmOStringStream package_settings_destination;
+ std::ostringstream package_settings_destination;
package_settings_destination << staging.str() << "/.DS_Store";
if(!this->CopyFile(package_settings_source, package_settings_destination))
@@ -309,10 +309,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Optionally add a custom background image ...
if(!cpack_dmg_background_image.empty())
{
- cmOStringStream package_background_source;
+ std::ostringstream package_background_source;
package_background_source << cpack_dmg_background_image;
- cmOStringStream package_background_destination;
+ std::ostringstream package_background_destination;
package_background_destination << staging.str() << "/background.png";
if(!this->CopyFile(package_background_source,
@@ -326,7 +326,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
return 0;
}
- cmOStringStream temp_background_hiding_command;
+ std::ostringstream temp_background_hiding_command;
temp_background_hiding_command << this->GetOption("CPACK_COMMAND_SETFILE");
temp_background_hiding_command << " -a V \"";
temp_background_hiding_command << package_background_destination.str();
@@ -346,7 +346,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::string temp_image = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
temp_image += "/temp.dmg";
- cmOStringStream temp_image_command;
+ std::ostringstream temp_image_command;
temp_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
temp_image_command << " create";
temp_image_command << " -ov";
@@ -368,9 +368,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Optionally set the custom icon flag for the image ...
if(!cpack_package_icon.empty())
{
- cmOStringStream temp_mount;
+ std::ostringstream temp_mount;
- cmOStringStream attach_command;
+ std::ostringstream attach_command;
attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
attach_command << " attach";
attach_command << " \"" << temp_image << "\"";
@@ -389,7 +389,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
mountpoint_regex.find(attach_output.c_str());
temp_mount << mountpoint_regex.match(1);
- cmOStringStream setfile_command;
+ std::ostringstream setfile_command;
setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
setfile_command << " -a C";
setfile_command << " \"" << temp_mount.str() << "\"";
@@ -403,7 +403,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
return 0;
}
- cmOStringStream detach_command;
+ std::ostringstream detach_command;
detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
detach_command << " detach";
detach_command << " \"" << temp_mount.str() << "\"";
@@ -471,7 +471,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
temp_udco += "/temp-udco.dmg";
- cmOStringStream udco_image_command;
+ std::ostringstream udco_image_command;
udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
udco_image_command << " convert \"" << temp_image << "\"";
udco_image_command << " -format UDCO";
@@ -488,7 +488,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
}
// unflatten dmg
- cmOStringStream unflatten_command;
+ std::ostringstream unflatten_command;
unflatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
unflatten_command << " unflatten ";
unflatten_command << "\"" << temp_udco << "\"";
@@ -503,7 +503,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
}
// Rez the SLA
- cmOStringStream embed_sla_command;
+ std::ostringstream embed_sla_command;
embed_sla_command << this->GetOption("CPACK_COMMAND_REZ");
const char* sysroot = this->GetOption("CPACK_OSX_SYSROOT");
if(sysroot && sysroot[0] != '\0')
@@ -524,7 +524,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
}
// flatten dmg
- cmOStringStream flatten_command;
+ std::ostringstream flatten_command;
flatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
flatten_command << " flatten ";
flatten_command << "\"" << temp_udco << "\"";
@@ -543,7 +543,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Create the final compressed read-only disk image ...
- cmOStringStream final_image_command;
+ std::ostringstream final_image_command;
final_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
final_image_command << " convert \"" << temp_image << "\"";
final_image_command << " -format ";
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 808c618..1c84d49 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -33,8 +33,8 @@ protected:
bool SupportsComponentInstallation() const;
- bool CopyFile(cmOStringStream& source, cmOStringStream& target);
- bool RunCommand(cmOStringStream& command, std::string* output = 0);
+ bool CopyFile(std::ostringstream& source, std::ostringstream& target);
+ bool RunCommand(std::ostringstream& command, std::string* output = 0);
std::string
GetComponentInstallDirNameSuffix(const std::string& componentName);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index e78f161..1c670d2 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -160,7 +160,7 @@ int cmCPackGenerator::PrepareNames()
"Cannot open description file name: " << descFileName << std::endl);
return 0;
}
- cmOStringStream ostr;
+ std::ostringstream ostr;
std::string line;
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@@ -421,7 +421,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
}
/* rebuild symlinks in the installed tree */
- if (symlinkedFiles.size()>0)
+ if (!symlinkedFiles.empty())
{
std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
@@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
<< symlinkedIt->second << "--> "
<< symlinkedIt->first << std::endl);
+ // make sure directory exists for symlink
+ std::string destDir =
+ cmSystemTools::GetFilenamePath(symlinkedIt->second);
+ if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: "
+ << destDir
+ << "\nTrying to create symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first
+ << std::endl);
+ }
if (!cmSystemTools::CreateSymlink(symlinkedIt->first,
symlinkedIt->second))
{
@@ -628,6 +640,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmGlobalGenerator* globalGenerator
= this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGenerator);
+ if ( !globalGenerator )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Specified package generator not found. "
+ "CPACK_CMAKE_GENERATOR value is invalid."
+ << std::endl);
+ return 0;
+ }
// set the global flag for unix style paths on cmSystemTools as
// soon as the generator is set. This allows gmake to be used
// on windows.
@@ -918,7 +938,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
- if (absoluteDestFiles.length()>0) {
+ if (!absoluteDestFiles.empty()) {
absoluteDestFiles +=";";
}
absoluteDestFiles +=
@@ -1348,7 +1368,7 @@ int cmCPackGenerator::PrepareGroupingKind()
groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
}
- if (groupingType.length()>0)
+ if (!groupingType.empty())
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
<< this->Name << "]"
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index ed89b53..907bb1e 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -29,7 +29,7 @@
#define cmCPackLogger(logType, msg) \
do { \
- cmOStringStream cmCPackLog_msg; \
+ std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
this->Logger->Log(logType, __FILE__, __LINE__,\
cmCPackLog_msg.str().c_str());\
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 94ca536..a07c29a 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -158,11 +158,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
//----------------------------------------------------------------------
cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
{
- std::vector<cmCPackGenerator*>::iterator it;
- for ( it = this->Generators.begin(); it != this->Generators.end(); ++ it )
- {
- delete *it;
- }
+ cmDeleteAll(this->Generators);
}
//----------------------------------------------------------------------
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index 7befca0..7633ac2 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -102,7 +102,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
- if ( tagString.size() > 0 ) { tagString += ","; }
+ if (!tagString.empty()) { tagString += ","; }
tagString = "VERBOSE";
}
}
@@ -112,7 +112,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
- if ( tagString.size() > 0 ) { tagString += ","; }
+ if (!tagString.empty()) { tagString += ","; }
tagString = "WARNING";
}
}
@@ -122,7 +122,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
- if ( tagString.size() > 0 ) { tagString += ","; }
+ if (!tagString.empty()) { tagString += ","; }
tagString = "ERROR";
}
}
@@ -132,7 +132,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
- if ( tagString.size() > 0 ) { tagString += ","; }
+ if (!tagString.empty()) { tagString += ","; }
tagString = "DEBUG";
}
useFileAndLine = true;
@@ -143,7 +143,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
- if ( tagString.size() > 0 ) { tagString += ","; }
+ if (!tagString.empty()) { tagString += ","; }
tagString = "VERBOSE";
}
}
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 812f1de..7a7ff58 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -17,7 +17,7 @@
#define cmCPack_Log(ctSelf, logType, msg) \
do { \
- cmOStringStream cmCPackLog_msg; \
+ std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
(ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str());\
} while ( 0 )
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index b506b06..8f63ca2 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -71,7 +71,7 @@ int cmCPackNSISGenerator::PackageFiles()
tmpFile += "/NSISOutput.log";
std::string nsisInstallOptions = nsisFileName + "/NSIS.InstallOptions.ini";
nsisFileName += "/project.nsi";
- cmOStringStream str;
+ std::ostringstream str;
std::vector<std::string>::const_iterator it;
for ( it = files.begin(); it != files.end(); ++ it )
{
@@ -91,7 +91,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::vector<std::string> dirs;
this->GetListOfSubdirectories(toplevel.c_str(), dirs);
std::vector<std::string>::const_iterator sit;
- cmOStringStream dstr;
+ std::ostringstream dstr;
for ( sit = dirs.begin(); sit != dirs.end(); ++ sit )
{
std::string componentName;
@@ -190,7 +190,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::string groupDescriptions;
std::string installTypesCode;
std::string defines;
- cmOStringStream macrosOut;
+ std::ostringstream macrosOut;
bool anyDownloadedComponents = false;
// Create installation types. The order is significant, so we first fill
@@ -503,8 +503,8 @@ int cmCPackNSISGenerator::InitializeInternal()
<< "not set" << std::endl);
}
- cmOStringStream str;
- cmOStringStream deleteStr;
+ std::ostringstream str;
+ std::ostringstream deleteStr;
if ( cpackPackageExecutables )
{
@@ -565,8 +565,8 @@ int cmCPackNSISGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
-void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
- cmOStringStream& deleteStr)
+void cmCPackNSISGenerator::CreateMenuLinks( std::ostringstream& str,
+ std::ostringstream& deleteStr)
{
const char* cpackMenuLinks
= this->GetOption("CPACK_NSIS_MENU_LINKS");
@@ -694,7 +694,7 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const
std::string
cmCPackNSISGenerator::
CreateComponentDescription(cmCPackComponent *component,
- cmOStringStream& macrosOut)
+ std::ostringstream& macrosOut)
{
// Basic description of the component
std::string componentCode = "Section ";
@@ -714,7 +714,7 @@ CreateComponentDescription(cmCPackComponent *component,
}
else if (!component->InstallationTypes.empty())
{
- cmOStringStream out;
+ std::ostringstream out;
std::vector<cmCPackInstallationType *>::iterator installTypeIter;
for (installTypeIter = component->InstallationTypes.begin();
installTypeIter != component->InstallationTypes.end();
@@ -734,7 +734,7 @@ CreateComponentDescription(cmCPackComponent *component,
// Compute the name of the archive.
std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packagesDir += ".dummy";
- cmOStringStream out;
+ std::ostringstream out;
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir)
<< "-" << component->Name << ".zip";
component->ArchiveFile = out.str();
@@ -859,7 +859,7 @@ CreateComponentDescription(cmCPackComponent *component,
{
totalSizeInKbytes = 1;
}
- cmOStringStream out;
+ std::ostringstream out;
out << " AddSize " << totalSizeInKbytes << "\n"
<< " Push \"" << component->ArchiveFile << "\"\n"
<< " Call DownloadFile\n"
@@ -935,7 +935,7 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription
}
visited.insert(component);
- cmOStringStream out;
+ std::ostringstream out;
std::vector<cmCPackComponent *>::iterator dependIt;
for (dependIt = component->Dependencies.begin();
dependIt != component->Dependencies.end();
@@ -967,7 +967,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription
}
visited.insert(component);
- cmOStringStream out;
+ std::ostringstream out;
std::vector<cmCPackComponent *>::iterator dependIt;
for (dependIt = component->ReverseDependencies.begin();
dependIt != component->ReverseDependencies.end();
@@ -992,7 +992,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription
std::string
cmCPackNSISGenerator::
CreateComponentGroupDescription(cmCPackComponentGroup *group,
- cmOStringStream& macrosOut)
+ std::ostringstream& macrosOut)
{
if (group->Components.empty() && group->Subgroups.empty())
{
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index e46fbda..c7b2ce1 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -38,8 +38,8 @@ public:
protected:
virtual int InitializeInternal();
- void CreateMenuLinks( cmOStringStream& str,
- cmOStringStream& deleteStr);
+ void CreateMenuLinks( std::ostringstream& str,
+ std::ostringstream& deleteStr);
int PackageFiles();
virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }
@@ -56,7 +56,7 @@ protected:
/// macrosOut.
std::string
CreateComponentDescription(cmCPackComponent *component,
- cmOStringStream& macrosOut);
+ std::ostringstream& macrosOut);
/// Produce NSIS code that selects all of the components that this component
/// depends on, recursively.
@@ -75,7 +75,7 @@ protected:
/// added macros will be emitted via macrosOut.
std::string
CreateComponentGroupDescription(cmCPackComponentGroup *group,
- cmOStringStream& macrosOut);
+ std::ostringstream& macrosOut);
/// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS.
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 28c7f1d..313e08b 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -45,8 +45,8 @@ int cmCPackOSXX11Generator::PackageFiles()
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: "
<< cpackPackageExecutables << "." << std::endl);
- cmOStringStream str;
- cmOStringStream deleteStr;
+ std::ostringstream str;
+ std::ostringstream deleteStr;
std::vector<std::string> cpackPackageExecutablesVector;
cmSystemTools::ExpandListArgument(cpackPackageExecutables,
cpackPackageExecutablesVector);
@@ -165,7 +165,7 @@ int cmCPackOSXX11Generator::PackageFiles()
std::string output;
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/hdiutilOutput.log";
- cmOStringStream dmgCmd;
+ std::ostringstream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
<< "\" create -ov -format UDZO -srcfolder \""
<< diskImageDirectory.c_str()
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index e799d06..dfe35c9 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -24,11 +24,20 @@
#include <cmsys/Glob.hxx>
#include <cmsys/FStream.hxx>
+#include <assert.h>
+
+static inline
+unsigned int getVersion(unsigned int major, unsigned int minor)
+{
+ assert(major < 256 && minor < 256);
+ return ((major & 0xFF) << 16 | minor);
+}
+
//----------------------------------------------------------------------
cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator()
{
this->PackageMakerVersion = 0.0;
- this->PackageCompatibilityVersion = 10.4;
+ this->PackageCompatibilityVersion = getVersion(10, 4);
}
//----------------------------------------------------------------------
@@ -39,7 +48,7 @@ cmCPackPackageMakerGenerator::~cmCPackPackageMakerGenerator()
//----------------------------------------------------------------------
bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const
{
- return this->PackageCompatibilityVersion >= 10.4;
+ return this->PackageCompatibilityVersion >= getVersion(10, 4);
}
//----------------------------------------------------------------------
@@ -241,7 +250,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
std::string packageFile;
if (compIt->second.IsDownloaded)
{
- if (this->PackageCompatibilityVersion >= 10.5 &&
+ if (this->PackageCompatibilityVersion >= getVersion(10, 5) &&
this->PackageMakerVersion >= 3.0)
{
// Build this package within the upload directory.
@@ -260,7 +269,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
}
else if (!warnedAboutDownloadCompatibility)
{
- if (this->PackageCompatibilityVersion < 10.5)
+ if (this->PackageCompatibilityVersion < getVersion(10, 5))
{
cmCPackLogger(
cmCPackLog::LOG_WARNING,
@@ -325,7 +334,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
if (this->Components.empty())
{
// Use PackageMaker to build the package.
- cmOStringStream pkgCmd;
+ std::ostringstream pkgCmd;
pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" -build -p \"" << packageDirFileName << "\"";
if (this->Components.empty())
@@ -359,7 +368,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/hdiutilOutput.log";
- cmOStringStream dmgCmd;
+ std::ostringstream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
<< "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName
<< "\" \"" << packageFileNames[0] << "\"";
@@ -520,22 +529,29 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
const char *packageCompat = this->GetOption("CPACK_OSX_PACKAGE_VERSION");
if (packageCompat && *packageCompat)
{
- this->PackageCompatibilityVersion = atof(packageCompat);
+ unsigned int majorVersion = 10;
+ unsigned int minorVersion = 5;
+ int res = sscanf(packageCompat, "%u.%u", &majorVersion, &minorVersion);
+ if (res == 2)
+ {
+ this->PackageCompatibilityVersion =
+ getVersion(majorVersion, minorVersion);
+ }
}
else if (this->GetOption("CPACK_DOWNLOAD_SITE"))
{
this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.5");
- this->PackageCompatibilityVersion = 10.5;
+ this->PackageCompatibilityVersion = getVersion(10, 5);
}
else if (this->GetOption("CPACK_COMPONENTS_ALL"))
{
this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.4");
- this->PackageCompatibilityVersion = 10.4;
+ this->PackageCompatibilityVersion = getVersion(10, 4);
}
else
{
this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.3");
- this->PackageCompatibilityVersion = 10.3;
+ this->PackageCompatibilityVersion = getVersion(10, 3);
}
std::vector<std::string> no_paths;
@@ -687,7 +703,7 @@ cmCPackPackageMakerGenerator::GetPackageName(const cmCPackComponent& component)
{
std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packagesDir += ".dummy";
- cmOStringStream out;
+ std::ostringstream out;
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir)
<< "-" << component.Name << ".pkg";
return out.str();
@@ -710,9 +726,9 @@ GenerateComponentPackage(const char *packageFile,
packageFile << std::endl);
// The command that will be used to run PackageMaker
- cmOStringStream pkgCmd;
+ std::ostringstream pkgCmd;
- if (this->PackageCompatibilityVersion < 10.5 ||
+ if (this->PackageCompatibilityVersion < getVersion(10, 5) ||
this->PackageMakerVersion < 3.0)
{
// Create Description.plist and Info.plist files for normal Mac OS
@@ -800,7 +816,7 @@ WriteDistributionFile(const char* metapackageFile)
// Create the choice outline, which provides a tree-based view of
// the components in their groups.
- cmOStringStream choiceOut;
+ std::ostringstream choiceOut;
choiceOut << "<choices-outline>" << std::endl;
// Emit the outline for the groups
@@ -862,7 +878,8 @@ WriteDistributionFile(const char* metapackageFile)
//----------------------------------------------------------------------
void
cmCPackPackageMakerGenerator::
-CreateChoiceOutline(const cmCPackComponentGroup& group, cmOStringStream& out)
+CreateChoiceOutline(const cmCPackComponentGroup& group,
+ std::ostringstream& out)
{
out << "<line choice=\"" << group.Name << "Choice\">" << std::endl;
std::vector<cmCPackComponentGroup*>::const_iterator groupIt;
@@ -885,7 +902,7 @@ CreateChoiceOutline(const cmCPackComponentGroup& group, cmOStringStream& out)
//----------------------------------------------------------------------
void
cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponentGroup& group,
- cmOStringStream& out)
+ std::ostringstream& out)
{
out << "<choice id=\"" << group.Name << "Choice\" "
<< "title=\"" << group.DisplayName << "\" "
@@ -903,7 +920,7 @@ cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponentGroup& group,
//----------------------------------------------------------------------
void
cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponent& component,
- cmOStringStream& out)
+ std::ostringstream& out)
{
std::string packageId = "com.";
packageId += this->GetOption("CPACK_PACKAGE_VENDOR");
@@ -989,7 +1006,7 @@ void
cmCPackPackageMakerGenerator::
AddDependencyAttributes(const cmCPackComponent& component,
std::set<const cmCPackComponent *>& visited,
- cmOStringStream& out)
+ std::ostringstream& out)
{
if (visited.find(&component) != visited.end())
{
@@ -1013,7 +1030,7 @@ void
cmCPackPackageMakerGenerator::
AddReverseDependencyAttributes(const cmCPackComponent& component,
std::set<const cmCPackComponent *>& visited,
- cmOStringStream& out)
+ std::ostringstream& out)
{
if (visited.find(&component) != visited.end())
{
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index e350a60..7d349c6 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -84,30 +84,30 @@ protected:
// dependency attributes for inter-component dependencies.
void AddDependencyAttributes(const cmCPackComponent& component,
std::set<const cmCPackComponent *>& visited,
- cmOStringStream& out);
+ std::ostringstream& out);
// Subroutine of WriteDistributionFile that writes out the
// reverse dependency attributes for inter-component dependencies.
void
AddReverseDependencyAttributes(const cmCPackComponent& component,
std::set<const cmCPackComponent *>& visited,
- cmOStringStream& out);
+ std::ostringstream& out);
// Generates XML that encodes the hierarchy of component groups and
// their components in a form that can be used by distribution
// metapackages.
void CreateChoiceOutline(const cmCPackComponentGroup& group,
- cmOStringStream& out);
+ std::ostringstream& out);
/// Create the "choice" XML element to describe a component group
/// for the installer GUI.
void CreateChoice(const cmCPackComponentGroup& group,
- cmOStringStream& out);
+ std::ostringstream& out);
/// Create the "choice" XML element to describe a component for the
/// installer GUI.
void CreateChoice(const cmCPackComponent& component,
- cmOStringStream& out);
+ std::ostringstream& out);
// Escape the given string to make it usable as an XML attribute
// value.
@@ -117,7 +117,7 @@ protected:
cmCPackComponent PostFlightComponent;
double PackageMakerVersion;
- double PackageCompatibilityVersion;
+ unsigned int PackageCompatibilityVersion;
};
#endif
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 26bf607..00bfe5b 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -117,7 +117,7 @@ int main (int argc, char const* const* argv)
cmSystemTools::EnableMSVCDebugHook();
- if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
+ if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established." << std::endl);
@@ -426,7 +426,7 @@ int main (int argc, char const* const* argv)
= mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
const char* projVersionPatch
= mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << projVersionMajor << "." << projVersionMinor << "."
<< projVersionPatch;
mf->AddDefinition("CPACK_PACKAGE_VERSION",
diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx
index 7f966aa..d62c260 100644
--- a/Source/CTest/cmCTestBatchTestHandler.cxx
+++ b/Source/CTest/cmCTestBatchTestHandler.cxx
@@ -58,7 +58,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
fout << "-J=" << properties->Name << " ";
//Write dependency information
- /*if(this->Tests[test].size() > 0)
+ /*if(!this->Tests[test].empty())
{
fout << "-P=afterany";
for(TestSet::iterator i = this->Tests[test].begin();
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index a101e39..d90aeb7 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -55,14 +55,14 @@ int cmCTestBuildAndTestHandler::ProcessHandler()
//----------------------------------------------------------------------
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
- cmOStringStream &out, std::string &cmakeOutString, std::string &cwd,
+ std::ostringstream &out, std::string &cmakeOutString, std::string &cwd,
cmake *cm)
{
unsigned int k;
std::vector<std::string> args;
args.push_back(cmSystemTools::GetCMakeCommand());
args.push_back(this->SourceDir);
- if(this->BuildGenerator.size())
+ if(!this->BuildGenerator.empty())
{
std::string generator = "-G";
generator += this->BuildGenerator;
@@ -74,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
platform += this->BuildGeneratorPlatform;
args.push_back(platform);
}
- if(this->BuildGeneratorToolset.size())
+ if(!this->BuildGeneratorToolset.empty())
{
std::string toolset = "-T";
toolset += this->BuildGeneratorToolset;
@@ -82,7 +82,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
}
const char* config = 0;
- if ( this->CTest->GetConfigType().size() > 0 )
+ if (!this->CTest->GetConfigType().empty())
{
config = this->CTest->GetConfigType().c_str();
}
@@ -193,7 +193,7 @@ public:
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
{
// if the generator and make program are not specified then it is an error
- if (!this->BuildGenerator.size())
+ if (this->BuildGenerator.empty())
{
if(outstring)
{
@@ -209,10 +209,10 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string cmakeOutString;
cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString);
static_cast<void>(captureRAII);
- cmOStringStream out;
+ std::ostringstream out;
- if ( this->CTest->GetConfigType().size() == 0 &&
- this->ConfigSample.size())
+ if ( this->CTest->GetConfigType().empty() &&
+ !this->ConfigSample.empty())
{
// use the config sample to set the ConfigType
std::string fullPath;
@@ -225,7 +225,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
resultingConfig,
extraPaths,
failed);
- if (fullPath.size() && resultingConfig.size())
+ if (!fullPath.empty() && !resultingConfig.empty())
{
this->CTest->SetConfigType(resultingConfig.c_str());
}
@@ -269,7 +269,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// do the build
std::vector<std::string>::iterator tarIt;
- if ( this->BuildTargets.size() == 0 )
+ if (this->BuildTargets.empty())
{
this->BuildTargets.push_back("");
}
@@ -291,7 +291,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
std::string output;
const char* config = 0;
- if ( this->CTest->GetConfigType().size() > 0 )
+ if (!this->CTest->GetConfigType().empty())
{
config = this->CTest->GetConfigType().c_str();
}
@@ -329,7 +329,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
// if no test was specified then we are done
- if (!this->TestCommand.size())
+ if (this->TestCommand.empty())
{
return 0;
}
@@ -340,7 +340,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string resultingConfig;
std::vector<std::string> extraPaths;
// if this->ExecutableDirectory is set try that as well
- if (this->ExecutableDirectory.size())
+ if (!this->ExecutableDirectory.empty())
{
std::string tempPath = this->ExecutableDirectory;
tempPath += "/";
@@ -388,7 +388,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string outs;
int retval = 0;
// run the test from the this->BuildRunDir if set
- if(this->BuildRunDir.size())
+ if(!this->BuildRunDir.empty())
{
out << "Run test in directory: " << this->BuildRunDir << "\n";
cmSystemTools::ChangeDirectory(this->BuildRunDir);
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index 5a7b916..a75c631 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -50,7 +50,7 @@ public:
protected:
///! Run CMake and build a test and then run it as a single test.
int RunCMakeAndTest(std::string* output);
- int RunCMake(std::string* outstring, cmOStringStream &out,
+ int RunCMake(std::string* outstring, std::ostringstream &out,
std::string &cmakeOutString,
std::string &cwd, cmake *cm);
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index a5a593a..c4df741 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -148,7 +148,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
}
else
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "has no project to build. If this is a "
"\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
"and CTEST_PROJECT_NAME are set."
@@ -181,7 +181,7 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
bool ret = cmCTestHandlerCommand::InitialPass(args, status);
if ( this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS])
{
- cmOStringStream str;
+ std::ostringstream str;
str << this->Handler->GetTotalErrors();
this->Makefile->AddDefinition(
this->Values[ctb_NUMBER_ERRORS], str.str().c_str());
@@ -189,7 +189,7 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
if ( this->Values[ctb_NUMBER_WARNINGS]
&& *this->Values[ctb_NUMBER_WARNINGS])
{
- cmOStringStream str;
+ std::ostringstream str;
str << this->Handler->GetTotalWarnings();
this->Makefile->AddDefinition(
this->Values[ctb_NUMBER_WARNINGS], str.str().c_str());
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index d226a6c..f941408 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -67,13 +67,13 @@ static const char* cmCTestErrorMatches[] = {
"^CMake Error.*:",
":[ \\t]cannot find",
":[ \\t]can't find",
- ": \\*\\*\\* No rule to make target \\`.*\\'. Stop",
+ ": \\*\\*\\* No rule to make target \\[`'].*\\'. Stop",
": \\*\\*\\* No targets specified and no makefile found",
": Invalid loader fixup for symbol",
": Invalid fixups exist",
": Can't find library for",
": internal link edit command failed",
- ": Unrecognized option \\`.*\\'",
+ ": Unrecognized option \\[`'].*\\'",
"\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)",
"ld: 0706-006 Cannot find or open library file: -l ",
"ild: \\(argument error\\) can't find library argument ::",
@@ -344,7 +344,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Determine build command and build directory
std::string makeCommand = this->GetMakeCommand();
- if ( makeCommand.size() == 0 )
+ if (makeCommand.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find MakeCommand key in the DartConfiguration.tcl"
@@ -354,7 +354,7 @@ int cmCTestBuildHandler::ProcessHandler()
const std::string &buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory");
- if ( buildDirectory.size() == 0 )
+ if (buildDirectory.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
@@ -702,12 +702,12 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os)
}
if ( !cm->SourceFile.empty() && cm->LineNumber >= 0 )
{
- if ( cm->SourceFile.size() > 0 )
+ if (!cm->SourceFile.empty())
{
os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>"
<< std::endl;
}
- if ( cm->SourceFileTail.size() > 0 )
+ if (!cm->SourceFileTail.empty())
{
os << "\t\t<SourceFileTail>" << cm->SourceFileTail
<< "</SourceFileTail>" << std::endl;
@@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{
// Create a contiguous array for the line
this->CurrentProcessingLine.clear();
- t_BuildProcessingQueueType::iterator cit;
- for ( cit = queue->begin(); cit != it; ++cit )
- {
- this->CurrentProcessingLine.push_back(*cit);
- }
+ this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
+ queue->begin(), it);
this->CurrentProcessingLine.push_back(0);
const char* line = &*this->CurrentProcessingLine.begin();
@@ -1153,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{
// This is not an error or warning.
// So, figure out if this is a post-context line
- if ( this->ErrorsAndWarnings.size() &&
+ if ( !this->ErrorsAndWarnings.empty() &&
this->LastErrorOrWarning != this->ErrorsAndWarnings.end() &&
this->PostContextCount < this->MaxPostContext )
{
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index ef62fd3..0f13263 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -66,7 +66,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
if ( !cmSystemTools::FileExists(cmakelists_file.c_str()) )
{
- cmOStringStream e;
+ std::ostringstream e;
e << "CMakeLists.txt file does not exist ["
<< cmakelists_file << "]";
this->SetError(e.str());
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index c492bf0..506433f 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -38,7 +38,7 @@ int cmCTestConfigureHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
std::string cCommand
= this->CTest->GetCTestConfiguration("ConfigureCommand");
- if ( cCommand.size() == 0 )
+ if (cCommand.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find ConfigureCommand key in the DartConfiguration.tcl"
@@ -48,7 +48,7 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory");
- if ( buildDirectory.size() == 0 )
+ if (buildDirectory.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index a1d770b..08b7c66 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -87,7 +87,7 @@ public:
}
args.push_back(0); // null terminate
cmsysProcess_SetCommand(this->Process, &*args.begin());
- if(this->WorkingDirectory.size())
+ if(!this->WorkingDirectory.empty())
{
cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str());
@@ -270,7 +270,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
std::string ndc
= cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str());
- if ( ndc.size() )
+ if (!ndc.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of " << file << std::endl);
@@ -281,7 +281,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
// Get the relative path to the file an apply it to the opposite directory.
// If it is the same as fileDir, then ignore, otherwise check.
std::string relPath;
- if(checkDir.size() )
+ if(!checkDir.empty())
{
relPath = cmSystemTools::RelativePath(checkDir.c_str(),
fFile.c_str());
@@ -309,7 +309,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str());
- if ( ndc.size() )
+ if (!ndc.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of: " << file << std::endl);
@@ -544,7 +544,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmsys::ifstream ifs(fullFileName.c_str());
if ( !ifs)
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "Cannot open source file: " << fullFileName;
errorsWhileAccumulating.push_back(ostr.str());
error ++;
@@ -563,7 +563,7 @@ int cmCTestCoverageHandler::ProcessHandler()
if ( !cmSystemTools::GetLineFromStream(ifs, line) &&
cc != fcov.size() -1 )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "Problem reading source file: " << fullFileName
<< " line:" << cc << " out total: " << fcov.size()-1;
errorsWhileAccumulating.push_back(ostr.str());
@@ -584,7 +584,7 @@ int cmCTestCoverageHandler::ProcessHandler()
}
if ( cmSystemTools::GetLineFromStream(ifs, line) )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "Looks like there are more lines in the file: " << fullFileName;
errorsWhileAccumulating.push_back(ostr.str());
}
@@ -633,7 +633,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmsys::ifstream ifs(fullPath.c_str());
if (!ifs)
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "Cannot open source file: " << fullPath;
errorsWhileAccumulating.push_back(ostr.str());
error ++;
@@ -665,7 +665,7 @@ int cmCTestCoverageHandler::ProcessHandler()
this->EndCoverageLogFile(covLogFile, logFileCount);
- if ( errorsWhileAccumulating.size() > 0 )
+ if (!errorsWhileAccumulating.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -910,7 +910,7 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
g.FindFiles(coverageFile);
files=g.GetFiles();
- if (files.size() > 0)
+ if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Jacoco Files, Performing Coverage" << std::endl);
@@ -943,7 +943,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
g.FindFiles(coverageFile);
files=g.GetFiles();
- if (files.size() > 0)
+ if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Delphi HTML Files, Performing Coverage" << std::endl);
@@ -973,7 +973,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
std::vector<std::string> files;
g.FindFiles(coverageFile);
files=g.GetFiles();
- if (files.size() > 0)
+ if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found BlanketJS output JSON, Performing Coverage" << std::endl);
@@ -1037,7 +1037,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
this->FindGCovFiles(files);
std::vector<std::string>::iterator it;
- if ( files.size() == 0 )
+ if (files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any GCov coverage files."
@@ -1131,7 +1131,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]"
<< std::endl);
- if ( line->size() == 0 )
+ if (line->empty())
{
// Ignore empty line; probably style 2
}
@@ -1311,7 +1311,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
//TODO: Handle gcov 3.0 non-coverage lines
// Skip empty lines
- if ( !nl.size() )
+ if (nl.empty())
{
continue;
}
@@ -1456,7 +1456,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
this->FindLCovFiles(files);
std::vector<std::string>::iterator it;
- if ( files.size() == 0 )
+ if (files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any LCov coverage files."
@@ -1538,7 +1538,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
std::string sourceFile;
std::string lcovFile;
- if ( line->size() == 0 )
+ if (line->empty())
{
// Ignore empty line
}
@@ -1627,7 +1627,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
cnt ++;
// Skip empty lines
- if ( !nl.size() )
+ if (nl.empty())
{
continue;
}
@@ -1759,7 +1759,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
gl.FindFiles(daGlob);
std::vector<std::string> files = gl.GetFiles();
- if ( files.size() == 0 )
+ if (files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any Python Trace.py coverage files."
@@ -1813,7 +1813,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
cnt ++;
// Skip empty lines
- if ( !nl.size() )
+ if (nl.empty())
{
continue;
}
@@ -2076,7 +2076,7 @@ int cmCTestCoverageHandler::RunBullseyeCommand(
std::string& outputFile)
{
std::string program = cmSystemTools::FindProgram(cmd);
- if(program.size() == 0)
+ if(program.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find :" << cmd << "\n");
return 0;
@@ -2183,7 +2183,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
while(cmSystemTools::GetLineFromStream(fin, stdline))
{
// if we have a line of output from stdout
- if(stdline.size())
+ if(!stdline.empty())
{
// parse the comma separated output
this->ParseBullsEyeCovsrcLine(stdline,
@@ -2498,11 +2498,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
// Label the source with the target labels.
LabelSet& labelSet = this->SourceLabels[source];
- for(std::vector<int>::const_iterator li = targetLabels.begin();
- li != targetLabels.end(); ++li)
- {
- labelSet.insert(*li);
- }
+ labelSet.insert(targetLabels.begin(), targetLabels.end());
}
}
}
@@ -2600,7 +2596,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
}
}
- if(extraMatches.size())
+ if(!extraMatches.empty())
{
for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i =
cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i)
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
new file mode 100644
index 0000000..b4c0137
--- /dev/null
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -0,0 +1,282 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCTestCurl.h"
+
+#include "cmSystemTools.h"
+#include "cmCTest.h"
+
+cmCTestCurl::cmCTestCurl(cmCTest* ctest)
+{
+ this->CTest = ctest;
+ this->SetProxyType();
+ this->UseHttp10 = false;
+ // In windows, this will init the winsock stuff
+ ::curl_global_init(CURL_GLOBAL_ALL);
+ // default is to verify https
+ this->VerifyPeerOff = false;
+ this->VerifyHostOff = false;
+ this->TimeOutSeconds = 0;
+ this->Curl = curl_easy_init();
+}
+
+cmCTestCurl::~cmCTestCurl()
+{
+ ::curl_easy_cleanup(this->Curl);
+ ::curl_global_cleanup();
+}
+
+std::string cmCTestCurl::Escape(std::string const& source)
+{
+ char* data1 = curl_easy_escape(this->Curl, source.c_str(), 0);
+ std::string ret = data1;
+ curl_free(data1);
+ return ret;
+}
+
+namespace
+{
+static size_t
+curlWriteMemoryCallback(void *ptr, size_t size, size_t nmemb,
+ void *data)
+{
+ int realsize = (int)(size * nmemb);
+
+ std::vector<char> *vec
+ = static_cast<std::vector<char>* >(data);
+ const char* chPtr = static_cast<char*>(ptr);
+ vec->insert(vec->end(), chPtr, chPtr + realsize);
+ return realsize;
+}
+
+static size_t
+curlDebugCallback(CURL *, curl_infotype, char *chPtr,
+ size_t size, void *data)
+{
+ std::vector<char> *vec
+ = static_cast<std::vector<char>* >(data);
+ vec->insert(vec->end(), chPtr, chPtr + size);
+
+ return size;
+}
+
+}
+
+void cmCTestCurl::SetCurlOptions(std::vector<std::string> const& args)
+{
+ for( std::vector<std::string>::const_iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ if(*i == "CURLOPT_SSL_VERIFYPEER_OFF")
+ {
+ this->VerifyPeerOff = true;
+ }
+ if(*i == "CURLOPT_SSL_VERIFYHOST_OFF")
+ {
+ this->VerifyHostOff = true;
+ }
+ }
+}
+
+bool cmCTestCurl::InitCurl()
+{
+ if(!this->Curl)
+ {
+ return false;
+ }
+ if(this->VerifyPeerOff)
+ {
+ curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYPEER, 0);
+ }
+ if(this->VerifyHostOff)
+ {
+ curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0);
+ }
+ if(this->HTTPProxy.size())
+ {
+ curl_easy_setopt(this->Curl, CURLOPT_PROXY, this->HTTPProxy.c_str());
+ curl_easy_setopt(this->Curl, CURLOPT_PROXYTYPE, this->HTTPProxyType);
+ if (this->HTTPProxyAuth.size() > 0)
+ {
+ curl_easy_setopt(this->Curl, CURLOPT_PROXYUSERPWD,
+ this->HTTPProxyAuth.c_str());
+ }
+ }
+ if(this->UseHttp10)
+ {
+ curl_easy_setopt(this->Curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ }
+ // enable HTTP ERROR parsing
+ curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1);
+ return true;
+}
+
+
+bool cmCTestCurl::UploadFile(std::string const& local_file,
+ std::string const& url,
+ std::string const& fields,
+ std::string& response)
+{
+ response = "";
+ if(!this->InitCurl())
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed");
+ return false;
+ }
+ /* enable uploading */
+ curl_easy_setopt(this->Curl, CURLOPT_UPLOAD, 1);
+ // if there is little to no activity for too long stop submitting
+ if(this->TimeOutSeconds)
+ {
+ ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_LIMIT, 1);
+ ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_TIME,
+ this->TimeOutSeconds);
+ }
+ /* HTTP PUT please */
+ ::curl_easy_setopt(this->Curl, CURLOPT_PUT, 1);
+ ::curl_easy_setopt(this->Curl, CURLOPT_VERBOSE, 1);
+
+ FILE* ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
+ if(!ftpfile)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Could not open file for upload: " << local_file << "\n");
+ return false;
+ }
+ // set the url
+ std::string upload_url = url;
+ upload_url += "?";
+ upload_url += fields;
+ ::curl_easy_setopt(this->Curl, CURLOPT_URL, upload_url.c_str());
+ // now specify which file to upload
+ ::curl_easy_setopt(this->Curl, CURLOPT_INFILE, ftpfile);
+ unsigned long filelen = cmSystemTools::FileLength(local_file);
+ // and give the size of the upload (optional)
+ ::curl_easy_setopt(this->Curl, CURLOPT_INFILESIZE,
+ static_cast<long>(filelen));
+ ::curl_easy_setopt(this->Curl, CURLOPT_WRITEFUNCTION,
+ curlWriteMemoryCallback);
+ ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION,
+ curlDebugCallback);
+ std::vector<char> responseData;
+ std::vector<char> debugData;
+ ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void *)&responseData);
+ ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, (void *)&debugData);
+ ::curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1);
+ // Now run off and do what you've been told!
+ ::curl_easy_perform(this->Curl);
+ ::fclose(ftpfile);
+
+ if ( responseData.size() > 0 )
+ {
+ response = std::string(responseData.begin(), responseData.end());
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Curl response: [" << response << "]\n");
+ }
+ std::string curlDebug;
+ if ( debugData.size() > 0 )
+ {
+ curlDebug = std::string(debugData.begin(), debugData.end());
+ cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
+ }
+ if(response.size() == 0)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" <<
+ curlDebug);
+ return false;
+ }
+ return true;
+}
+
+bool cmCTestCurl::HttpRequest(std::string const& url,
+ std::string const& fields,
+ std::string& response)
+{
+ response = "";
+ cmCTestLog(this->CTest, DEBUG, "HttpRequest\n"
+ << "url: " << url << "\n"
+ << "fields " << fields << "\n");
+ if(!this->InitCurl())
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed");
+ return false;
+ }
+ curl_easy_setopt(this->Curl, CURLOPT_POST, 1);
+ curl_easy_setopt(this->Curl, CURLOPT_POSTFIELDS, fields.c_str());
+ ::curl_easy_setopt(this->Curl, CURLOPT_URL, url.c_str());
+ ::curl_easy_setopt(this->Curl, CURLOPT_FOLLOWLOCATION, 1);
+ //set response options
+ ::curl_easy_setopt(this->Curl, CURLOPT_WRITEFUNCTION,
+ curlWriteMemoryCallback);
+ ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION,
+ curlDebugCallback);
+ std::vector<char> responseData;
+ std::vector<char> debugData;
+ ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void *)&responseData);
+ ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGDATA, (void *)&debugData);
+ ::curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1);
+
+ CURLcode res = ::curl_easy_perform(this->Curl);
+
+ if ( responseData.size() > 0 )
+ {
+ response = std::string(responseData.begin(), responseData.end());
+ cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n");
+ }
+ if ( debugData.size() > 0 )
+ {
+ std::string curlDebug = std::string(debugData.begin(), debugData.end());
+ cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
+ }
+ cmCTestLog(this->CTest, DEBUG, "Curl res: " << res << "\n");
+ return (res == 0);
+}
+
+void cmCTestCurl::SetProxyType()
+{
+ if ( cmSystemTools::GetEnv("HTTP_PROXY") )
+ {
+ this->HTTPProxy = cmSystemTools::GetEnv("HTTP_PROXY");
+ if ( cmSystemTools::GetEnv("HTTP_PROXY_PORT") )
+ {
+ this->HTTPProxy += ":";
+ this->HTTPProxy += cmSystemTools::GetEnv("HTTP_PROXY_PORT");
+ }
+ if ( cmSystemTools::GetEnv("HTTP_PROXY_TYPE") )
+ {
+ // this is the default
+ this->HTTPProxyType = CURLPROXY_HTTP;
+ std::string type = cmSystemTools::GetEnv("HTTP_PROXY_TYPE");
+ // HTTP/SOCKS4/SOCKS5
+ if ( type == "HTTP" )
+ {
+ this->HTTPProxyType = CURLPROXY_HTTP;
+ }
+ else if ( type == "SOCKS4" )
+ {
+ this->HTTPProxyType = CURLPROXY_SOCKS4;
+ }
+ else if ( type == "SOCKS5" )
+ {
+ this->HTTPProxyType = CURLPROXY_SOCKS5;
+ }
+ }
+ if ( cmSystemTools::GetEnv("HTTP_PROXY_USER") )
+ {
+ this->HTTPProxyAuth = cmSystemTools::GetEnv("HTTP_PROXY_USER");
+ }
+ if ( cmSystemTools::GetEnv("HTTP_PROXY_PASSWD") )
+ {
+ this->HTTPProxyAuth += ":";
+ this->HTTPProxyAuth += cmSystemTools::GetEnv("HTTP_PROXY_PASSWD");
+ }
+ }
+}
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
new file mode 100644
index 0000000..0737bb6
--- /dev/null
+++ b/Source/CTest/cmCTestCurl.h
@@ -0,0 +1,54 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCTestCurl_h
+#define cmCTestCurl_h
+
+#include "cmStandardIncludes.h"
+
+#include "cm_curl.h"
+
+class cmCTest;
+
+class cmCTestCurl
+{
+public:
+ cmCTestCurl(cmCTest*);
+ ~cmCTestCurl();
+ bool UploadFile(std::string const& url,
+ std::string const& file,
+ std::string const& fields,
+ std::string& response);
+ bool HttpRequest(std::string const& url,
+ std::string const& fields,
+ std::string& response);
+ // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
+ // and CURLOPT_SSL_VERIFYHOST_OFF
+ void SetCurlOptions(std::vector<std::string> const& args);
+ void SetUseHttp10On() { this->UseHttp10 = true;}
+ void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s;}
+ std::string Escape(std::string const& source);
+protected:
+ void SetProxyType();
+ bool InitCurl();
+private:
+ cmCTest* CTest;
+ CURL* Curl;
+ std::string HTTPProxyAuth;
+ std::string HTTPProxy;
+ curl_proxytype HTTPProxyType;
+ bool VerifyHostOff;
+ bool VerifyPeerOff;
+ bool UseHttp10;
+ int TimeOutSeconds;
+};
+
+#endif
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
index 5ddef01..e175592 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
@@ -24,7 +24,7 @@ bool cmCTestEmptyBinaryDirectoryCommand
if ( !cmCTestScriptHandler::EmptyBinaryDirectory(args[0].c_str()) )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "problem removing the binary directory: " << args[0];
this->SetError(ostr.str());
return false;
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 2df2229..13c8ca5 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -103,7 +103,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
<< std::endl;);
return false;
}
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << name;
if ( this->SubmitIndex > 0 )
{
@@ -142,7 +142,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name,
"Cannot create log file without providing the name" << std::endl;);
return false;
}
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "Last" << name;
if ( this->SubmitIndex > 0 )
{
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 5b525dd..b886777 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -46,7 +46,7 @@ bool cmCTestHandlerCommand
if(!this->CheckArgumentKeyword(args[i]) &&
!this->CheckArgumentValue(args[i]))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with unknown argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
@@ -141,7 +141,7 @@ bool cmCTestHandlerCommand
int res = handler->ProcessHandler();
if ( this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE])
{
- cmOStringStream str;
+ std::ostringstream str;
str << res;
this->Makefile->AddDefinition(
this->Values[ct_RETURN_VALUE], str.str().c_str());
@@ -183,7 +183,7 @@ bool cmCTestHandlerCommand::CheckArgumentValue(std::string const& arg)
unsigned int k = this->ArgumentIndex;
if(this->Values[k])
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Called with more than one value for " << this->Arguments[k];
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 77c5d57..62fa2be 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -720,7 +720,7 @@ bool cmCTestLaunch::Match(std::string const& line,
//----------------------------------------------------------------------------
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{
- if(this->OptionFilterPrefix.size() && cmSystemTools::StringStartsWith(
+ if(!this->OptionFilterPrefix.empty() && cmSystemTools::StringStartsWith(
line.c_str(), this->OptionFilterPrefix.c_str()))
{
return true;
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 09cf760..d4ff24f 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -75,7 +75,7 @@ public:
this->ParseError(atts);
}
// Create the log
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << name << ":\n";
int i = 0;
for(; atts[i] != 0; i+=2)
@@ -198,7 +198,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
{
std::vector<std::string>::size_type pp;
std::string index;
- cmOStringStream stream;
+ std::ostringstream stream;
std::string memcheckcommand
= cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str());
stream << test;
@@ -223,7 +223,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
this->MemoryTesterEnvironmentVariable;
for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
{
- if(memTesterEnvironmentVariable.size())
+ if(!memTesterEnvironmentVariable.empty())
{
// If we are using env to pass options, append all the options to
// this string with space separation.
@@ -241,7 +241,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
}
// if this is an env option type, then add the env string as a single
// argument.
- if(memTesterEnvironmentVariable.size())
+ if(!memTesterEnvironmentVariable.empty())
{
std::string::size_type pos = memTesterEnvironmentVariable.find("??");
if (pos != std::string::npos)
@@ -592,7 +592,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
}
}
- if(this->MemoryTester.size() == 0 )
+ if(this->MemoryTester.empty())
{
cmCTestLog(this->CTest, WARNING,
"Memory checker (MemoryCheckCommand) "
@@ -834,7 +834,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
int defects = 0;
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
- cmOStringStream ostr;
+ std::ostringstream ostr;
log = "";
for( std::vector<std::string>::iterator i = lines.begin();
i != lines.end(); ++i)
@@ -848,10 +848,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
{
resultFound = sanitizerWarning.match(1);
}
- if(resultFound.size())
+ if(!resultFound.empty())
{
std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound);
- if(result.size() == 0 || idx > result.size()-1)
+ if(result.empty() || idx > result.size()-1)
{
result.push_back(1);
}
@@ -878,7 +878,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
{
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
- cmOStringStream ostr;
+ std::ostringstream ostr;
log = "";
cmsys::RegularExpression pfW("^\\[[WEI]\\] ([A-Z][A-Z][A-Z][A-Z]*): ");
@@ -941,7 +941,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
std::string::size_type cc;
- cmOStringStream ostr;
+ std::ostringstream ostr;
log = "";
int defects = 0;
@@ -1197,7 +1197,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res,
<< res.Name << std::endl);
std::vector<std::string> files;
this->TestOutputFileNames(test, files);
- if ( files.size() == 0 )
+ if (files.empty())
{
return;
}
@@ -1269,7 +1269,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(int test,
files)
{
std::string index;
- cmOStringStream stream;
+ std::ostringstream stream;
stream << test;
index = stream.str();
std::string ofile = this->MemoryTesterOutputFile;
@@ -1280,7 +1280,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(int test,
ofile += ".*";
cmsys::Glob g;
g.FindFiles(ofile);
- if(g.GetFiles().size() == 0)
+ if(g.GetFiles().empty())
{
std::string log = "Cannot find memory tester output file: "
+ ofile;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 4c89caa..f9e8a3c 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -92,7 +92,7 @@ void cmCTestMultiProcessHandler::RunTests()
}
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests();
- while(this->Tests.size() != 0)
+ while(!this->Tests.empty())
{
if(this->StopTimePassed)
{
@@ -162,12 +162,9 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
//---------------------------------------------------------
void cmCTestMultiProcessHandler::LockResources(int index)
{
- for(std::set<std::string>::iterator i =
- this->Properties[index]->LockedResources.begin();
- i != this->Properties[index]->LockedResources.end(); ++i)
- {
- this->LockedResources.insert(*i);
- }
+ this->LockedResources.insert(
+ this->Properties[index]->LockedResources.begin(),
+ this->Properties[index]->LockedResources.end());
}
//---------------------------------------------------------
@@ -268,7 +265,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
bool cmCTestMultiProcessHandler::CheckOutput()
{
// no more output we are done
- if(this->RunningTests.size() == 0)
+ if(this->RunningTests.empty())
{
return false;
}
@@ -499,11 +496,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
i != previousSet.end(); ++i)
{
TestSet const& dependencies = this->Tests[*i];
- for(TestSet::const_iterator j = dependencies.begin();
- j != dependencies.end(); ++j)
- {
- currentSet.insert(*j);
- }
+ currentSet.insert(dependencies.begin(), dependencies.end());
}
for(TestSet::const_iterator i = currentSet.begin();
@@ -526,11 +519,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
TestList sortedCopy;
- for(TestSet::const_iterator j = currentSet.begin();
- j != currentSet.end(); ++j)
- {
- sortedCopy.push_back(*j);
- }
+ sortedCopy.insert(sortedCopy.end(),
+ currentSet.begin(), currentSet.end());
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);
@@ -646,7 +636,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode
- if(p.Labels.size()) //print the labels
+ if(!p.Labels.empty()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
}
@@ -655,7 +645,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
}
- if(p.Labels.size()) //print the labels
+ if(!p.Labels.empty()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
}
@@ -668,7 +658,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Test");
}
- cmOStringStream indexStr;
+ std::ostringstream indexStr;
indexStr << " #" << p.Index << ":";
cmCTestLog(this->CTest, HANDLER_OUTPUT,
std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex()))
@@ -693,7 +683,7 @@ void cmCTestMultiProcessHandler::PrintLabels()
allLabels.insert(p.Labels.begin(), p.Labels.end());
}
- if(allLabels.size())
+ if(!allLabels.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
}
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 0bb1a99..31002a6 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -324,7 +324,7 @@ private:
//----------------------------------------------------------------------------
void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
{
- if(P4Options.size() == 0)
+ if(P4Options.empty())
{
const char* p4 = this->CommandLineTool.c_str();
P4Options.push_back(p4);
@@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
std::vector<std::string> args =
cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<std::string>::const_iterator ai = args.begin();
- ai != args.end(); ++ai)
- {
- P4Options.push_back(*ai);
- }
+ P4Options.insert(P4Options.end(), args.begin(), args.end());
}
CommandOptions.clear();
@@ -451,7 +447,7 @@ void cmCTestP4::LoadRevisions()
ChangeLists.clear();
this->RunChild(&p4_changes[0], &out, &err);
- if(ChangeLists.size() == 0)
+ if(ChangeLists.empty())
return;
//p4 describe -s ...@1111111,2222222
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index bdf9b9c..7afbe04 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -54,7 +54,7 @@ bool cmCTestRunScriptCommand
int ret;
cmCTestScriptHandler::RunScript(this->CTest, args[i].c_str(), !np,
&ret);
- cmOStringStream str;
+ std::ostringstream str;
str << ret;
this->Makefile->AddDefinition(returnVariable, str.str().c_str());
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 9e3c9fc..314c8ad 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -116,10 +116,10 @@ void cmCTestRunTest::CompressOutput()
unsigned char *encoded_buffer
= new unsigned char[static_cast<int>(outSize * 1.5)];
- unsigned long rlen
+ size_t rlen
= cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1);
- for(unsigned long i = 0; i < rlen; i++)
+ for(size_t i = 0; i < rlen; i++)
{
this->CompressedOutput += encoded_buffer[i];
}
@@ -155,7 +155,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
std::string> >::iterator passIt;
bool forceFail = false;
bool outputTestErrorsToConsole = false;
- if ( this->TestProperties->RequiredRegularExpressions.size() > 0 )
+ if (!this->TestProperties->RequiredRegularExpressions.empty())
{
bool found = false;
for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
@@ -184,7 +184,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
}
reason += "]";
}
- if ( this->TestProperties->ErrorRegularExpressions.size() > 0 )
+ if (!this->TestProperties->ErrorRegularExpressions.empty())
{
for ( passIt = this->TestProperties->ErrorRegularExpressions.begin();
passIt != this->TestProperties->ErrorRegularExpressions.end();
@@ -318,7 +318,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
*this->TestHandler->LogFile
<< "----------------------------------------------------------"
<< std::endl;
- if(this->TestResult.Reason.size())
+ if(!this->TestResult.Reason.empty())
{
*this->TestHandler->LogFile << reasonType << ":\n"
<< this->TestResult.Reason << "\n";
@@ -670,7 +670,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
cmSystemTools::SaveRestoreEnvironment sre;
#endif
- if (environment && environment->size()>0)
+ if (environment && !environment->empty())
{
cmSystemTools::AppendEnv(*environment);
}
@@ -694,7 +694,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Test");
}
- cmOStringStream indexStr;
+ std::ostringstream indexStr;
indexStr << " #" << this->Index << ":";
cmCTestLog(this->CTest, HANDLER_OUTPUT,
std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex()))
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index f958e7b..8184bb4 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -299,7 +299,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
cmsysProcess_Delete(cp);
if(failed)
{
- cmOStringStream message;
+ std::ostringstream message;
message << "Error running command: [";
message << result << "] ";
for(std::vector<const char*>::iterator i = argv.begin();
@@ -415,7 +415,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->UpdateElapsedTime();
// add the script arg if defined
- if (script_arg.size())
+ if (!script_arg.empty())
{
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
}
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 1a39a8a..8ea6cef 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -126,7 +126,7 @@ bool cmCTestStartCommand
}
if(!cmSystemTools::FileIsDirectory(sourceDir))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given source path\n"
<< " " << sourceDir << "\n"
<< "which is not an existing directory. "
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 07a994d..cc3514f 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -27,7 +27,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
= this->Makefile->GetDefinition("CTEST_TRIGGER_SITE");
bool ctestDropSiteCDash
= this->Makefile->IsOn("CTEST_DROP_SITE_CDASH");
-
+ const char* ctestProjectName
+ = this->Makefile->GetDefinition("CTEST_PROJECT_NAME");
if ( !ctestDropMethod )
{
ctestDropMethod = "http";
@@ -43,7 +44,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
// error: CDash requires CTEST_DROP_LOCATION definition
// in CTestConfig.cmake
}
-
+ this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName);
this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite);
this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
@@ -74,13 +75,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> notesFiles;
cmCTest::VectorOfStrings newNotesFiles;
cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles);
- std::vector<std::string>::iterator it;
- for ( it = notesFiles.begin();
- it != notesFiles.end();
- ++ it )
- {
- newNotesFiles.push_back(*it);
- }
+ newNotesFiles.insert(newNotesFiles.end(),
+ notesFiles.begin(), notesFiles.end());
this->CTest->GenerateNotesFile(newNotesFiles);
}
@@ -91,13 +87,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> extraFiles;
cmCTest::VectorOfStrings newExtraFiles;
cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
- std::vector<std::string>::iterator it;
- for ( it = extraFiles.begin();
- it != extraFiles.end();
- ++ it )
- {
- newExtraFiles.push_back(*it);
- }
+ newExtraFiles.insert(newExtraFiles.end(),
+ extraFiles.begin(), extraFiles.end());
if ( !this->CTest->SubmitExtraFiles(newExtraFiles))
{
this->SetError("problem submitting extra files.");
@@ -154,44 +145,75 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
static_cast<cmCTestSubmitHandler*>(handler)->SetOption("InternalTest",
this->InternalTest ? "ON" : "OFF");
+ if (this->CDashUpload)
+ {
+ static_cast<cmCTestSubmitHandler*>(handler)->
+ SetOption("CDashUploadFile", this->CDashUploadFile.c_str());
+ static_cast<cmCTestSubmitHandler*>(handler)->
+ SetOption("CDashUploadType", this->CDashUploadType.c_str());
+ }
return handler;
}
+//----------------------------------------------------------------------------
+bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ this->CDashUpload = !args.empty() && args[0] == "CDASH_UPLOAD";
+ return this->cmCTestHandlerCommand::InitialPass(args, status);
+}
//----------------------------------------------------------------------------
bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
{
- // Look for arguments specific to this command.
- if(arg == "PARTS")
+ if (this->CDashUpload)
{
- this->ArgumentDoing = ArgumentDoingParts;
- this->PartsMentioned = true;
- return true;
- }
+ if(arg == "CDASH_UPLOAD")
+ {
+ this->ArgumentDoing = ArgumentDoingCDashUpload;
+ return true;
+ }
- if(arg == "FILES")
- {
- this->ArgumentDoing = ArgumentDoingFiles;
- this->FilesMentioned = true;
- return true;
+ if(arg == "CDASH_UPLOAD_TYPE")
+ {
+ this->ArgumentDoing = ArgumentDoingCDashUploadType;
+ return true;
+ }
}
-
- if(arg == "RETRY_COUNT")
+ else
{
- this->ArgumentDoing = ArgumentDoingRetryCount;
- return true;
- }
+ // Look for arguments specific to this command.
+ if(arg == "PARTS")
+ {
+ this->ArgumentDoing = ArgumentDoingParts;
+ this->PartsMentioned = true;
+ return true;
+ }
- if(arg == "RETRY_DELAY")
- {
- this->ArgumentDoing = ArgumentDoingRetryDelay;
- return true;
- }
+ if(arg == "FILES")
+ {
+ this->ArgumentDoing = ArgumentDoingFiles;
+ this->FilesMentioned = true;
+ return true;
+ }
- if(arg == "INTERNAL_TEST_CHECKSUM")
- {
- this->InternalTest = true;
- return true;
+ if(arg == "RETRY_COUNT")
+ {
+ this->ArgumentDoing = ArgumentDoingRetryCount;
+ return true;
+ }
+
+ if(arg == "RETRY_DELAY")
+ {
+ this->ArgumentDoing = ArgumentDoingRetryDelay;
+ return true;
+ }
+
+ if(arg == "INTERNAL_TEST_CHECKSUM")
+ {
+ this->InternalTest = true;
+ return true;
+ }
}
// Look for other arguments.
@@ -212,7 +234,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Part name \"" << arg << "\" is invalid.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
@@ -229,7 +251,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "File \"" << filename << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -250,6 +272,20 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
return true;
}
+ if(this->ArgumentDoing == ArgumentDoingCDashUpload)
+ {
+ this->ArgumentDoing = ArgumentDoingNone;
+ this->CDashUploadFile = arg;
+ return true;
+ }
+
+ if(this->ArgumentDoing == ArgumentDoingCDashUploadType)
+ {
+ this->ArgumentDoing = ArgumentDoingNone;
+ this->CDashUploadType = arg;
+ return true;
+ }
+
// Look for other arguments.
return this->Superclass::CheckArgumentValue(arg);
}
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 3673fbd..19e8eaf 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -32,6 +32,7 @@ public:
this->InternalTest = false;
this->RetryCount = "";
this->RetryDelay = "";
+ this->CDashUpload = false;
}
/**
@@ -45,6 +46,9 @@ public:
return ni;
}
+ virtual bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus &status);
+
/**
* The name of the command as specified in CMakeList.txt.
*/
@@ -64,6 +68,8 @@ protected:
ArgumentDoingFiles,
ArgumentDoingRetryDelay,
ArgumentDoingRetryCount,
+ ArgumentDoingCDashUpload,
+ ArgumentDoingCDashUploadType,
ArgumentDoingLast2
};
@@ -74,6 +80,9 @@ protected:
cmCTest::SetOfStrings Files;
std::string RetryCount;
std::string RetryDelay;
+ bool CDashUpload;
+ std::string CDashUploadFile;
+ std::string CDashUploadType;
};
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 6aa1c2b..5b52df7 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -10,7 +10,8 @@
See the License for more information.
============================================================================*/
#include "cmCTestSubmitHandler.h"
-
+#include "cmCTestScriptHandler.h"
+#include "cmake.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmGeneratedFileStream.h"
@@ -23,8 +24,10 @@
// For XML-RPC submission
#include "cm_xmlrpc.h"
+#include <cm_jsoncpp_reader.h>
// For curl submission
-#include "cm_curl.h"
+#include "cmCurl.h"
+#include "cmCTestCurl.h"
#include <sys/stat.h>
@@ -61,7 +64,7 @@ private:
std::string GetCurrentValue()
{
std::string val;
- if(this->CurrentValue.size())
+ if(!this->CurrentValue.empty())
{
val.assign(&this->CurrentValue[0], this->CurrentValue.size());
}
@@ -273,13 +276,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
// Now run off and do what you've been told!
res = ::curl_easy_perform(curl);
- if ( chunk.size() > 0 )
+ if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
- if ( chunkDebug.size() > 0 )
+ if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@@ -301,7 +304,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
<< error_buffer << std::endl
<< " Curl output was: ";
// avoid dereference of empty vector
- if(chunk.size())
+ if(!chunk.empty())
{
*this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size());
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
@@ -363,6 +366,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
curl = curl_easy_init();
if(curl)
{
+ cmCurlSetCAInfo(curl);
if(verifyPeerOff)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
@@ -390,7 +394,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
- if (this->HTTPProxyAuth.size() > 0)
+ if (!this->HTTPProxyAuth.empty())
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str());
@@ -523,14 +527,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
chunk.assign(mock_output.begin(), mock_output.end());
}
- if ( chunk.size() > 0 )
+ if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
this->ParseResponse(chunk);
}
- if ( chunkDebug.size() > 0 )
+ if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@@ -576,7 +580,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
res = ::curl_easy_perform(curl);
- if ( chunk.size() > 0 )
+ if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
@@ -605,7 +609,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
<< " Error message was: " << error_buffer
<< std::endl;
// avoid deref of begin for zero size array
- if(chunk.size())
+ if(!chunk.empty())
{
*this->LogFile << " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size())
@@ -697,7 +701,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
- if (this->HTTPProxyAuth.size() > 0)
+ if (!this->HTTPProxyAuth.empty())
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str());
@@ -766,7 +770,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
<< std::endl
<< " Error message was: " << error_buffer
<< std::endl;
- if(chunk.size())
+ if(!chunk.empty())
{
*this->LogFile
<< " Curl output was: "
@@ -780,13 +784,13 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
return false;
}
- if ( chunk.size() > 0 )
+ if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
- if ( chunkDebug.size() > 0 )
+ if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size())
@@ -812,8 +816,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
const std::string& remoteprefix,
const std::string& url)
{
- if ( !scp_command.size() || !localprefix.size() ||
- !files.size() || !remoteprefix.size() || !url.size() )
+ if ( scp_command.empty() || localprefix.empty() ||
+ files.empty() || remoteprefix.empty() || url.empty() )
{
return 0;
}
@@ -912,8 +916,8 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
const std::string& remoteprefix,
const std::string& destination)
{
- if ( !localprefix.size() ||
- !files.size() || !remoteprefix.size() || !destination.size() )
+ if ( localprefix.empty() ||
+ files.empty() || remoteprefix.empty() || destination.empty() )
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Missing arguments for submit via cp:\n"
@@ -1055,19 +1059,184 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&,
}
#endif
+void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod,
+ std::string& url)
+{
+ dropMethod = this->CTest->GetCTestConfiguration("DropMethod");
+ url = dropMethod;
+ url += "://";
+ if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
+ {
+ url += this->CTest->GetCTestConfiguration("DropSiteUser");
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ this->CTest->GetCTestConfiguration("DropSiteUser").c_str());
+ if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
+ {
+ url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
+ }
+ url += "@";
+ }
+ url += this->CTest->GetCTestConfiguration("DropSite") +
+ this->CTest->GetCTestConfiguration("DropLocation");
+}
+
+
+int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
+ std::string const& typeString)
+{
+ if (file.empty())
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Upload file not specified\n");
+ return -1;
+ }
+ if (!cmSystemTools::FileExists(file))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Upload file not found: '" << file << "'\n");
+ return -1;
+ }
+ cmCTestCurl curl(this->CTest);
+ std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArgument(curlopt, args);
+ curl.SetCurlOptions(args);
+ curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
+ std::string dropMethod;
+ std::string url;
+ this->ConstructCDashURL(dropMethod, url);
+ std::string::size_type pos = url.find("submit.php?");
+ url = url.substr(0, pos+10);
+ if ( ! (dropMethod == "http" || dropMethod == "https" ) )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Only http and https are supported for CDASH_UPLOAD\n");
+ return -1;
+ }
+ char md5sum[33];
+ md5sum[32] = 0;
+ cmSystemTools::ComputeFileMD5(file, md5sum);
+ // 1. request the buildid and check to see if the file
+ // has already been uploaded
+ // TODO I added support for subproject. You would need to add
+ // a "&subproject=subprojectname" to the first POST.
+ cmCTestScriptHandler* ch =
+ static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script"));
+ cmake* cm = ch->GetCMake();
+ const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL);
+ // TODO: Encode values for a URL instead of trusting caller.
+ std::ostringstream str;
+ str << "project="
+ << curl.Escape(this->CTest->GetCTestConfiguration("ProjectName")) << "&";
+ if(subproject)
+ {
+ str << "subproject=" << curl.Escape(subproject) << "&";
+ }
+ str << "stamp=" << curl.Escape(this->CTest->GetCurrentTag()) << "-"
+ << curl.Escape(this->CTest->GetTestModelString()) << "&"
+ << "model=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
+ << "build="
+ << curl.Escape(this->CTest->GetCTestConfiguration("BuildName")) << "&"
+ << "site="
+ << curl.Escape(this->CTest->GetCTestConfiguration("Site")) << "&"
+ << "track="
+ << curl.Escape(this->CTest->GetTestModelString()) << "&"
+ << "starttime=" << (int)cmSystemTools::GetTime() << "&"
+ << "endtime=" << (int)cmSystemTools::GetTime() << "&"
+ << "datafilesmd5[0]=" << md5sum << "&"
+ << "type=" << curl.Escape(typeString);
+ std::string fields = str.str();
+ cmCTestLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:"
+ << url << "\nfile: " << file << "\n");
+ std::string response;
+ if(!curl.HttpRequest(url, fields, response))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Error in HttpRequest\n" << response);
+ return -1;
+ }
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Request upload response: [" << response << "]\n");
+ Json::Value json;
+ Json::Reader reader;
+ if(!reader.parse(response, json))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "error parsing json string [" << response << "]\n"
+ << reader.getFormattedErrorMessages() << "\n");
+ return -1;
+ }
+ if(json["status"].asInt() != 0)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Bad status returned from CDash: "
+ << json["status"].asInt());
+ return -1;
+ }
+ if(json["datafilesmd5"].isArray())
+ {
+ int datares = json["datafilesmd5"][0].asInt();
+ if(datares == 1)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "File already exists on CDash, skip upload "
+ << file << "\n");
+ return 0;
+ }
+ }
+ else
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "bad datafilesmd5 value in response "
+ << response << "\n");
+ return -1;
+ }
+
+ std::string upload_as = cmSystemTools::GetFilenameName(file);
+ std::ostringstream fstr;
+ fstr << "type=" << curl.Escape(typeString) << "&"
+ << "md5=" << md5sum << "&"
+ << "filename=" << curl.Escape(upload_as) << "&"
+ << "buildid=" << json["buildid"].asString();
+ if(!curl.UploadFile(file, url, fstr.str(), response))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "error uploading to CDash. "
+ << file << " " << url << " " << fstr.str());
+ return -1;
+ }
+ if(!reader.parse(response, json))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "error parsing json string [" << response << "]\n"
+ << reader.getFormattedErrorMessages() << "\n");
+ return -1;
+ }
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Upload file response: [" << response << "]\n");
+ return 0;
+}
+
//----------------------------------------------------------------------------
int cmCTestSubmitHandler::ProcessHandler()
{
+ const char* cdashUploadFile = this->GetOption("CDashUploadFile");
+ const char* cdashUploadType = this->GetOption("CDashUploadType");
+ if(cdashUploadFile && cdashUploadType)
+ {
+ return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType);
+ }
std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash");
// cdash does not need to trigger so just return true
- if(iscdash.size())
+ if(!iscdash.empty())
{
this->CDash = true;
}
const std::string &buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory");
- if ( buildDirectory.size() == 0 )
+ if (buildDirectory.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
@@ -1140,12 +1309,12 @@ int cmCTestSubmitHandler::ProcessHandler()
}
}
- if ( this->HTTPProxy.size() > 0 )
+ if (!this->HTTPProxy.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: "
<< this->HTTPProxy << std::endl);
}
- if ( this->FTPProxy.size() > 0 )
+ if (!this->FTPProxy.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: "
<< this->FTPProxy << std::endl);
@@ -1160,11 +1329,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{
// Submit the explicitly selected files:
//
- cmCTest::SetOfStrings::const_iterator it;
- for (it = this->Files.begin(); it != this->Files.end(); ++it)
- {
- files.insert(*it);
- }
+ files.insert(this->Files.begin(), this->Files.end());
}
// Add to the list of files to submit from any selected, existing parts:
@@ -1219,11 +1384,7 @@ int cmCTestSubmitHandler::ProcessHandler()
// Submit files from this part.
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
- for(std::vector<std::string>::const_iterator pi = pfiles.begin();
- pi != pfiles.end(); ++pi)
- {
- files.insert(*pi);
- }
+ files.insert(pfiles.begin(), pfiles.end());
}
if ( ofs )
@@ -1264,12 +1425,12 @@ int cmCTestSubmitHandler::ProcessHandler()
this->CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe(
this->CTest->GetCTestConfiguration("DropLocation"));
- if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
+ if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration(
"DropSiteUser").c_str());
- if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
+ if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
}
@@ -1318,12 +1479,12 @@ int cmCTestSubmitHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method"
<< std::endl
<< " Drop site:" << url);
- if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
+ if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str());
- if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
+ if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
@@ -1408,7 +1569,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{
std::string url;
std::string oldWorkingDirectory;
- if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
+ if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@";
}
@@ -1503,9 +1664,5 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
//----------------------------------------------------------------------------
void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files)
{
- cmCTest::SetOfStrings::const_iterator it;
- for (it = files.begin(); it != files.end(); ++it)
- {
- this->Files.insert(*it);
- }
+ this->Files.insert(files.begin(), files.end());
}
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index accabd1..f9cd894 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -41,6 +41,11 @@ public:
/** Specify a set of files to submit. */
void SelectFiles(cmCTest::SetOfStrings const& files);
+ // handle the cdash file upload protocol
+ int HandleCDashUploadFile(std::string const& file, std::string const& type);
+
+ void ConstructCDashURL(std::string& dropMethod, std::string& url);
+
private:
void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 231f035..d209094 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -53,7 +53,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
if ( this->Values[ctt_START] || this->Values[ctt_END] ||
this->Values[ctt_STRIDE] )
{
- cmOStringStream testsToRunString;
+ std::ostringstream testsToRunString;
if ( this->Values[ctt_START] )
{
testsToRunString << this->Values[ctt_START];
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index b77825d..925e3c9 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -564,7 +564,7 @@ int cmCTestTestHandler::ProcessHandler()
}
else
{
- if (this->HandlerVerbose && passed.size() &&
+ if (this->HandlerVerbose && !passed.empty() &&
(this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag))
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
@@ -578,7 +578,7 @@ int cmCTestTestHandler::ProcessHandler()
}
float percent = float(passed.size()) * 100.0f / float(total);
- if ( failed.size() > 0 && percent > 99)
+ if (!failed.empty() && percent > 99)
{
percent = 99;
}
@@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
<< realBuf << "\n" );
- if (failed.size())
+ if (!failed.empty())
{
cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
@@ -668,7 +668,7 @@ void cmCTestTestHandler::PrintLabelSummary()
for(; it != this->TestList.end(); ++it)
{
cmCTestTestProperties& p = *it;
- if(p.Labels.size() != 0)
+ if(!p.Labels.empty())
{
for(std::vector<std::string>::iterator l = p.Labels.begin();
l != p.Labels.end(); ++l)
@@ -688,7 +688,7 @@ void cmCTestTestHandler::PrintLabelSummary()
{
cmCTestTestResult &result = *ri;
cmCTestTestProperties& p = *result.Properties;
- if(p.Labels.size() != 0)
+ if(!p.Labels.empty())
{
for(std::vector<std::string>::iterator l = p.Labels.begin();
l != p.Labels.end(); ++l)
@@ -698,7 +698,7 @@ void cmCTestTestHandler::PrintLabelSummary()
}
}
// now print times
- if(labels.size())
+ if(!labels.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
}
@@ -717,7 +717,7 @@ void cmCTestTestHandler::PrintLabelSummary()
<< buf << "\n";
}
}
- if(labels.size())
+ if(!labels.empty())
{
if(this->LogFile)
{
@@ -738,7 +738,7 @@ void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it)
}
// if there are no labels and we are filtering by labels
// then exclude the test as it does not have the label
- if(it.Labels.size() == 0 )
+ if(it.Labels.empty())
{
it.IsInBasedOnREOptions = false;
return;
@@ -772,7 +772,7 @@ void cmCTestTestHandler::CheckLabelFilterExclude(cmCTestTestProperties& it)
}
// if there are no labels and we are excluding by labels
// then do nothing as a no label can not be a match
- if(it.Labels.size() == 0 )
+ if(it.Labels.empty())
{
return;
}
@@ -850,7 +850,7 @@ void cmCTestTestHandler::ComputeTestList()
if (this->UseUnion)
{
// if it is not in the list and not in the regexp then skip
- if ((this->TestsToRun.size() &&
+ if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions)
{
@@ -860,7 +860,7 @@ void cmCTestTestHandler::ComputeTestList()
else
{
// is this test in the list of tests to run? If not then skip it
- if ((this->TestsToRun.size() &&
+ if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(),
this->TestsToRun.end(), inREcnt)
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions)
@@ -891,7 +891,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed()
cnt ++;
// if this test is not in our list of tests to run, then skip it.
- if ((this->TestsToRun.size() &&
+ if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end()))
{
@@ -1094,7 +1094,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
p.Timeout = this->CTest->GetGlobalTimeout();
}
- if(p.Depends.size())
+ if(!p.Depends.empty())
{
for(std::vector<std::string>::iterator i = p.Depends.begin();
i != p.Depends.end(); ++i)
@@ -1192,7 +1192,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
<< "name=\"Execution Time\"><Value>"
<< result->ExecutionTime
<< "</Value></NamedMeasurement>\n";
- if(result->Reason.size())
+ if(!result->Reason.empty())
{
const char* reasonType = "Pass Reason";
if(result->Status != cmCTestTestHandler::COMPLETED &&
@@ -1376,7 +1376,7 @@ void cmCTestTestHandler
{
std::string tempPath;
- if (filepath.size() &&
+ if (!filepath.empty() &&
filepath[filepath.size()-1] != '/')
{
filepath += "/";
@@ -1385,7 +1385,7 @@ void cmCTestTestHandler
attempted.push_back(tempPath);
attemptedConfigs.push_back("");
- if(ctest->GetConfigType().size())
+ if(!ctest->GetConfigType().empty())
{
tempPath = filepath;
tempPath += ctest->GetConfigType();
@@ -1463,7 +1463,7 @@ std::string cmCTestTestHandler
// even if a fullpath was specified also try it relative to the current
// directory
- if (filepath.size() && filepath[0] == '/')
+ if (!filepath.empty() && filepath[0] == '/')
{
std::string localfilepath = filepath.substr(1,filepath.size()-1);
cmCTestTestHandler::AddConfigurations(ctest, attempted,
@@ -1474,7 +1474,7 @@ std::string cmCTestTestHandler
// if extraPaths are provided and we were not passed a full path, try them,
// try any extra paths
- if (filepath.size() == 0)
+ if (filepath.empty())
{
for (unsigned int i = 0; i < extraPaths.size(); ++i)
{
@@ -1494,7 +1494,7 @@ std::string cmCTestTestHandler
// now look in the paths we specified above
for(unsigned int ai=0;
- ai < attempted.size() && fullPath.size() == 0; ++ai)
+ ai < attempted.size() && fullPath.empty(); ++ai)
{
// first check without exe extension
if(cmSystemTools::FileExists(attempted[ai].c_str())
@@ -1524,7 +1524,7 @@ std::string cmCTestTestHandler
// if everything else failed, check the users path, but only if a full path
// wasn't specified
- if (fullPath.size() == 0 && filepath.size() == 0)
+ if (fullPath.empty() && filepath.empty())
{
std::string path = cmSystemTools::FindProgram(filename.c_str());
if (path != "")
@@ -1533,7 +1533,7 @@ std::string cmCTestTestHandler
return path;
}
}
- if(fullPath.size() == 0)
+ if(fullPath.empty())
{
cmCTestLog(ctest, HANDLER_OUTPUT,
"Could not find executable " << testCommand << "\n"
@@ -1865,7 +1865,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
SPACE_REGEX "*>([^<]*)</DartMeasurementFile>");
- cmOStringStream ostr;
+ std::ostringstream ostr;
bool done = false;
std::string cxml = xml;
while ( ! done )
@@ -1976,9 +1976,8 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
= new unsigned char [ static_cast<int>(
static_cast<double>(len) * 1.5 + 5.0) ];
- unsigned long rlen
+ size_t rlen
= cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
- unsigned long cc;
ostr
<< "\t\t\t<NamedMeasurement"
@@ -1988,7 +1987,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
<< measurementfile.match(4) << "\""
<< " encoding=\"base64\""
<< ">" << std::endl << "\t\t\t\t<Value>";
- for ( cc = 0; cc < rlen; cc ++ )
+ for (size_t cc = 0; cc < rlen; cc ++ )
{
ostr << encoded_buffer[cc];
if ( cc % 60 == 0 && cc )
@@ -2099,7 +2098,7 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
output = output.substr(0, current - begin);
// Append truncation message.
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "...\n"
"The rest of the test output was removed since it exceeds the threshold "
"of " << length << " bytes.\n";
@@ -2164,11 +2163,7 @@ bool cmCTestTestHandler::SetTestsProperties(
std::vector<std::string> lval;
cmSystemTools::ExpandListArgument(val, lval);
- for(std::vector<std::string>::iterator f = lval.begin();
- f != lval.end(); ++f)
- {
- rtit->LockedResources.insert(*f);
- }
+ rtit->LockedResources.insert(lval.begin(), lval.end());
}
if ( key == "TIMEOUT" )
{
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 7206914..4c37c8b 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -94,7 +94,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
{
// restore the value of LC_MESSAGES after running the version control
// commands
- if(saveLCMessages.size())
+ if(!saveLCMessages.empty())
{
std::string put = "LC_MESSAGES=";
put += saveLCMessages;
@@ -413,7 +413,7 @@ bool cmCTestUpdateHandler::SelectVCS()
}
if (this->UpdateCommand.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot find UpdateCommand ";
if (key)
{
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
index 954c024..d2423c0 100644
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -17,10 +17,6 @@
#include "cmCTestGenericHandler.h"
#include "cmListFileCache.h"
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
/** \class cmCTestUpdateHandler
* \brief A class that handles ctest -S invocations
*
@@ -70,8 +66,4 @@ private:
bool SelectVCS();
};
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma reset woff 1375 /* base class destructor not virtual */
-#endif
-
#endif
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index f7de294..5613751 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -55,7 +55,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "File \"" << filename << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index 15f796f..6e93e95 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -105,7 +105,7 @@ bool cmCTestVC::RunChild(char const* const* cmd, OutputParser* out,
//----------------------------------------------------------------------------
std::string cmCTestVC::ComputeCommandLine(char const* const* cmd)
{
- cmOStringStream line;
+ std::ostringstream line;
const char* sep = "";
for(const char* const* arg = cmd; *arg; ++arg)
{
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index 97454a8..3642308 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -163,7 +163,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
}
// if we do not have a routine yet, then it should be
// the first argument in the vector
- if(routine.size() == 0)
+ if(routine.empty())
{
routine = separateLine[0];
// Find the full path to the file
@@ -191,7 +191,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
// move to next line. We should have already warned
// after the call to FindMumpsFile that we did not find
// it, so don't report again to cut down on output
- if(filepath.size() == 0)
+ if(filepath.empty())
{
continue;
}
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 0742be1..e19b199 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -12,9 +12,11 @@ public:
XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont)
: CTest(ctest), Coverage(cont)
{
- this->InSources = false;
- this->InSource = false;
+ this->InSources = false;
+ this->InSource = false;
+ this->SkipThisClass = false;
this->FilePaths.push_back(this->Coverage.SourceDir);
+ this->FilePaths.push_back(this->Coverage.BinaryDir);
this->CurFileName = "";
}
@@ -35,6 +37,10 @@ protected:
{
this->InSources=false;
}
+ else if(name == "class")
+ {
+ this->SkipThisClass = false;
+ }
}
virtual void CharacterDataHandler(const char* data, int length)
@@ -72,15 +78,33 @@ protected:
<< atts[tagCount+1]<< std::endl);
std::string filename = atts[tagCount+1];
this->CurFileName = "";
+
+ // Check if this is an absolute path that falls within our
+ // source or binary directories.
for(size_t i=0;i < FilePaths.size();i++)
{
- finalpath = FilePaths[i] + "/" + filename;
- if(cmSystemTools::FileExists(finalpath.c_str()))
+ if (filename.find(FilePaths[i]) == 0)
{
- this->CurFileName = finalpath;
+ this->CurFileName = filename;
break;
}
}
+
+ if (this->CurFileName == "")
+ {
+ // Check if this is a path that is relative to our source or
+ // binary directories.
+ for(size_t i=0;i < FilePaths.size();i++)
+ {
+ finalpath = FilePaths[i] + "/" + filename;
+ if(cmSystemTools::FileExists(finalpath.c_str()))
+ {
+ this->CurFileName = finalpath;
+ break;
+ }
+ }
+ }
+
cmsys::ifstream fin(this->CurFileName.c_str());
if(this->CurFileName == "" || !fin )
{
@@ -89,10 +113,11 @@ protected:
fin.open(this->CurFileName.c_str());
if (!fin)
{
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Python Coverage: Error opening " << this->CurFileName
- << std::endl);
- this->Coverage.Error++;
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Skipping system file " << filename <<
+ std::endl);
+
+ this->SkipThisClass = true;
break;
}
}
@@ -117,6 +142,10 @@ protected:
int curHits = -1;
while(true)
{
+ if(this->SkipThisClass)
+ {
+ break;
+ }
if(strcmp(atts[tagCount], "hits") == 0)
{
curHits = atoi(atts[tagCount+1]);
@@ -144,6 +173,7 @@ private:
bool InSources;
bool InSource;
+ bool SkipThisClass;
std::vector<std::string> FilePaths;
typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector
FileLinesType;
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 3afbfac..4dfdfac 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -61,7 +61,7 @@ public:
continue;
}
else if((line.find("end;") != line.npos)
- && (beginSet.size() > 0))
+ && !beginSet.empty())
{
beginSet.pop_back();
coverageVector.push_back(-1);
@@ -80,7 +80,7 @@ public:
}
}
//Based up what was found, add a line to the coverageVector
- if((beginSet.size() > 0) && line != "" && !blockComFlag
+ if(!beginSet.empty() && line != "" && !blockComFlag
&& !lineComFlag)
{
coverageVector.push_back(0);
@@ -147,7 +147,7 @@ public:
std::string glob = Coverage.SourceDir + "*/" + filename;
gl.FindFiles(glob);
std::vector<std::string> const& files = gl.GetFiles();
- if(files.size() == 0)
+ if(files.empty())
{
/*
* If that doesn't find any matching files
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index d77244a..f3f8008 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -80,7 +80,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
// no need to search the file if we just did it
if(function == lastfunction && lastroutine == routine)
{
- if(lastpath.size())
+ if(!lastpath.empty())
{
this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber]
+= count;
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index f270adb..780debc 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -106,7 +106,7 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
{
FileLinesType& curFileLines=
this->Coverage.TotalCoverage[this->CurFileName];
- if(curFileLines.size() > 0)
+ if(!curFileLines.empty())
{
curFileLines[nr-1] = ci;
}
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 167b992..e1bd02b 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -39,7 +39,7 @@ void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
bool cmProcess::StartProcess()
{
- if(this->Command.size() == 0)
+ if(this->Command.empty())
{
return false;
}
@@ -56,7 +56,7 @@ bool cmProcess::StartProcess()
this->ProcessArgs.push_back(0); // null terminate the list
this->Process = cmsysProcess_New();
cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin());
- if(this->WorkingDirectory.size())
+ if(!this->WorkingDirectory.empty())
{
cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str());
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 4200e9e..dcd0b6c 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -69,11 +69,7 @@ cmCursesMainForm::~cmCursesMainForm()
// Clean-up composites
if (this->Entries)
{
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
- {
- delete *it;
- }
+ cmDeleteAll(*this->Entries);
}
delete this->Entries;
if (this->CMakeInstance)
@@ -188,12 +184,7 @@ void cmCursesMainForm::InitializeUI()
// Clean old entries
if (this->Entries)
{
- // Have to call delete on each pointer
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
- {
- delete *it;
- }
+ cmDeleteAll(*this->Entries);
}
delete this->Entries;
this->Entries = newEntries;
@@ -902,7 +893,7 @@ void cmCursesMainForm::HandleInput()
if ( key == 10 || key == KEY_ENTER )
{
this->SearchMode = false;
- if ( this->SearchString.size() > 0 )
+ if (!this->SearchString.empty())
{
this->JumpToCacheEntry(this->SearchString.c_str());
this->OldSearchString = this->SearchString;
@@ -927,7 +918,7 @@ void cmCursesMainForm::HandleInput()
}
else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC )
{
- if ( this->SearchString.size() > 0 )
+ if (!this->SearchString.empty())
{
this->SearchString.resize(this->SearchString.size()-1);
}
@@ -1076,7 +1067,7 @@ void cmCursesMainForm::HandleInput()
}
else if ( key == 'n' )
{
- if ( this->OldSearchString.size() > 0 )
+ if (!this->OldSearchString.empty())
{
this->JumpToCacheEntry(this->OldSearchString.c_str());
}
@@ -1210,7 +1201,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
int findex = start_index;
for(;;)
{
- if ( str.size() > 0 )
+ if (!str.empty())
{
cmCursesWidget* lbl = 0;
if ( findex >= 0 )
diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h
index 791ac9b..6047ec5 100644
--- a/Source/CursesDialog/cmCursesStandardIncludes.h
+++ b/Source/CursesDialog/cmCursesStandardIncludes.h
@@ -22,25 +22,6 @@
#include <form.h>
-// This is a hack to prevent warnings about these functions being
-// declared but not referenced.
-#if defined(__sgi) && !defined(__GNUC__)
-class cmCursesStandardIncludesHack
-{
-public:
- enum
- {
- Ref1 = sizeof(cfgetospeed(0)),
- Ref2 = sizeof(cfgetispeed(0)),
- Ref3 = sizeof(tcgetattr(0, 0)),
- Ref4 = sizeof(tcsetattr(0, 0, 0)),
- Ref5 = sizeof(cfsetospeed(0,0)),
- Ref6 = sizeof(cfsetispeed(0,0))
- };
-};
-#endif
-
-
// on some machines move erase and clear conflict with stl
// so remove them from the namespace
inline void curses_move(unsigned int x, unsigned int y)
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 0574681..b8077f2 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -119,7 +119,7 @@ CMakeSetupDialog::CMakeSetupDialog()
QAction* showChangesAction = ToolsMenu->addAction(tr("&Show My Changes"));
QObject::connect(showChangesAction, SIGNAL(triggered(bool)),
this, SLOT(showUserChanges()));
-#if defined(Q_WS_MAC)
+#if defined(Q_WS_MAC) || defined(Q_OS_MAC)
this->InstallForCommandLineAction
= ToolsMenu->addAction(tr("&Install For Command Line Use"));
QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)),
diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui
index 98da249..b04bd93 100644
--- a/Source/QtDialog/CMakeSetupDialog.ui
+++ b/Source/QtDialog/CMakeSetupDialog.ui
@@ -134,7 +134,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>12</width>
<height>23</height>
</size>
</property>
diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx
index 8b8c531..fa7df43 100644
--- a/Source/QtDialog/QMacInstallDialog.cxx
+++ b/Source/QtDialog/QMacInstallDialog.cxx
@@ -15,11 +15,11 @@ QMacInstallDialog::QMacInstallDialog(QWidget*w)
{
this->Internals = new QMacInstallDialogInternals;
this->Internals->setupUi(this);
- QObject::connect(this->Internals->choosePathButton, SIGNAL(pressed()),
+ QObject::connect(this->Internals->choosePathButton, SIGNAL(clicked(bool)),
this, SLOT(ShowBrowser()));
- QObject::connect(this->Internals->skipInstallButton, SIGNAL(pressed()),
+ QObject::connect(this->Internals->skipInstallButton, SIGNAL(clicked(bool)),
this, SLOT(SkipInstall()));
- QObject::connect(this->Internals->doInstallButton, SIGNAL(pressed()),
+ QObject::connect(this->Internals->doInstallButton, SIGNAL(clicked(bool)),
this, SLOT(DoInstall()));
this->Internals->InstallPrefix->setText("/usr/bin/");
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 818b910..8fb49ca 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -305,7 +305,7 @@ bool cmAddCustomCommandCommand
}
// No command for this output exists.
- cmOStringStream e;
+ std::ostringstream e;
e << "given APPEND option with output \"" << output[0]
<< "\" which is not already a custom command output.";
this->SetError(e.str());
@@ -354,7 +354,7 @@ bool cmAddCustomCommandCommand
}
if(!okay)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not locate source file with a custom command producing \""
<< output[0] << "\" even though this command tried to create it!";
this->SetError(e.str());
@@ -375,7 +375,7 @@ bool cmAddCustomCommandCommand
else
{
bool issueMessage = true;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050))
{
@@ -436,7 +436,7 @@ cmAddCustomCommandCommand
std::string::size_type pos = o->find_first_of("#<>");
if(pos != o->npos)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "called with OUTPUT containing a \"" << (*o)[pos]
<< "\". This character is not allowed.";
this->SetError(msg.str());
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 09c8af5..a0e20c8 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -30,7 +30,7 @@ bool cmAddCustomTargetCommand
// Check the target name.
if(targetName.find_first_of("/\\") != targetName.npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with invalid target name \"" << targetName
<< "\". Target names may not contain a slash. "
<< "Use ADD_CUSTOM_COMMAND to generate files.";
@@ -170,7 +170,7 @@ bool cmAddCustomTargetCommand
std::string::size_type pos = targetName.find_first_of("#<>");
if(pos != targetName.npos)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "called with target name containing a \"" << targetName[pos]
<< "\". This character is not allowed.";
this->SetError(msg.str());
@@ -189,7 +189,7 @@ bool cmAddCustomTargetCommand
if (!nameOk)
{
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- cmOStringStream e;
+ std::ostringstream e;
bool issueMessage = false;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037))
{
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index e897d81..b560452 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -26,7 +26,7 @@ bool cmAddDependenciesCommand
std::string target_name = args[0];
if(this->Makefile->IsAlias(target_name))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot add target-level dependencies to alias target \""
<< target_name << "\".\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -35,7 +35,7 @@ bool cmAddDependenciesCommand
{
if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot add target-level dependencies to INTERFACE library "
"target \"" << target_name << "\".\n";
this->SetError(e.str());
@@ -51,7 +51,7 @@ bool cmAddDependenciesCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot add target-level dependencies to non-existent target \""
<< target_name << "\".\n"
<< "The add_dependencies works for top-level logical targets created "
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index c30e764..74dc8eb 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -79,7 +79,7 @@ bool cmAddExecutableCommand
if (!nameOk)
{
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- cmOStringStream e;
+ std::ostringstream e;
bool issueMessage = false;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037))
{
@@ -149,7 +149,7 @@ bool cmAddExecutableCommand
}
if(args.size() != 3)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
this->SetError(e.str());
return false;
@@ -158,7 +158,7 @@ bool cmAddExecutableCommand
const char *aliasedName = s->c_str();
if(this->Makefile->IsAlias(aliasedName))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << exename
<< "\" because target \"" << aliasedName << "\" is itself an ALIAS.";
this->SetError(e.str());
@@ -168,7 +168,7 @@ bool cmAddExecutableCommand
this->Makefile->FindTargetToUse(aliasedName, true);
if(!aliasedTarget)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << exename
<< "\" because target \"" << aliasedName << "\" does not already "
"exist.";
@@ -178,7 +178,7 @@ bool cmAddExecutableCommand
cmTarget::TargetType type = aliasedTarget->GetType();
if(type != cmTarget::EXECUTABLE)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << exename
<< "\" because target \"" << aliasedName << "\" is not an "
"executable.";
@@ -187,7 +187,7 @@ bool cmAddExecutableCommand
}
if(aliasedTarget->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << exename
<< "\" because target \"" << aliasedName << "\" is IMPORTED.";
this->SetError(e.str());
@@ -203,7 +203,7 @@ bool cmAddExecutableCommand
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(exename))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create imported target \"" << exename
<< "\" because another target with the same name already exists.";
this->SetError(e.str());
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index bba4d41..db2f6fb 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -51,7 +51,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting STATIC type.";
this->SetError(e.str());
return false;
@@ -64,7 +64,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting SHARED type.";
this->SetError(e.str());
return false;
@@ -77,7 +77,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting MODULE type.";
this->SetError(e.str());
return false;
@@ -90,7 +90,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting OBJECT type.";
this->SetError(e.str());
return false;
@@ -103,7 +103,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting UNKNOWN type.";
this->SetError(e.str());
return false;
@@ -116,7 +116,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
this->SetError(e.str());
return false;
@@ -128,21 +128,21 @@ bool cmAddLibraryCommand
{
if (haveSpecifiedType)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting/multiple types.";
this->SetError(e.str());
return false;
}
if (isAlias)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
this->SetError(e.str());
return false;
}
if (excludeFromAll)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
this->SetError(e.str());
return false;
@@ -155,7 +155,7 @@ bool cmAddLibraryCommand
{
if (type == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
this->SetError(e.str());
return false;
@@ -175,7 +175,7 @@ bool cmAddLibraryCommand
}
else if(type == cmTarget::INTERFACE_LIBRARY && *s == "GLOBAL")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "GLOBAL option may only be used with IMPORTED libraries.";
this->SetError(e.str());
return false;
@@ -190,14 +190,14 @@ bool cmAddLibraryCommand
{
if (s != args.end())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library requires no source arguments.";
this->SetError(e.str());
return false;
}
if (importGlobal && !importTarget)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
this->SetError(e.str());
return false;
@@ -214,7 +214,7 @@ bool cmAddLibraryCommand
if (!nameOk)
{
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
- cmOStringStream e;
+ std::ostringstream e;
bool issueMessage = false;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037))
{
@@ -267,7 +267,7 @@ bool cmAddLibraryCommand
}
if(args.size() != 3)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
this->SetError(e.str());
return false;
@@ -276,7 +276,7 @@ bool cmAddLibraryCommand
const char *aliasedName = s->c_str();
if(this->Makefile->IsAlias(aliasedName))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << libName
<< "\" because target \"" << aliasedName << "\" is itself an ALIAS.";
this->SetError(e.str());
@@ -286,7 +286,7 @@ bool cmAddLibraryCommand
this->Makefile->FindTargetToUse(aliasedName, true);
if(!aliasedTarget)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << libName
<< "\" because target \"" << aliasedName << "\" does not already "
"exist.";
@@ -300,7 +300,7 @@ bool cmAddLibraryCommand
&& aliasedType != cmTarget::OBJECT_LIBRARY
&& aliasedType != cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << libName
<< "\" because target \"" << aliasedName << "\" is not a library.";
this->SetError(e.str());
@@ -308,7 +308,7 @@ bool cmAddLibraryCommand
}
if(aliasedTarget->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create ALIAS target \"" << libName
<< "\" because target \"" << aliasedName << "\" is IMPORTED.";
this->SetError(e.str());
@@ -333,7 +333,7 @@ bool cmAddLibraryCommand
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
- cmOStringStream w;
+ std::ostringstream w;
w <<
"ADD_LIBRARY called with " <<
(type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE") <<
@@ -364,7 +364,7 @@ bool cmAddLibraryCommand
{
if (!cmGeneratorExpression::IsValidTargetName(libName))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
this->SetError(e.str());
return false;
@@ -374,7 +374,7 @@ bool cmAddLibraryCommand
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(libName))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create imported target \"" << libName
<< "\" because another target with the same name already exists.";
this->SetError(e.str());
@@ -413,7 +413,7 @@ bool cmAddLibraryCommand
if (!cmGeneratorExpression::IsValidTargetName(libName)
|| libName.find("::") != std::string::npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Invalid name for INTERFACE library target: " << libName;
this->SetError(e.str());
return false;
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 477a3d9..01598bc 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -37,7 +37,7 @@ bool cmAddSubDirectoryCommand::InitialPass
excludeFromAll = true;
continue;
}
- else if (!binArg.size())
+ else if (binArg.empty())
{
binArg = *i;
}
@@ -81,7 +81,7 @@ bool cmAddSubDirectoryCommand::InitialPass
if(!cmSystemTools::IsSubDirectory(srcPath,
this->Makefile->GetCurrentDirectory()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "not given a binary directory but the given source directory "
<< "\"" << srcPath << "\" is not a subdirectory of \""
<< this->Makefile->GetCurrentDirectory() << "\". "
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 2531a1a..3472b98 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -36,11 +36,7 @@ bool cmAddTestCommand
// Collect the command with arguments.
std::vector<std::string> command;
- for(std::vector<std::string>::const_iterator it = args.begin() + 1;
- it != args.end(); ++it)
- {
- command.push_back(*it);
- }
+ command.insert(command.end(), args.begin() + 1, args.end());
// Create the test but add a generator only the first time it is
// seen. This preserves behavior from before test generators.
@@ -51,7 +47,7 @@ bool cmAddTestCommand
// allow it to be duplicated.
if(!test->GetOldStyle())
{
- cmOStringStream e;
+ std::ostringstream e;
e << " given test name \"" << args[0]
<< "\" which already exists in this directory.";
this->SetError(e.str());
@@ -135,7 +131,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << " given unknown argument:\n " << args[i] << "\n";
this->SetError(e.str());
return false;
@@ -159,7 +155,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
// Require a unique test name within the directory.
if(this->Makefile->GetTest(name))
{
- cmOStringStream e;
+ std::ostringstream e;
e << " given test NAME \"" << name
<< "\" which already exists in this directory.";
this->SetError(e.str());
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index a2aecac..c24c68e 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -16,6 +16,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cm_libarchive.h>
+#include "cm_get_date.h"
//----------------------------------------------------------------------------
static std::string cm_archive_error_string(struct archive* a)
@@ -271,10 +272,26 @@ bool cmArchiveWrite::AddFile(const char* file,
cm_archive_entry_copy_pathname(e, dest);
if(archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK)
{
- this->Error = "archive_read_disk_entry_from_file: ";
+ this->Error = "archive_read_disk_entry_from_file '";
+ this->Error += file;
+ this->Error += "': ";
this->Error += cm_archive_error_string(this->Disk);
return false;
}
+ if (!this->MTime.empty())
+ {
+ time_t now;
+ time(&now);
+ time_t t = cm_get_date(now, this->MTime.c_str());
+ if (t == -1)
+ {
+ this->Error = "unable to parse mtime '";
+ this->Error += this->MTime;
+ this->Error += "'";
+ return false;
+ }
+ archive_entry_set_mtime(e, t, 0);
+ }
// Clear acl and xattr fields not useful for distribution.
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index a6dcc0e..17357b4 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -74,6 +74,7 @@ public:
// std::cout.
void SetVerbose(bool v) { this->Verbose = v; }
+ void SetMTime(std::string const& t) { this->MTime = t; }
private:
bool Okay() const { return this->Error.empty(); }
bool AddPath(const char* path, size_t skip, const char* prefix);
@@ -90,6 +91,7 @@ private:
struct archive* Disk;
bool Verbose;
std::string Error;
+ std::string MTime;
};
#endif
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index d8c3c43..a30d992 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -61,7 +61,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass
std::string ext = file.substr(dotpos+1);
std::string base = file.substr(0, dotpos);
// Process only source files
- if( base.size() != 0
+ if(!base.empty()
&& std::find( this->Makefile->GetSourceExtensions().begin(),
this->Makefile->GetSourceExtensions().end(), ext )
!= this->Makefile->GetSourceExtensions().end() )
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index ff527db..34245b3 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -18,7 +18,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const &args,
if(!this->Makefile->IsLoopBlock())
{
bool issueMessage = true;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055))
{
@@ -53,7 +53,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const &args,
if(!args.empty())
{
bool issueMessage = true;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055))
{
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 93f7801..5d32437 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -78,7 +78,7 @@ bool cmBuildCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "unknown argument \"" << args[i] << "\"";
this->SetError(e.str());
return false;
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index c64209f..171ed0f 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -50,7 +50,7 @@ bool cmBuildNameCommand
{
buildname = "";
cmSystemTools::RunSingleCommand("uname -a", &buildname);
- if(buildname.length())
+ if(!buildname.empty())
{
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
cmsys::RegularExpression reg( RegExp.c_str() );
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 384e0a7..8591ed6 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -78,7 +78,7 @@ bool cmCMakeMinimumRequired
&required_major, &required_minor,
&required_patch, &required_tweak) < 2)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not parse VERSION \"" << version_string << "\".";
this->SetError(e.str());
return false;
@@ -97,7 +97,7 @@ bool cmCMakeMinimumRequired
current_tweak < required_tweak))
{
// The current version is too low.
- cmOStringStream e;
+ std::ostringstream e;
e << "CMake " << version_string
<< " or higher is required. You are running version "
<< cmVersion::GetCMakeVersion();
@@ -132,7 +132,7 @@ bool cmCMakeMinimumRequired::EnforceUnknownArguments()
{
if(!this->UnknownArguments.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with unknown argument \""
<< this->UnknownArguments[0] << "\".";
this->SetError(e.str());
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index ddd5d6a..9662fbf 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -56,7 +56,7 @@ bool cmCMakePolicyCommand
return this->HandleVersionMode(args);
}
- cmOStringStream e;
+ std::ostringstream e;
e << "given unknown first argument \"" << args[0] << "\"";
this->SetError(e.str());
return false;
@@ -82,7 +82,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "SET given unrecognized policy status \"" << args[2] << "\"";
this->SetError(e.str());
return false;
@@ -113,7 +113,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
cmPolicies::PolicyID pid;
if(!this->Makefile->GetPolicies()->GetPolicyID(id.c_str(), pid))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "GET given policy \"" << id << "\" which is not known to this "
<< "version of CMake.";
this->SetError(e.str());
@@ -140,7 +140,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
case cmPolicies::REQUIRED_ALWAYS:
// The policy is required to be set before anything needs it.
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Makefile->GetPolicies()->GetRequiredPolicyError(pid)
<< "\n"
<< "The call to cmake_policy(GET " << id << " ...) at which this "
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index b304f28..d0dc30a 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -769,7 +769,7 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir,
}
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot find source file \"" << pathname << "\"";
e << "\n\nTried extensions";
for( std::vector<std::string>::const_iterator ext = sourceExts.begin();
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 80dbaf3..f08b87c 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -9,7 +9,7 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#include "cm_curl.h"
+#include "cmCurl.h" // include before anything that includes windows.h
#include "cmCTest.h"
#include "cmake.h"
@@ -192,6 +192,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
FILE* file;
::curl_global_init(CURL_GLOBAL_ALL);
curl = ::curl_easy_init();
+ cmCurlSetCAInfo(curl);
//set request options based on method
switch(method)
@@ -212,7 +213,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
::curl_easy_setopt(curl, CURLOPT_INFILE, file);
//fall through to append GET fields
case cmCTest::HTTP_GET:
- if(fields.size())
+ if(!fields.empty())
{
url += "?" + fields;
}
@@ -240,7 +241,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
//----------------------------------------------------------------------
std::string cmCTest::MakeURLSafe(const std::string& str)
{
- cmOStringStream ost;
+ std::ostringstream ost;
char buffer[10];
for ( std::string::size_type pos = 0; pos < str.size(); pos ++ )
{
@@ -378,13 +379,7 @@ cmCTest::cmCTest()
//----------------------------------------------------------------------
cmCTest::~cmCTest()
{
- cmCTest::t_TestingHandlers::iterator it;
- for ( it = this->TestingHandlers.begin();
- it != this->TestingHandlers.end(); ++ it )
- {
- delete it->second;
- it->second = 0;
- }
+ cmDeleteAll(this->TestingHandlers);
this->SetOutputLogFileName(0);
}
@@ -586,7 +581,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
tfin.close();
}
- if (tag.size() == 0 || (0 != command) || this->Parts[PartStart])
+ if (tag.empty() || (0 != command) || this->Parts[PartStart])
{
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
<< std::endl);
@@ -778,7 +773,7 @@ bool cmCTest::UpdateCTestConfiguration()
fin.getline(buffer, 1023);
buffer[1023] = 0;
std::string line = cmCTest::CleanString(buffer);
- if(line.size() == 0)
+ if(line.empty())
{
continue;
}
@@ -878,7 +873,7 @@ bool cmCTest::OpenOutputFile(const std::string& path,
bool compress)
{
std::string testingDir = this->BinaryDir + "/Testing";
- if ( path.size() > 0 )
+ if (!path.empty())
{
testingDir += "/" + path;
}
@@ -1073,7 +1068,7 @@ int cmCTest::ProcessTests()
if ( cmSystemTools::FileExists(fullname.c_str()) &&
!cmSystemTools::FileIsDirectory(fullname) )
{
- if ( this->NotesFiles.size() > 0 )
+ if (!this->NotesFiles.empty())
{
this->NotesFiles += ";";
}
@@ -1086,7 +1081,7 @@ int cmCTest::ProcessTests()
if (this->Parts[PartNotes])
{
this->UpdateCTestConfiguration();
- if ( this->NotesFiles.size() )
+ if (!this->NotesFiles.empty())
{
this->GenerateNotesFile(this->NotesFiles.c_str());
}
@@ -1272,7 +1267,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
std::ostream* log, double testTimeOut,
std::vector<std::string>* environment)
{
- bool modifyEnv = (environment && environment->size()>0);
+ bool modifyEnv = (environment && !environment->empty());
// determine how much time we have
double timeout = this->GetRemainingTimeAllowed() - 120;
@@ -1302,7 +1297,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
inst.TimeOut = timeout;
// Capture output of the child ctest.
- cmOStringStream oss;
+ std::ostringstream oss;
inst.SetStreams(&oss, &oss);
std::vector<std::string> args;
@@ -1316,7 +1311,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
if (strcmp(argv[i],"--build-generator") == 0 && timeout > 0)
{
args.push_back("--test-timeout");
- cmOStringStream msg;
+ std::ostringstream msg;
msg << timeout;
args.push_back(msg.str());
}
@@ -1659,7 +1654,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
cmCTestLog(this, OUTPUT, "Create notes file" << std::endl);
files = cmSystemTools::SplitString(cfiles, ';');
- if ( files.size() == 0 )
+ if (files.empty())
{
return 1;
}
@@ -1674,7 +1669,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
std::vector<std::string> files;
files.push_back(file);
- if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
+ if(!cmSystemTools::CreateTar(tarFile.c_str(), files,
+ cmSystemTools::TarCompressGZip, false))
{
cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while "
"encoding file: " << file << std::endl);
@@ -1688,7 +1684,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
//----------------------------------------------------------------------
std::string cmCTest::Base64EncodeFile(std::string file)
{
- long len = cmSystemTools::FileLength(file);
+ size_t const len = cmSystemTools::FileLength(file);
cmsys::ifstream ifs(file.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
@@ -1699,14 +1695,13 @@ std::string cmCTest::Base64EncodeFile(std::string file)
ifs.close();
unsigned char *encoded_buffer
- = new unsigned char [ static_cast<int>(
- static_cast<double>(len) * 1.5 + 5.0) ];
+ = new unsigned char [ (len * 3) / 2 + 5 ];
- unsigned long rlen
+ size_t const rlen
= cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
std::string base64 = "";
- for(unsigned long i = 0; i < rlen; i++)
+ for(size_t i = 0; i < rlen; i++)
{
base64 += encoded_buffer[i];
}
@@ -1750,7 +1745,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles)
cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl);
files = cmSystemTools::SplitString(cfiles, ';');
- if ( files.size() == 0 )
+ if (files.empty())
{
return 1;
}
@@ -2942,11 +2937,11 @@ bool cmCTest::RunCommand(
}
cmsysProcess_WaitForExit(cp, 0);
- if ( tempOutput.size() > 0 )
+ if (!tempOutput.empty())
{
stdOut->append(&*tempOutput.begin(), tempOutput.size());
}
- if ( tempError.size() > 0 )
+ if (!tempError.empty())
{
stdErr->append(&*tempError.begin(), tempError.size());
}
@@ -3142,7 +3137,7 @@ double cmCTest::GetRemainingTimeAllowed()
void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
{
std::string test_outputs("\n*** Test Failed:\n");
- if(process_output.size())
+ if(!process_output.empty())
{
test_outputs.append(&*process_output.begin(), process_output.size());
}
@@ -3190,9 +3185,9 @@ bool cmCTest::CompressString(std::string& str)
// Now base64 encode the resulting binary string
unsigned char* base64EncodedBuffer
- = new unsigned char[static_cast<int>(outSize * 1.5)];
+ = new unsigned char[(outSize * 3) / 2];
- unsigned long rlen
+ size_t rlen
= cmsysBase64_Encode(out, strm.total_out, base64EncodedBuffer, 1);
str = "";
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index e19d32c..deb8896 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -27,7 +27,7 @@ class cmCTestStartCommand;
#define cmCTestLog(ctSelf, logType, msg) \
do { \
- cmOStringStream cmCTestLog_msg; \
+ std::ostringstream cmCTestLog_msg; \
cmCTestLog_msg << msg; \
(ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__,\
cmCTestLog_msg.str().c_str());\
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 6a47ea7..45e92ce 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -609,7 +609,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value)
{
// if value has trailing space or tab, enclose it in single quotes
- if (value.size() &&
+ if (!value.empty() &&
(value[value.size() - 1] == ' ' ||
value[value.size() - 1] == '\t'))
{
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index a34ea71..6689243 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -155,7 +155,7 @@ public:
*/
const char* GetError()
{
- if(this->Error.length() == 0)
+ if(this->Error.empty())
{
this->Error = this->GetName();
this->Error += " unknown error.";
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 64b67c9..747b7e4 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -103,7 +103,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
}
return this->EmptyVariable;
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Syntax $" << key << "{} is not supported. "
<< "Only ${}, $ENV{}, and $CACHE{} are allowed.";
this->SetError(e.str());
@@ -118,7 +118,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
}
if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0)
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << this->FileLine;
return this->AddString(ostr.str());
}
@@ -136,7 +136,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
cmSystemTools::IsSubDirectory(this->FileName,
this->Makefile->GetHomeOutputDirectory()))
{
- cmOStringStream msg;
+ std::ostringstream msg;
cmListFileBacktrace bt(this->Makefile->GetLocalGenerator());
cmListFileContext lfc;
lfc.FilePath = this->FileName;
@@ -253,7 +253,7 @@ bool cmCommandArgumentParserHelper::HandleEscapeSymbol
break;
default:
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Invalid escape sequence \\" << symbol;
this->SetError(e.str());
}
@@ -335,7 +335,7 @@ int cmCommandArgumentParserHelper::LexInput(char* buf, int maxlen)
void cmCommandArgumentParserHelper::Error(const char* str)
{
unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << str << " (" << pos << ")";
this->SetError(ostr.str());
}
diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx
index 1d5fc07..1a2efc6 100644
--- a/Source/cmCommandArgumentsHelper.cxx
+++ b/Source/cmCommandArgumentsHelper.cxx
@@ -50,13 +50,8 @@ void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group)
if (group!=0)
{
this->ArgumentsBeforeEmpty = false;
- for(std::vector<cmCommandArgument*>::const_iterator
- argIt= group->ContainedArguments.begin();
- argIt != group->ContainedArguments.end();
- ++argIt)
- {
- this->ArgumentsBefore.insert(*argIt);
- }
+ this->ArgumentsBefore.insert(group->ContainedArguments.begin(),
+ group->ContainedArguments.end());
}
}
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index a636d23..32d5cd3 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -200,12 +200,7 @@ cmComputeLinkDepends
//----------------------------------------------------------------------------
cmComputeLinkDepends::~cmComputeLinkDepends()
{
- for(std::vector<DependSetList*>::iterator
- i = this->InferredDependSets.begin();
- i != this->InferredDependSets.end(); ++i)
- {
- delete *i;
- }
+ cmDeleteAll(this->InferredDependSets);
delete this->CCG;
}
@@ -266,10 +261,9 @@ cmComputeLinkDepends::Compute()
// Iterate in reverse order so we can keep only the last occurrence
// of a shared library.
std::set<int> emmitted;
- const std::vector<int>& cFLO = this->FinalLinkOrder;
for(std::vector<int>::const_reverse_iterator
- li = cFLO.rbegin(),
- le = cFLO.rend();
+ li = this->FinalLinkOrder.rbegin(),
+ le = this->FinalLinkOrder.rend();
li != le; ++li)
{
int i = *li;
@@ -682,11 +676,8 @@ void cmComputeLinkDepends::InferDependencies()
}
// Add the inferred dependencies to the graph.
- for(DependSet::const_iterator j = common.begin(); j != common.end(); ++j)
- {
- int dependee_index = *j;
- this->EntryConstraintGraph[depender_index].push_back(dependee_index);
- }
+ cmGraphEdgeList& edges = this->EntryConstraintGraph[depender_index];
+ edges.insert(edges.end(), common.begin(), common.end());
}
}
@@ -710,7 +701,7 @@ void cmComputeLinkDepends::CleanConstraintGraph()
void cmComputeLinkDepends::DisplayConstraintGraph()
{
// Display the graph nodes and their edges.
- cmOStringStream e;
+ std::ostringstream e;
for(unsigned int i=0; i < this->EntryConstraintGraph.size(); ++i)
{
EdgeList const& nl = this->EntryConstraintGraph[i];
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index f4fa5c6..479da75 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -408,11 +408,7 @@ cmComputeLinkInformation
// Construct a mask to not bother with this behavior for link
// directories already specified by the user.
std::vector<std::string> const& dirs = this->Target->GetLinkDirectories();
- for(std::vector<std::string>::const_iterator di = dirs.begin();
- di != dirs.end(); ++di)
- {
- this->OldLinkDirMask.insert(*di);
- }
+ this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
}
}
@@ -448,18 +444,7 @@ std::string cmComputeLinkInformation::GetRPathLinkString()
}
// Construct the linker runtime search path.
- std::string rpath_link;
- const char* sep = "";
- std::vector<std::string> const& dirs =
- this->OrderDependentRPath->GetOrderedDirectories();
- for(std::vector<std::string>::const_iterator di = dirs.begin();
- di != dirs.end(); ++di)
- {
- rpath_link += sep;
- sep = ":";
- rpath_link += *di;
- }
- return rpath_link;
+ return cmJoin(this->OrderDependentRPath->GetOrderedDirectories(), ":");
}
//----------------------------------------------------------------------------
@@ -1342,7 +1327,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
// Try to separate the framework name and path.
if(!this->SplitFramework.find(item.c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Could not parse framework path \"" << item << "\" "
<< "linked by target " << this->Target->GetName() << ".";
cmSystemTools::Error(e.str().c_str());
@@ -1389,7 +1374,7 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
{
// A full path to a directory was found as a link item. Warn the
// user.
- cmOStringStream e;
+ std::ostringstream e;
e << "WARNING: Target \"" << this->Target->GetName()
<< "\" requests linking to directory \"" << item << "\". "
<< "Targets may link only to libraries. "
@@ -1420,11 +1405,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
}
- for(std::vector<std::string>::const_iterator i = implicitDirVec.begin();
- i != implicitDirVec.end(); ++i)
- {
- this->FrameworkPathsEmmitted.insert(*i);
- }
+ this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
+ implicitDirVec.end());
// Regular expression to extract a framework path and name.
this->SplitFramework.compile("(.*)/(.*)\\.framework$");
@@ -1505,7 +1487,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
if(!this->CMakeInstance->GetPropertyAsBool(wid))
{
this->CMakeInstance->SetProperty(wid, "1");
- cmOStringStream w;
+ std::ostringstream w;
w << (this->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0008)) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
@@ -1524,7 +1506,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
- cmOStringStream e;
+ std::ostringstream e;
e << (this->Makefile->GetPolicies()->
GetRequiredPolicyError(cmPolicies::CMP0008)) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
@@ -1554,7 +1536,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
if(!this->CMakeInstance->GetPropertyAsBool("CMP0003-WARNING-GIVEN"))
{
this->CMakeInstance->SetProperty("CMP0003-WARNING-GIVEN", "1");
- cmOStringStream w;
+ std::ostringstream w;
this->PrintLinkPolicyDiagnosis(w);
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace());
@@ -1569,7 +1551,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
- cmOStringStream e;
+ std::ostringstream e;
e << (this->Makefile->GetPolicies()->
GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
this->PrintLinkPolicyDiagnosis(e);
@@ -1694,11 +1676,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
}
// Store implicit link directories.
- for(std::vector<std::string>::const_iterator i = implicitDirVec.begin();
- i != implicitDirVec.end(); ++i)
- {
- this->ImplicitLinkDirs.insert(*i);
- }
+ this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end());
// Get language-specific implicit libraries.
std::vector<std::string> implicitLibVec;
@@ -1999,18 +1977,7 @@ std::string cmComputeLinkInformation::GetRPathString(bool for_install)
this->GetRPath(runtimeDirs, for_install);
// Concatenate the paths.
- std::string rpath;
- const char* sep = "";
- for(std::vector<std::string>::const_iterator ri = runtimeDirs.begin();
- ri != runtimeDirs.end(); ++ri)
- {
- // Separate from previous path.
- rpath += sep;
- sep = this->GetRuntimeSep().c_str();
-
- // Add this path.
- rpath += *ri;
- }
+ std::string rpath = cmJoin(runtimeDirs, this->GetRuntimeSep());
// If the rpath will be replaced at install time, prepare space.
if(!for_install && this->RuntimeUseChrpath)
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 75d3967..cf2b88e 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -361,7 +361,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmMakefile *makefile = depender->GetMakefile();
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
- cmOStringStream e;
+ std::ostringstream e;
switch(depender->GetPolicyStatusCMP0046())
{
case cmPolicies::WARN:
@@ -539,7 +539,7 @@ cmComputeTargetDepends
bool strong)
{
// Construct the error message.
- cmOStringStream e;
+ std::ostringstream e;
e << "The inter-target dependency graph contains the following "
<< "strongly connected component (cycle):\n";
std::vector<NodeList> const& components = ccg.GetComponents();
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index aba26de..eb4f3a1 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -53,10 +53,7 @@ bool cmConditionEvaluator::IsTrue(
cmArgumentList newArgs;
// copy to the list structure
- for(unsigned int i = 0; i < args.size(); ++i)
- {
- newArgs.push_back(args[i]);
- }
+ newArgs.insert(newArgs.end(), args.begin(), args.end());
// now loop through the arguments and see if we can reduce any of them
// we do this multiple times. Once for each level of precedence
@@ -119,7 +116,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
if(!hasBeenReported)
{
- cmOStringStream e;
+ std::ostringstream e;
e << (this->Makefile.GetPolicies()->GetPolicyWarning(
cmPolicies::CMP0054)) << "\n";
e << "Quoted variables like \"" << argument.GetValue() <<
@@ -169,7 +166,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
if(!hasBeenReported)
{
- cmOStringStream e;
+ std::ostringstream e;
e << (this->Makefile.GetPolicies()->GetPolicyWarning(
cmPolicies::CMP0054)) << "\n";
e << "Quoted keywords like \"" << argument.GetValue() <<
@@ -411,10 +408,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList &newArgs,
// copy to the list structure
cmArgumentList::iterator argP1 = arg;
argP1++;
- for(; argP1 != argClose; argP1++)
- {
- newArgs2.push_back(*argP1);
- }
+ newArgs2.insert(newArgs2.end(), argP1, argClose);
newArgs2.pop_back();
// now recursively invoke IsTrue to handle the values inside the
// parenthetical expression
@@ -559,7 +553,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs,
cmsys::RegularExpression regEntry;
if ( !regEntry.compile(rex) )
{
- cmOStringStream error;
+ std::ostringstream error;
error << "Regular expression \"" << rex << "\" cannot compile";
errorString = error.str();
status = cmake::FATAL_ERROR;
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 79776f4..c0a1aa9 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -9,10 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#cmakedefine CMAKE_NO_STD_NAMESPACE
-#cmakedefine CMAKE_NO_ANSI_STREAM_HEADERS
-#cmakedefine CMAKE_NO_ANSI_STRING_STREAM
-#cmakedefine CMAKE_NO_ANSI_FOR_SCOPE
#cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE
#cmakedefine HAVE_UNSETENV
#cmakedefine CMAKE_USE_ELF_PARSER
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index cc6cf5f..fa7f486 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -34,7 +34,7 @@ bool cmConfigureFileCommand
// If the input location is a directory, error out.
if(cmSystemTools::FileIsDirectory(this->InputFile))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "input location\n"
<< " " << this->InputFile << "\n"
<< "is a directory but a file was expected.";
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 0030b84..5b5d6b6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -109,7 +109,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
default:
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
- "Only libraries may be used as try_compile IMPORTED "
+ "Only libraries may be used as try_compile or try_run IMPORTED "
"LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of "
"type " + tgt->GetTargetTypeName(tgt->GetType()) + ".");
return -1;
@@ -150,7 +150,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
else
{
- cmOStringStream m;
+ std::ostringstream m;
m << "try_compile given unknown argument \"" << argv[i] << "\".";
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str());
}
@@ -201,13 +201,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
else
{
// only valid for srcfile signatures
- if (compileDefs.size())
+ if (!compileDefs.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE");
return -1;
}
- if (copyFile.size())
+ if (!copyFile.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COPY_FILE specified on a srcdir type TRY_COMPILE");
@@ -220,7 +220,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// do not allow recursive try Compiles
if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Attempt at a recursive or nested TRY_COMPILE in directory\n"
<< " " << this->BinaryDirectory << "\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -256,7 +256,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
else
{
- cmOStringStream err;
+ std::ostringstream err;
err << "Unknown extension \"" << ext << "\" for file\n"
<< " " << *si << "\n"
<< "try_compile() works only for enabled languages. "
@@ -282,7 +282,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
FILE *fout = cmsys::SystemTools::Fopen(outFileName,"w");
if (!fout)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Failed to open\n"
<< " " << outFileName << "\n"
<< cmSystemTools::GetLastSystemError();
@@ -337,7 +337,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if(this->Makefile->PolicyOptionalWarningEnabled(
"CMAKE_POLICY_WARNING_CMP0056"))
{
- cmOStringStream w;
+ std::ostringstream w;
w << (this->Makefile->GetCMakeInstance()->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0056)) << "\n"
"For compatibility with older versions of CMake, try_compile "
@@ -371,7 +371,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on
- if (compileDefs.size())
+ if (!compileDefs.empty())
{
fprintf(fout, "add_definitions( ");
for (size_t i = 0; i < compileDefs.size(); ++i)
@@ -537,7 +537,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
"Result of TRY_COMPILE",
cmCacheManager::INTERNAL);
- if ( outputVariable.size() > 0 )
+ if (!outputVariable.empty())
{
this->Makefile->AddDefinition(outputVariable, output.c_str());
}
@@ -547,13 +547,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string copyFileErrorMessage;
this->FindOutputFile(targetName);
- if ((res==0) && (copyFile.size()))
+ if ((res==0) && !copyFile.empty())
{
if(this->OutputFile.empty() ||
!cmSystemTools::CopyFileAlways(this->OutputFile,
copyFile))
{
- cmOStringStream emsg;
+ std::ostringstream emsg;
emsg << "Cannot copy output executable\n"
<< " '" << this->OutputFile << "'\n"
<< "to destination specified by COPY_FILE:\n"
@@ -691,7 +691,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
}
}
- cmOStringStream emsg;
+ std::ostringstream emsg;
emsg << "Unable to find the executable at any of:\n";
for (unsigned int i = 0; i < searchDirs.size(); ++i)
{
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 02fb8cb..f93d3df 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -101,7 +101,7 @@ bool cmCreateTestSourceList
break;
}
std::string func_name;
- if (cmSystemTools::GetFilenamePath(*i).size() > 0)
+ if (!cmSystemTools::GetFilenamePath(*i).empty())
{
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(*i);
@@ -126,7 +126,7 @@ bool cmCreateTestSourceList
for(i = testsBegin, j = tests_func_name.begin(); i != tests.end(); ++i, ++j)
{
std::string func_name;
- if (cmSystemTools::GetFilenamePath(*i).size() > 0)
+ if (!cmSystemTools::GetFilenamePath(*i).empty())
{
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(*i);
@@ -145,12 +145,12 @@ bool cmCreateTestSourceList
" },\n";
numTests++;
}
- if(extraInclude.size())
+ if(!extraInclude.empty())
{
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
extraInclude.c_str());
}
- if(function.size())
+ if(!function.empty())
{
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
function.c_str());
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
new file mode 100644
index 0000000..96d3547
--- /dev/null
+++ b/Source/cmCurl.cxx
@@ -0,0 +1,64 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCurl.h"
+#include "cmSystemTools.h"
+
+#define check_curl_result(result, errstr) \
+ if (result != CURLE_OK) \
+ { \
+ e += e.empty()? "" : "\n"; \
+ e += errstr; \
+ e += ::curl_easy_strerror(result); \
+ }
+
+//----------------------------------------------------------------------------
+std::string cmCurlSetCAInfo(::CURL *curl, const char* cafile)
+{
+ std::string e;
+ if(cafile && *cafile)
+ {
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ }
+#if !defined(CMAKE_USE_SYSTEM_CURL) && \
+ !defined(_WIN32) && !defined(__APPLE__) && \
+ !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
+# define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt"
+ else if(cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true))
+ {
+ ::CURLcode res =
+ ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_FEDORA);
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ }
+# undef CMAKE_CAFILE_FEDORA
+ else
+ {
+# define CMAKE_CAFILE_COMMON "/etc/ssl/certs/ca-certificates.crt"
+ if(cmSystemTools::FileExists(CMAKE_CAFILE_COMMON, true))
+ {
+ ::CURLcode res =
+ ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_COMMON);
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ }
+# undef CMAKE_CAFILE_COMMON
+# define CMAKE_CAPATH_COMMON "/etc/ssl/certs"
+ if(cmSystemTools::FileIsDirectory(CMAKE_CAPATH_COMMON))
+ {
+ ::CURLcode res =
+ ::curl_easy_setopt(curl, CURLOPT_CAPATH, CMAKE_CAPATH_COMMON);
+ check_curl_result(res, "Unable to set TLS/SSL Verify CAPATH: ");
+ }
+# undef CMAKE_CAPATH_COMMON
+ }
+#endif
+ return e;
+}
diff --git a/Source/cmStandardIncludes.cxx b/Source/cmCurl.h
index a4bdb2e..0c5609c 100644
--- a/Source/cmStandardIncludes.cxx
+++ b/Source/cmCurl.h
@@ -1,6 +1,6 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
- Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -9,8 +9,13 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
+#ifndef cmCurl_h
+#define cmCurl_h
+
+#include <cmsys/Configure.h>
+#include "cm_curl.h"
#include "cmStandardIncludes.h"
-#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
-cmOStringStream::cmOStringStream() {}
-cmOStringStream::~cmOStringStream() {}
+
+std::string cmCurlSetCAInfo(::CURL *curl, const char* cafile = 0);
+
#endif
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 2afb029..015825d 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -131,21 +131,14 @@ const char* cmCustomCommand::GetComment() const
//----------------------------------------------------------------------------
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
- for(cmCustomCommandLines::const_iterator i=commandLines.begin();
- i != commandLines.end(); ++i)
- {
- this->CommandLines.push_back(*i);
- }
+ this->CommandLines.insert(this->CommandLines.end(),
+ commandLines.begin(), commandLines.end());
}
//----------------------------------------------------------------------------
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{
- for(std::vector<std::string>::const_iterator i=depends.begin();
- i != depends.end(); ++i)
- {
- this->Depends.push_back(*i);
- }
+ this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
}
//----------------------------------------------------------------------------
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 6b729de..5ff0186 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -53,7 +53,7 @@ bool cmDefinePropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid scope " << args[0] << ". "
<< "Valid scopes are "
<< "GLOBAL, DIRECTORY, TARGET, SOURCE, "
@@ -100,7 +100,7 @@ bool cmDefinePropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 947db82..d419011 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -123,7 +123,7 @@ void cmDepends::Clear(const char *file)
// Print verbose output.
if(this->Verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Clearing dependencies in \"" << file << "\"." << std::endl;
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -213,7 +213,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if(this->Verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Dependee \"" << dependee
<< "\" does not exist for depender \""
<< depender << "\"." << std::endl;
@@ -235,7 +235,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if(this->Verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Dependee \"" << dependee
<< "\" is newer than depender \""
<< depender << "\"." << std::endl;
@@ -257,7 +257,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if(this->Verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Dependee \"" << dependee
<< "\" is newer than depends file \""
<< internalDependsFileName << "\"." << std::endl;
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a1fc268..6dde349 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -90,12 +90,7 @@ cmDependsC::cmDependsC(cmLocalGenerator* lg,
cmDependsC::~cmDependsC()
{
this->WriteCacheFile();
-
- for (std::map<std::string, cmIncludeLines*>::iterator it=
- this->FileCache.begin(); it!=this->FileCache.end(); ++it)
- {
- delete it->second;
- }
+ cmDeleteAll(this->FileCache);
}
//----------------------------------------------------------------------------
@@ -125,11 +120,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->ValidDeps->find(obj);
if (tmpIt!= this->ValidDeps->end())
{
- for(DependencyVector::const_iterator i=tmpIt->second.begin();
- i != tmpIt->second.end(); ++i)
- {
- dependencies.insert(*i);
- }
+ dependencies.insert(tmpIt->second.begin(), tmpIt->second.end());
haveDeps = true;
}
}
@@ -294,7 +285,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
//----------------------------------------------------------------------------
void cmDependsC::ReadCacheFile()
{
- if(this->CacheFileName.size() == 0)
+ if(this->CacheFileName.empty())
{
return;
}
@@ -383,7 +374,7 @@ void cmDependsC::ReadCacheFile()
//----------------------------------------------------------------------------
void cmDependsC::WriteCacheFile() const
{
- if(this->CacheFileName.size() == 0)
+ if(this->CacheFileName.empty())
{
return;
}
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 4082d24..d9818ce 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -319,17 +319,13 @@ void cmDependsFortran::LocateModules()
infoI != objInfo.end(); ++infoI)
{
cmDependsFortranSourceInfo const& info = infoI->second;
- for(std::set<std::string>::const_iterator i = info.Provides.begin();
- i != info.Provides.end(); ++i)
- {
- // Include this module in the set provided by this target.
- this->Internal->TargetProvides.insert(*i);
- }
+ // Include this module in the set provided by this target.
+ this->Internal->TargetProvides.insert(info.Provides.begin(),
+ info.Provides.end());
for(std::set<std::string>::const_iterator i = info.Requires.begin();
i != info.Requires.end(); ++i)
{
- // Include this module in the set required by this target.
this->Internal->TargetRequires[*i] = "";
}
}
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 02f2d21..3c02325 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -226,7 +226,7 @@ void cmDependsJavaParserHelper::EndClass()
{
CurrentClass* parent = 0;
CurrentClass* current = 0;
- if ( this->ClassStack.size() > 0 )
+ if (!this->ClassStack.empty())
{
current = &(*(this->ClassStack.end() - 1));
if ( this->ClassStack.size() > 1 )
@@ -251,7 +251,7 @@ void cmDependsJavaParserHelper::EndClass()
void cmDependsJavaParserHelper::PrintClasses()
{
- if ( this->ClassStack.size() == 0 )
+ if (this->ClassStack.empty())
{
std::cerr << "Error when parsing. No classes on class stack" << std::endl;
abort();
@@ -305,13 +305,13 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
if ( verb )
{
- if ( this->CurrentPackage.size() > 0 )
+ if (!this->CurrentPackage.empty())
{
std::cout << "Current package is: " <<
this->CurrentPackage << std::endl;
}
std::cout << "Imports packages:";
- if ( this->PackagesImport.size() > 0 )
+ if (!this->PackagesImport.empty())
{
std::vector<std::string>::iterator it;
for ( it = this->PackagesImport.begin();
@@ -323,7 +323,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
}
std::cout << std::endl;
std::cout << "Depends on:";
- if ( this->ClassesFound.size() > 0 )
+ if (!this->ClassesFound.empty())
{
std::vector<std::string>::iterator it;
for ( it = this->ClassesFound.begin();
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 3ff1017..f4e3a75 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -87,12 +87,7 @@ cmDocumentation::cmDocumentation()
//----------------------------------------------------------------------------
cmDocumentation::~cmDocumentation()
{
- for(std::map<std::string,cmDocumentationSection *>::iterator i =
- this->AllSections.begin();
- i != this->AllSections.end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(this->AllSections);
}
//----------------------------------------------------------------------------
@@ -167,7 +162,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
// given stream.
cmsys::ofstream* fout = 0;
std::ostream* s = &os;
- if(i->Filename.length() > 0)
+ if(!i->Filename.empty())
{
fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out);
if(fout)
@@ -882,7 +877,7 @@ bool cmDocumentation::PrintHelp(std::ostream& os)
//----------------------------------------------------------------------------
const char* cmDocumentation::GetNameString() const
{
- if(this->NameString.length() > 0)
+ if(!this->NameString.empty())
{
return this->NameString.c_str();
}
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index 29c806d..4de59c0 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -46,7 +46,7 @@ void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
preformatted.append(1, '\n');
}
}
- if(preformatted.length())
+ if(!preformatted.empty())
{
this->PrintPreformatted(os, preformatted.c_str());
}
@@ -62,7 +62,7 @@ void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
++ptr;
paragraph.append(1, '\n');
}
- if(paragraph.length())
+ if(!paragraph.empty())
{
this->PrintParagraph(os, paragraph.c_str());
}
@@ -201,7 +201,7 @@ void cmDocumentationFormatter
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
op != entries.end(); ++op)
{
- if(op->Name.size())
+ if(!op->Name.empty())
{
os << " " << op->Name;
this->TextIndent = " ";
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index cab23b7..d062987 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -532,7 +532,7 @@ cmELFInternalImpl<Types>
break;
}
#endif
- cmOStringStream e;
+ std::ostringstream e;
e << "Unknown ELF file type " << eti;
this->SetErrorMessage(e.str().c_str());
return;
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 9b59088..e021d0b 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -41,7 +41,7 @@ bool cmExecProgramCommand
}
else if ( haveoutput_variable )
{
- if ( output_variable.size() > 0 )
+ if (!output_variable.empty())
{
this->SetError("called with incorrect number of arguments");
return false;
@@ -59,7 +59,7 @@ bool cmExecProgramCommand
}
else if ( havereturn_variable )
{
- if ( return_variable.size() > 0 )
+ if (!return_variable.empty())
{
this->SetError("called with incorrect number of arguments");
return false;
@@ -84,7 +84,7 @@ bool cmExecProgramCommand
}
std::string command;
- if(arguments.size())
+ if(!arguments.empty())
{
command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str());
command += " ";
@@ -95,7 +95,7 @@ bool cmExecProgramCommand
command = args[0];
}
bool verbose = true;
- if(output_variable.size() > 0)
+ if(!output_variable.empty())
{
verbose = false;
}
@@ -118,7 +118,7 @@ bool cmExecProgramCommand
retVal = -1;
}
- if ( output_variable.size() > 0 )
+ if (!output_variable.empty())
{
std::string::size_type first = output.find_first_not_of(" \n\t\r");
std::string::size_type last = output.find_last_not_of(" \n\t\r");
@@ -135,7 +135,7 @@ bool cmExecProgramCommand
this->Makefile->AddDefinition(output_variable, coutput.c_str());
}
- if ( return_variable.size() > 0 )
+ if (!return_variable.empty())
{
char buffer[100];
sprintf(buffer, "%d", retVal);
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 11f8ae5..1225992 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -189,7 +189,7 @@ bool cmExecuteProcessCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << " given unknown argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
@@ -324,12 +324,12 @@ bool cmExecuteProcessCommand
error_strip_trailing_whitespace);
// Store the output obtained.
- if(!output_variable.empty() && tempOutput.size())
+ if(!output_variable.empty() && !tempOutput.empty())
{
this->Makefile->AddDefinition(output_variable,
&*tempOutput.begin());
}
- if(!merge_output && !error_variable.empty() && tempError.size())
+ if(!merge_output && !error_variable.empty() && !tempError.empty())
{
this->Makefile->AddDefinition(error_variable,
&*tempError.begin());
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 134ee98..a28ec48 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -45,7 +45,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given target \"" << te->GetName() << "\" more than once.";
this->Makefile->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
@@ -70,7 +70,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
cmTarget* te = *tei;
if (te->GetProperty("INTERFACE_SOURCES"))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \""
<< te->GetName()
<< "\" has a populated INTERFACE_SOURCES property. This is not "
@@ -313,7 +313,7 @@ cmExportBuildFileGenerator
return;
}
- cmOStringStream e;
+ std::ostringstream e;
e << "export called with target \"" << depender->GetName()
<< "\" which requires target \"" << dependee->GetName() << "\" ";
if (occurrences == 0)
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index db21c49..76283d4 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -89,7 +89,7 @@ bool cmExportCommand
if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString())
!= ".cmake")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "FILE option given filename \"" << this->Filename.GetString()
<< "\" which does not have an extension of \".cmake\".\n";
this->SetError(e.str());
@@ -103,7 +103,7 @@ bool cmExportCommand
{
if(!this->Makefile->CanIWriteThisFile(fname.c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "FILE option given filename \"" << fname
<< "\" which is in the source tree.\n";
this->SetError(e.str());
@@ -126,7 +126,7 @@ bool cmExportCommand
{
if (this->Append.IsEnabled())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "EXPORT signature does not recognise the APPEND option.";
this->SetError(e.str());
return false;
@@ -134,7 +134,7 @@ bool cmExportCommand
if (this->ExportOld.IsEnabled())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "EXPORT signature does not recognise the "
"EXPORT_LINK_INTERFACE_LIBRARIES option.";
this->SetError(e.str());
@@ -145,7 +145,7 @@ bool cmExportCommand
std::string setName = this->ExportSetName.GetString();
if (setMap.find(setName) == setMap.end())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Export set \"" << setName << "\" not found.";
this->SetError(e.str());
return false;
@@ -161,7 +161,7 @@ bool cmExportCommand
{
if (this->Makefile->IsAlias(*currentTarget))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given ALIAS target \"" << *currentTarget
<< "\" which may not be exported.";
this->SetError(e.str());
@@ -172,7 +172,7 @@ bool cmExportCommand
{
if(target->GetType() == cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given OBJECT library \"" << *currentTarget
<< "\" which may not be exported.";
this->SetError(e.str());
@@ -181,7 +181,7 @@ bool cmExportCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given target \"" << *currentTarget
<< "\" which is not built by this project.";
this->SetError(e.str());
@@ -261,7 +261,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "PACKAGE given unknown argument: " << args[i];
this->SetError(e.str());
return false;
@@ -278,7 +278,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
cmsys::RegularExpression packageRegex(packageExpr);
if(!packageRegex.find(package.c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "PACKAGE given invalid package name \"" << package << "\". "
<< "Package names must match \"" << packageExpr << "\".";
this->SetError(e.str());
@@ -314,7 +314,7 @@ void cmExportCommand::ReportRegistryError(std::string const& msg,
std::string const& key,
long err)
{
- cmOStringStream e;
+ std::ostringstream e;
e << msg << "\n"
<< " HKEY_CURRENT_USER\\" << key << "\n";
wchar_t winmsg[1024];
@@ -355,7 +355,7 @@ void cmExportCommand::StorePackageRegistryWin(std::string const& package,
RegCloseKey(hKey);
if(err != ERROR_SUCCESS)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Cannot set registry value \"" << hash << "\" under key";
this->ReportRegistryError(msg.str(), key, err);
return;
@@ -400,7 +400,7 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot create package registry file:\n"
<< " " << fname << "\n"
<< cmSystemTools::GetLastSystemError() << "\n";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 1f39d7a..af4ce8b 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -81,7 +81,7 @@ bool cmExportFileGenerator::GenerateImportFile()
if(!foutPtr.get() || !*foutPtr)
{
std::string se = cmSystemTools::GetLastSystemError();
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot write to file \"" << this->MainImportFile
<< "\": " << se;
cmSystemTools::Error(e.str().c_str());
@@ -247,7 +247,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
continue;
}
cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
+ std::ostringstream e;
if (genexPos != std::string::npos)
{
switch (target->GetPolicyStatusCMP0041())
@@ -295,7 +295,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{
case cmPolicies::WARN:
{
- cmOStringStream s;
+ std::ostringstream s;
s << target->GetMakefile()->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
s << "Directory:\n \"" << *li << "\"\nin "
@@ -391,7 +391,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
if (cge->GetHadContextSensitiveCondition())
{
cmMakefile* mf = target->GetMakefile();
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << target->GetName() << "\" is installed with "
"INCLUDES DESTINATION set to a context sensitive path. Paths which "
"depend on the configuration, policy values or the link interface are "
@@ -456,11 +456,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop,
}
std::vector<std::string> content;
cmSystemTools::ExpandListArgument(p, content);
- for (std::vector<std::string>::const_iterator ci = content.begin();
- ci != content.end(); ++ci)
- {
- ifaceProperties.insert(*ci);
- }
+ ifaceProperties.insert(content.begin(), content.end());
}
//----------------------------------------------------------------------------
@@ -473,7 +469,7 @@ void getCompatibleInterfaceProperties(cmTarget *target,
if (!info)
{
cmMakefile* mf = target->GetMakefile();
- cmOStringStream e;
+ std::ostringstream e;
e << "Exporting the target \"" << target->GetName() << "\" is not "
"allowed since its linker language cannot be determined";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -773,7 +769,7 @@ cmExportFileGenerator
if(newCMP0022Behavior && !this->ExportOld)
{
cmMakefile *mf = target->GetMakefile();
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
"but also has old-style LINK_INTERFACE_LIBRARIES properties "
"populated, but it was exported without the "
@@ -857,7 +853,7 @@ cmExportFileGenerator
{
std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
prop += suffix;
- cmOStringStream m;
+ std::ostringstream m;
m << iface->Multiplicity;
properties[prop] = m.str();
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 3f5866a..98ed818 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -56,7 +56,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "install(EXPORT \""
<< this->IEGen->GetExportSet()->GetName()
<< "\" ...) " << "includes target \"" << te->Target->GetName()
@@ -133,7 +133,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
if (te->GetProperty("INTERFACE_SOURCES"))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \""
<< te->GetName()
<< "\" has a populated INTERFACE_SOURCES property. This is not "
@@ -290,7 +290,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(
if(!exportFileStream)
{
std::string se = cmSystemTools::GetLastSystemError();
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot write to file \"" << fileName
<< "\": " << se;
cmSystemTools::Error(e.str().c_str());
@@ -516,7 +516,7 @@ cmExportInstallFileGenerator
cmTarget* dependee,
int occurrences)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "install(EXPORT \""
<< this->IEGen->GetExportSet()->GetName()
<< "\" ...) "
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
index 33b0630..14812e4 100644
--- a/Source/cmExportSet.cxx
+++ b/Source/cmExportSet.cxx
@@ -15,10 +15,7 @@
cmExportSet::~cmExportSet()
{
- for(unsigned int i = 0; i < this->TargetExports.size(); ++ i)
- {
- delete this->TargetExports[i];
- }
+ cmDeleteAll(this->TargetExports);
}
void cmExportSet::AddTargetExport(cmTargetExport* te)
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index 5174118..14c4458 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -25,12 +25,7 @@ cmExportSet* cmExportSetMap::operator[](const std::string &name)
void cmExportSetMap::clear()
{
- for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
- it != this->end();
- ++ it)
- {
- delete it->second;
- }
+ cmDeleteAll(*this);
this->derived::clear();
}
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index cc35f84..6016c4c 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -99,7 +99,7 @@ int cmExprParserHelper::LexInput(char* buf, int maxlen)
void cmExprParserHelper::Error(const char* str)
{
unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << str << " (" << pos << ")";
this->ErrorString = ostr.str();
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 79d7bcaff..69857ef 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -615,12 +615,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::vector<std::string> includes;
target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, gtgt, "C", buildType);
- for(std::vector<std::string>::const_iterator dirIt=includes.begin();
- dirIt != includes.end();
- ++dirIt)
- {
- uniqIncludeDirs.insert(*dirIt);
- }
+
+ uniqIncludeDirs.insert(includes.begin(), includes.end());
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
@@ -628,12 +624,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
- dirIt != dirs.end();
- ++dirIt)
- {
- uniqIncludeDirs.insert(*dirIt);
- }
+ uniqIncludeDirs.insert(dirs.begin(), dirs.end());
}
systemIncludeDirs = makefile->GetSafeDefinition(
@@ -642,12 +633,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
- dirIt != dirs.end();
- ++dirIt)
- {
- uniqIncludeDirs.insert(*dirIt);
- }
+ uniqIncludeDirs.insert(dirs.begin(), dirs.end());
}
for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index cc42bca..eb50a7d 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -454,7 +454,7 @@ cmExtraCodeLiteGenerator::GetBuildCommand(const cmMakefile* mf) const
else if ( generator == "MinGW Makefiles" ||
generator == "Unix Makefiles" )
{
- cmOStringStream ss;
+ std::ostringstream ss;
ss << make << " -j " << this->CpuCount;
buildCommand = ss.str();
}
@@ -482,7 +482,7 @@ cmExtraCodeLiteGenerator::GetSingleFileBuildCommand
std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
if ( generator == "Unix Makefiles" || generator == "MinGW Makefiles" )
{
- cmOStringStream ss;
+ std::ostringstream ss;
ss << make << " -f$(ProjectPath)/Makefile $(CurrentFileName).cpp.o";
buildCommand = ss.str();
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 2f69882..d64b0d7 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -62,6 +62,7 @@ void cmExtraEclipseCDT4Generator
if (*lit == "CXX")
{
this->Natures.insert("org.eclipse.cdt.core.ccnature");
+ this->Natures.insert("org.eclipse.cdt.core.cnature");
}
else if (*lit == "C")
{
@@ -1179,7 +1180,7 @@ std::string
cmExtraEclipseCDT4Generator::GetPathBasename(const std::string& path)
{
std::string outputBasename = path;
- while (outputBasename.size() > 0 &&
+ while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' ||
outputBasename[outputBasename.size() - 1] == '\\'))
{
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 567542e..9645d0e 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -334,7 +334,7 @@ std::string cmExtraKateGenerator::GenerateProjectName(const std::string& name,
std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const
{
std::string outputBasename = path;
- while (outputBasename.size() > 0 &&
+ while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' ||
outputBasename[outputBasename.size() - 1] == '\\'))
{
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 3c2dfa5..579e715 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -20,7 +20,7 @@
#include "cmTimestamp.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_curl.h"
+#include "cmCurl.h"
#include "cmFileLockResult.h"
#endif
@@ -336,14 +336,14 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
// is there a limit?
long sizeLimit = -1;
- if (limitArg.GetString().size() > 0)
+ if (!limitArg.GetString().empty())
{
sizeLimit = atoi(limitArg.GetCString());
}
// is there an offset?
long offset = 0;
- if (offsetArg.GetString().size() > 0)
+ if (!offsetArg.GetString().empty())
{
offset = atoi(offsetArg.GetCString());
}
@@ -404,7 +404,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
#if defined(CMAKE_BUILD_WITH_CMAKE)
if(args.size() != 3)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " requires a file name and output variable";
this->SetError(e.str());
return false;
@@ -419,14 +419,14 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
this->Makefile->AddDefinition(args[2], out.c_str());
return true;
}
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " failed to read file \"" << args[1] << "\": "
<< cmSystemTools::GetLastSystemError();
this->SetError(e.str());
}
return false;
#else
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " not available during bootstrap";
this->SetError(e.str().c_str());
return false;
@@ -472,7 +472,13 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
bool have_regex = false;
bool newline_consume = false;
bool hex_conversion_enabled = true;
- bool utf8_encoding = false;
+ enum { encoding_none = cmsys::FStream::BOM_None,
+ encoding_utf8 = cmsys::FStream::BOM_UTF8,
+ encoding_utf16le = cmsys::FStream::BOM_UTF16LE,
+ encoding_utf16be = cmsys::FStream::BOM_UTF16BE,
+ encoding_utf32le = cmsys::FStream::BOM_UTF32LE,
+ encoding_utf32be = cmsys::FStream::BOM_UTF32BE};
+ int encoding = encoding_none;
int arg_mode = arg_none;
for(unsigned int i=3; i < args.size(); ++i)
{
@@ -519,7 +525,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
if(sscanf(args[i].c_str(), "%d", &limit_input) != 1 ||
limit_input < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option LIMIT_INPUT value \""
<< args[i] << "\" is not an unsigned integer.";
this->SetError(e.str());
@@ -532,7 +538,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
if(sscanf(args[i].c_str(), "%d", &limit_output) != 1 ||
limit_output < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option LIMIT_OUTPUT value \""
<< args[i] << "\" is not an unsigned integer.";
this->SetError(e.str());
@@ -545,7 +551,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
int count;
if(sscanf(args[i].c_str(), "%d", &count) != 1 || count < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option LIMIT_COUNT value \""
<< args[i] << "\" is not an unsigned integer.";
this->SetError(e.str());
@@ -559,7 +565,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
int len;
if(sscanf(args[i].c_str(), "%d", &len) != 1 || len < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option LENGTH_MINIMUM value \""
<< args[i] << "\" is not an unsigned integer.";
this->SetError(e.str());
@@ -573,7 +579,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
int len;
if(sscanf(args[i].c_str(), "%d", &len) != 1 || len < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option LENGTH_MAXIMUM value \""
<< args[i] << "\" is not an unsigned integer.";
this->SetError(e.str());
@@ -586,7 +592,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{
if(!regex.compile(args[i].c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option REGEX value \""
<< args[i] << "\" could not be compiled.";
this->SetError(e.str());
@@ -599,11 +605,27 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{
if(args[i] == "UTF-8")
{
- utf8_encoding = true;
+ encoding = encoding_utf8;
+ }
+ else if(args[i] == "UTF-16LE")
+ {
+ encoding = encoding_utf16le;
+ }
+ else if(args[i] == "UTF-16BE")
+ {
+ encoding = encoding_utf16be;
+ }
+ else if(args[i] == "UTF-32LE")
+ {
+ encoding = encoding_utf32le;
+ }
+ else if(args[i] == "UTF-32BE")
+ {
+ encoding = encoding_utf32be;
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS option ENCODING \""
<< args[i] << "\" not recognized.";
this->SetError(e.str());
@@ -613,7 +635,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS given unknown argument \""
<< args[i] << "\"";
this->SetError(e.str());
@@ -641,12 +663,29 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
#endif
if(!fin)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "STRINGS file \"" << fileName << "\" cannot be read.";
this->SetError(e.str());
return false;
}
+ //If BOM is found and encoding was not specified, use the BOM
+ int bom_found = cmsys::FStream::ReadBOM(fin);
+ if(encoding == encoding_none && bom_found != cmsys::FStream::BOM_None)
+ {
+ encoding = bom_found;
+ }
+
+ unsigned int bytes_rem = 0;
+ if(encoding == encoding_utf16le || encoding == encoding_utf16be)
+ {
+ bytes_rem = 1;
+ }
+ if(encoding == encoding_utf32le || encoding == encoding_utf32be)
+ {
+ bytes_rem = 3;
+ }
+
// Parse strings out of the file.
int output_size = 0;
std::vector<std::string> strings;
@@ -658,6 +697,25 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
std::string current_str;
int c = fin.get();
+ for(unsigned int i=0; i<bytes_rem; ++i)
+ {
+ int c1 = fin.get();
+ if(!fin)
+ {
+ fin.putback(static_cast<char>(c1));
+ break;
+ }
+ c = (c << 8) | c1;
+ }
+ if(encoding == encoding_utf16le)
+ {
+ c = ((c & 0xFF) << 8) | ((c & 0xFF00) >> 8);
+ }
+ else if(encoding == encoding_utf32le)
+ {
+ c = (((c & 0xFF) << 24) | ((c & 0xFF00) << 8) |
+ ((c & 0xFF0000) >> 8) | ((c & 0xFF000000) >> 24));
+ }
if(c == '\r')
{
@@ -673,7 +731,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// c is guaranteed to fit in char by the above if...
current_str += static_cast<char>(c);
}
- else if(utf8_encoding)
+ else if(encoding == encoding_utf8)
{
// Check for UTF-8 encoded string (up to 4 octets)
static const unsigned char utf8_check_table[3][2] =
@@ -745,7 +803,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// A non-string character has been found. Check if the current
// string matches the requirements. We require that the length
// be at least one no matter what the user specified.
- if(s.length() >= minlen && s.length() >= 1 &&
+ if(s.length() >= minlen && !s.empty() &&
(!have_regex || regex.find(s.c_str())))
{
output_size += static_cast<int>(s.size()) + 1;
@@ -899,7 +957,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
{
std::string expr = this->Makefile->GetCurrentDirectory();
// Handle script mode
- if ( expr.size() > 0 )
+ if (!expr.empty())
{
expr += "/" + *i;
g.FindFiles(expr);
@@ -1037,7 +1095,7 @@ cmFileCommand::HandleDifferentCommand(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "DIFFERENT given unknown argument " << args[i];
this->SetError(e.str());
return false;
@@ -1152,7 +1210,7 @@ protected:
{
if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot set permissions on \"" << toFile << "\"";
this->FileCommand->SetError(e.str());
return false;
@@ -1176,7 +1234,7 @@ protected:
else if(arg == "SETGID") { permissions |= mode_setgid; }
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " given invalid permission \"" << arg << "\".";
this->FileCommand->SetError(e.str());
return false;
@@ -1203,7 +1261,7 @@ protected:
virtual bool ReportMissing(const char* fromFile)
{
// The input file does not exist and installation is not optional.
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot find \"" << fromFile << "\".";
this->FileCommand->SetError(e.str());
return false;
@@ -1236,14 +1294,14 @@ protected:
void NotBeforeMatch(std::string const& arg)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "option " << arg << " may not appear before PATTERN or REGEX.";
this->FileCommand->SetError(e.str());
this->Doing = DoingError;
}
void NotAfterMatch(std::string const& arg)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "option " << arg << " may not appear after PATTERN or REGEX.";
this->FileCommand->SetError(e.str());
this->Doing = DoingError;
@@ -1281,7 +1339,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args)
if(!this->CheckKeyword(args[i]) &&
!this->CheckValue(args[i]))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with unknown argument \"" << args[i] << "\".";
this->FileCommand->SetError(e.str());
return false;
@@ -1297,7 +1355,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args)
// Require a destination.
if(this->Destination.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " given no DESTINATION";
this->FileCommand->SetError(e.str());
return false;
@@ -1477,7 +1535,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not compile PATTERN \"" << arg << "\".";
this->FileCommand->SetError(e.str());
this->Doing = DoingError;
@@ -1493,7 +1551,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not compile REGEX \"" << arg << "\".";
this->FileCommand->SetError(e.str());
this->Doing = DoingError;
@@ -1573,7 +1631,7 @@ bool cmFileCopier::Install(const char* fromFile, const char* toFile)
{
if(!*fromFile)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL encountered an empty string input file name.";
this->FileCommand->SetError(e.str());
return false;
@@ -1614,7 +1672,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
std::string symlinkTarget;
if(!cmSystemTools::ReadSymlink(fromFile, symlinkTarget))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot read symlink \"" << fromFile
<< "\" to duplicate at \"" << toFile << "\".";
this->FileCommand->SetError(e.str());
@@ -1647,7 +1705,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
// Create the symlink.
if(!cmSystemTools::CreateSymlink(symlinkTarget, toFile))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot duplicate symlink \"" << fromFile
<< "\" at \"" << toFile << "\".";
this->FileCommand->SetError(e.str());
@@ -1679,7 +1737,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
// Copy the file.
if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot copy file \"" << fromFile
<< "\" to \"" << toFile << "\".";
this->FileCommand->SetError(e.str());
@@ -1698,7 +1756,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
}
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot set modification time on \""
<< toFile << "\"";
this->FileCommand->SetError(e.str());
@@ -1730,7 +1788,7 @@ bool cmFileCopier::InstallDirectory(const char* source,
// Make sure the destination directory exists.
if(!cmSystemTools::MakeDirectory(destination))
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Name << " cannot make directory \"" << destination << "\": "
<< cmSystemTools::GetLastSystemError();
this->FileCommand->SetError(e.str());
@@ -2075,7 +2133,7 @@ bool cmFileInstaller::CheckKeyword(std::string const& arg)
else if(arg == "COMPONENTS" || arg == "CONFIGURATIONS" ||
arg == "PROPERTIES")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL called with old-style " << arg << " argument. "
<< "This script was generated with an older version of CMake. "
<< "Re-run this cmake version on your build tree.";
@@ -2143,7 +2201,7 @@ bool cmFileInstaller
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Option TYPE given unknown value \"" << stype << "\".";
this->FileCommand->SetError(e.str());
return false;
@@ -2288,7 +2346,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_CHANGE given unknown argument " << args[i];
this->SetError(e.str());
return false;
@@ -2311,7 +2369,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args)
}
if(!cmSystemTools::FileExists(file, true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_CHANGE given FILE \"" << file << "\" that does not exist.";
this->SetError(e.str());
return false;
@@ -2323,7 +2381,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args)
bool changed;
if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_CHANGE could not write new RPATH:\n"
<< " " << newRPath << "\n"
<< "to the file:\n"
@@ -2373,7 +2431,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_REMOVE given unknown argument " << args[i];
this->SetError(e.str());
return false;
@@ -2386,7 +2444,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
}
if(!cmSystemTools::FileExists(file, true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_REMOVE given FILE \"" << file << "\" that does not exist.";
this->SetError(e.str());
return false;
@@ -2398,7 +2456,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
bool removed;
if(!cmSystemTools::RemoveRPath(file, &emsg, &removed))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_REMOVE could not remove RPATH from file:\n"
<< " " << file << "\n"
<< emsg;
@@ -2454,7 +2512,7 @@ cmFileCommand::HandleRPathCheckCommand(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "RPATH_CHECK given unknown argument " << args[i];
this->SetError(e.str());
return false;
@@ -2555,7 +2613,7 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
if(!cmSystemTools::RenameFile(oldname.c_str(), newname.c_str()))
{
std::string err = cmSystemTools::GetLastSystemError();
- cmOStringStream e;
+ std::ostringstream e;
e << "RENAME failed to rename\n"
<< " " << oldname << "\n"
<< "to\n"
@@ -2722,7 +2780,7 @@ namespace {
if (updated)
{
- cmOStringStream oss;
+ std::ostringstream oss;
oss << "[" << this->Text << " " << this->CurrentPercentage
<< "% complete]";
status = oss.str();
@@ -2992,9 +3050,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
msg = "returning early; file already exists with expected ";
msg += hashMatchMSG;
msg += "\"";
- if(statusVar.size())
+ if(!statusVar.empty())
{
- cmOStringStream result;
+ std::ostringstream result;
result << (int)0 << ";\"" << msg;
this->Makefile->AddDefinition(statusVar,
result.str().c_str());
@@ -3068,10 +3126,11 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
// check to see if a CAINFO file has been specified
// command arg comes first
- if(cainfo && *cainfo)
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
+ if (!cainfo_err.empty())
{
- res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo);
- check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
+ this->SetError(cainfo_err);
+ return false;
}
cmFileCommandVectorOfChar chunkDebug;
@@ -3085,7 +3144,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "DOWNLOAD cannot set follow-redirect option: ");
- if(verboseLog.size())
+ if(!verboseLog.empty())
{
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "DOWNLOAD cannot set verbose: ");
@@ -3131,9 +3190,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
g_curl.release();
::curl_easy_cleanup(curl);
- if(statusVar.size())
+ if(!statusVar.empty())
{
- cmOStringStream result;
+ std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
this->Makefile->AddDefinition(statusVar,
result.str().c_str());
@@ -3151,7 +3210,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
if (hash.get())
{
std::string actualHash = hash->HashFile(file);
- if (actualHash.size() == 0)
+ if (actualHash.empty())
{
this->SetError("DOWNLOAD cannot compute hash on downloaded file");
return false;
@@ -3159,7 +3218,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
if (expectedHash != actualHash)
{
- cmOStringStream oss;
+ std::ostringstream oss;
oss << "DOWNLOAD HASH mismatch" << std::endl
<< " for file: [" << file << "]" << std::endl
<< " expected hash: [" << expectedHash << "]" << std::endl
@@ -3172,14 +3231,14 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
}
- if(chunkDebug.size())
+ if(!chunkDebug.empty())
{
chunkDebug.push_back(0);
if(CURLE_OPERATION_TIMEOUTED == res)
{
std::string output = &*chunkDebug.begin();
- if(verboseLog.size())
+ if(!verboseLog.empty())
{
this->Makefile->AddDefinition(verboseLog,
&*chunkDebug.begin());
@@ -3335,7 +3394,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "UPLOAD cannot set follow-redirect option: ");
- if(logVar.size())
+ if(!logVar.empty())
{
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "UPLOAD cannot set verbose: ");
@@ -3390,9 +3449,9 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
g_curl.release();
::curl_easy_cleanup(curl);
- if(statusVar.size())
+ if(!statusVar.empty())
{
- cmOStringStream result;
+ std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
this->Makefile->AddDefinition(statusVar,
result.str().c_str());
@@ -3403,11 +3462,11 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
fclose(fin);
fin = NULL;
- if(logVar.size())
+ if(!logVar.empty())
{
std::string log;
- if(chunkResponse.size())
+ if(!chunkResponse.empty())
{
chunkResponse.push_back(0);
log += "Response:\n";
@@ -3415,7 +3474,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
log += "\n";
}
- if(chunkDebug.size())
+ if(!chunkDebug.empty())
{
chunkDebug.push_back(0);
log += "Debug:\n";
@@ -3568,7 +3627,7 @@ bool cmFileCommand::HandleLockCommand(
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << merr << ", but got:\n \"" << args[i] << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
@@ -3601,7 +3660,7 @@ bool cmFileCommand::HandleLockCommand(
if(!cmSystemTools::StringToLong(args[i].c_str(), &scanned)
|| scanned < 0)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TIMEOUT value \"" << args[i] << "\" is not an unsigned integer.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
@@ -3610,7 +3669,7 @@ bool cmFileCommand::HandleLockCommand(
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "expected DIRECTORY, RELEASE, GUARD, RESULT_VARIABLE or TIMEOUT\n";
e << "but got: \"" << args[i] << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -3635,7 +3694,7 @@ bool cmFileCommand::HandleLockCommand(
std::string parentDir = cmSystemTools::GetParentDirectory(path);
if (!cmSystemTools::MakeDirectory(parentDir))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "directory\n \"" << parentDir << "\"\ncreation failed ";
e << "(check permissions).";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -3645,7 +3704,7 @@ bool cmFileCommand::HandleLockCommand(
FILE *file = cmsys::SystemTools::Fopen(path, "w");
if (!file)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "file\n \"" << path << "\"\ncreation failed (check permissions).";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
@@ -3685,7 +3744,7 @@ bool cmFileCommand::HandleLockCommand(
if (resultVariable.empty() && !fileLockResult.IsOk())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "error locking file\n \"" << path << "\"\n" << result << ".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index 551a75a..cf8e9a9 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -23,16 +23,8 @@ cmFileLockPool::cmFileLockPool()
cmFileLockPool::~cmFileLockPool()
{
- for (It i = this->FunctionScopes.begin();
- i != this->FunctionScopes.end(); ++i)
- {
- delete *i;
- }
-
- for (It i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i)
- {
- delete *i;
- }
+ cmDeleteAll(this->FunctionScopes);
+ cmDeleteAll(this->FileScopes);
}
void cmFileLockPool::PushFunctionScope()
@@ -148,10 +140,7 @@ cmFileLockPool::ScopePool::ScopePool()
cmFileLockPool::ScopePool::~ScopePool()
{
- for (It i = this->Locks.begin(); i != this->Locks.end(); ++i)
- {
- delete *i;
- }
+ cmDeleteAll(this->Locks);
}
cmFileLockResult cmFileLockPool::ScopePool::Lock(
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index beb6dde..69991d5 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -152,10 +152,10 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
}
- if(this->VariableDocumentation.size() == 0)
+ if(this->VariableDocumentation.empty())
{
this->VariableDocumentation = "Where can ";
- if(this->Names.size() == 0)
+ if(this->Names.empty())
{
this->VariableDocumentation += "the (unknown) library be found";
}
@@ -184,10 +184,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
std::vector<std::string> shortArgs = this->Names;
this->Names.clear(); // clear out any values in Names
this->Names.push_back(shortArgs[0]);
- for(unsigned int j = 1; j < shortArgs.size(); ++j)
- {
- this->UserGuessArgs.push_back(shortArgs[j]);
- }
+ this->UserGuessArgs.insert(this->UserGuessArgs.end(),
+ shortArgs.begin() + 1, shortArgs.end());
}
this->ExpandPaths();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 8410cda..7746980 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -80,15 +80,12 @@ void cmFindPackageCommand::AppendSearchPathGroups()
PathLabel::SystemRegistry);
// Create the new path objects
- this->LabeledPaths.insert(
- std::pair<cmFindCommon::PathLabel, cmSearchPath>(
- PathLabel::UserRegistry, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::pair<cmFindCommon::PathLabel, cmSearchPath>(
- PathLabel::Builds, cmSearchPath(this)));
- this->LabeledPaths.insert(
- std::pair<cmFindCommon::PathLabel, cmSearchPath>(
- PathLabel::SystemRegistry, cmSearchPath(this)));
+ this->LabeledPaths.insert(std::make_pair(PathLabel::UserRegistry,
+ cmSearchPath(this)));
+ this->LabeledPaths.insert(std::make_pair(PathLabel::Builds,
+ cmSearchPath(this)));
+ this->LabeledPaths.insert(std::make_pair(PathLabel::SystemRegistry,
+ cmSearchPath(this)));
}
//----------------------------------------------------------------------------
@@ -301,7 +298,7 @@ bool cmFindPackageCommand
if(args[i].find_first_of(":/\\") != args[i].npos ||
cmSystemTools::GetFilenameLastExtension(args[i]) != ".cmake")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given CONFIGS option followed by invalid file name \""
<< args[i] << "\". The names given must be file names without "
<< "a path and with a \".cmake\" extension.";
@@ -317,7 +314,7 @@ bool cmFindPackageCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with invalid argument \"" << args[i] << "\"";
this->SetError(e.str());
return false;
@@ -330,7 +327,7 @@ bool cmFindPackageCommand
std::back_inserter(doubledComponents));
if(!doubledComponents.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "called with components that are both required and optional:\n";
for(unsigned int i=0; i<doubledComponents.size(); ++i)
{
@@ -345,7 +342,7 @@ bool cmFindPackageCommand
this->UseConfigFiles = moduleArgs.empty();
if(!this->UseFindModules && !this->UseConfigFiles)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given options exclusive to Module mode:\n";
for(std::set<unsigned int>::const_iterator si = moduleArgs.begin();
si != moduleArgs.end(); ++si)
@@ -427,7 +424,7 @@ bool cmFindPackageCommand
{
if (this->Required)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "for module " << this->Name << " called with REQUIRED, but "
<< disableFindPackageVar
<< " is enabled. A REQUIRED package cannot be disabled.";
@@ -460,7 +457,7 @@ bool cmFindPackageCommand
if(this->UseFindModules && this->UseConfigFiles &&
this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE"))
{
- cmOStringStream aw;
+ std::ostringstream aw;
if(this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2,8,8))
{
aw << "find_package called without either MODULE or CONFIG option and "
@@ -625,7 +622,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
module += this->Name;
module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
- if ( mfile.size() )
+ if (!mfile.empty())
{
// Load the module we found, and set "<name>_FIND_MODULE" to true
// while inside it.
@@ -751,8 +748,8 @@ bool cmFindPackageCommand::HandlePackageMode()
if (result && !found && (!this->Quiet || this->Required))
{
// The variable is not set.
- cmOStringStream e;
- cmOStringStream aw;
+ std::ostringstream e;
+ std::ostringstream aw;
if (configFileSetFOUNDFalse)
{
e << "Found package configuration file:\n"
@@ -766,7 +763,7 @@ bool cmFindPackageCommand::HandlePackageMode()
}
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
- else if (this->ConsideredConfigs.size() > 0)
+ else if (!this->ConsideredConfigs.empty())
{
e << "Could not find a configuration file for package \""
<< this->Name << "\" that "
@@ -1470,7 +1467,7 @@ void cmFindPackageCommand::FillPrefixesBuilds()
// It is likely that CMake will have recently built the project.
for(int i=0; i <= 10; ++i)
{
- cmOStringStream r;
+ std::ostringstream r;
r <<
"[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\"
"Settings\\StartPath;WhereBuild" << i << "]";
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index f4cc4c2..49fbf45 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -48,7 +48,7 @@ bool cmFindPathCommand
}
std::string result = this->FindHeader();
- if(result.size() != 0)
+ if(!result.empty())
{
this->Makefile->AddCacheDefinition
(this->VariableName, result.c_str(),
@@ -108,7 +108,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
fileName = file;
frameWorkName = "";
}
- if(frameWorkName.size())
+ if(!frameWorkName.empty())
{
std::string fpath = dir;
fpath += frameWorkName;
@@ -134,7 +134,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
cmsys::Glob globIt;
globIt.FindFiles(glob);
std::vector<std::string> files = globIt.GetFiles();
- if(files.size())
+ if(!files.empty())
{
std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
if(this->IncludeFileInPath)
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 03d6590..8e3510d 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -170,7 +170,7 @@ bool cmForEachCommand
step == 0
)
{
- cmOStringStream str;
+ std::ostringstream str;
str << "called with incorrect range specification: start ";
str << start << ", stop " << stop << ", step " << step;
this->SetError(str.str());
@@ -243,7 +243,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Unknown argument:\n" << " " << args[i] << "\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return true;
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 3580374..c33048c 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -103,7 +103,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies);
// set the value of argc
- cmOStringStream strStream;
+ std::ostringstream strStream;
strStream << expandedArgs.size();
this->Makefile->AddDefinition("ARGC",strStream.str().c_str());
this->Makefile->MarkVariableAsUsed("ARGC");
@@ -111,7 +111,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
// set the values for ARGV0 ARGV1 ...
for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
- cmOStringStream tmpStream;
+ std::ostringstream tmpStream;
tmpStream << "ARGV" << t;
this->Makefile->AddDefinition(tmpStream.str(),
expandedArgs[t].c_str());
@@ -132,14 +132,14 @@ bool cmFunctionHelperCommand::InvokeInitialPass
unsigned int cnt = 0;
for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
{
- if ( argvDef.size() > 0 )
+ if (!argvDef.empty())
{
argvDef += ";";
}
argvDef += *eit;
if ( cnt >= this->Args.size()-1 )
{
- if ( argnDef.size() > 0 )
+ if (!argnDef.empty())
{
argnDef += ";";
}
@@ -271,11 +271,7 @@ bool cmFunctionCommand
// create a function blocker
cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker();
- for(std::vector<std::string>::const_iterator j = args.begin();
- j != args.end(); ++j)
- {
- f->Args.push_back(*j);
- }
+ f->Args.insert(f->Args.end(), args.begin(), args.end());
this->Makefile->AddFunctionBlocker(f);
return true;
}
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 7adee7b..2aa6beb 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -15,10 +15,6 @@
#include "cmStandardIncludes.h"
#include <cmsys/FStream.hxx>
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
// This is the first base class of cmGeneratedFileStream. It will be
// created before and destroyed after the ofstream portion and can
// therefore be used to manage the temporary file.
@@ -146,8 +142,4 @@ private:
cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented
};
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma reset woff 1375 /* base class destructor not virtual */
-#endif
-
#endif
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 861122c..bf96951 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -98,12 +98,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(
{
this->Output += (*it)->Evaluate(&context, dagChecker);
- for(std::set<std::string>::const_iterator
- p = context.SeenTargetProperties.begin();
- p != context.SeenTargetProperties.end(); ++p)
- {
- this->SeenTargetProperties.insert(*p);
- }
+ this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(),
+ context.SeenTargetProperties.end());
if (context.HadError)
{
this->Output = "";
@@ -150,15 +146,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
//----------------------------------------------------------------------------
cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
{
- std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
- = this->Evaluators.begin();
- const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
- = this->Evaluators.end();
-
- for ( ; it != end; ++it)
- {
- delete *it;
- }
+ cmDeleteAll(this->Evaluators);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 75a84cb..c8b9949 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -66,9 +66,7 @@ cmGeneratorExpressionDAGChecker::Initialize()
if (it != top->Seen.end())
{
const std::set<std::string> &propSet = it->second;
- const std::set<std::string>::const_iterator i
- = propSet.find(this->Property);
- if (i != propSet.end())
+ if (propSet.find(this->Property) != propSet.end())
{
this->CheckResult = ALREADY_SEEN;
return;
@@ -106,7 +104,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
if (parent && !parent->Parent)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Error evaluating generator expression:\n"
<< " " << expr << "\n"
<< "Self reference on target \""
@@ -118,7 +116,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
}
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Error evaluating generator expression:\n"
<< " " << expr << "\n"
<< "Dependency loop found.";
@@ -130,7 +128,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
int loopStep = 1;
while (parent)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Loop step " << loopStep << "\n"
<< " "
<< (parent->Content ? parent->Content->GetOriginalExpression() : expr)
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 03d0bc6..4e2a868 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -51,7 +51,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
}
if (condResult != "1")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Evaluation file condition \"" << rawCondition << "\" did "
"not evaluate to valid content. Got \"" << condResult << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -73,7 +73,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
{
return;
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Evaluation file to be written multiple times for different "
"configurations with different content:\n " << outputFileName;
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -123,7 +123,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
cmsys::ifstream fin(this->Input.c_str());
if(!fin)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Evaluation file \"" << this->Input << "\" cannot be read.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7ddf4d0..6692a92 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -36,7 +36,7 @@ void reportError(cmGeneratorExpressionContext *context,
return;
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Error evaluating generator expression:\n"
<< " " << expr << "\n"
<< result;
@@ -429,7 +429,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
const char *compilerId =
context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID");
- if (parameters.size() == 0)
+ if (parameters.empty())
{
return compilerId ? compilerId : "";
}
@@ -456,7 +456,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
case cmPolicies::WARN:
{
- cmOStringStream e;
+ std::ostringstream e;
e << context->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0044);
context->Makefile->GetCMakeInstance()
@@ -534,7 +534,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
{
const char *compilerVersion = context->Makefile->GetSafeDefinition(
"CMAKE_" + lang + "_COMPILER_VERSION");
- if (parameters.size() == 0)
+ if (parameters.empty())
{
return compilerVersion ? compilerVersion : "";
}
@@ -616,7 +616,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{
const char *platformId =
context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME");
- if (parameters.size() == 0)
+ if (parameters.empty())
{
return platformId ? platformId : "";
}
@@ -803,18 +803,9 @@ static const struct JoinNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
- std::string result;
-
std::vector<std::string> list;
cmSystemTools::ExpandListArgument(parameters.front(), list);
- std::string sep;
- for(std::vector<std::string>::const_iterator li = list.begin();
- li != list.end(); ++li)
- {
- result += sep + *li;
- sep = parameters[1];
- }
- return result;
+ return cmJoin(list, parameters[1]);
}
} joinNode;
@@ -953,7 +944,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (!target)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \""
<< targetName
<< "\" not found.";
@@ -1253,7 +1244,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
{
if (!context->EvaluateForBuildsystem)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The evaluation of the TARGET_OBJECTS generator expression "
"is only suitable for consumption by CMake. It is not suitable "
"for writing out elsewhere.";
@@ -1266,7 +1257,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
context->Makefile->FindGeneratorTargetToUse(tgtName);
if (!gt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but no such target exists.";
reportError(context, content->GetOriginalExpression(), e.str());
@@ -1274,7 +1265,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
}
if (gt->GetType() != cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not an OBJECT library.";
reportError(context, content->GetOriginalExpression(), e.str());
@@ -1377,10 +1368,25 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
for (LangMap::const_iterator lit = testedFeatures.begin();
lit != testedFeatures.end(); ++lit)
{
+ std::vector<std::string> const& langAvailable
+ = availableFeatures[lit->first];
+ const char* standardDefault = context->Makefile
+ ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT");
for (std::vector<std::string>::const_iterator it = lit->second.begin();
it != lit->second.end(); ++it)
{
- if (!context->Makefile->HaveFeatureAvailable(target,
+ if (std::find(langAvailable.begin(), langAvailable.end(), *it)
+ == langAvailable.end())
+ {
+ return "0";
+ }
+ if (standardDefault && !*standardDefault)
+ {
+ // This compiler has no notion of language standard levels.
+ // All features known for the language are always available.
+ continue;
+ }
+ if (!context->Makefile->HaveStandardAvailable(target,
lit->first, *it))
{
if (evalLL)
@@ -1388,8 +1394,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
const char* l = target->GetProperty(lit->first + "_STANDARD");
if (!l)
{
- l = context->Makefile
- ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT");
+ l = standardDefault;
}
assert(l);
context->MaxLanguageStandard[target][lit->first] = l;
@@ -2028,7 +2033,7 @@ std::string GeneratorExpressionContent::EvaluateParameters(
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "$<" + identifier + "> expression requires "
<< numExpected
<< " comma separated parameters, but got "
@@ -2054,30 +2059,9 @@ std::string GeneratorExpressionContent::EvaluateParameters(
}
//----------------------------------------------------------------------------
-static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &c)
-{
- std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
- = c.begin();
- const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
- = c.end();
- for ( ; it != end; ++it)
- {
- delete *it;
- }
-}
-
-//----------------------------------------------------------------------------
GeneratorExpressionContent::~GeneratorExpressionContent()
{
- deleteAll(this->IdentifierChildren);
-
- typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector;
- std::vector<EvaluatorVector>::const_iterator pit =
- this->ParamChildren.begin();
- const std::vector<EvaluatorVector>::const_iterator pend =
- this->ParamChildren.end();
- for ( ; pit != pend; ++pit)
- {
- deleteAll(*pit);
- }
+ cmDeleteAll(this->IdentifierChildren);
+ std::for_each(this->ParamChildren.begin(), this->ParamChildren.end(),
+ cmDeleteAll<std::vector<cmGeneratorExpressionEvaluator*> >);
}
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index ec15daf..a17da8c 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -39,7 +39,7 @@ void cmGeneratorExpressionParser::Parse(
static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result,
std::vector<cmGeneratorExpressionToken>::const_iterator it)
{
- if (result.size() > 0
+ if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text)
{
@@ -57,7 +57,7 @@ static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result,
static void extendResult(std::vector<cmGeneratorExpressionEvaluator*> &result,
const std::vector<cmGeneratorExpressionEvaluator*> &contents)
{
- if (result.size() > 0
+ if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text
&& (*contents.begin())->GetType()
@@ -256,7 +256,7 @@ void cmGeneratorExpressionParser::ParseContent(
{
if (this->NestingLevel == 0)
{
- if (result.size() > 0
+ if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text)
{
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2b531e2..a4f099b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -31,7 +31,7 @@ void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib,
{
if(!badObjLib.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "OBJECT library \"" << target->GetName() << "\" contains:\n";
for(std::vector<cmSourceFile*>::const_iterator i = badObjLib.begin();
i != badObjLib.end(); ++i)
@@ -489,11 +489,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
unique.insert(*li);
}
result.clear();
- for(std::set<std::string>::iterator li = unique.begin();
- li != unique.end(); ++li)
- {
- result.push_back(*li);
- }
+ result.insert(result.end(), unique.begin(), unique.end());
IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first;
@@ -630,7 +626,7 @@ cmTargetTraceDependencies
this->GlobalGenerator->GetFilenameTargetDepends(sf);
if (tgts.find(this->Target) != tgts.end())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Evaluation output file\n \"" << sf->GetFullPath()
<< "\"\ndepends on the sources of a target it is used in. This "
"is a dependency loop and is not allowed.";
@@ -667,6 +663,14 @@ void cmTargetTraceDependencies::Trace()
{
std::vector<std::string> objDeps;
cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
+ for(std::vector<std::string>::iterator odi = objDeps.begin();
+ odi != objDeps.end(); ++odi)
+ {
+ if (cmSystemTools::FileIsFullPath(*odi))
+ {
+ *odi = cmSystemTools::CollapseFullPath(*odi);
+ }
+ }
this->FollowNames(objDeps);
}
@@ -822,11 +826,7 @@ cmTargetTraceDependencies
= ge.Parse(*cli);
cge->Evaluate(this->Makefile, "", true);
std::set<cmTarget*> geTargets = cge->GetTargets();
- for(std::set<cmTarget*>::const_iterator it = geTargets.begin();
- it != geTargets.end(); ++it)
- {
- targets.insert(*it);
- }
+ targets.insert(geTargets.begin(), geTargets.end());
}
}
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index e88f498..e193cf5 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -33,7 +33,7 @@ bool cmGetCMakePropertyCommand
{
int cacheonly = 0;
std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
- if (vars.size()>0)
+ if (!vars.empty())
{
output = vars[0];
}
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index e7d2857..9aceb39 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -113,7 +113,7 @@ bool cmGetFilenameComponentCommand
if(args.size() == 4 && args[3] == "CACHE")
{
- if(programArgs.size() && storeArgs.size())
+ if(!programArgs.empty() && !storeArgs.empty())
{
this->Makefile->AddCacheDefinition
(storeArgs, programArgs.c_str(),
@@ -127,7 +127,7 @@ bool cmGetFilenameComponentCommand
}
else
{
- if(programArgs.size() && storeArgs.size())
+ if(!programArgs.empty() && !storeArgs.empty())
{
this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
}
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 3c59c25..f0b2686 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -73,7 +73,7 @@ bool cmGetPropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid scope " << args[1] << ". "
<< "Valid scopes are "
<< "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL.";
@@ -122,7 +122,7 @@ bool cmGetPropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
@@ -312,7 +312,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not find TARGET " << this->Name
<< ". Perhaps it has not yet been created.";
this->SetError(e.str());
@@ -338,7 +338,7 @@ bool cmGetPropertyCommand::HandleSourceMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given SOURCE name that could not be found or created: "
<< this->Name;
this->SetError(e.str());
@@ -362,7 +362,7 @@ bool cmGetPropertyCommand::HandleTestMode()
}
// If not found it is an error.
- cmOStringStream e;
+ std::ostringstream e;
e << "given TEST name that does not exist: " << this->Name;
this->SetError(e.str());
return false;
@@ -423,7 +423,7 @@ bool cmGetPropertyCommand::HandleInstallMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given INSTALL name that could not be found or created: "
<< this->Name;
this->SetError(e.str());
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index aa6f0c1..eed19f4 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -23,6 +23,7 @@ bool cmGetTargetPropertyCommand
std::string var = args[0];
const std::string& targetName = args[1];
std::string prop;
+ bool prop_exists = false;
if(args[2] == "ALIASED_TARGET")
{
@@ -32,6 +33,7 @@ bool cmGetTargetPropertyCommand
this->Makefile->FindTargetToUse(targetName))
{
prop = target->GetName();
+ prop_exists = true;
}
}
}
@@ -42,12 +44,13 @@ bool cmGetTargetPropertyCommand
if(prop_cstr)
{
prop = prop_cstr;
+ prop_exists = true;
}
}
else
{
bool issueMessage = false;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0045))
{
@@ -74,7 +77,7 @@ bool cmGetTargetPropertyCommand
}
}
}
- if (!prop.empty())
+ if (prop_exists)
{
this->Makefile->AddDefinition(var, prop.c_str());
return true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index dd7fbc8..6d0fedc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -38,6 +38,8 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <cmsys/MD5.h>
+# include "cm_jsoncpp_value.h"
+# include "cm_jsoncpp_writer.h"
#endif
#include <stdlib.h> // required for atof
@@ -88,7 +90,7 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e <<
"Generator\n"
" " << this->GetName() << "\n"
@@ -109,7 +111,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e <<
"Generator\n"
" " << this->GetName() << "\n"
@@ -174,7 +176,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
{
path = name;
}
- if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
+ if((path.empty() || !cmSystemTools::FileExists(path.c_str()))
&& (optional==false))
{
return;
@@ -265,7 +267,7 @@ cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
// Find the make program for the generator, required for try compiles
void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
- if(this->FindMakeProgramFile.size() == 0)
+ if(this->FindMakeProgramFile.empty())
{
cmSystemTools::Error(
"Generator implementation error, "
@@ -276,7 +278,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
std::string setMakeProgram =
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
- if(setMakeProgram.size())
+ if(!setMakeProgram.empty())
{
mf->ReadListFile(0, setMakeProgram.c_str());
}
@@ -284,7 +286,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
{
- cmOStringStream err;
+ std::ostringstream err;
err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
<< "probably need to select a different build tool.";
@@ -313,25 +315,6 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
"make program",
cmCacheManager::FILEPATH);
}
-
- if(makeProgram.find("xcodebuild") != makeProgram.npos)
- {
- // due to the text file busy /bin/sh problem with xcodebuild
- // use the cmakexbuild wrapper instead. This program
- // will run xcodebuild and if it sees the error text file busy
- // it will stop forwarding output, and let the build finish.
- // Then it will retry the build. It will continue this
- // until no text file busy errors occur.
- std::string cmakexbuild =
- this->CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_COMMAND");
- cmakexbuild = cmakexbuild.substr(0, cmakexbuild.length()-5);
- cmakexbuild += "cmakexbuild";
-
- mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM",
- cmakexbuild.c_str(),
- "make program",
- cmCacheManager::FILEPATH);
- }
}
// enable the given language
@@ -383,7 +366,7 @@ void
cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *mf, bool optional)
{
- if(languages.size() == 0)
+ if(languages.empty())
{
cmSystemTools::Error("EnableLanguage must have a lang specified!");
cmSystemTools::SetFatalErrorOccured();
@@ -405,7 +388,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
const char* lang = li->c_str();
if(this->LanguagesReady.find(lang) == this->LanguagesReady.end())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The test project needs language "
<< lang << " which is not enabled.";
this->TryCompileOuterMakefile
@@ -426,7 +409,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// If the configuration files path has been set,
// then we are in a try compile and need to copy the enable language
// files from the parent cmake bin dir, into the try compile bin dir
- if(this->ConfiguredFilesPath.size())
+ if(!this->ConfiguredFilesPath.empty())
{
rootBin = this->ConfiguredFilesPath;
}
@@ -467,7 +450,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
- cmOStringStream windowsVersionString;
+ std::ostringstream windowsVersionString;
windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
windowsVersionString.str();
mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
@@ -660,7 +643,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
std::string compilerEnv = "CMAKE_";
compilerEnv += lang;
compilerEnv += "_COMPILER_ENV_VAR";
- cmOStringStream noCompiler;
+ std::ostringstream noCompiler;
const char* compilerFile = mf->GetDefinition(compilerName);
if(!compilerFile || !*compilerFile ||
cmSystemTools::IsNOTFOUND(compilerFile))
@@ -852,7 +835,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
if(!this->CMakeInstance->GetIsInTryCompile() &&
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025"))
{
- cmOStringStream w;
+ std::ostringstream w;
w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n"
"Converting " << lang <<
" compiler id \"AppleClang\" to \"Clang\" for compatibility."
@@ -884,7 +867,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
if(!this->CMakeInstance->GetIsInTryCompile() &&
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047"))
{
- cmOStringStream w;
+ std::ostringstream w;
w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n"
"Converting " << lang <<
" compiler id \"QCC\" to \"GNU\" for compatibility."
@@ -1147,7 +1130,7 @@ void cmGlobalGenerator::Configure()
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
- cmOStringStream msg;
+ std::ostringstream msg;
if(cmSystemTools::GetErrorOccuredFlag())
{
msg << "Configuring incomplete, errors occurred!";
@@ -1196,7 +1179,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
}
// This generator does not support duplicate custom targets.
- cmOStringStream e;
+ std::ostringstream e;
e << "This project has enabled the ALLOW_DUPLICATE_CUSTOM_TARGETS "
<< "global property. "
<< "The \"" << this->GetName() << "\" generator does not support "
@@ -1346,7 +1329,7 @@ void cmGlobalGenerator::Generate()
if(!this->CMP0042WarnTargets.empty())
{
- cmOStringStream w;
+ std::ostringstream w;
w <<
(this->GetCMakeInstance()->GetPolicies()->
GetPolicyWarning(cmPolicies::CMP0042)) << "\n";
@@ -1510,34 +1493,16 @@ void cmGlobalGenerator::CreateGeneratorTargets()
//----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorMembers()
{
- for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
- i != this->GeneratorTargets.end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = this->EvaluationFiles.begin();
- li != this->EvaluationFiles.end();
- ++li)
- {
- delete *li;
- }
+ cmDeleteAll(this->EvaluationFiles);
this->EvaluationFiles.clear();
- for(std::map<std::string, cmExportBuildFileGenerator*>::iterator
- i = this->BuildExportSets.begin();
- i != this->BuildExportSets.end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
- {
- delete this->LocalGenerators[i];
- }
+ cmDeleteAll(this->LocalGenerators);
this->LocalGenerators.clear();
this->ExportSets.clear();
@@ -1650,7 +1615,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
static_cast<float>(this->LocalGenerators.size()));
}
- if(notFoundMap.size())
+ if(!notFoundMap.empty())
{
std::string notFoundVars;
for(std::map<std::string, std::string>::const_iterator
@@ -2207,7 +2172,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(this->GetPackageTargetName(),
"Run CPack packaging tool...",
&cpackCommandLines, depends,
- workingDir.c_str(), /*uses_terminal*/false);
+ workingDir.c_str(), /*uses_terminal*/true);
}
// CPack source
const char* packageSourceTargetName = this->GetPackageSourceTargetName();
@@ -2231,7 +2196,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(packageSourceTargetName,
"Run CPack packaging tool for source...",
&cpackCommandLines, depends,
- workingDir.c_str(), /*uses_terminal*/false);
+ workingDir.c_str(), /*uses_terminal*/true);
}
}
@@ -2257,7 +2222,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[this->GetTestTargetName()]
= this->CreateGlobalTarget(this->GetTestTargetName(),
"Running tests...", &cpackCommandLines, depends, 0,
- /*uses_terminal*/false);
+ /*uses_terminal*/true);
}
//Edit Cache
@@ -2312,7 +2277,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[rebuildCacheTargetName] =
this->CreateGlobalTarget(
rebuildCacheTargetName, "Running CMake to regenerate build system...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/false);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/true);
}
//Install
@@ -2331,8 +2296,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
depends.erase(depends.begin(), depends.end());
- cmOStringStream ostr;
- if ( componentsSet->size() > 0 )
+ std::ostringstream ostr;
+ if (!componentsSet->empty())
{
ostr << "Available install components are:";
std::set<std::string>::iterator it;
@@ -2393,7 +2358,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[this->GetInstallTargetName()] =
this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/false);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/true);
// install_local
if(const char* install_local = this->GetInstallLocalTargetName())
@@ -2409,7 +2374,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_local] =
this->CreateGlobalTarget(
install_local, "Installing only the local directory...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/false);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/true);
}
// install_strip
@@ -2426,7 +2391,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
(*targets)[install_strip] =
this->CreateGlobalTarget(
install_strip, "Installing the project stripped...",
- &cpackCommandLines, depends, 0, /*uses_terminal*/false);
+ &cpackCommandLines, depends, 0, /*uses_terminal*/true);
}
}
}
@@ -2474,19 +2439,19 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf)
locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
std::string gcc = "gcc.exe";
- if(tgcc.size())
+ if(!tgcc.empty())
{
gcc = tgcc;
}
std::string tgxx = cmSystemTools::FindProgram("g++", locations);
std::string gxx = "g++.exe";
- if(tgxx.size())
+ if(!tgxx.empty())
{
gxx = tgxx;
}
std::string trc = cmSystemTools::FindProgram("windres", locations);
std::string rc = "windres.exe";
- if(trc.size())
+ if(!trc.empty())
{
rc = trc;
}
@@ -2929,10 +2894,21 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
std::string dir = target->GetSupportDirectory();
std::string file = dir;
file += "/Labels.txt";
+ std::string json_file = dir + "/Labels.json";
+#ifdef CMAKE_BUILD_WITH_CMAKE
// Check whether labels are enabled for this target.
if(const char* value = target->GetProperty("LABELS"))
{
+ Json::Value lj_root(Json::objectValue);
+ Json::Value& lj_target =
+ lj_root["target"] = Json::objectValue;
+ lj_target["name"] = target->GetName();
+ Json::Value& lj_target_labels =
+ lj_target["labels"] = Json::arrayValue;
+ Json::Value& lj_sources =
+ lj_root["sources"] = Json::arrayValue;
+
cmSystemTools::MakeDirectory(dir.c_str());
cmGeneratedFileStream fout(file.c_str());
@@ -2947,6 +2923,7 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
li != labels.end(); ++li)
{
fout << " " << *li << "\n";
+ lj_target_labels.append(*li);
}
}
@@ -2972,23 +2949,33 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
{
continue;
}
+ Json::Value& lj_source = lj_sources.append(Json::objectValue);
cmSourceFile* sf = *si;
- fout << sf->GetFullPath() << "\n";
+ std::string const& sfp = sf->GetFullPath();
+ fout << sfp << "\n";
+ lj_source["file"] = sfp;
if(const char* svalue = sf->GetProperty("LABELS"))
{
labels.clear();
+ Json::Value& lj_source_labels =
+ lj_source["labels"] = Json::arrayValue;
cmSystemTools::ExpandListArgument(svalue, labels);
for(std::vector<std::string>::const_iterator li = labels.begin();
li != labels.end(); ++li)
{
fout << " " << *li << "\n";
+ lj_source_labels.append(*li);
}
}
}
+ cmGeneratedFileStream json_fout(json_file.c_str());
+ json_fout << lj_root;
}
else
+#endif
{
cmSystemTools::RemoveFile(file);
+ cmSystemTools::RemoveFile(json_file);
}
}
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ee0c583..b9c01fa 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -236,7 +236,7 @@ bool cmGlobalKdevelopGenerator
// make it relative to the project dir
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
// only put relative paths
- if (tmp.size() && tmp[0] != '/')
+ if (!tmp.empty() && tmp[0] != '/')
{
fout << tmp.c_str() <<"\n";
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6f0586b..3c07be1 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -71,7 +71,7 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
if (std::find_if(ident.begin(), ident.end(),
std::not1(std::ptr_fun(IsIdentChar))) != ident.end()) {
static unsigned VarNum = 0;
- cmOStringStream names;
+ std::ostringstream names;
names << "ident" << VarNum++;
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
@@ -191,7 +191,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
build += " " + rule;
// Write the variables bound to this build statement.
- cmOStringStream variable_assignments;
+ std::ostringstream variable_assignments;
for(cmNinjaVars::const_iterator i = variables.begin();
i != variables.end(); ++i)
cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
@@ -295,7 +295,7 @@ cmGlobalNinjaGenerator::AddMacOSXContentRule()
cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
- cmOStringStream cmd;
+ std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(
mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL)
@@ -1021,12 +1021,9 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
}
//insert outputs from all WirteBuild commands
- for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin();
- i != this->CombinedBuildOutputs.end(); ++i)
- {
- //these paths have already be encoded when added to CombinedBuildOutputs
- knownDependencies.insert(*i);
- }
+ //these paths have already be encoded when added to CombinedBuildOutputs
+ knownDependencies.insert(this->CombinedBuildOutputs.begin(),
+ this->CombinedBuildOutputs.end());
//after we have combined the data into knownDependencies we have no need
//to keep this data around
@@ -1103,7 +1100,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
- cmOStringStream cmd;
+ std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(
mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL)
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 3478534..5f1bb83 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -572,7 +572,7 @@ void cmGlobalUnixMakefileGenerator3
if (!targetName.empty())
{
cmLocalUnixMakefileGenerator3 *lg;
- if (this->LocalGenerators.size())
+ if (!this->LocalGenerators.empty())
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]);
@@ -597,7 +597,7 @@ void cmGlobalUnixMakefileGenerator3
tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT);
cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname);
- if (!this->LocalGenerators.size())
+ if (this->LocalGenerators.empty())
{
delete lg;
}
@@ -783,7 +783,7 @@ cmGlobalUnixMakefileGenerator3
lg->GetMakefile()->GetHomeOutputDirectory();
progressDir += cmake::GetCMakeFilesDirectory();
{
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
// all target counts
progCmd << lg->Convert(progressDir,
@@ -824,7 +824,7 @@ cmGlobalUnixMakefileGenerator3
{
// TODO: Convert the total progress count to a make variable.
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target
progCmd << lg->Convert(progressDir,
@@ -841,7 +841,7 @@ cmGlobalUnixMakefileGenerator3
commands.push_back(lg->GetRecursiveMakeCall
(tmp.c_str(),localName));
{
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << lg->Convert(progressDir,
cmLocalGenerator::FULL,
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 499ac56..531a714 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -156,7 +156,7 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
if (this->SystemIsWindowsCE && ts.empty() &&
this->DefaultPlatformToolset.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->GetName() << " Windows CE version '" << this->SystemVersion
<< "' requires CMAKE_GENERATOR_TOOLSET to be set.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -202,7 +202,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
{
if(this->DefaultPlatformName != "Win32")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR "
<< "specifies a platform too: '" << this->GetName() << "'";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -231,7 +231,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
{
if (this->DefaultPlatformName != "Win32")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
<< "specifies a platform too: '" << this->GetName() << "'";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -246,7 +246,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->GetName() << " does not support Windows Phone.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
@@ -255,7 +255,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->GetName() << " does not support Windows Store.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
@@ -320,7 +320,7 @@ void cmGlobalVisualStudio10Generator::Generate()
if(this->LongestSource.Length > 0)
{
cmMakefile* mf = this->LongestSource.Target->GetMakefile();
- cmOStringStream e;
+ std::ostringstream e;
e <<
"The binary and/or source directory paths may be too long to generate "
"Visual Studio 10 files for this project. "
@@ -574,7 +574,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
"Windows\\v7.1;InstallationFolder", winSDK_7_1))
{
- cmOStringStream m;
+ std::ostringstream m;
m << "Found Windows SDK v7.1: " << winSDK_7_1;
mf->DisplayStatus(m.str().c_str(), -1);
this->DefaultPlatformToolset = "Windows7.1SDK";
@@ -582,7 +582,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
<< "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
<< " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 2b69222..3013200 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -133,7 +133,7 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
- cmOStringStream e;
+ std::ostringstream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Phone '8.0', but not '"
@@ -156,7 +156,7 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
{
if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
- cmOStringStream e;
+ std::ostringstream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Store '8.0', but not '"
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 047f2ad..2bc9379 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -113,7 +113,7 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
- cmOStringStream e;
+ std::ostringstream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Phone '8.0' and '8.1', but "
@@ -136,7 +136,7 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
{
if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
- cmOStringStream e;
+ std::ostringstream e;
if(this->DefaultPlatformToolset.empty())
{
e << this->GetName() << " supports Windows Store '8.0' and '8.1', but "
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index a67a649..64f9cee 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -93,6 +93,11 @@ void cmGlobalVisualStudio71Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
+#ifdef CMAKE_ENCODING_UTF8
+ // Add UTF-8 BOM for .sln file to indicate encoding
+ const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
+ fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
+#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 401e475..0eb7d2c 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -558,6 +558,11 @@ void cmGlobalVisualStudio7Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
+#ifdef CMAKE_ENCODING_UTF8
+ // Add UTF-8 BOM for .sln file to indicate encoding
+ const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
+ fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
+#endif
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 2dab23c..320a1f4 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -845,22 +845,14 @@ cmGlobalVisualStudioGenerator::TargetCompare
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetDependSet const& targets)
{
- for(TargetDependSet::const_iterator ti =
- targets.begin(); ti != targets.end(); ++ti)
- {
- this->insert(*ti);
- }
+ this->insert(targets.begin(), targets.end());
}
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetSet const& targets)
{
- for(TargetSet::const_iterator ti = targets.begin();
- ti != targets.end(); ++ti)
- {
- this->insert(*ti);
- }
+ this->insert(targets.begin(), targets.end());
}
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6a480a9..cd0dcc6 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -136,13 +136,13 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]);
this->XcodeVersion = 10*v[0] + v[1];
- this->FindMakeProgramFile = "CMakeFindXCode.cmake";
this->RootObject = 0;
this->MainGroupChildren = 0;
this->SourcesGroupChildren = 0;
this->ResourcesGroupChildren = 0;
this->CurrentMakefile = 0;
this->CurrentLocalGenerator = 0;
+ this->XcodeBuildCommandInitialized = false;
}
//----------------------------------------------------------------------------
@@ -202,6 +202,49 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
}
//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
+{
+ // The Xcode generator knows how to lookup its build tool
+ // directly instead of needing a helper module to do it, so we
+ // do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
+ if(cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
+ {
+ mf->AddDefinition("CMAKE_MAKE_PROGRAM",
+ this->GetXcodeBuildCommand().c_str());
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string const& cmGlobalXCodeGenerator::GetXcodeBuildCommand()
+{
+ if(!this->XcodeBuildCommandInitialized)
+ {
+ this->XcodeBuildCommandInitialized = true;
+ this->XcodeBuildCommand = this->FindXcodeBuildCommand();
+ }
+ return this->XcodeBuildCommand;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
+{
+ if (this->XcodeVersion >= 40)
+ {
+ std::string makeProgram = cmSystemTools::FindProgram("xcodebuild");
+ if (makeProgram.empty())
+ {
+ makeProgram = "xcodebuild";
+ }
+ return makeProgram;
+ }
+ else
+ {
+ // Use cmakexbuild wrapper to suppress environment dump from output.
+ return cmSystemTools::GetCMakeCommand() + "xbuild";
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
@@ -272,7 +315,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
{
// now build the test
makeCommand.push_back(
- this->SelectMakeProgram(makeProgram, "xcodebuild")
+ this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())
);
makeCommand.push_back("-project");
@@ -969,16 +1012,40 @@ struct cmSourceFilePathCompare
};
//----------------------------------------------------------------------------
-void
+struct cmCompareTargets
+{
+ bool operator () (std::string const& a, std::string const& b) const
+ {
+ if (a == "ALL_BUILD")
+ {
+ return true;
+ }
+ if (b == "ALL_BUILD")
+ {
+ return false;
+ }
+ return strcmp(a.c_str(), b.c_str()) < 0;
+ }
+};
+
+//----------------------------------------------------------------------------
+bool
cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&
targets)
{
this->SetCurrentLocalGenerator(gen);
cmTargets &tgts = this->CurrentMakefile->GetTargets();
+ typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+ cmSortedTargets sortedTargets;
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
- cmTarget& cmtarget = l->second;
+ sortedTargets[l->first] = &l->second;
+ }
+ for(cmSortedTargets::iterator l = sortedTargets.begin();
+ l != sortedTargets.end(); l++)
+ {
+ cmTarget& cmtarget = *l->second;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
// make sure ALL_BUILD, INSTALL, etc are only done once
@@ -995,7 +1062,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
if(cmtarget.GetType() == cmTarget::UTILITY ||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
- targets.push_back(this->CreateUtilityTarget(cmtarget));
+ cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
+ if (!t)
+ {
+ return false;
+ }
+ targets.push_back(t);
continue;
}
@@ -1003,7 +1075,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
@@ -1170,7 +1242,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
this->CreateString("2147483647"));
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
this->CreateString("6"));
- cmOStringStream ostr;
+ std::ostringstream ostr;
if (cmtarget.IsFrameworkOnApple())
{
// dstPath in frameworks is relative to Versions/<version>
@@ -1230,6 +1302,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
}
+ return true;
}
//----------------------------------------------------------------------------
@@ -1581,7 +1654,7 @@ void cmGlobalXCodeGenerator
}
else
{
- cmOStringStream str;
+ std::ostringstream str;
str << "_buildpart_" << count++ ;
tname[&ccg.GetCC()] = std::string(target.GetName()) + str.str();
makefileStream << "\\\n\t" << tname[&ccg.GetCC()];
@@ -2299,7 +2372,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// VERSION -> current_version
target.GetTargetVersion(false, major, minor, patch);
- cmOStringStream v;
+ std::ostringstream v;
// Xcode always wants at least 1.0.0 or nothing
if(!(major == 0 && minor == 0 && patch == 0))
@@ -2311,7 +2384,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// SOVERSION -> compatibility_version
target.GetTargetVersion(true, major, minor, patch);
- cmOStringStream vso;
+ std::ostringstream vso;
// Xcode always wants at least 1.0.0 or nothing
if(!(major == 0 && minor == 0 && patch == 0))
@@ -2906,7 +2979,7 @@ void cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
+bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
{
@@ -2949,7 +3022,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
// Put cmSourceFile instances in proper groups:
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -2982,6 +3055,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
}
}
+ return true;
}
cmXCodeObject *cmGlobalXCodeGenerator
@@ -3102,7 +3176,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator
+bool cmGlobalXCodeGenerator
::CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
@@ -3183,7 +3257,10 @@ void cmGlobalXCodeGenerator
this->MainGroupChildren->AddObject(resourcesGroup);
// now create the cmake groups
- this->CreateGroups(root, generators);
+ if (!this->CreateGroups(root, generators))
+ {
+ return false;
+ }
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
productGroup->AddAttribute("name", this->CreateString("Products"));
@@ -3383,7 +3460,10 @@ void cmGlobalXCodeGenerator
{
if(!this->IsExcluded(root, *i))
{
- this->CreateXCodeTargets(*i, targets);
+ if (!this->CreateXCodeTargets(*i, targets))
+ {
+ return false;
+ }
}
}
// loop over all targets and add link and depend info
@@ -3412,6 +3492,7 @@ void cmGlobalXCodeGenerator
}
}
this->RootObject->AddAttribute("targets", allTargets);
+ return true;
}
//----------------------------------------------------------------------------
@@ -3598,8 +3679,10 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
}
}
- this->CreateXCodeObjects(root,
- generators);
+ if (!this->CreateXCodeObjects(root, generators))
+ {
+ return;
+ }
std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();
xcodeDir += "/";
xcodeDir += root->GetMakefile()->GetProjectName();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f38435e..f513e28 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -70,6 +70,8 @@ public:
const std::string& suffix,
std::string& dir);
+ virtual void FindMakeProgram(cmMakefile*);
+
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGIntDir() const;
///! expand CFGIntDir
@@ -91,7 +93,7 @@ private:
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
std::string name);
- void CreateGroups(cmLocalGenerator* root,
+ bool CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators);
std::string XCodeEscapePath(const char* p);
@@ -150,7 +152,7 @@ private:
std::string ExtractFlag(const char* flag, std::string& flags);
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();
- void CreateXCodeObjects(cmLocalGenerator* root,
+ bool CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
@@ -169,7 +171,7 @@ private:
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
cmSourceFile* sf,
cmTarget& cmtarget);
- void CreateXCodeTargets(cmLocalGenerator* gen,
+ bool CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&);
bool IsHeaderFile(cmSourceFile*);
void AddDependTarget(cmXCodeObject* target,
@@ -212,6 +214,11 @@ protected:
std::vector<cmXCodeObject*> XCodeObjects;
cmXCodeObject* RootObject;
private:
+ std::string const& GetXcodeBuildCommand();
+ std::string FindXcodeBuildCommand();
+ std::string XcodeBuildCommand;
+ bool XcodeBuildCommandInitialized;
+
void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {}
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 601993f..af88d1c 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -125,7 +125,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
__set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
this->TargetsToIgnoreRegex.clear();
- if (ignoreTargetsRegexes.size() > 0)
+ if (!ignoreTargetsRegexes.empty())
{
std::vector<std::string> ignoreTargetsRegExVector;
cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,
@@ -497,7 +497,7 @@ int cmGraphVizWriter::CollectAllTargets()
continue;
}
//std::cout << "Found target: " << tit->first.c_str() << std::endl;
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[realTargetName] = ostr.str();
this->TargetPtrs[realTargetName] = &tit->second;
@@ -544,7 +544,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
this->TargetPtrs.find(libName);
if ( tarIt == this->TargetPtrs.end() )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
this->TargetPtrs[libName] = NULL;
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index b8e30b7..3362abb 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -116,7 +116,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, messType);
- if (errorString.size())
+ if (!errorString.empty())
{
std::string err = cmIfCommandError(&mf, expandedArguments);
err += errorString;
@@ -177,7 +177,7 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
{
// if the endif has arguments, then make sure
// they match the arguments of the matching if
- if (lff.Arguments.size() == 0 ||
+ if (lff.Arguments.empty() ||
lff.Arguments == this->Args)
{
return true;
@@ -204,7 +204,7 @@ bool cmIfCommand
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, status);
- if (errorString.size())
+ if (!errorString.empty())
{
std::string err = cmIfCommandError(this->Makefile, expandedArguments);
err += errorString;
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 0a1d280..c15d46e 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -40,7 +40,7 @@ bool cmIncludeCommand
}
else if(args[i] == "RESULT_VARIABLE")
{
- if (resultVarName.size() > 0)
+ if (!resultVarName.empty())
{
this->SetError("called with invalid arguments: "
"only one result variable allowed");
@@ -83,7 +83,7 @@ bool cmIncludeCommand
std::string module = fname;
module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
- if ( mfile.size() )
+ if (!mfile.empty())
{
fname = mfile.c_str();
}
@@ -98,7 +98,7 @@ bool cmIncludeCommand
if (gg->IsExportedTargetsFile(fname_abs))
{
const char *modal = 0;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024))
@@ -137,7 +137,7 @@ bool cmIncludeCommand
noPolicyScope);
// add the location of the included file if a result variable was given
- if (resultVarName.size())
+ if (!resultVarName.empty())
{
this->Makefile->AddDefinition(resultVarName,
readit?fullFilePath.c_str():"NOTFOUND");
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index df5508e..464b4c2 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -47,7 +47,7 @@ bool cmIncludeDirectoryCommand
system = true;
continue;
}
- if(i->size() == 0)
+ if(i->empty())
{
this->SetError("given empty-string as include directory.");
return false;
@@ -71,11 +71,7 @@ bool cmIncludeDirectoryCommand
}
if (system)
{
- for (std::vector<std::string>::const_iterator li = includes.begin();
- li != includes.end(); ++li)
- {
- systemIncludes.insert(*li);
- }
+ systemIncludes.insert(includes.begin(), includes.end());
}
}
std::reverse(beforeIncludes.begin(), beforeIncludes.end());
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c3c9c55..2d7d7cc 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -273,7 +273,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if(!unknownArgs.empty())
{
// Unknown argument.
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given unknown argument \"" << unknownArgs[0] << "\".";
this->SetError(e.str());
return false;
@@ -373,7 +373,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if (this->Makefile->IsAlias(*targetIt))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given target \"" << (*targetIt)
<< "\" which is an alias.";
this->SetError(e.str());
@@ -390,7 +390,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
target->GetType() != cmTarget::OBJECT_LIBRARY &&
target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given target \"" << (*targetIt)
<< "\" which is not an executable, library, or module.";
this->SetError(e.str());
@@ -398,7 +398,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else if(target->GetType() == cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given OBJECT library \"" << (*targetIt)
<< "\" which may not be installed.";
this->SetError(e.str());
@@ -410,7 +410,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
else
{
// Did not find the target.
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given target \"" << (*targetIt)
<< "\" which does not exist in this directory.";
this->SetError(e.str());
@@ -502,7 +502,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no FRAMEWORK DESTINATION for shared library "
"FRAMEWORK target \"" << target.GetName() << "\".";
this->SetError(e.str());
@@ -522,7 +522,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no LIBRARY DESTINATION for shared library "
"target \"" << target.GetName() << "\".";
this->SetError(e.str());
@@ -542,7 +542,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no ARCHIVE DESTINATION for static library "
"target \"" << target.GetName() << "\".";
this->SetError(e.str());
@@ -563,7 +563,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no LIBRARY DESTINATION for module target \""
<< target.GetName() << "\".";
this->SetError(e.str());
@@ -598,7 +598,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
if(!bundleGenerator)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE "
"executable target \"" << target.GetName() << "\".";
this->SetError(e.str());
@@ -615,7 +615,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "TARGETS given no RUNTIME DESTINATION for executable "
"target \"" << target.GetName() << "\".";
this->SetError(e.str());
@@ -681,7 +681,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL TARGETS - target " << target.GetName() << " has "
<< "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
cmSystemTools::Message(e.str().c_str(), "Warning");
@@ -708,7 +708,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL TARGETS - target " << target.GetName() << " has "
<< "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
cmSystemTools::Message(e.str().c_str(), "Warning");
@@ -734,7 +734,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL TARGETS - target " << target.GetName() << " has "
<< "RESOURCE files but no RESOURCE DESTINATION.";
cmSystemTools::Message(e.str().c_str(), "Warning");
@@ -777,19 +777,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->GetExportSets()[exports.GetString()]->AddTargetExport(te);
- std::vector<std::string> dirs = includesArgs.GetIncludeDirs();
- if(!dirs.empty())
- {
- std::string dirString;
- const char *sep = "";
- for (std::vector<std::string>::const_iterator it = dirs.begin();
- it != dirs.end(); ++it)
- {
- te->InterfaceIncludeDirectories += sep;
- te->InterfaceIncludeDirectories += *it;
- sep = ";";
- }
- }
+ te->InterfaceIncludeDirectories =
+ cmJoin(includesArgs.GetIncludeDirs(), ";");
}
}
@@ -855,7 +844,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
if(!unknownArgs.empty())
{
// Unknown argument.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\".";
this->SetError(e.str());
return false;
@@ -870,7 +859,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
if(!ica.GetRename().empty() && files.GetVector().size() > 1)
{
// The rename option works only with one file.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given RENAME option with more than one file.";
this->SetError(e.str());
return false;
@@ -890,7 +879,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
if(ica.GetDestination().empty())
{
// A destination is required.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given no DESTINATION!";
this->SetError(e.str());
return false;
@@ -931,7 +920,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -945,7 +934,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -960,7 +949,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -988,7 +977,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
// Add this property to the current match rule.
if(!in_match_mode || doing == DoingPattern || doing == DoingRegex)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" before a PATTERN or REGEX is given.";
this->SetError(e.str());
@@ -1001,7 +990,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(!in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" before a PATTERN or REGEX is given.";
this->SetError(e.str());
@@ -1016,7 +1005,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1030,7 +1019,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1044,7 +1033,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1059,7 +1048,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1074,7 +1063,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1088,7 +1077,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
{
if(in_match_mode)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " does not allow \""
<< args[i] << "\" after PATTERN or REGEX.";
this->SetError(e.str());
@@ -1113,7 +1102,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
if(cmSystemTools::FileExists(dir.c_str()) &&
!cmSystemTools::FileIsDirectory(dir))
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given non-directory \""
<< args[i] << "\" to install.";
this->SetError(e.str());
@@ -1169,7 +1158,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
// Check the requested permission.
if(!cmInstallCommandArguments::CheckPermissions(args[i],permissions_file))
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given invalid file permission \""
<< args[i] << "\".";
this->SetError(e.str());
@@ -1181,7 +1170,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
// Check the requested permission.
if(!cmInstallCommandArguments::CheckPermissions(args[i],permissions_dir))
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given invalid directory permission \""
<< args[i] << "\".";
this->SetError(e.str());
@@ -1193,7 +1182,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
// Check the requested permission.
if(!cmInstallCommandArguments::CheckPermissions(args[i], literal_args))
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given invalid permission \""
<< args[i] << "\".";
this->SetError(e.str());
@@ -1203,7 +1192,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
else
{
// Unknown argument.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given unknown argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
@@ -1224,7 +1213,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
if(!destination)
{
// A destination is required.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given no DESTINATION!";
this->SetError(e.str());
return false;
@@ -1271,7 +1260,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
if (!unknownArgs.empty())
{
// Unknown argument.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\".";
this->SetError(e.str());
return false;
@@ -1286,7 +1275,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
if(ica.GetDestination().empty())
{
// A destination is required.
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given no DESTINATION!";
this->SetError(e.str());
return false;
@@ -1296,7 +1285,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
std::string fname = filename.GetString();
if(fname.find_first_of(":/\\") != fname.npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument may not contain a path. "
<< "Specify the path in the DESTINATION argument.";
@@ -1308,7 +1297,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
if(!fname.empty() &&
cmSystemTools::GetFilenameLastExtension(fname) != ".cmake")
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument must specify a name ending in \".cmake\".";
this->SetError(e.str());
@@ -1323,7 +1312,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
if(fname.find_first_of(":/\\") != fname.npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " given export name \"" << exp.GetString() << "\". "
<< "This name cannot be safely converted to a file name. "
<< "Specify a different export name or use the FILE option to set "
@@ -1348,7 +1337,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
if(!newCMP0022Behavior)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL(EXPORT) given keyword \""
<< "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \""
<< te->Target->GetName()
@@ -1395,7 +1384,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName,
// Make sure the file is not a directory.
if(gpos == file.npos && cmSystemTools::FileIsDirectory(file))
{
- cmOStringStream e;
+ std::ostringstream e;
e << modeName << " given directory \"" << (*fileIt) << "\" to install.";
this->SetError(e.str());
return false;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index ddfd6c5..4480cc6 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -121,7 +121,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
// Skip empty sets.
if(ExportSet->GetTargetExports()->empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INSTALL(EXPORT) given unknown export \""
<< ExportSet->GetName() << "\"";
cmSystemTools::Error(e.str().c_str());
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index f106e1a..06a78e5 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -47,11 +47,8 @@ bool cmInstallFilesCommand
else
{
this->IsFilesForm = false;
- std::vector<std::string>::const_iterator s = args.begin();
- for (++s;s != args.end(); ++s)
- {
- this->FinalArgs.push_back(*s);
- }
+ this->FinalArgs.insert(this->FinalArgs.end(),
+ args.begin() + 1, args.end());
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
@@ -83,7 +80,7 @@ void cmInstallFilesCommand::FinalPass()
{
// replace any variables
std::string temps = *s;
- if (cmSystemTools::GetFilenamePath(temps).size() > 0)
+ if (!cmSystemTools::GetFilenamePath(temps).empty())
{
testf = cmSystemTools::GetFilenamePath(temps) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 0405769..cc223ab 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -27,11 +27,7 @@ bool cmInstallProgramsCommand
this->Destination = args[0];
- std::vector<std::string>::const_iterator s = args.begin();
- for (++s;s != args.end(); ++s)
- {
- this->FinalArgs.push_back(*s);
- }
+ this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end());
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->AddInstallComponent(this->Makefile->GetSafeDefinition(
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index bb346fb..6d69f54 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -47,7 +47,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
// Warn if installing an exclude-from-all target.
if(this->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "WARNING: Target \"" << this->Target->GetName()
<< "\" has EXCLUDE_FROM_ALL set and will not be built by default "
<< "but an install rule has been provided for it. CMake does "
@@ -424,7 +424,7 @@ cmInstallTargetGenerator
::AddTweak(std::ostream& os, Indent const& indent, const std::string& config,
std::string const& file, TweakMethod tweak)
{
- cmOStringStream tw;
+ std::ostringstream tw;
(this->*tweak)(tw, indent.Next(), config, file);
std::string tws = tw.str();
if(!tws.empty())
@@ -450,7 +450,7 @@ cmInstallTargetGenerator
else
{
// Generate a foreach loop to tweak multiple files.
- cmOStringStream tw;
+ std::ostringstream tw;
this->AddTweak(tw, indent.Next(), config, "${file}", tweak);
std::string tws = tw.str();
if(!tws.empty())
@@ -523,7 +523,7 @@ cmInstallTargetGenerator
std::string installNameTool =
this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
- if(!installNameTool.size())
+ if(installNameTool.empty())
{
return;
}
@@ -699,7 +699,7 @@ cmInstallTargetGenerator
(!oldRuntimeDirs.empty() || !newRuntimeDirs.empty())
)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "WARNING: Target \"" << this->Target->GetName()
<< "\" has runtime paths which cannot be changed during install. "
<< "To change runtime paths, OS X version 10.6 or newer is required. "
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 7134a4e..503f92c 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -38,11 +38,7 @@ public:
~Property()
{
- for(ExpressionVectorType::iterator i = ValueExpressions.begin();
- i != ValueExpressions.end(); ++i)
- {
- delete *i;
- }
+ cmDeleteAll(this->ValueExpressions);
}
ExpressionVectorType ValueExpressions;
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 3644d93..ade1feb 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -36,7 +36,7 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
if(!cmSystemTools::FileIsFullPath(unixPath.c_str()))
{
bool convertToAbsolute = false;
- cmOStringStream e;
+ std::ostringstream e;
e << "This command specifies the relative path\n"
<< " " << unixPath << "\n"
<< "as a link directory.\n";
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index f1ea088..107dca9 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -98,7 +98,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
return false;
}
// if the size of the list
- if(listString.size() == 0)
+ if(listString.empty())
{
return true;
}
@@ -109,7 +109,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
for(std::vector<std::string>::iterator i = list.begin();
i != list.end(); ++i)
{
- if(i->size() == 0)
+ if(i->empty())
{
hasEmpty = true;
break;
@@ -225,7 +225,7 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
}
if ( item < 0 || nitem <= (size_t)item )
{
- cmOStringStream str;
+ std::ostringstream str;
str << "index: " << item << " out of range (-"
<< varArgsExpanded.size() << ", "
<< varArgsExpanded.size()-1 << ")";
@@ -257,7 +257,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
size_t cc;
for ( cc = 2; cc < args.size(); ++ cc )
{
- if(listString.size())
+ if(!listString.empty())
{
listString += ";";
}
@@ -322,13 +322,13 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
if((!this->GetList(varArgsExpanded, listName)
|| varArgsExpanded.empty()) && item != 0)
{
- cmOStringStream str;
+ std::ostringstream str;
str << "index: " << item << " out of range (0, 0)";
this->SetError(str.str());
return false;
}
- if ( varArgsExpanded.size() != 0 )
+ if (!varArgsExpanded.empty())
{
size_t nitem = varArgsExpanded.size();
if ( item < 0 )
@@ -337,31 +337,19 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
}
if ( item < 0 || nitem <= (size_t)item )
{
- cmOStringStream str;
+ std::ostringstream str;
str << "index: " << item << " out of range (-"
<< varArgsExpanded.size() << ", "
- << (varArgsExpanded.size() == 0?0:(varArgsExpanded.size()-1)) << ")";
+ << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1)) << ")";
this->SetError(str.str());
return false;
}
}
- size_t cc;
- size_t cnt = 0;
- for ( cc = 3; cc < args.size(); ++ cc )
- {
- varArgsExpanded.insert(varArgsExpanded.begin()+item+cnt, args[cc]);
- cnt ++;
- }
- std::string value;
- const char* sep = "";
- for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
- {
- value += sep;
- value += varArgsExpanded[cc];
- sep = ";";
- }
+ varArgsExpanded.insert(varArgsExpanded.begin()+item,
+ args.begin() + 3, args.end());
+ std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
}
@@ -402,15 +390,8 @@ bool cmListCommand
}
}
- std::string value;
- const char* sep = "";
- for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
- {
- value += sep;
- value += varArgsExpanded[cc];
- sep = ";";
- }
+ std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
}
@@ -518,16 +499,7 @@ bool cmListCommand
std::sort(varArgsExpanded.begin(), varArgsExpanded.end());
- std::string value;
- std::vector<std::string>::iterator it;
- const char* sep = "";
- for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it )
- {
- value += sep;
- value += it->c_str();
- sep = ";";
- }
-
+ std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
}
@@ -570,7 +542,7 @@ bool cmListCommand::HandleRemoveAtCommand(
}
if ( item < 0 || nitem <= (size_t)item )
{
- cmOStringStream str;
+ std::ostringstream str;
str << "index: " << item << " out of range (-"
<< varArgsExpanded.size() << ", "
<< varArgsExpanded.size()-1 << ")";
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 1c39563..3e26349 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -68,7 +68,7 @@ bool cmListFileParser::ParseFile()
bom != cmListFileLexer_BOM_UTF8)
{
cmListFileLexer_SetFileName(this->Lexer, 0, 0);
- cmOStringStream m;
+ std::ostringstream m;
m << "File\n " << this->FileName << "\n"
<< "starts with a Byte-Order-Mark that is not UTF-8.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str());
@@ -108,7 +108,7 @@ bool cmListFileParser::ParseFile()
}
else
{
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n"
<< this->FileName << ":" << token->line << ":\n"
<< "Parse error. Expected a newline, got "
@@ -120,7 +120,7 @@ bool cmListFileParser::ParseFile()
}
else
{
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n"
<< this->FileName << ":" << token->line << ":\n"
<< "Parse error. Expected a command name, got "
@@ -268,7 +268,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
token->type == cmListFileLexer_Token_Space) {}
if(!token)
{
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n" << this->FileName << ":"
<< cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
<< "Parse error. Function missing opening \"(\".";
@@ -277,7 +277,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
}
if(token->type != cmListFileLexer_Token_ParenLeft)
{
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n" << this->FileName << ":"
<< cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
<< "Parse error. Expected \"(\", got "
@@ -355,7 +355,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
else
{
// Error.
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n" << this->FileName << ":"
<< cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
<< "Parse error. Function missing ending \")\". "
@@ -367,7 +367,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
}
}
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n"
<< this->FileName << ":" << lastLine << ":\n"
<< "Parse error. Function missing ending \")\". "
@@ -389,7 +389,7 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
}
bool isError = (this->Separation == SeparationError ||
delim == cmListFileArgument::Bracket);
- cmOStringStream m;
+ std::ostringstream m;
m << "Syntax " << (isError? "Error":"Warning") << " in cmake code at\n"
<< " " << this->FileName << ":" << token->line << ":"
<< token->column << "\n"
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 427e29d..93aec32 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -110,10 +110,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
// Prepare the table of variables to read.
this->Prefix = args[2];
- for(unsigned int i=3; i < args.size(); ++i)
- {
- this->VariablesToRead.insert(args[i]);
- }
+ this->VariablesToRead.insert(args.begin() + 3, args.end());
// Read the cache file.
cmsys::ifstream fin(cacheFile.c_str());
@@ -160,7 +157,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
}
}
}
- if(line.length())
+ if(!line.empty())
{
// Partial last line.
this->CheckLine(line.c_str());
@@ -184,7 +181,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// This was requested. Set this variable locally with the given
// prefix.
var = this->Prefix + var;
- if(value.length())
+ if(!value.empty())
{
this->Makefile->AddDefinition(var, value.c_str());
}
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index a4063a6..cdfd00c 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -226,7 +226,7 @@ bool cmLoadCommandCommand
std::string fullPath = cmSystemTools::FindFile(moduleName.c_str(), path);
if (fullPath == "")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Attempt to load command failed from file \""
<< moduleName << "\"";
this->SetError(e.str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2de6c93..af4c950 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -153,7 +153,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
}
else
{
- cmOStringStream w;
+ std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax
<< ", which is less than the minimum of 128. "
<< "The value will be ignored.";
@@ -162,7 +162,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
}
else
{
- cmOStringStream w;
+ std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen
<< "\", which fails to parse as a positive integer. "
<< "The value will be ignored.";
@@ -191,7 +191,7 @@ void cmLocalGenerator::ReadInputFile()
// The file is missing. Check policy CMP0014.
cmMakefile* mf = this->Parent->GetMakefile();
- cmOStringStream e;
+ std::ostringstream e;
e << "The source directory\n"
<< " " << this->Makefile->GetStartDirectory() << "\n"
<< "does not contain a CMakeLists.txt file.";
@@ -335,7 +335,7 @@ void cmLocalGenerator::GenerateTestFiles()
{
(*gi)->Generate(fout, config, configurationTypes);
}
- if ( this->Children.size())
+ if (!this->Children.empty())
{
size_t i;
for(i = 0; i < this->Children.size(); ++i)
@@ -634,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<std::string>::iterator a = cmd.begin();
- a != cmd.end(); ++a)
- {
- commandLine.push_back(*a);
- }
+ commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
@@ -745,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<std::string>::iterator a = cmd.begin();
- a != cmd.end(); ++a)
- {
- commandLine.push_back(*a);
- }
+ commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
@@ -944,7 +936,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
if(variable == "TARGET_QUOTED")
{
std::string targetQuoted = replaceValues.Target;
- if(targetQuoted.size() && targetQuoted[0] != '\"')
+ if(!targetQuoted.empty() && targetQuoted[0] != '\"')
{
targetQuoted = '\"';
targetQuoted += replaceValues.Target;
@@ -1245,7 +1237,7 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
{
if(const char* val = this->GetRuleLauncher(target, prop))
{
- cmOStringStream wrapped;
+ std::ostringstream wrapped;
wrapped << val << " " << s;
s = wrapped.str();
}
@@ -1326,7 +1318,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL;
- cmOStringStream includeFlags;
+ std::ostringstream includeFlags;
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
@@ -1422,12 +1414,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
std::string includePath =
this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths);
- if(quotePaths && includePath.size() && includePath[0] != '\"')
+ if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{
includeFlags << "\"";
}
includeFlags << includePath;
- if(quotePaths && includePath.size() && includePath[0] != '\"')
+ if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{
includeFlags << "\"";
}
@@ -1435,7 +1427,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
std::string flags = includeFlags.str();
// remove trailing separators
- if((sep[0] != ' ') && flags.size()>0 && flags[flags.size()-1] == sep[0])
+ if((sep[0] != ' ') && !flags.empty() && flags[flags.size()-1] == sep[0])
{
flags[flags.size()-1] = ' ';
}
@@ -1521,7 +1513,7 @@ void cmLocalGenerator::AddCompileOptions(
}
if (this->Makefile->IsLaterStandard(it->first, standard, it->second))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The COMPILE_FEATURES property of target \""
<< target->GetName() << "\" was evaluated when computing the link "
"implementation, and the \"" << it->first << "_STANDARD\" was \""
@@ -1880,7 +1872,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
OutputFormat shellFormat = (forResponseFile) ? RESPONSE :
((useWatcomQuote) ? WATCOMQUOTE : SHELL);
bool escapeAllowMakeVars = !forResponseFile;
- cmOStringStream fout;
+ std::ostringstream fout;
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config);
if(!pcli)
@@ -2215,6 +2207,13 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
{
return;
}
+ const char* defaultStd
+ = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
+ if (defaultStd && !*defaultStd)
+ {
+ // This compiler has no notion of language standard levels.
+ return;
+ }
std::string stdProp = lang + "_STANDARD";
const char *standardProp = target->GetProperty(stdProp);
if (!standardProp)
@@ -2242,7 +2241,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
const char *opt = target->GetMakefile()->GetDefinition(option_flag);
if (!opt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << target->GetName() << "\" requires the language "
"dialect \"" << lang << standardProp << "\" "
<< (ext ? "(with compiler extensions)" : "") << ", but CMake "
@@ -2277,8 +2276,6 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
std::find(stds.begin(), stds.end(), standard);
assert(stdIt != stds.end());
- const char* defaultStd
- = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
std::vector<std::string>::const_iterator defaultStdIt;
if (defaultStd)
{
@@ -2327,7 +2324,7 @@ static void AddVisibilityCompileOption(std::string &flags, cmTarget* target,
&& strcmp(prop, "protected") != 0
&& strcmp(prop, "internal") != 0 )
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target " << target->GetName() << " uses unsupported value \""
<< prop << "\" for " << flagDefine << ".";
cmSystemTools::Error(e.str().c_str());
@@ -2442,7 +2439,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
{
case cmPolicies::WARN:
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Variable " << flagsVar << " has been modified. CMake "
"will ignore the POSITION_INDEPENDENT_CODE target property for "
"shared libraries and will use the " << flagsVar << " variable "
@@ -2522,7 +2519,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
{
if(!newFlags.empty())
{
- if(flags.size())
+ if(!flags.empty())
{
flags += " ";
}
@@ -2914,7 +2911,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
assert(in_remote[0] != '\"');
// The local path should never have a trailing slash.
- assert(local.size() > 0 && !(local[local.size()-1] == ""));
+ assert(!local.empty() && !(local[local.size()-1] == ""));
// If the path is already relative then just return the path.
if(!cmSystemTools::FileIsFullPath(in_remote.c_str()))
@@ -2976,7 +2973,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// If the entire path is in common except for a trailing slash then
// just return a "./".
if(common+1 == remote.size() &&
- remote[common].size() == 0 &&
+ remote[common].empty() &&
common == local.size())
{
return "./";
@@ -3006,7 +3003,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// the trailing slash in the output.
for(unsigned int i=common; i < remote.size(); ++i)
{
- if(relative.size() > 0)
+ if(!relative.empty())
{
relative += "/";
}
@@ -3251,7 +3248,7 @@ cmLocalGenerator
// Warn if this is the first time the path has been seen.
if(this->ObjectMaxPathViolations.insert(dir_max).second)
{
- cmOStringStream m;
+ std::ostringstream m;
m << "The object file directory\n"
<< " " << dir_max << "\n"
<< "has " << dir_max.size() << " characters. "
@@ -3649,7 +3646,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
if(function_style)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "WARNING: Function-style preprocessor definitions may not be "
<< "passed on the compiler command line because many compilers "
<< "do not support it.\n"
@@ -3662,7 +3659,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
// Many compilers do not support # in the value so we disable it.
if(define.find_first_of("#") != define.npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "WARNING: Preprocessor definitions containing '#' may not be "
<< "passed on the compiler command line because many compilers "
<< "do not support it.\n"
@@ -3704,7 +3701,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
}
if(!cmSystemTools::FileExists(inFile.c_str(), true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \""
<< inFile << "\" could not be found.";
cmSystemTools::Error(e.str().c_str());
@@ -3748,7 +3745,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target,
}
if(!cmSystemTools::FileExists(inFile.c_str(), true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \""
<< inFile << "\" could not be found.";
cmSystemTools::Error(e.str().c_str());
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 0b0d971..413dc0f 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -369,7 +369,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
return ":";
#endif
- cmOStringStream cmd;
+ std::ostringstream cmd;
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
li != cmdLines.end(); ++li)
#ifdef _WIN32
@@ -409,7 +409,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
if (wd.empty())
wd = this->GetMakefile()->GetStartOutputDirectory();
- cmOStringStream cdCmd;
+ std::ostringstream cdCmd;
#ifdef _WIN32
std::string cdStr = "cd /D ";
#else
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 812ded3..fbf2140 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -738,11 +738,8 @@ cmLocalUnixMakefileGenerator3
// Add the output to the local help if requested.
if(in_help)
{
- for (std::vector<std::string>::const_iterator i = outputs.begin();
- i != outputs.end(); ++i)
- {
- this->LocalHelp.push_back(*i);
- }
+ this->LocalHelp.insert(this->LocalHelp.end(),
+ outputs.begin(), outputs.end());
}
}
@@ -1160,7 +1157,7 @@ cmLocalUnixMakefileGenerator3
{
// Build the command line in a single string.
std::string cmd = ccg.GetCommand(c);
- if (cmd.size())
+ if (!cmd.empty())
{
// Use "call " before any invocations of .bat or .cmd files
// invoked as custom commands in the WindowsShell.
@@ -1554,7 +1551,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Dependee \"" << tgtInfo
<< "\" is newer than depender \""
<< internalDependFile << "\"." << std::endl;
@@ -1577,7 +1574,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Dependee \"" << dirInfoFile
<< "\" is newer than depender \""
<< internalDependFile << "\"." << std::endl;
@@ -1788,7 +1785,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Deleting primary custom command output \"" << dependee
<< "\" because another output \""
<< depender << "\" does not exist." << std::endl;
@@ -1829,7 +1826,7 @@ void cmLocalUnixMakefileGenerator3
std::vector<std::string> no_depends;
this->WriteMakeRule(ruleFileStream,
"Allow only one \"make -f Makefile2\" at a time, but pass parallelism.",
- ".NOTPARALLEL", no_depends, no_commands, true);
+ ".NOTPARALLEL", no_depends, no_commands, false);
}
}
@@ -1856,13 +1853,8 @@ void cmLocalUnixMakefileGenerator3
{
text = "Running external command ...";
}
- std::set<std::string>::const_iterator dit;
- for ( dit = glIt->second.GetUtilities().begin();
- dit != glIt->second.GetUtilities().end();
- ++ dit )
- {
- depends.push_back(*dit);
- }
+ depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
+ glIt->second.GetUtilities().end());
this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal);
@@ -1918,7 +1910,7 @@ void cmLocalUnixMakefileGenerator3
std::string progressDir = this->Makefile->GetHomeOutputDirectory();
progressDir += cmake::GetCMakeFilesDirectory();
{
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd <<
"$(CMAKE_COMMAND) -E cmake_progress_start ";
progCmd << this->Convert(progressDir,
@@ -1942,7 +1934,7 @@ void cmLocalUnixMakefileGenerator3
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
{
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << this->Convert(progressDir,
cmLocalGenerator::FULL,
@@ -2178,7 +2170,7 @@ cmLocalUnixMakefileGenerator3
cmd += " ";
// Pass down verbosity level.
- if(this->GetMakeSilentFlag().size())
+ if(!this->GetMakeSilentFlag().empty())
{
cmd += this->GetMakeSilentFlag();
cmd += " ";
@@ -2302,7 +2294,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
for(unsigned int i=1; i < components.size(); ++i)
{
// Only the last component can be empty to avoid double slashes.
- if(components[i].length() > 0 || (i == (components.size()-1)))
+ if(!components[i].empty() || (i == (components.size()-1)))
{
if(!first)
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index b9a5074..1d62093 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1321,7 +1321,7 @@ void cmLocalVisualStudio6Generator
int major;
int minor;
target.GetTargetVersion(major, minor);
- cmOStringStream targetVersionStream;
+ std::ostringstream targetVersionStream;
targetVersionStream << "/version:" << major << "." << minor;
targetVersionFlag = targetVersionStream.str();
}
@@ -1998,7 +1998,7 @@ cmLocalVisualStudio6Generator
if(define.find_first_of(" ") != define.npos &&
define.find_first_of("\"$;") != define.npos)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "WARNING: The VS6 IDE does not support preprocessor definition "
<< "values with spaces and '\"', '$', or ';'.\n"
<< "CMake is dropping a preprocessor definition: " << define << "\n"
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 0e66764..914df5f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1115,7 +1115,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
if(this->GetVersion() < VS8 || this->FortranProject)
{
- cmOStringStream libdeps;
+ std::ostringstream libdeps;
this->Internal->OutputObjects(libdeps, &target);
if(!libdeps.str().empty())
{
@@ -1713,7 +1713,7 @@ bool cmLocalVisualStudio7Generator
// Write the children to temporary output.
bool hasChildrenWithSources = false;
- cmOStringStream tmpOut;
+ std::ostringstream tmpOut;
for(unsigned int i=0;i<children.size();++i)
{
if(this->WriteGroup(&children[i], target, tmpOut, libName, configs))
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index ae81c58..69fcca7 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -107,7 +107,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies);
// set the value of argc
- cmOStringStream argcDefStream;
+ std::ostringstream argcDefStream;
argcDefStream << expandedArgs.size();
std::string argcDef = argcDefStream.str();
@@ -116,7 +116,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::string argnDef;
bool argnDefInitialized = false;
bool argvDefInitialized = false;
- if( this->Functions.size())
+ if(!this->Functions.empty())
{
this->FilePath = this->Functions[0].FilePath;
}
@@ -170,7 +170,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
if ( cnt >= this->Args.size()-1 )
{
- if ( argnDef.size() > 0 )
+ if (!argnDef.empty())
{
argnDef += ";";
}
@@ -195,7 +195,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::vector<std::string>::const_iterator eit;
for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
{
- if ( argvDef.size() > 0 )
+ if (!argvDef.empty())
{
argvDef += ";";
}
@@ -328,11 +328,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker
cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker();
- for(std::vector<std::string>::const_iterator j = args.begin();
- j != args.end(); ++j)
- {
- f->Args.push_back(*j);
- }
+ f->Args.insert(f->Args.end(), args.begin(), args.end());
this->Makefile->AddFunctionBlocker(f);
return true;
}
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 1499e57..31bbb73 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -34,12 +34,7 @@ cmMakeDepend::cmMakeDepend()
cmMakeDepend::~cmMakeDepend()
{
- for(DependInformationMapType::iterator i =
- this->DependInformationMap.begin();
- i != this->DependInformationMap.end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(this->DependInformationMap);
}
@@ -180,7 +175,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
t != this->IncludeDirectories.end(); ++t)
{
std::string incpath = *t;
- if (incpath.size() && incpath[incpath.size() - 1] != '/')
+ if (!incpath.empty() && incpath[incpath.size() - 1] != '/')
{
incpath = incpath + "/";
}
@@ -323,7 +318,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
i != this->IncludeDirectories.end(); ++i)
{
std::string path = *i;
- if (path.size() && path[path.size() - 1] != '/')
+ if (!path.empty() && path[path.size() - 1] != '/')
{
path = path + "/";
}
@@ -340,7 +335,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
if (extraPath)
{
std::string path = extraPath;
- if (path.size() && path[path.size() - 1] != '/')
+ if (!path.empty() && path[path.size() - 1] != '/')
{
path = path + "/";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 20dae5a..ba914e1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -194,45 +194,13 @@ bool cmMakefile::NeedCacheCompatibility(int major, int minor) const
cmMakefile::~cmMakefile()
{
- for(std::vector<cmInstallGenerator*>::iterator
- i = this->InstallGenerators.begin();
- i != this->InstallGenerators.end(); ++i)
- {
- delete *i;
- }
- for(std::vector<cmTestGenerator*>::iterator
- i = this->TestGenerators.begin();
- i != this->TestGenerators.end(); ++i)
- {
- delete *i;
- }
- for(std::vector<cmSourceFile*>::iterator i = this->SourceFiles.begin();
- i != this->SourceFiles.end(); ++i)
- {
- delete *i;
- }
- for(std::map<std::string, cmTest*>::iterator i = this->Tests.begin();
- i != this->Tests.end(); ++i)
- {
- delete i->second;
- }
- for(std::vector<cmTarget*>::iterator
- i = this->ImportedTargetsOwned.begin();
- i != this->ImportedTargetsOwned.end(); ++i)
- {
- delete *i;
- }
- for(unsigned int i=0; i < this->FinalPassCommands.size(); i++)
- {
- delete this->FinalPassCommands[i];
- }
- std::vector<cmFunctionBlocker*>::iterator pos;
- for (pos = this->FunctionBlockers.begin();
- pos != this->FunctionBlockers.end(); ++pos)
- {
- cmFunctionBlocker* b = *pos;
- delete b;
- }
+ cmDeleteAll(this->InstallGenerators);
+ cmDeleteAll(this->TestGenerators);
+ cmDeleteAll(this->SourceFiles);
+ cmDeleteAll(this->Tests);
+ cmDeleteAll(this->ImportedTargetsOwned);
+ cmDeleteAll(this->FinalPassCommands);
+ cmDeleteAll(this->FunctionBlockers);
this->FunctionBlockers.clear();
if (this->PolicyStack.size() != 1)
{
@@ -363,7 +331,7 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
//----------------------------------------------------------------------------
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << lff.FilePath << "(" << lff.Line << "): ";
msg << lff.Name << "(";
for(std::vector<cmListFileArgument>::const_iterator i =
@@ -556,7 +524,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
case cmPolicies::WARN:
// Warn because the user did not set this policy.
{
- cmOStringStream w;
+ std::ostringstream w;
w << policies->GetPolicyWarning(cmPolicies::CMP0011) << "\n"
<< "The included script\n " << this->File << "\n"
<< "affects policy settings. "
@@ -568,7 +536,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
- cmOStringStream e;
+ std::ostringstream e;
e << policies->GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
<< "The included script\n " << this->File << "\n"
<< "affects policy settings, so it requires this policy to be set.";
@@ -741,7 +709,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const
// Diagnose a violation of CMP0000 if necessary.
if(this->CheckCMP0000)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "No cmake_minimum_required command is present. "
<< "A line of code such as\n"
<< " cmake_minimum_required(VERSION "
@@ -897,7 +865,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
{
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
- cmOStringStream e;
+ std::ostringstream e;
switch(this->GetPolicyStatus(cmPolicies::CMP0040))
{
case cmPolicies::WARN:
@@ -924,7 +892,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
if(ti->second.GetType() == cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << target << "\" is an OBJECT library "
"that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -932,7 +900,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
}
if(ti->second.GetType() == cmTarget::INTERFACE_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << target << "\" is an INTERFACE library "
"that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -997,7 +965,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
cmCustomCommandLine const& cl = *i;
if(!cl.empty() && !cl[0].empty() && cl[0][0] == '"')
{
- cmOStringStream e;
+ std::ostringstream e;
e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
return 0;
@@ -1555,7 +1523,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
(tgt->GetType() == cmTarget::INTERFACE_LIBRARY) ||
tgt->IsExecutableWithExports()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << lib << "\" of type "
<< cmTarget::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. "
@@ -1568,7 +1536,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Attempt to add link library \""
<< lib << "\" to target \""
<< target << "\" which is not built in this directory.";
@@ -1584,7 +1552,7 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target,
{
if(this->IsAlias(target))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "ALIAS target \"" << target << "\" "
<< "may not be linked into another target.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1791,22 +1759,12 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
return;
}
- std::string incString;
- std::string sep;
-
- for(std::vector<std::string>::const_iterator li = incs.begin();
- li != incs.end(); ++li)
- {
- incString += sep + *li;
- sep = ";";
- }
-
std::vector<cmValueWithOrigin>::iterator position =
before ? this->IncludeDirectoriesEntries.begin()
: this->IncludeDirectoriesEntries.end();
cmListFileBacktrace lfbt = this->GetBacktrace();
- cmValueWithOrigin entry(incString, lfbt);
+ cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt);
this->IncludeDirectoriesEntries.insert(position, entry);
// Property on each target:
@@ -1822,11 +1780,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
void
cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{
- for(std::set<std::string>::const_iterator li = incs.begin();
- li != incs.end(); ++li)
- {
- this->SystemIncludeDirectories.insert(*li);
- }
+ this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l)
@@ -1844,7 +1798,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
}
this->Internal->VarStack.top().Set(name, value);
- if (this->Internal->VarUsageStack.size() &&
+ if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
@@ -1919,7 +1873,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
void cmMakefile::AddDefinition(const std::string& name, bool value)
{
this->Internal->VarStack.top().Set(name, value? "ON" : "OFF");
- if (this->Internal->VarUsageStack.size() &&
+ if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
@@ -1983,7 +1937,7 @@ void cmMakefile::CheckForUnused(const char* reason,
{
std::string path;
cmListFileBacktrace bt(this->GetLocalGenerator());
- if (this->CallStack.size())
+ if (!this->CallStack.empty())
{
const cmListFileContext* file = this->CallStack.back().Context;
bt.push_back(*file);
@@ -2006,7 +1960,7 @@ void cmMakefile::CheckForUnused(const char* reason,
!cmSystemTools::IsSubDirectory(path,
cmake::GetCMakeFilesDirectory())))
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "unused variable (" << reason << ") \'" << name << "\'";
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
msg.str(),
@@ -2018,7 +1972,7 @@ void cmMakefile::CheckForUnused(const char* reason,
void cmMakefile::RemoveDefinition(const std::string& name)
{
this->Internal->VarStack.top().Set(name, 0);
- if (this->Internal->VarUsageStack.size() &&
+ if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("unsetting", name);
@@ -2311,7 +2265,7 @@ void cmMakefile::ExpandVariablesCMP0019()
{
return;
}
- cmOStringStream w;
+ std::ostringstream w;
const char *includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
if(mightExpandVariablesCMP0019(includeDirs))
@@ -2389,7 +2343,7 @@ void cmMakefile::ExpandVariablesCMP0019()
if(!w.str().empty())
{
- cmOStringStream m;
+ std::ostringstream m;
m << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0019)
<< "\n"
<< "The following variable evaluations were encountered:\n"
@@ -2567,12 +2521,7 @@ std::vector<std::string> cmMakefile
}
std::vector<std::string> res;
-
- std::set<std::string>::iterator fit;
- for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
- {
- res.push_back(*fit);
- }
+ res.insert(res.end(), definitions.begin(), definitions.end());
return res;
}
@@ -2782,7 +2731,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
else
{
// Construct the main error message.
- cmOStringStream error;
+ std::ostringstream error;
error << "Syntax error in cmake code ";
if(filename && line > 0)
{
@@ -2890,7 +2839,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
case NORMAL:
if(filename && lookup == lineVar)
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << line;
varresult = ostr.str();
}
@@ -2932,7 +2881,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
cmSystemTools::IsSubDirectory(filename,
this->GetHomeOutputDirectory()))
{
- cmOStringStream msg;
+ std::ostringstream msg;
cmListFileBacktrace bt(this->GetLocalGenerator());
cmListFileContext lfc;
lfc.FilePath = filename;
@@ -3126,7 +3075,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
if(error)
{
- cmOStringStream emsg;
+ std::ostringstream emsg;
emsg << "Syntax error in cmake code ";
if(filename)
{
@@ -3341,7 +3290,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
{
// Report the context in which the unclosed block was opened.
cmListFileContext const& lfc = fb->GetStartingContext();
- cmOStringStream e;
+ std::ostringstream e;
e << "A logical block opening on the line\n"
<< " " << lfc << "\n"
<< "is not closed.";
@@ -3499,7 +3448,7 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
if(!(*pos)->ShouldRemove(lff, *this))
{
cmListFileContext const& lfc = fb->GetStartingContext();
- cmOStringStream e;
+ std::ostringstream e;
e << "A logical block opening on the line\n"
<< " " << lfc << "\n"
<< "closes on the line\n"
@@ -3559,14 +3508,14 @@ void cmMakefile::SetScriptModeFile(const char* scriptfile)
void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
{
- cmOStringStream strStream;
+ std::ostringstream strStream;
strStream << args.size();
this->AddDefinition("CMAKE_ARGC", strStream.str().c_str());
//this->MarkVariableAsUsed("CMAKE_ARGC");
for (unsigned int t = 0; t < args.size(); ++t)
{
- cmOStringStream tmpStream;
+ std::ostringstream tmpStream;
tmpStream << "CMAKE_ARGV" << t;
this->AddDefinition(tmpStream.str(), args[t].c_str());
//this->MarkVariableAsUsed(tmpStream.str().c_str());
@@ -3903,12 +3852,12 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
// from which we are being called is located itself in CMAKE_ROOT, then
// prefer results from CMAKE_ROOT depending on the policy setting.
result = moduleInCMakeModulePath;
- if (result.size() == 0)
+ if (result.empty())
{
result = moduleInCMakeRoot;
}
- if ((moduleInCMakeModulePath.size()>0) && (moduleInCMakeRoot.size()>0))
+ if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty())
{
const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmakeRoot + std::string("/Modules/");
@@ -3918,7 +3867,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
{
case cmPolicies::WARN:
{
- cmOStringStream e;
+ std::ostringstream e;
e << "File " << currentFile << " includes "
<< moduleInCMakeModulePath
<< " (found via CMAKE_MODULE_PATH) which shadows "
@@ -4098,7 +4047,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
if(bom != cmsys::FStream::BOM_None &&
bom != cmsys::FStream::BOM_UTF8)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "File starts with a Byte-Order-Mark that is not UTF-8:\n "
<< sinfile;
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -4310,7 +4259,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
}
else if (prop == "LINK_DIRECTORIES")
{
- cmOStringStream str;
+ std::ostringstream str;
for (std::vector<std::string>::const_iterator
it = this->GetLinkDirectories().begin();
it != this->GetLinkDirectories().end();
@@ -4488,7 +4437,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
std::string cmMakefile::GetListFileStack() const
{
- cmOStringStream tmp;
+ std::ostringstream tmp;
size_t depth = this->ListFileStack.size();
if (depth > 0)
{
@@ -4561,16 +4510,8 @@ void cmMakefile::PopScope()
this->Internal->VarInitStack.pop();
this->Internal->VarUsageStack.pop();
// Push initialization and usage up to the parent scope.
- it = init.begin();
- for (; it != init.end(); ++it)
- {
- this->Internal->VarInitStack.top().insert(*it);
- }
- it = usage.begin();
- for (; it != usage.end(); ++it)
- {
- this->Internal->VarUsageStack.top().insert(*it);
- }
+ this->Internal->VarInitStack.top().insert(init.begin(), init.end());
+ this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end());
}
void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
@@ -4606,7 +4547,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
}
else
{
- cmOStringStream m;
+ std::ostringstream m;
m << "Cannot set \"" << var << "\": current scope has no parent.";
this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
}
@@ -4701,7 +4642,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
{
if(this->IsAlias(name))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create target \"" << name
<< "\" because an alias with the same name already exists.";
msg = e.str();
@@ -4715,7 +4656,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
{
// Imported targets were not supported in previous versions.
// This is new code, so we can make it an error.
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create target \"" << name
<< "\" because an imported target with the same name already exists.";
msg = e.str();
@@ -4754,7 +4695,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
// Produce an error that tells the user how to work around the
// problem.
- cmOStringStream e;
+ std::ostringstream e;
e << "cannot create target \"" << name
<< "\" because another target with the same name already exists. "
<< "The existing target is ";
@@ -4800,7 +4741,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
{
return true;
}
- cmOStringStream e;
+ std::ostringstream e;
switch (this->GetPolicyStatus(cmPolicies::CMP0013))
{
case cmPolicies::WARN:
@@ -4985,7 +4926,7 @@ bool cmMakefile::SetPolicy(const char *id,
cmPolicies::PolicyID pid;
if (!this->GetPolicies()->GetPolicyID(id, /* out */ pid))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Policy \"" << id << "\" is not known to this version of CMake.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
@@ -5200,7 +5141,7 @@ AddRequiredTargetFeature(cmTarget *target, const std::string& feature,
availableFeatures.end(),
feature) == availableFeatures.end())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The compiler feature \"" << feature
<< "\" is not known to " << lang << " compiler\n\""
<< this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
@@ -5240,7 +5181,7 @@ CompileFeatureKnown(cmTarget const* target, const std::string& feature,
lang = "CXX";
return true;
}
- cmOStringStream e;
+ std::ostringstream e;
if (error)
{
e << "specified";
@@ -5271,7 +5212,7 @@ CompileFeaturesAvailable(const std::string& lang, std::string *error) const
if (!featuresKnown || !*featuresKnown)
{
- cmOStringStream e;
+ std::ostringstream e;
if (error)
{
e << "no";
@@ -5298,19 +5239,41 @@ CompileFeaturesAvailable(const std::string& lang, std::string *error) const
}
//----------------------------------------------------------------------------
-bool cmMakefile::HaveFeatureAvailable(cmTarget const* target,
+bool cmMakefile::HaveStandardAvailable(cmTarget const* target,
std::string const& lang,
const std::string& feature) const
{
return lang == "C"
- ? this->HaveCFeatureAvailable(target, feature)
- : this->HaveCxxFeatureAvailable(target, feature);
+ ? this->HaveCStandardAvailable(target, feature)
+ : this->HaveCxxStandardAvailable(target, feature);
}
//----------------------------------------------------------------------------
bool cmMakefile::
-HaveCFeatureAvailable(cmTarget const* target, const std::string& feature) const
-{
+HaveCStandardAvailable(cmTarget const* target,
+ const std::string& feature) const
+{
+ const char* defaultCStandard =
+ this->GetDefinition("CMAKE_C_STANDARD_DEFAULT");
+ if (!defaultCStandard)
+ {
+ std::ostringstream e;
+ e << "CMAKE_C_STANDARD_DEFAULT is not set. COMPILE_FEATURES support "
+ "not fully configured for this compiler.";
+ this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+ // Return true so the caller does not try to lookup the default standard.
+ return true;
+ }
+ if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
+ cmStrCmp(defaultCStandard)) == cmArrayEnd(C_STANDARDS))
+ {
+ std::ostringstream e;
+ e << "The CMAKE_C_STANDARD_DEFAULT variable contains an "
+ "invalid value: \"" << defaultCStandard << "\".";
+ this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+ return false;
+ }
+
bool needC90 = false;
bool needC99 = false;
bool needC11 = false;
@@ -5320,13 +5283,13 @@ HaveCFeatureAvailable(cmTarget const* target, const std::string& feature) const
const char *existingCStandard = target->GetProperty("C_STANDARD");
if (!existingCStandard)
{
- existingCStandard = this->GetDefinition("CMAKE_C_STANDARD_DEFAULT");
+ existingCStandard = defaultCStandard;
}
if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
cmStrCmp(existingCStandard)) == cmArrayEnd(C_STANDARDS))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -5386,9 +5349,30 @@ bool cmMakefile::IsLaterStandard(std::string const& lang,
}
//----------------------------------------------------------------------------
-bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target,
+bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
const std::string& feature) const
{
+ const char* defaultCxxStandard =
+ this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT");
+ if (!defaultCxxStandard)
+ {
+ std::ostringstream e;
+ e << "CMAKE_CXX_STANDARD_DEFAULT is not set. COMPILE_FEATURES support "
+ "not fully configured for this compiler.";
+ this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+ // Return true so the caller does not try to lookup the default standard.
+ return true;
+ }
+ if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
+ cmStrCmp(defaultCxxStandard)) == cmArrayEnd(CXX_STANDARDS))
+ {
+ std::ostringstream e;
+ e << "The CMAKE_CXX_STANDARD_DEFAULT variable contains an "
+ "invalid value: \"" << defaultCxxStandard << "\".";
+ this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+ return false;
+ }
+
bool needCxx98 = false;
bool needCxx11 = false;
bool needCxx14 = false;
@@ -5397,13 +5381,13 @@ bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target,
const char *existingCxxStandard = target->GetProperty("CXX_STANDARD");
if (!existingCxxStandard)
{
- existingCxxStandard = this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT");
+ existingCxxStandard = defaultCxxStandard;
}
if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
cmStrCmp(existingCxxStandard)) == cmArrayEnd(CXX_STANDARDS))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -5478,7 +5462,7 @@ AddRequiredTargetCxxFeature(cmTarget *target,
if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
cmStrCmp(existingCxxStandard)) == cmArrayEnd(CXX_STANDARDS))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -5577,7 +5561,7 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const
if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
cmStrCmp(existingCStandard)) == cmArrayEnd(C_STANDARDS))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\".";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index fcfec8d..bff8c12 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -965,7 +965,7 @@ public:
const char* CompileFeaturesAvailable(const std::string& lang,
std::string *error) const;
- bool HaveFeatureAvailable(cmTarget const* target, std::string const& lang,
+ bool HaveStandardAvailable(cmTarget const* target, std::string const& lang,
const std::string& feature) const;
bool IsLaterStandard(std::string const& lang,
@@ -1197,9 +1197,9 @@ private:
void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98,
bool& needCxx11, bool& needCxx14) const;
- bool HaveCFeatureAvailable(cmTarget const* target,
+ bool HaveCStandardAvailable(cmTarget const* target,
const std::string& feature) const;
- bool HaveCxxFeatureAvailable(cmTarget const* target,
+ bool HaveCxxStandardAvailable(cmTarget const* target,
const std::string& feature) const;
mutable bool SuppressWatches;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index fc52ccc..d4036d2 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -371,8 +371,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetVersionMajor;
std::string targetVersionMinor;
{
- cmOStringStream majorStream;
- cmOStringStream minorStream;
+ std::ostringstream majorStream;
+ std::ostringstream minorStream;
int major;
int minor;
this->Target->GetTargetVersion(major, minor);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 305d81d..cdda36c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -566,8 +566,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string targetVersionMajor;
std::string targetVersionMinor;
{
- cmOStringStream majorStream;
- cmOStringStream minorStream;
+ std::ostringstream majorStream;
+ std::ostringstream minorStream;
int major;
int minor;
this->Target->GetTargetVersion(major, minor);
@@ -805,7 +805,7 @@ cmMakefileLibraryTargetGenerator
if(major > 0 || minor > 0 || patch > 0)
{
// Append the flag since a non-zero version is specified.
- cmOStringStream vflag;
+ std::ostringstream vflag;
vflag << flag << major << "." << minor << "." << patch;
this->LocalGenerator->AppendFlags(flags, vflag.str());
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index cbf8573..7ed0c10 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -451,7 +451,7 @@ void cmMakefileTargetGenerator
}
else
{
- cmOStringStream err;
+ std::ostringstream err;
err << "Warning: Source file \""
<< source.GetFullPath()
<< "\" is listed multiple times for target \""
@@ -759,13 +759,10 @@ cmMakefileTargetGenerator
if(const char* extra_outputs_str =
source.GetProperty("OBJECT_OUTPUTS"))
{
+ // Register these as extra files to clean.
cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
- for(std::vector<std::string>::const_iterator eoi = outputs.begin()+1;
- eoi != outputs.end(); ++eoi)
- {
- // Register this as an extra file to clean.
- this->CleanFiles.push_back(*eoi);
- }
+ this->CleanFiles.insert(this->CleanFiles.end(),
+ outputs.begin() + 1, outputs.end());
}
// Write the rule.
@@ -1101,7 +1098,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Add a command to call CMake to scan dependencies. CMake will
// touch the corresponding depends file after scanning dependencies.
- cmOStringStream depCmd;
+ std::ostringstream depCmd;
// TODO: Account for source file properties and directory-level
// definitions when scanning for dependencies.
#if !defined(_WIN32) || defined(__CYGWIN__)
@@ -1174,11 +1171,7 @@ cmMakefileTargetGenerator
{
cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
const std::vector<std::string>& outputs = ccg.GetOutputs();
- for(std::vector<std::string>::const_iterator o = outputs.begin();
- o != outputs.end(); ++o)
- {
- depends.push_back(*o);
- }
+ depends.insert(depends.end(), outputs.begin(), outputs.end());
}
}
}
@@ -1217,7 +1210,7 @@ void cmMakefileTargetGenerator
}
// Now append the actual user-specified commands.
- cmOStringStream content;
+ std::ostringstream content;
this->LocalGenerator->AppendCustomCommand(commands, ccg, this->Target, false,
cmLocalGenerator::HOME_OUTPUT,
&content);
@@ -1279,7 +1272,7 @@ cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
}
std::string progressDir = this->Makefile->GetHomeOutputDirectory();
progressDir += cmake::GetCMakeFilesDirectory();
- cmOStringStream progCmd;
+ std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
progCmd << this->LocalGenerator->Convert(progressDir,
cmLocalGenerator::FULL,
@@ -1462,11 +1455,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
}
// Make sure the extra files are built.
- for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin();
- i != this->ExtraFiles.end(); ++i)
- {
- depends.push_back(*i);
- }
+ depends.insert(depends.end(),
+ this->ExtraFiles.begin(), this->ExtraFiles.end());
}
// Write the driver rule.
@@ -1553,11 +1543,7 @@ void cmMakefileTargetGenerator
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
{
std::vector<std::string> const& libDeps = cli->GetDepends();
- for(std::vector<std::string>::const_iterator j = libDeps.begin();
- j != libDeps.end(); ++j)
- {
- depends.push_back(*j);
- }
+ depends.insert(depends.end(), libDeps.begin(), libDeps.end());
}
}
@@ -1577,12 +1563,8 @@ void cmMakefileTargetGenerator
}
// Add dependencies on the external object files.
- for(std::vector<std::string>::const_iterator obj
- = this->ExternalObjects.begin();
- obj != this->ExternalObjects.end(); ++obj)
- {
- depends.push_back(*obj);
- }
+ depends.insert(depends.end(),
+ this->ExternalObjects.begin(), this->ExternalObjects.end());
// Add a dependency on the rule file itself.
this->LocalGenerator->AppendRuleDepend(depends,
@@ -1888,7 +1870,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
std::string includeFlags =
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
- lang, false, useResponseFile);
+ lang, false, useResponseFile,
+ config);
if(includeFlags.empty())
{
return;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 53b7a8e..c352c1a 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -22,6 +22,7 @@
#include <assert.h>
#include <algorithm>
+#include <limits>
#ifndef _WIN32
#include <unistd.h>
@@ -218,8 +219,8 @@ cmNinjaNormalTargetGenerator
std::string targetVersionMajor;
std::string targetVersionMinor;
{
- cmOStringStream majorStream;
- cmOStringStream minorStream;
+ std::ostringstream majorStream;
+ std::ostringstream minorStream;
int major;
int minor;
this->GetTarget()->GetTargetVersion(major, minor);
@@ -255,10 +256,10 @@ cmNinjaNormalTargetGenerator
this->GetLocalGenerator()->BuildCommandLine(linkCmds);
// Write the linker rule with response file if needed.
- cmOStringStream comment;
+ std::ostringstream comment;
comment << "Rule for linking " << this->TargetLinkLanguage << " "
<< this->GetVisibleTypeName() << ".";
- cmOStringStream description;
+ std::ostringstream description;
description << "Linking " << this->TargetLinkLanguage << " "
<< this->GetVisibleTypeName() << " $TARGET_FILE";
this->GetGlobalGenerator()->AddRule(ruleName,
@@ -366,15 +367,29 @@ cmNinjaNormalTargetGenerator
static int calculateCommandLineLengthLimit(int linkRuleLength)
{
+ static int const limits[] = {
#ifdef _WIN32
- return 8000 - linkRuleLength;
-#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__)
- // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
- return ((int)sysconf(_SC_ARG_MAX)) - linkRuleLength - 1000;
-#else
- (void)linkRuleLength;
- return -1;
+ 8000,
#endif
+#if defined(__APPLE__) || defined(__HAIKU__) || defined(__linux)
+ // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
+ ((int)sysconf(_SC_ARG_MAX)) - 1000,
+#endif
+#if defined(__linux)
+ // #define MAX_ARG_STRLEN (PAGE_SIZE * 32) in Linux's binfmts.h
+ ((int)sysconf(_SC_PAGESIZE) * 32) - 1000,
+#endif
+ std::numeric_limits<int>::max()
+ };
+
+ size_t const arrSz = cmArraySize(limits);
+ int const sz = *std::min_element(limits, limits + arrSz);
+ if (sz == std::numeric_limits<int>::max())
+ {
+ return -1;
+ }
+
+ return sz - linkRuleLength;
}
@@ -435,7 +450,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaVars vars;
// Compute the comment.
- cmOStringStream comment;
+ std::ostringstream comment;
comment <<
"Link the " << this->GetVisibleTypeName() << " " << targetOutputReal;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b36ff93..cfd8937 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -170,8 +170,10 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
std::string includeFlags =
this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
language,
- language == "RC" ? true : false); // full include paths for RC
+ language == "RC" ? true : false, // full include paths for RC
// needed by cmcldeps
+ false,
+ this->GetConfigName());
if(cmGlobalNinjaGenerator::IsMinGW())
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
@@ -198,21 +200,21 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
return flags;
}
-
-bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang)
+bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const
{
- cmMakefile* mf = this->GetMakefile();
-
- const bool usingMSVC = std::string("MSVC") ==
- (mf->GetDefinition("CMAKE_C_COMPILER_ID") ?
- mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") :
- mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"));
-
- return !usingMSVC || lang == "RC";
+ if (lang == "C" || lang == "CXX")
+ {
+ cmMakefile* mf = this->GetMakefile();
+ return (
+ strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "MSVC") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "MSVC") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "MSVC") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "MSVC") == 0
+ );
+ }
+ return false;
}
-
-
// TODO: Refactor with
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
std::string
@@ -389,22 +391,22 @@ cmNinjaTargetGenerator
cmMakefile* mf = this->GetMakefile();
- const std::string cId = mf->GetDefinition("CMAKE_C_COMPILER_ID")
- ? mf->GetSafeDefinition("CMAKE_C_COMPILER_ID")
- : mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
- const std::string sId = mf->GetDefinition("CMAKE_C_SIMULATE_ID")
- ? mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID")
- : mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID");
- const bool usingMSVC = (cId == "MSVC" || sId == "MSVC");
-
// Tell ninja dependency format so all deps can be loaded into a database
std::string deptype;
std::string depfile;
std::string cldeps;
std::string flags = "$FLAGS";
- if (usingMSVC)
+ if (this->NeedDepTypeMSVC(lang))
+ {
+ deptype = "msvc";
+ depfile = "";
+ flags += " /showIncludes";
+ }
+ else if (lang == "RC" && this->NeedDepTypeMSVC("C"))
{
- if (!mf->GetIsSourceFileTryCompile() && lang == "RC")
+ // For the MS resource compiler we need cmcldeps, but skip dependencies
+ // for source-file try_compile cases because they are always fresh.
+ if (!mf->GetIsSourceFileTryCompile())
{
deptype = "gcc";
depfile = "$DEP_FILE";
@@ -417,12 +419,6 @@ cmNinjaTargetGenerator
cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
cldeps += "\" \"" + cl + "\" ";
}
- else
- {
- deptype = "msvc";
- depfile = "";
- flags += " /showIncludes";
- }
}
else
{
@@ -468,9 +464,9 @@ cmNinjaTargetGenerator
// Write the rule for compiling file of the given language.
- cmOStringStream comment;
+ std::ostringstream comment;
comment << "Rule for compiling " << lang << " files.";
- cmOStringStream description;
+ std::ostringstream description;
description << "Building " << lang << " object $out";
this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(lang),
cmdLine,
@@ -603,6 +599,14 @@ cmNinjaTargetGenerator
if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) {
std::vector<std::string> depList;
cmSystemTools::ExpandListArgument(objectDeps, depList);
+ for(std::vector<std::string>::iterator odi = depList.begin();
+ odi != depList.end(); ++odi)
+ {
+ if (cmSystemTools::FileIsFullPath(*odi))
+ {
+ *odi = cmSystemTools::CollapseFullPath(*odi);
+ }
+ }
std::transform(depList.begin(), depList.end(),
std::back_inserter(implicitDeps), MapToNinjaPath());
}
@@ -626,7 +630,7 @@ cmNinjaTargetGenerator
cmNinjaVars vars;
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
- if (needsDepFile(language)) {
+ if (!this->NeedDepTypeMSVC(language)) {
vars["DEP_FILE"] =
cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d");
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 17cf517..5733fde 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -42,7 +42,7 @@ public:
std::string GetTargetName() const;
- bool needsDepFile(const std::string& lang);
+ bool NeedDepTypeMSVC(const std::string& lang) const;
protected:
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 3cdd2f6..23f8526 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -86,7 +86,7 @@ public:
}
}
- void FindImplicitConflicts(cmOStringStream& w)
+ void FindImplicitConflicts(std::ostringstream& w)
{
bool first = true;
for(unsigned int i=0; i < this->OD->OriginalDirectories.size(); ++i)
@@ -291,18 +291,8 @@ cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
//----------------------------------------------------------------------------
cmOrderDirectories::~cmOrderDirectories()
{
- for(std::vector<cmOrderDirectoriesConstraint*>::iterator
- i = this->ConstraintEntries.begin();
- i != this->ConstraintEntries.end(); ++i)
- {
- delete *i;
- }
- for(std::vector<cmOrderDirectoriesConstraint*>::iterator
- i = this->ImplicitDirEntries.begin();
- i != this->ImplicitDirEntries.end(); ++i)
- {
- delete *i;
- }
+ cmDeleteAll(this->ConstraintEntries);
+ cmDeleteAll(this->ImplicitDirEntries);
}
//----------------------------------------------------------------------------
@@ -541,7 +531,7 @@ void cmOrderDirectories::FindImplicitConflicts()
{
// Check for items in implicit link directories that have conflicts
// in the explicit directories.
- cmOStringStream conflicts;
+ std::ostringstream conflicts;
for(unsigned int i=0; i < this->ImplicitDirEntries.size(); ++i)
{
this->ImplicitDirEntries[i]->FindImplicitConflicts(conflicts);
@@ -555,7 +545,7 @@ void cmOrderDirectories::FindImplicitConflicts()
}
// Warn about the conflicts.
- cmOStringStream w;
+ std::ostringstream w;
w << "Cannot generate a safe " << this->Purpose
<< " for target " << this->Target->GetName()
<< " because files in some directories may conflict with "
@@ -624,7 +614,7 @@ void cmOrderDirectories::DiagnoseCycle()
this->CycleDiagnosed = true;
// Construct the message.
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot generate a safe " << this->Purpose
<< " for target " << this->Target->GetName()
<< " because there is a cycle in the constraint graph:\n";
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 1a27a25..3a48101 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -41,7 +41,7 @@ public:
std::string GetVersionString()
{
- cmOStringStream v;
+ std::ostringstream v;
v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced;
if(this->PatchVersionIntroduced > 0)
{
@@ -378,13 +378,7 @@ cmPolicies::cmPolicies()
cmPolicies::~cmPolicies()
{
- // free the policies
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
- = this->Policies.begin();
- for (;i != this->Policies.end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(this->Policies);
}
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
@@ -432,7 +426,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
if(sscanf(ver.c_str(), "%u.%u.%u.%u",
&majorVer, &minorVer, &patchVer, &tweakVer) < 2)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Invalid policy version value \"" << ver << "\". "
<< "A numeric major.minor[.patch[.tweak]] must be given.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -462,7 +456,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
patchVer == cmVersion::GetPatchVersion() &&
tweakVer > cmVersion::GetTweakVersion()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "An attempt was made to set the policy version of CMake to \""
<< version << "\" which is greater than this version of CMake. "
<< "This is not allowed because the greater version may have new "
@@ -534,7 +528,7 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy,
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << defaultVar << " has value \"" << defaultValue
<< "\" but must be \"OLD\", \"NEW\", or \"\" (empty).";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -584,7 +578,7 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
return "Request for warning text for undefined policy!";
}
- cmOStringStream msg;
+ std::ostringstream msg;
msg <<
"Policy " << pos->second->IDString << " is not set: "
"" << pos->second->ShortDescription << " "
@@ -608,7 +602,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
return "Request for error text for undefined policy!";
}
- cmOStringStream error;
+ std::ostringstream error;
error <<
"Policy " << pos->second->IDString << " is not set to NEW: "
"" << pos->second->ShortDescription << " "
@@ -645,7 +639,7 @@ std::string
cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
{
std::string pid = this->GetPolicyIDString(id);
- cmOStringStream e;
+ std::ostringstream e;
e << "Policy " << pid << " may not be set to OLD behavior because this "
<< "version of CMake no longer supports it. "
<< "The policy was introduced in "
@@ -667,7 +661,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
unsigned int patchVer,
cmMakefile* mf)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The project requests behavior compatible with CMake version \""
<< majorVer << "." << minorVer << "." << patchVer
<< "\", which requires the OLD behavior for some policies:\n";
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 12318c8..61c0133 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -215,7 +215,7 @@ bool cmProjectCommand
}
if(!vw.empty())
{
- cmOStringStream w;
+ std::ostringstream w;
w << (this->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0048))
<< "\nThe following variable(s) would be set to empty:" << vw;
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a01a384..bf79066 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -224,16 +224,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
}
}
depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end());
- std::string entriesList;
- const char* sep = "";
- for(std::vector<std::string>::const_iterator it = qrcEntries.begin();
- it != qrcEntries.end(); ++it)
- {
- entriesList += sep;
- entriesList += *it;
- sep = "@list_sep@";
- }
- return entriesList;
+ return cmJoin(qrcEntries, "@list_sep@");
}
std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf,
@@ -512,29 +503,13 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
// Get the include dirs for this target, without stripping the implicit
// include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false);
- const char* sep = "";
- incs = "";
- for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
- incDirIt != includeDirs.end();
- ++incDirIt)
- {
- incs += sep;
- sep = ";";
- incs += *incDirIt;
- }
+
+ incs = cmJoin(includeDirs, ";");
std::set<std::string> defines;
localGen->AddCompileDefinitions(defines, target, config);
- sep = "";
- for(std::set<std::string>::const_iterator defIt = defines.begin();
- defIt != defines.end();
- ++defIt)
- {
- defs += sep;
- sep = ";";
- defs += *defIt;
- }
+ defs += cmJoin(defines, ";");
}
void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
@@ -879,16 +854,7 @@ static void GetUicOpts(cmTarget const* target, const std::string& config,
{
std::vector<std::string> opts;
target->GetAutoUicOptions(opts, config);
-
- const char* sep = "";
- for(std::vector<std::string>::const_iterator optIt = opts.begin();
- optIt != opts.end();
- ++optIt)
- {
- optString += sep;
- sep = ";";
- optString += *optIt;
- }
+ optString = cmJoin(opts, ";");
}
void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
@@ -899,12 +865,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::set<std::string> skipped;
std::vector<std::string> skipVec;
cmSystemTools::ExpandListArgument(this->SkipUic, skipVec);
-
- for (std::vector<std::string>::const_iterator li = skipVec.begin();
- li != skipVec.end(); ++li)
- {
- skipped.insert(*li);
- }
+ skipped.insert(skipVec.begin(), skipVec.end());
makefile->AddDefinition("_skip_uic",
cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str());
@@ -1622,12 +1583,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
std::vector<std::string> headerFilesVec;
cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
- for (std::vector<std::string>::const_iterator it = headerFilesVec.begin();
- it != headerFilesVec.end();
- ++it)
- {
- headerFiles.insert(*it);
- }
+ headerFiles.insert(headerFilesVec.begin(), headerFilesVec.end());
// key = moc source filepath, value = moc output filename
std::map<std::string, std::string> notIncludedMocs;
@@ -2188,24 +2144,12 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
std::vector<std::string> command;
command.push_back(this->MocExecutable);
- for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
- it != this->MocIncludes.end();
- ++it)
- {
- command.push_back(*it);
- }
- for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
- it != this->MocDefinitions.end();
- ++it)
- {
- command.push_back(*it);
- }
- for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
- it != this->MocOptions.end();
- ++it)
- {
- command.push_back(*it);
- }
+ command.insert(command.end(),
+ this->MocIncludes.begin(), this->MocIncludes.end());
+ command.insert(command.end(),
+ this->MocDefinitions.begin(), this->MocDefinitions.end());
+ command.insert(command.end(),
+ this->MocOptions.begin(), this->MocOptions.end());
#ifdef _WIN32
command.push_back("-DWIN32");
#endif
@@ -2277,12 +2221,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5");
}
- for(std::vector<std::string>::const_iterator optIt = opts.begin();
- optIt != opts.end();
- ++optIt)
- {
- command.push_back(*optIt);
- }
+ command.insert(command.end(), opts.begin(), opts.end());
command.push_back("-o");
command.push_back(this->Builddir + ui_output_file);
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index cca995b..f4607c6 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -417,14 +417,7 @@ void cmRST::ProcessDirectiveReplace()
{
// Record markup lines as replacement text.
std::string& replacement = this->Replace[this->ReplaceName];
- const char* sep = "";
- for(std::vector<std::string>::iterator i = this->MarkupLines.begin();
- i != this->MarkupLines.end(); ++i)
- {
- replacement += sep;
- replacement += *i;
- sep = " ";
- }
+ replacement += cmJoin(this->MarkupLines, " ");
this->ReplaceName = "";
}
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index bcb8564..bad38be 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -39,10 +39,7 @@ bool cmRemoveCommand
// check for REMOVE(VAR v1 v2 ... vn)
std::vector<std::string> argsExpanded;
std::vector<std::string> temp;
- for(unsigned int j = 1; j < args.size(); ++j)
- {
- temp.push_back(args[j]);
- }
+ temp.insert(temp.end(), args.begin() + 1, args.end());
cmSystemTools::ExpandList(temp, argsExpanded);
// now create the new value
@@ -60,7 +57,7 @@ bool cmRemoveCommand
}
if (!found)
{
- if (value.size())
+ if (!value.empty())
{
value += ";";
}
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 1ee3f29..8e6c311 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -51,7 +51,7 @@ bool cmSeparateArgumentsCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given unknown argument " << args[i];
this->SetError(e.str());
return false;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 176a08d..90d7b03 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -37,7 +37,7 @@ bool cmSetCommand
delete [] varName;
// will it be set to something, then set it
- if (args.size() > 1 && args[1].size())
+ if (args.size() > 1 && !args[1].empty())
{
// but only if it is different from current value
if (!currValue || strcmp(currValue,args[1].c_str()))
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 653d764..1150bc7 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -67,7 +67,7 @@ bool cmSetPropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid scope " << *arg << ". "
<< "Valid scopes are GLOBAL, DIRECTORY, "
"TARGET, SOURCE, TEST, CACHE, INSTALL.";
@@ -117,7 +117,7 @@ bool cmSetPropertyCommand
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid argument \"" << *arg << "\".";
this->SetError(e.str());
return false;
@@ -265,7 +265,7 @@ bool cmSetPropertyCommand::HandleTargetMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not find TARGET " << *ni
<< ". Perhaps it has not yet been created.";
this->SetError(e.str());
@@ -316,7 +316,7 @@ bool cmSetPropertyCommand::HandleSourceMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given SOURCE name that could not be found or created: " << *ni;
this->SetError(e.str());
return false;
@@ -373,7 +373,7 @@ bool cmSetPropertyCommand::HandleTestMode()
// Names that are still left were not found.
if(!this->Names.empty())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given TEST names that do not exist:\n";
for(std::set<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end(); ++ni)
@@ -417,7 +417,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
!cmSystemTools::IsOn(this->PropertyValue.c_str()) &&
!cmSystemTools::IsOff(this->PropertyValue.c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given non-boolean value \"" << this->PropertyValue
<< "\" for CACHE property \"ADVANCED\". ";
this->SetError(e.str());
@@ -428,7 +428,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
{
if(!cmCacheManager::IsType(this->PropertyValue.c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\"";
this->SetError(e.str());
return false;
@@ -438,7 +438,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
this->PropertyName != "STRINGS" &&
this->PropertyName != "VALUE")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given invalid CACHE property " << this->PropertyName << ". "
<< "Settable CACHE properties are: "
<< "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE.";
@@ -463,7 +463,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "could not find CACHE variable " << *ni
<< ". Perhaps it has not yet been created.";
this->SetError(e.str());
@@ -513,7 +513,7 @@ bool cmSetPropertyCommand::HandleInstallMode()
}
else
{
- cmOStringStream e;
+ std::ostringstream e;
e << "given INSTALL name that could not be found or created: " << *i;
this->SetError(e.str());
return false;
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index bf3519c..aeb8077 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -61,7 +61,7 @@ bool cmSetTargetPropertiesCommand
return false;
}
}
- if(propertyPairs.size() == 0)
+ if(propertyPairs.empty())
{
this->SetError("called with illegal arguments, maybe missing "
"a PROPERTIES specifier?");
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index b026ff3..e66d13d 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -62,7 +62,7 @@ bool cmSetTestsPropertiesCommand
return false;
}
}
- if(propertyPairs.size() == 0)
+ if(propertyPairs.empty())
{
this->SetError("called with illegal arguments, maybe "
"missing a PROPERTIES specifier?");
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index e61caab..927888b 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -66,7 +66,7 @@ bool cmSiteNameCommand
&host, 0, 0, cmSystemTools::OUTPUT_NONE);
// got the hostname
- if (host.length())
+ if (!host.empty())
{
// remove any white space from the host name
std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*";
@@ -77,7 +77,7 @@ bool cmSiteNameCommand
host = hostReg.match(1);
}
- if(host.length())
+ if(!host.empty())
{
siteName = host;
}
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 6fe5c62..6847475 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -24,7 +24,7 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
this->CustomCommand = 0;
this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
this->FindFullPathFailed = false;
- this->IsUiFile = ("ui" ==
+ this->IsUiFile = (".ui" ==
cmSystemTools::GetFilenameLastExtension(this->Location.GetName()));
}
@@ -202,7 +202,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
}
}
- cmOStringStream e;
+ std::ostringstream e;
std::string missing = this->Location.GetDirectory();
if(!missing.empty())
{
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index edba5ba..1741e05 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -90,7 +90,7 @@ bool cmSourceGroupCommand
}
else
{
- cmOStringStream err;
+ std::ostringstream err;
err << "Unknown argument \"" << args[i] << "\". "
<< "Perhaps the FILES keyword is missing.\n";
this->SetError(err.str());
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 6b85634..646300d 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -16,8 +16,6 @@
#ifndef cmStandardIncludes_h
#define cmStandardIncludes_h
-// include configure generated header to define CMAKE_NO_ANSI_STREAM_HEADERS,
-// CMAKE_NO_STD_NAMESPACE, and other macros.
#include <cmConfigure.h>
#include <cmsys/Configure.hxx>
@@ -25,7 +23,6 @@
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 )
#pragma warning ( disable : 4512 ) /* operator=() could not be generated */
-#define CMAKE_NO_ANSI_FOR_SCOPE
#endif
@@ -37,35 +34,12 @@
// Provide fixed-size integer types.
#include <cmIML/INT.h>
-#include <stdarg.h> // Work-around for SGI MIPSpro 7.4.2m header bug
-
-// This is a hack to prevent warnings about these functions being
-// declared but not referenced.
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 3970 /* conversion from pointer to same-sized */
-# include <sys/termios.h>
-class cmStandardIncludesHack
-{
-public:
- enum
- {
- Ref1 = sizeof(cfgetospeed(0)),
- Ref2 = sizeof(cfgetispeed(0)),
- Ref3 = sizeof(tcgetattr(0, 0)),
- Ref4 = sizeof(tcsetattr(0, 0, 0)),
- Ref5 = sizeof(cfsetospeed(0,0)),
- Ref6 = sizeof(cfsetispeed(0,0))
- };
-};
-#endif
-
// Include stream compatibility layer from KWSys.
// This is needed to work with large file support
// on some platforms whose stream operators do not
// support the large integer types.
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <cmsys/IOStream.hxx>
-# undef GetCurrentDirectory // Borland <iosfwd> includes windows.h
#endif
// Avoid warnings in system headers.
@@ -73,23 +47,10 @@ public:
# pragma warning (push,1)
#endif
-#ifndef CMAKE_NO_ANSI_STREAM_HEADERS
-# include <fstream>
-# include <iostream>
-# include <iomanip>
-#else
-# include <fstream.h>
-# include <iostream.h>
-# include <iomanip.h>
-#endif
-
-#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
-# include <sstream>
-#elif !defined(CMAKE_NO_ANSI_STREAM_HEADERS)
-# include <strstream>
-#else
-# include <strstream.h>
-#endif
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
// we must have stl with the standard include style
#include <vector>
@@ -111,195 +72,18 @@ public:
#include <stdio.h>
#include <stdlib.h>
-// Borland C++ defines several of the stdlib.h and string.h symbols in
-// sub-headers search.h and mem.h. These sub-headers have using
-// declarations to pull functions from the std namespace to the global
-// namespace, but they are defined only if the header was not included
-// through the C++-style cstdlib or cstring header. These outer
-// headers are included by the streams library in C++-style and
-// include blockers are put in place that prevent including the
-// C-style versions from ever including the sub-headers. Therefore we
-// have to include the sub-headers here to get the using declarations.
-
-
-#if !defined(_WIN32) && defined(__COMO__)
-// Hack for como strict mode to avoid defining _SVID_SOURCE or _BSD_SOURCE.
-extern "C"
-{
-extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
-extern int pclose (FILE *__stream) __THROW;
-extern char *realpath (__const char *__restrict __name,
- char *__restrict __resolved) __THROW;
-extern char *strdup (__const char *__s) __THROW;
-extern int putenv (char *__string) __THROW;
-}
-#endif
-
-// if std:: is not supported, then just #define it away
-#ifdef CMAKE_NO_STD_NAMESPACE
-#define std
-#endif
-
-// if the compiler does not support ansi for scoping of vars use a
-// #define hack
-#ifdef CMAKE_NO_ANSI_FOR_SCOPE
-#define for if(false) {} else for
-#endif
-
-// Provide std::ios_base on ancient GCC 2.9x
-#if defined(__GNUC__) && __GNUC__ < 3
-namespace std { typedef ios ios_base; }
-#endif
-
-// check for the 720 compiler on the SGI
-// which has some strange properties that I don't think are worth
-// checking for in a general way in configure
-#if defined(__sgi) && !defined(__GNUC__)
-# if (_COMPILER_VERSION >= 730)
-# define CM_SGI_CC_730
-# elif (_COMPILER_VERSION >= 720)
-# define CM_HAS_STD_BUT_NOT_FOR_IOSTREAM
-# endif
-#endif
-
-#ifdef __DECCXX_VER
-# if __DECCXX_VER <= 60390008
-# define CM_HAS_STD_BUT_NOT_FOR_IOSTREAM
-# endif
-#endif
-
#if defined( _MSC_VER )
typedef unsigned short mode_t;
#endif
-
-#ifdef CM_HAS_STD_BUT_NOT_FOR_IOSTREAM
-// some compilers have std:: but not for the stream library,
-// so we have to bring it into the std namespace by hand.
-namespace std {
-using ::ostream;
-using ::istream;
-using ::ios;
-using ::cout;
-using ::cerr;
-using ::cin;
-using ::ifstream;
-using ::ofstream;
-
-#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
- using ::ostringstream;
- using ::istringstream;
-#else
- using ::ostrstream;
- using ::istrstream;
-#endif
-
-using ::endl;
-using ::ends;
-using ::flush;
-using ::dec;
-using ::hex;
-using ::setw;
-using ::setiosflags;
-using ::setfill;
-using ::setprecision;
-}
-// The string class is missing these operators so add them
-#if !defined(cmsys_STL_STRING_NEQ_CHAR_DEFINED)
-# define cmsys_STL_STRING_NO_NEQ_CHAR
-inline bool operator!=(std::string const& a, const char* b)
-{ return !(a==std::string(b)); }
-#endif
-
-inline bool operator==(std::string const& a, const char* b)
-{ return (a==std::string(b)); }
-# endif // end CM_SGI_CC_720
-
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
// use this class to shrink the size of symbols in .o files
// std::string is really basic_string<....lots of stuff....>
// when combined with a map or set, the symbols can be > 2000 chars!
#include <cmsys/String.hxx>
//typedef cmsys::String std::string;
-// Define cmOStringStream and cmIStringStream wrappers to hide
-// differences between std::stringstream and the old strstream.
-#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
-class cmOStringStream: public std::ostringstream
-{
-public:
- cmOStringStream();
- ~cmOStringStream();
-private:
- cmOStringStream(const cmOStringStream&);
- void operator=(const cmOStringStream&);
-};
-class cmIStringStream: public std::istringstream
-{
-public:
- typedef std::istringstream Superclass;
- cmIStringStream() {}
- cmIStringStream(const std::string& s): Superclass(s) {}
-private:
- cmIStringStream(const cmIStringStream&);
- void operator=(const cmIStringStream&);
-};
-#else
-class cmOStrStreamCleanup
-{
-public:
- cmOStrStreamCleanup(std::ostrstream& ostr): OStrStream(ostr) {}
- ~cmOStrStreamCleanup() { this->OStrStream.rdbuf()->freeze(0); }
- static void IgnoreUnusedVariable(const cmOStrStreamCleanup&) {}
-protected:
- std::ostrstream& OStrStream;
-};
-
-class cmOStringStream: public std::ostrstream
-{
-public:
- typedef std::ostrstream Superclass;
- cmOStringStream() {}
- std::string str()
- {
- cmOStrStreamCleanup cleanup(*this);
- cmOStrStreamCleanup::IgnoreUnusedVariable(cleanup);
- int pcount = this->pcount();
- const char* ptr = this->Superclass::str();
- return std::string(ptr?ptr:"", pcount);
- }
-private:
- cmOStringStream(const cmOStringStream&);
- void operator=(const cmOStringStream&);
-};
-
-class cmIStringStream: private std::string, public std::istrstream
-{
-public:
- typedef std::string StdString;
- typedef std::istrstream IStrStream;
- cmIStringStream(): StdString(), IStrStream(StdString::c_str()) {}
- cmIStringStream(const std::string& s):
- StdString(s), IStrStream(StdString::c_str()) {}
- std::string str() const { return *this; }
- void str(const std::string& s)
- {
- // Very dangerous. If this throws, the object is hosed. When the
- // destructor is later called, the program is hosed too.
- this->~cmIStringStream();
- new (this) cmIStringStream(s);
- }
-private:
- cmIStringStream(const cmIStringStream&);
- void operator=(const cmIStringStream&);
-};
-#endif
-
/* Poison this operator to avoid common mistakes. */
-extern void operator << (std::ostream&, const cmOStringStream&);
+extern void operator << (std::ostream&, const std::ostringstream&);
/** Standard documentation entry for cmDocumentation's formatting. */
struct cmDocumentationEntry
@@ -332,10 +116,6 @@ public:
typedef Superclass::const_iterator const_iterator;
};
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma reset woff 1375 /* base class destructor not virtual */
-#endif
-
// All subclasses of cmCommand or cmCTestGenericHandler should
// invoke this macro.
#define cmTypeMacro(thisClass,superclass) \
@@ -363,6 +143,33 @@ static thisClass* SafeDownCast(cmObject *c) \
} \
class cmTypeMacro_UseTrailingSemicolon
+template<typename Range>
+std::string cmJoin(Range const& r, const char* delimiter)
+{
+ if (r.empty())
+ {
+ return std::string();
+ }
+ std::ostringstream os;
+ typedef typename Range::value_type ValueType;
+ typedef typename Range::const_iterator InputIt;
+ InputIt first = r.begin();
+ InputIt last = r.end();
+ --last;
+ std::copy(first, last,
+ std::ostream_iterator<ValueType>(os, delimiter));
+
+ os << *last;
+
+ return os.str();
+}
+
+template<typename Range>
+std::string cmJoin(Range const& r, std::string delimiter)
+{
+ return cmJoin(r, delimiter.c_str());
+};
+
inline bool cmHasLiteralPrefixImpl(const std::string &str1,
const char *str2,
size_t N)
@@ -393,20 +200,6 @@ inline bool cmHasLiteralSuffixImpl(const char* str1,
return len >= N && strcmp(str1 + len - N, str2) == 0;
}
-#if defined(__GNUC__) && __GNUC__ < 3
-
-#define cmArrayBegin(a) a
-#define cmArraySize(a) (sizeof(a)/sizeof(*a))
-#define cmArrayEnd(a) a + cmArraySize(a)
-
-#define cmHasLiteralPrefix(STR1, STR2) \
- cmHasLiteralPrefixImpl(STR1, "" STR2 "", sizeof(STR2) - 1)
-
-#define cmHasLiteralSuffix(STR1, STR2) \
- cmHasLiteralSuffixImpl(STR1, "" STR2 "", sizeof(STR2) - 1)
-
-#else
-
template<typename T, size_t N>
const T* cmArrayBegin(const T (&a)[N]) { return a; }
template<typename T, size_t N>
@@ -426,8 +219,6 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
return cmHasLiteralSuffixImpl(str1, str2, N - 1);
}
-#endif
-
struct cmStrCmp {
cmStrCmp(const char *test) : m_test(test) {}
cmStrCmp(const std::string &test) : m_test(test) {}
@@ -446,4 +237,44 @@ private:
const std::string m_test;
};
+namespace ContainerAlgorithms {
+
+template<typename T>
+struct cmIsPair
+{
+ enum { value = false };
+};
+
+template<typename K, typename V>
+struct cmIsPair<std::pair<K, V> >
+{
+ enum { value = true };
+};
+
+template<typename Container,
+ bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value>
+struct DefaultDeleter
+{
+ void operator()(typename Container::value_type value) {
+ delete value;
+ }
+};
+
+template<typename Container>
+struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
+{
+ void operator()(typename Container::value_type value) {
+ delete value.second;
+ }
+};
+
+}
+
+template<typename Container>
+void cmDeleteAll(Container const& c)
+{
+ std::for_each(c.begin(), c.end(),
+ ContainerAlgorithms::DefaultDeleter<Container>());
+}
+
#endif
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index 981e03e..bd08ac7 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -25,12 +25,6 @@
# pragma warning ( disable : 4786 )
#endif
-/* Make sure SGI termios does not define ECHO differently. */
-#if defined(__sgi) && !defined(__GNUC__)
-# include <sys/termios.h>
-# undef ECHO
-#endif
-
/* Define isatty on windows. */
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h>
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 8341027..3e606d7 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -122,7 +122,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
#if defined(CMAKE_BUILD_WITH_CMAKE)
if(args.size() != 3)
{
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " requires an output variable and an input string";
this->SetError(e.str());
return false;
@@ -137,7 +137,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
}
return false;
#else
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " not available during bootstrap";
this->SetError(e.str().c_str());
return false;
@@ -233,7 +233,7 @@ bool cmStringCommand::HandleConfigureCommand(
}
else
{
- cmOStringStream err;
+ std::ostringstream err;
err << "Unrecognized argument \"" << args[i] << "\"";
this->SetError(err.str());
return false;
@@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
this->SetError(e);
return false;
}
- if(output.length() > 0)
+ if(!output.empty())
{
output += ";";
}
@@ -591,7 +591,7 @@ bool cmStringCommand::HandleFindCommand(std::vector<std::string> const&
}
if(std::string::npos != pos)
{
- cmOStringStream s;
+ std::ostringstream s;
s << pos;
this->Makefile->AddDefinition(outvar, s.str().c_str());
return true;
@@ -705,7 +705,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
int intStringLength = static_cast<int>(stringLength);
if ( begin < 0 || begin > intStringLength )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "begin index: " << begin << " is out of range 0 - "
<< stringLength;
this->SetError(ostr.str());
@@ -713,7 +713,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
}
if ( end < -1 )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "end index: " << end << " should be -1 or greater";
this->SetError(ostr.str());
return false;
@@ -898,7 +898,7 @@ bool cmStringCommand
}
}
}
- if ( !alphabet.size() )
+ if (alphabet.empty())
{
alphabet = cmStringCommandDefaultAlphabet;
}
@@ -1089,7 +1089,7 @@ bool cmStringCommand
this->Makefile->AddDefinition(outputVariable, uuid.c_str());
return true;
#else
- cmOStringStream e;
+ std::ostringstream e;
e << args[0] << " not available during bootstrap";
this->SetError(e.str().c_str());
return false;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1c8c387..e9735ed 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -79,10 +79,6 @@ public:
#endif
};
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
#if !defined(HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
// For GetEnvironmentVariables
# if defined(_WIN32)
@@ -828,18 +824,12 @@ bool cmSystemTools::RunSingleCommand(
std::string
cmSystemTools::PrintSingleCommand(std::vector<std::string> const& command)
{
- std::string commandStr;
- const char* sep = "";
- for(std::vector<std::string>::const_iterator i = command.begin();
- i != command.end(); ++i)
+ if (command.empty())
{
- commandStr += sep;
- commandStr += "\"";
- commandStr += *i;
- commandStr += "\"";
- sep = " ";
+ return std::string();
}
- return commandStr;
+
+ return "\"" + cmJoin(command, "\" \"") + "\"";
}
bool cmSystemTools::DoesFileExistWithExtensions(
@@ -1162,7 +1152,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
std::string path = cmSystemTools::GetFilenamePath(glob);
std::string ppath = cmSystemTools::GetFilenameName(glob);
ppath = ppath.substr(0, ppath.size()-1);
- if ( path.size() == 0 )
+ if (path.empty())
{
path = "/";
}
@@ -1273,11 +1263,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
{
std::vector<std::string> temp;
bool res = Superclass::Split(s, temp);
- for(std::vector<std::string>::const_iterator i = temp.begin();
- i != temp.end(); ++i)
- {
- l.push_back(*i);
- }
+ l.insert(l.end(), temp.begin(), temp.end());
return res;
}
@@ -1482,7 +1468,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<std::string>& files,
- bool gzip, bool bzip2, bool verbose)
+ cmTarCompression compressType,
+ bool verbose, std::string const& mtime)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1496,10 +1483,25 @@ bool cmSystemTools::CreateTar(const char* outFileName,
cmSystemTools::Error(e.c_str());
return false;
}
- cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
- (bzip2? cmArchiveWrite::CompressBZip2 :
- cmArchiveWrite::CompressNone)),
- cmArchiveWrite::TypeTAR);
+ cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
+ switch (compressType)
+ {
+ case TarCompressGZip:
+ compress = cmArchiveWrite::CompressGZip;
+ break;
+ case TarCompressBZip2:
+ compress = cmArchiveWrite::CompressBZip2;
+ break;
+ case TarCompressXZ:
+ compress = cmArchiveWrite::CompressXZ;
+ break;
+ case TarCompressNone:
+ compress = cmArchiveWrite::CompressNone;
+ break;
+ }
+ cmArchiveWrite a(fout, compress,
+ cmArchiveWrite::TypeTAR);
+ a.SetMTime(mtime);
a.SetVerbose(verbose);
for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
@@ -1524,7 +1526,6 @@ bool cmSystemTools::CreateTar(const char* outFileName,
#else
(void)outFileName;
(void)files;
- (void)gzip;
(void)verbose;
return false;
#endif
@@ -1785,7 +1786,7 @@ bool extract_tar(const char* outFileName, bool verbose,
#endif
bool cmSystemTools::ExtractTar(const char* outFileName,
- bool , bool verbose)
+ bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
return extract_tar(outFileName, verbose, true);
@@ -1797,7 +1798,6 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
}
bool cmSystemTools::ListTar(const char* outFileName,
- bool ,
bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2505,7 +2505,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
}
if(emsg)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The current " << se_name[i] << " is:\n"
<< " " << se[i]->Value << "\n"
<< "which does not contain:\n"
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d49af74..361f42e 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -383,13 +383,20 @@ public:
static void EnableVSConsoleOutput();
/** Create tar */
+ enum cmTarCompression
+ {
+ TarCompressGZip,
+ TarCompressBZip2,
+ TarCompressXZ,
+ TarCompressNone
+ };
static bool ListTar(const char* outFileName,
- bool gzip, bool verbose);
+ bool verbose);
static bool CreateTar(const char* outFileName,
- const std::vector<std::string>& files, bool gzip,
- bool bzip2, bool verbose);
- static bool ExtractTar(const char* inFileName, bool gzip,
- bool verbose);
+ const std::vector<std::string>& files,
+ cmTarCompression compressType, bool verbose,
+ std::string const& mtime = std::string());
+ static bool ExtractTar(const char* inFileName, bool verbose);
// This should be called first thing in main
// it will keep child processes from inheriting the
// stdin and stdout of this process. This is important
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 94a6de3..98cb75c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -226,13 +226,7 @@ cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
static void deleteAndClear(
std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
{
- for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
- it = entries.begin(),
- end = entries.end();
- it != end; ++it)
- {
- delete *it;
- }
+ cmDeleteAll(entries);
entries.clear();
}
@@ -424,12 +418,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories();
- for (std::set<std::string>::const_iterator it
- = parentSystemIncludes.begin();
- it != parentSystemIncludes.end(); ++it)
- {
- this->SystemIncludeDirectories.insert(*it);
- }
+ this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
+ parentSystemIncludes.end());
const std::vector<cmValueWithOrigin> parentOptions =
this->Makefile->GetCompileOptionsEntries();
@@ -548,12 +538,8 @@ void cmTarget::ClearLinkMaps()
this->Internal->LinkInterfaceMap.clear();
this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
this->Internal->LinkClosureMap.clear();
- for (cmTargetLinkInformationMap::const_iterator it
- = this->LinkInformation.begin();
- it != this->LinkInformation.end(); ++it)
- {
- delete it->second;
- }
+ this->Internal->SourceFilesMap.clear();
+ cmDeleteAll(this->LinkInformation);
this->LinkInformation.clear();
}
@@ -686,7 +672,7 @@ static bool processSources(cmTarget const* tgt,
if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str()))
{
- cmOStringStream err;
+ std::ostringstream err;
if (!targetName.empty())
{
err << "Target \"" << targetName << "\" contains relative "
@@ -863,7 +849,7 @@ cmTarget::GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const
thisConfigFiles += (*fi)->GetFullPath();
sep = "\n ";
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << this->Name << "\" has source files which vary by "
"configuration. This is not supported by the \""
<< this->Makefile->GetLocalGenerator()
@@ -923,16 +909,7 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
//----------------------------------------------------------------------------
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
{
- std::string srcFiles;
- const char* sep = "";
- for(std::vector<std::string>::const_iterator i = srcs.begin();
- i != srcs.end(); ++i)
- {
- std::string filename = *i;
- srcFiles += sep;
- srcFiles += filename;
- sep = ";";
- }
+ std::string srcFiles = cmJoin(srcs, ";");
if (!srcFiles.empty())
{
this->Internal->SourceFilesMap.clear();
@@ -996,7 +973,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s)
this->Makefile->ExpandVariablesInString(src);
if (src != s)
{
- cmOStringStream e;
+ std::ostringstream e;
bool noMessage = false;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049))
@@ -1279,7 +1256,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
}
//----------------------------------------------------------------------------
-void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
+void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
TLLSignature sig) const
{
std::vector<cmListFileBacktrace> sigs;
@@ -1307,7 +1284,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
if(i != it->end())
{
cmListFileContext const& lfc = *i;
- cmOStringStream line;
+ std::ostringstream line;
line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
if (emitted.insert(line.str()).second)
{
@@ -1397,22 +1374,14 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
void
cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{
- for(std::set<std::string>::const_iterator li = incs.begin();
- li != incs.end(); ++li)
- {
- this->SystemIncludeDirectories.insert(*li);
- }
+ this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
}
//----------------------------------------------------------------------------
void
cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
{
- for(std::vector<std::string>::const_iterator li = incs.begin();
- li != incs.end(); ++li)
- {
- this->SystemIncludeDirectories.insert(*li);
- }
+ this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
}
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -1539,7 +1508,7 @@ cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf )
{
// skip zero size library entries, this may happen
// if a variable expands to nothing.
- if (lib->first.size() != 0)
+ if (!lib->first.empty())
{
this->EmitForVS6( *lib, dep_map, done, visited, newLinkLibrariesForVS6 );
}
@@ -1679,7 +1648,7 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf,
while( end != std::string::npos )
{
std::string l = depline.substr( start, end-start );
- if( l.size() != 0 )
+ if(!l.empty())
{
if (l == "debug")
{
@@ -1749,7 +1718,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
"The property \"" << prop << "\" is not allowed.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1757,7 +1726,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
else if (prop == "NAME")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
@@ -1800,7 +1769,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1816,7 +1785,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
{
if(this->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "SOURCES property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1844,7 +1813,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
"The property \"" << prop << "\" is not allowed.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1852,7 +1821,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if (prop == "NAME")
{
- cmOStringStream e;
+ std::ostringstream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
@@ -1887,7 +1856,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1902,7 +1871,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
{
if(this->IsImported())
{
- cmOStringStream e;
+ std::ostringstream e;
e << "SOURCES property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -1931,7 +1900,7 @@ std::string cmTarget::GetExportName() const
{
if (!cmGeneratorExpression::IsValidTargetName(exportName))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "EXPORT_NAME property \"" << exportName << "\" for \""
<< this->GetName() << "\": is not valid.";
cmSystemTools::Error(e.str().c_str());
@@ -2043,7 +2012,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
if (fromImported
&& !cmSystemTools::FileExists(li->c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::FATAL_ERROR;
if (checkCMP0027)
{
@@ -2076,7 +2045,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
if (!cmSystemTools::FileIsFullPath(li->c_str()))
{
- cmOStringStream e;
+ std::ostringstream e;
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
if (!targetName.empty())
@@ -2426,7 +2395,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
{
case cmPolicies::WARN:
{
- cmOStringStream e;
+ std::ostringstream e;
e << this->Makefile->GetCMakeInstance()->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0043);
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
@@ -2559,7 +2528,7 @@ static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
"LINK_INTERFACE_LIBRARIES");
// Report an error.
- cmOStringStream e;
+ std::ostringstream e;
e << "Property " << prop << " may not contain link-type keyword \""
<< keys.match(2) << "\". "
<< "The " << base << " property has a per-configuration "
@@ -2596,7 +2565,7 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
}
// Report an error.
- cmOStringStream e;
+ std::ostringstream e;
e << "Property INTERFACE_LINK_LIBRARIES may not contain link-type "
"keyword \"" << keys.match(2) << "\". The INTERFACE_LINK_LIBRARIES "
@@ -2895,7 +2864,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{
return true;
}
- cmOStringStream e;
+ std::ostringstream e;
const char *modal = 0;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch (context->GetPolicyStatus(cmPolicies::CMP0026))
@@ -2954,7 +2923,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "INTERFACE_LIBRARY targets may only have whitelisted properties. "
"The property \"" << prop << "\" is not allowed.";
context->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -3130,7 +3099,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
return 0;
}
- cmOStringStream ss;
+ std::ostringstream ss;
const char* sep = "";
typedef cmTargetInternals::TargetPropertyEntry
TargetPropertyEntry;
@@ -3160,7 +3129,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
bool addContent = false;
bool noMessage = true;
- cmOStringStream e;
+ std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(context->GetPolicyStatus(cmPolicies::CMP0051))
{
@@ -3258,7 +3227,7 @@ public:
{
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
+ std::ostringstream e;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
{
case cmPolicies::WARN:
@@ -3379,7 +3348,7 @@ public:
}
else if(this->Preferred.size() > 1)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target " << this->Target->GetName()
<< " contains multiple languages with the highest linker preference"
<< " (" << this->Preference << "):\n";
@@ -3751,7 +3720,7 @@ bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
{
- cmOStringStream w;
+ std::ostringstream w;
w << "Attempting to use";
if(macosx_rpath)
{
@@ -5049,7 +5018,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
report += compatibilityAgree(t, propContent != consistent.second);
if (!consistent.first)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Property " << p << " on target \""
<< tgt->GetName() << "\" does\nnot match the "
"INTERFACE_" << p << " property requirement\nof "
@@ -5082,7 +5051,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
report += compatibilityAgree(t, propContent != consistent.second);
if (!consistent.first)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Property " << p << " on target \""
<< tgt->GetName() << "\" is\nimplied to be " << defaultValue
<< " because it was used to determine the link libraries\n"
@@ -5116,7 +5085,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
report += compatibilityAgree(t, propContent != consistent.second);
if (!consistent.first)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The INTERFACE_" << p << " property of \""
<< theTarget->GetName() << "\" does\nnot agree with the value "
"of " << p << " already determined\nfor \""
@@ -6024,7 +5993,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
if (newExplicitLibraries
&& strcmp(newExplicitLibraries, explicitLibraries) != 0)
{
- cmOStringStream w;
+ std::ostringstream w;
w <<
(thisTarget->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
@@ -6070,8 +6039,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// The link implementation is the default link interface.
cmTarget::LinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
- std::copy(impl->Libraries.begin(), impl->Libraries.end(),
- std::back_inserter(iface.Libraries));
+ iface.Libraries.insert(iface.Libraries.end(),
+ impl->Libraries.begin(), impl->Libraries.end());
if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && !usage_requirements_only)
{
@@ -6088,30 +6057,14 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
}
if (ifaceLibs != iface.Libraries)
{
- std::string oldLibraries;
- std::string newLibraries;
- const char *sep = "";
- for(std::vector<cmLinkImplItem>::const_iterator it
- = impl->Libraries.begin(); it != impl->Libraries.end(); ++it)
- {
- oldLibraries += sep;
- oldLibraries += *it;
- sep = ";";
- }
- sep = "";
- for(std::vector<cmLinkItem>::const_iterator it
- = ifaceLibs.begin(); it != ifaceLibs.end(); ++it)
- {
- newLibraries += sep;
- newLibraries += *it;
- sep = ";";
- }
+ std::string oldLibraries = cmJoin(impl->Libraries, ";");
+ std::string newLibraries = cmJoin(ifaceLibs, ";");
if(oldLibraries.empty())
{ oldLibraries = "(empty)"; }
if(newLibraries.empty())
{ newLibraries = "(empty)"; }
- cmOStringStream w;
+ std::ostringstream w;
w <<
(thisTarget->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
@@ -6366,7 +6319,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
{
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
+ std::ostringstream e;
switch(thisTarget->GetPolicyStatusCMP0038())
{
case cmPolicies::WARN:
@@ -6449,11 +6402,8 @@ cmTargetInternals::ComputeLinkImplementationLanguages(
// Get languages used in our source files.
thisTarget->GetLanguages(languages, config);
// Copy the set of langauges to the link implementation.
- for(std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li)
- {
- impl.Languages.push_back(*li);
- }
+ impl.Languages.insert(impl.Languages.begin(),
+ languages.begin(), languages.end());
}
//----------------------------------------------------------------------------
@@ -6472,7 +6422,7 @@ cmTarget const* cmTarget::FindTargetToLink(std::string const& name) const
if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to "
"OBJECT library \"" << tgt->GetName() << "\" but this is not "
"allowed. "
@@ -6511,7 +6461,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
{
case cmPolicies::WARN:
{
- cmOStringStream w;
+ std::ostringstream w;
w << (this->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0004)) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
@@ -6523,7 +6473,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
break;
case cmPolicies::NEW:
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace. "
<< "This is now an error according to policy CMP0004.";
@@ -6533,7 +6483,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
- cmOStringStream e;
+ std::ostringstream e;
e << (this->Makefile->GetPolicies()
->GetRequiredPolicyError(cmPolicies::CMP0004)) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
@@ -6614,7 +6564,7 @@ void checkPropertyConsistency(cmTarget const* depender,
std::string pfile = pdir + pname + ".rst";
if(cmSystemTools::FileExists(pfile.c_str(), true))
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Target \"" << dependee->GetName() << "\" has property \""
<< *pi << "\" listed in its " << propName << " property. "
"This is not allowed. Only user-defined properties may appear "
@@ -6776,7 +6726,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
{
propsString += " and the " + *props.begin();
}
- cmOStringStream e;
+ std::ostringstream e;
e << "Property \"" << prop << "\" appears in both the "
<< propsString <<
" property in the dependencies of target \"" << this->GetName() <<
@@ -6919,10 +6869,7 @@ cmTargetLinkInformationMap
//----------------------------------------------------------------------------
cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
{
- for(derived::iterator i = this->begin(); i != this->end(); ++i)
- {
- delete i->second;
- }
+ cmDeleteAll(*this);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a3ecca0..ddd9859 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -202,7 +202,7 @@ public:
PlainTLLSignature
};
bool PushTLLCommandTrace(TLLSignature signature);
- void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
+ void GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const;
void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname,
const LinkLibraryVectorType& libs );
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 66d8ad3..dc19720 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -20,7 +20,7 @@ bool cmTargetCompileDefinitionsCommand
void cmTargetCompileDefinitionsCommand
::HandleImportedTarget(const std::string &tgt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile definitions for imported target \""
<< tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -29,7 +29,7 @@ void cmTargetCompileDefinitionsCommand
void cmTargetCompileDefinitionsCommand
::HandleMissingTarget(const std::string &name)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile definitions for target \"" << name << "\" "
"which is not built by this project.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 10daad4..6ebc31e 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -21,7 +21,7 @@ bool cmTargetCompileFeaturesCommand::InitialPass(
void cmTargetCompileFeaturesCommand
::HandleImportedTarget(const std::string &tgt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile features for imported target \""
<< tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -30,7 +30,7 @@ void cmTargetCompileFeaturesCommand
void cmTargetCompileFeaturesCommand
::HandleMissingTarget(const std::string &name)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile features for target \"" << name << "\" "
"which is not built by this project.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -40,15 +40,7 @@ void cmTargetCompileFeaturesCommand
std::string cmTargetCompileFeaturesCommand
::Join(const std::vector<std::string> &content)
{
- std::string defs;
- std::string sep;
- for(std::vector<std::string>::const_iterator it = content.begin();
- it != content.end(); ++it)
- {
- defs += sep + *it;
- sep = ";";
- }
- return defs;
+ return cmJoin(content, ";");
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 3fb76a6..8c6fc06 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -20,7 +20,7 @@ bool cmTargetCompileOptionsCommand
void cmTargetCompileOptionsCommand
::HandleImportedTarget(const std::string &tgt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile options for imported target \""
<< tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -29,7 +29,7 @@ void cmTargetCompileOptionsCommand
void cmTargetCompileOptionsCommand
::HandleMissingTarget(const std::string &name)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify compile options for target \"" << name << "\" "
"which is not built by this project.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -39,15 +39,7 @@ void cmTargetCompileOptionsCommand
std::string cmTargetCompileOptionsCommand
::Join(const std::vector<std::string> &content)
{
- std::string defs;
- std::string sep;
- for(std::vector<std::string>::const_iterator it = content.begin();
- it != content.end(); ++it)
- {
- defs += sep + *it;
- sep = ";";
- }
- return defs;
+ return cmJoin(content, ";");
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index e9f0e04..b638e57 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -25,7 +25,7 @@ bool cmTargetIncludeDirectoriesCommand
void cmTargetIncludeDirectoriesCommand
::HandleImportedTarget(const std::string &tgt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify include directories for imported target \""
<< tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -35,7 +35,7 @@ void cmTargetIncludeDirectoriesCommand
void cmTargetIncludeDirectoriesCommand
::HandleMissingTarget(const std::string &name)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify include directories for target \"" << name << "\" "
"which is not built by this project.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -91,15 +91,7 @@ void cmTargetIncludeDirectoriesCommand
if (system)
{
- std::string joined;
- std::string sep;
- for(std::vector<std::string>::const_iterator it = content.begin();
- it != content.end(); ++it)
- {
- joined += sep;
- sep = ";";
- joined += *it;
- }
+ std::string joined = cmJoin(content, ";");
tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
joined.c_str());
}
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 56e1338..75c94c5 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -43,7 +43,7 @@ bool cmTargetLinkLibrariesCommand
if(!this->Target)
{
cmake::MessageType t = cmake::FATAL_ERROR; // fail by default
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify link libraries for target \"" << args[0] << "\" "
<< "which is not built by this project.";
// The bad target is the only argument. Check how policy CMP0016 is set,
@@ -92,7 +92,7 @@ bool cmTargetLinkLibrariesCommand
if(this->Target->GetType() == cmTarget::OBJECT_LIBRARY)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Object library target \"" << args[0] << "\" "
<< "may not link to anything.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -102,7 +102,7 @@ bool cmTargetLinkLibrariesCommand
if (this->Target->GetType() == cmTarget::UTILITY)
{
- cmOStringStream e;
+ std::ostringstream e;
const char *modal = 0;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039))
@@ -311,7 +311,7 @@ bool cmTargetLinkLibrariesCommand
// Make sure the last argument was not a library type specifier.
if(haveLLT)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "The \"" << this->LinkLibraryTypeNames[llt]
<< "\" argument must be followed by a library.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -342,7 +342,7 @@ void
cmTargetLinkLibrariesCommand
::LinkLibraryTypeSpecifierWarning(int left, int right)
{
- cmOStringStream w;
+ std::ostringstream w;
w << "Link library type specifier \""
<< this->LinkLibraryTypeNames[left] << "\" is followed by specifier \""
<< this->LinkLibraryTypeNames[right] << "\" instead of a library name. "
@@ -373,7 +373,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature;
if (!this->Target->PushTLLCommandTrace(sig))
{
- cmOStringStream e;
+ std::ostringstream e;
const char *modal = 0;
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023))
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index ce3b11e..0a44d6f 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -24,7 +24,7 @@ bool cmTargetSourcesCommand
void cmTargetSourcesCommand
::HandleImportedTarget(const std::string &tgt)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify sources for imported target \""
<< tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -34,7 +34,7 @@ void cmTargetSourcesCommand
void cmTargetSourcesCommand
::HandleMissingTarget(const std::string &name)
{
- cmOStringStream e;
+ std::ostringstream e;
e << "Cannot specify sources for target \"" << name << "\" "
"which is not built by this project.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -44,15 +44,7 @@ void cmTargetSourcesCommand
std::string cmTargetSourcesCommand
::Join(const std::vector<std::string> &content)
{
- std::string srcs;
- std::string sep;
- for(std::vector<std::string>::const_iterator it = content.begin();
- it != content.end(); ++it)
- {
- srcs += sep + *it;
- sep = ";";
- }
- return srcs;
+ return cmJoin(content, ";");
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 8f2deeb..b5280cf 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -48,7 +48,8 @@ bool cmTryRunCommand
{
++i;
while (i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" &&
- argv[i] != "CMAKE_FLAGS")
+ argv[i] != "CMAKE_FLAGS" &&
+ argv[i] != "LINK_LIBRARIES")
{
runArgs += " ";
runArgs += argv[i];
@@ -104,8 +105,8 @@ bool cmTryRunCommand
// although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder
if (this->OutputVariable.size()
- && ((this->RunOutputVariable.size())
- || (this->CompileOutputVariable.size())))
+ && (!this->RunOutputVariable.empty()
+ || !this->CompileOutputVariable.empty()))
{
cmSystemTools::Error(
"You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
@@ -115,18 +116,18 @@ bool cmTryRunCommand
}
bool captureRunOutput = false;
- if (this->OutputVariable.size())
+ if (!this->OutputVariable.empty())
{
captureRunOutput = true;
tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->OutputVariable);
}
- if (this->CompileOutputVariable.size())
+ if (!this->CompileOutputVariable.empty())
{
tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->CompileOutputVariable);
}
- if (this->RunOutputVariable.size())
+ if (!this->RunOutputVariable.empty())
{
captureRunOutput = true;
}
@@ -140,7 +141,7 @@ bool cmTryRunCommand
// now try running the command if it compiled
if (!res)
{
- if (this->OutputFile.size() == 0)
+ if (this->OutputFile.empty())
{
cmSystemTools::Error(this->FindErrorMessage.c_str());
}
@@ -160,13 +161,13 @@ bool cmTryRunCommand
}
// now put the output into the variables
- if(this->RunOutputVariable.size())
+ if(!this->RunOutputVariable.empty())
{
this->Makefile->AddDefinition(this->RunOutputVariable,
runOutputContents.c_str());
}
- if(this->OutputVariable.size())
+ if(!this->OutputVariable.empty())
{
// if the TryCompileCore saved output in this outputVariable then
// prepend that output to this output
@@ -196,7 +197,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
int retVal = -1;
std::string finalCommand = cmSystemTools::ConvertToRunCommandPath(
this->OutputFile.c_str());
- if (runArgs.size())
+ if (!runArgs.empty())
{
finalCommand += runArgs;
}
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 8d26f86..2ee664f 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -44,7 +44,7 @@ bool cmUseMangledMesaCommand
const char* destDir = args[1].c_str();
std::vector<std::string> files;
cmSystemTools::Glob(inputDir, "\\.h$", files);
- if(files.size() == 0)
+ if(files.empty())
{
cmSystemTools::Error("Could not open Mesa Directory ", inputDir);
return false;
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index ba6b4ac..ee1ff29 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -95,7 +95,7 @@ bool cmUtilitySourceCommand
{
exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
}
- if(exePath.size())
+ if(!exePath.empty())
{
utilityDirectory = exePath;
}
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 8b5b7ae..e2d0049 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -66,7 +66,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
{
output = uuidNamespace;
- if(name.size())
+ if(!name.empty())
{
output.resize(output.size() + name.size());
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index cb6cb12..b8a6df2 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -34,21 +34,16 @@ cmVariableWatch::cmVariableWatch()
{
}
-cmVariableWatch::~cmVariableWatch()
+template<typename C>
+void deleteAllSecond(typename C::value_type it)
{
- cmVariableWatch::StringToVectorOfPairs::iterator svp_it;
-
- for ( svp_it = this->WatchMap.begin();
- svp_it != this->WatchMap.end(); ++svp_it )
- {
- cmVariableWatch::VectorOfPairs::iterator p_it;
+ cmDeleteAll(it.second);
+}
- for ( p_it = svp_it->second.begin();
- p_it != svp_it->second.end(); ++p_it )
- {
- delete *p_it;
- }
- }
+cmVariableWatch::~cmVariableWatch()
+{
+ std::for_each(this->WatchMap.begin(), this->WatchMap.end(),
+ deleteAllSecond<cmVariableWatch::StringToVectorOfPairs>);
}
bool cmVariableWatch::AddWatch(const std::string& variable,
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index debe243..9473008 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -70,7 +70,7 @@ static void cmVariableWatchCommandVariableAccessed(
{
arg.FilePath = "Unknown";
arg.Line = 0;
- cmOStringStream error;
+ std::ostringstream error;
error << "Error in cmake code at\n"
<< arg.FilePath << ":" << arg.Line << ":\n"
<< "A command failed during the invocation of callback \""
@@ -83,7 +83,7 @@ static void cmVariableWatchCommandVariableAccessed(
}
if ( !processed )
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Variable \"" << variable << "\" was accessed using "
<< accessString << " with value \"" << (newValue?newValue:"") << "\".";
makefile->IssueMessage(cmake::LOG, msg.str());
@@ -135,7 +135,7 @@ bool cmVariableWatchCommand
}
if ( variable == "CMAKE_CURRENT_LIST_FILE" )
{
- cmOStringStream ostr;
+ std::ostringstream ostr;
ostr << "cannot be set on the variable: " << variable;
this->SetError(ostr.str());
return false;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b265c0e..a286049 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1211,6 +1211,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
std::string shaderType;
std::string shaderEntryPoint;
std::string shaderModel;
+ std::string shaderAdditionalFlags;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
if(ext == "hlsl")
{
@@ -1233,6 +1234,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
shaderModel = sm;
toolHasSettings = true;
}
+ // Figure out if there's any additional flags to use
+ if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS"))
+ {
+ shaderAdditionalFlags = saf;
+ toolHasSettings = true;
+ }
}
else if(ext == "jpg" ||
ext == "png")
@@ -1342,6 +1349,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
(*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)
<< "</ShaderModel>\n";
}
+ if(!shaderAdditionalFlags.empty())
+ {
+ this->WriteString("<AdditionalOptions>", 3);
+ (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
+ << "</AdditionalOptions>\n";
+ }
this->WriteString("</", 2);
(*this->BuildFileStream) << tool << ">\n";
}
@@ -2749,6 +2762,8 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
this->WriteString("<ApplicationTypeRevision>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(v)
<< "</ApplicationTypeRevision>\n";
+ this->WriteString("<DefaultLanguage>en-US"
+ "</DefaultLanguage>\n", 2);
if(v == "8.1")
{
// Visual Studio 12.0 is necessary for building 8.1 apps
@@ -2783,12 +2798,12 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
if(isAppContainer)
{
this->WriteString("<AppContainerApplication>true"
- "</AppContainerApplication>", 2);
+ "</AppContainerApplication>\n", 2);
}
else if (this->Platform == "ARM")
{
this->WriteString("<WindowsSDKDesktopARMSupport>true"
- "</WindowsSDKDesktopARMSupport>", 2);
+ "</WindowsSDKDesktopARMSupport>\n", 2);
}
}
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 47edb03..5170ead 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
while (isTrue)
{
- if (errorString.size())
+ if (!errorString.empty())
{
std::string err = "had incorrect arguments: ";
unsigned int i;
@@ -120,7 +120,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& )
{
// if the endwhile has arguments, then make sure
// they match the arguments of the matching while
- if (lff.Arguments.size() == 0 ||
+ if (lff.Arguments.empty() ||
lff.Arguments == this->Args)
{
return true;
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 391b874..1d3e0e9 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -54,7 +54,7 @@ int cmXMLParser::ParseFile(const char* file)
return 0;
}
- cmOStringStream str;
+ std::ostringstream str;
str << ifs.rdbuf();
return this->Parse(str.str().c_str());
}
diff --git a/Source/cm_get_date.c b/Source/cm_get_date.c
new file mode 100644
index 0000000..2e0d4bd
--- /dev/null
+++ b/Source/cm_get_date.c
@@ -0,0 +1,16 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cm_get_date.h"
+
+#define __archive_get_date cm_get_date
+
+#include "../Utilities/cmlibarchive/libarchive/archive_getdate.c"
diff --git a/Source/cm_get_date.h b/Source/cm_get_date.h
new file mode 100644
index 0000000..d5f6d3e
--- /dev/null
+++ b/Source/cm_get_date.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cm_get_date_h
+#define cm_get_date_h
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Parse a date/time string. Treat relative times with respect to 'now'. */
+time_t cm_get_date(time_t now, const char *str);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index bbd3fe4..652e451 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -171,16 +171,8 @@ cmake::~cmake()
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
}
- for(RegisteredCommandsMap::iterator j = this->Commands.begin();
- j != this->Commands.end(); ++j)
- {
- delete (*j).second;
- }
- for(RegisteredGeneratorsVector::iterator j = this->Generators.begin();
- j != this->Generators.end(); ++j)
- {
- delete *j;
- }
+ cmDeleteAll(this->Commands);
+ cmDeleteAll(this->Generators);
#ifdef CMAKE_BUILD_WITH_CMAKE
delete this->VariableWatch;
#endif
@@ -324,7 +316,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
if(arg.find("-D",0) == 0)
{
std::string entry = arg.substr(2);
- if(entry.size() == 0)
+ if(entry.empty())
{
++i;
if(i < args.size())
@@ -388,7 +380,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
else if(arg.find("-U",0) == 0)
{
std::string entryPattern = arg.substr(2);
- if(entryPattern.size() == 0)
+ if(entryPattern.empty())
{
++i;
if(i < args.size())
@@ -432,7 +424,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
else if(arg.find("-C",0) == 0)
{
std::string path = arg.substr(2);
- if ( path.size() == 0 )
+ if (path.empty())
{
++i;
if(i < args.size())
@@ -445,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
}
- std::cerr << "loading initial cache file " << path << "\n";
+ std::cout << "loading initial cache file " << path << "\n";
this->ReadListFile(args, path.c_str());
}
else if(arg.find("-P",0) == 0)
@@ -457,7 +449,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
std::string path = args[i];
- if ( path.size() == 0 )
+ if (path.empty())
{
cmSystemTools::Error("No cmake script provided.");
return false;
@@ -771,7 +763,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-A",0) == 0)
{
std::string value = arg.substr(2);
- if(value.size() == 0)
+ if(value.empty())
{
++i;
if(i >= args.size())
@@ -792,7 +784,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-T",0) == 0)
{
std::string value = arg.substr(2);
- if(value.size() == 0)
+ if(value.empty())
{
++i;
if(i >= args.size())
@@ -813,7 +805,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-G",0) == 0)
{
std::string value = arg.substr(2);
- if(value.size() == 0)
+ if(value.empty())
{
++i;
if(i >= args.size())
@@ -917,7 +909,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
}
// If there is a CMakeCache.txt file, use its settings.
- if(cachePath.length() > 0)
+ if(!cachePath.empty())
{
cmCacheManager* cachem = this->GetCacheManager();
cmCacheManager::CacheIterator it = cachem->NewIterator();
@@ -933,7 +925,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
}
// If there is a CMakeLists.txt file, use it as the source tree.
- if(listPath.length() > 0)
+ if(!listPath.empty())
{
this->SetHomeDirectory(listPath);
this->SetStartDirectory(listPath);
@@ -1131,13 +1123,13 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
// restore the original environment variables CXX and CC
// Restore CC
std::string env = "CC=";
- if(this->CCEnvironment.size())
+ if(!this->CCEnvironment.empty())
{
env += this->CCEnvironment;
}
cmSystemTools::PutEnv(env);
env = "CXX=";
- if(this->CXXEnvironment.size())
+ if(!this->CXXEnvironment.empty())
{
env += this->CXXEnvironment;
}
@@ -1182,7 +1174,7 @@ int cmake::DoPreConfigureChecks()
srcList += "/CMakeLists.txt";
if(!cmSystemTools::FileExists(srcList.c_str()))
{
- cmOStringStream err;
+ std::ostringstream err;
if(cmSystemTools::FileIsDirectory(this->GetHomeDirectory()))
{
err << "The source directory \"" << this->GetHomeDirectory()
@@ -1250,7 +1242,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
}
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved;
- cmOStringStream warning;
+ std::ostringstream warning;
warning
<< "You have changed variables that require your cache to be deleted.\n"
<< "Configure will be re-run and you may have to reset some variables.\n"
@@ -1616,7 +1608,7 @@ void cmake::PreLoadCMakeFiles()
{
std::vector<std::string> args;
std::string pre_load = this->GetHomeDirectory();
- if ( pre_load.size() > 0 )
+ if (!pre_load.empty())
{
pre_load += "/PreLoad.cmake";
if ( cmSystemTools::FileExists(pre_load.c_str()) )
@@ -1625,7 +1617,7 @@ void cmake::PreLoadCMakeFiles()
}
}
pre_load = this->GetHomeOutputDirectory();
- if ( pre_load.size() > 0 )
+ if (!pre_load.empty())
{
pre_load += "/PreLoad.cmake";
if ( cmSystemTools::FileExists(pre_load.c_str()) )
@@ -1967,11 +1959,11 @@ int cmake::CheckBuildSystem()
// determine whether CMake should rerun.
// If no file is provided for the check, we have to rerun.
- if(this->CheckBuildSystemArgument.size() == 0)
+ if(this->CheckBuildSystemArgument.empty())
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake no build system arguments\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -1983,7 +1975,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake missing file: "
<< this->CheckBuildSystemArgument << "\n";
cmSystemTools::Stdout(msg.str().c_str());
@@ -2003,7 +1995,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake error reading : "
<< this->CheckBuildSystemArgument << "\n";
cmSystemTools::Stdout(msg.str().c_str());
@@ -2045,7 +2037,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake, missing byproduct: " << *pi << "\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2068,7 +2060,7 @@ int cmake::CheckBuildSystem()
// Not enough information was provided to do the test. Just rerun.
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake no CMAKE_MAKEFILE_DEPENDS "
"or CMAKE_MAKEFILE_OUTPUTS :\n";
cmSystemTools::Stdout(msg.str().c_str());
@@ -2094,7 +2086,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake: build system dependency is missing\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2120,7 +2112,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake: build system output is missing\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2138,7 +2130,7 @@ int cmake::CheckBuildSystem()
{
if(verbose)
{
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Re-run cmake file: " << out_oldest
<< " older than: " << dep_newest << "\n";
cmSystemTools::Stdout(msg.str().c_str());
@@ -2285,7 +2277,7 @@ const char *cmake::GetProperty(const std::string& prop,
this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{
- if ( output.size() )
+ if (!output.empty())
{
output += ";";
}
@@ -2320,14 +2312,7 @@ const char *cmake::GetProperty(const std::string& prop,
{
std::vector<std::string> enLangs;
this->GlobalGenerator->GetEnabledLanguages(enLangs);
- const char* sep = "";
- for(std::vector<std::string>::iterator i = enLangs.begin();
- i != enLangs.end(); ++i)
- {
- lang += sep;
- sep = ";";
- lang += *i;
- }
+ lang = cmJoin(enLangs, ";");
}
this->SetProperty("ENABLED_LANGUAGES", lang.c_str());
}
@@ -2410,7 +2395,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
else if(arg.find("-G",0) == 0)
{
std::string value = arg.substr(2);
- if(value.size() == 0)
+ if(value.empty())
{
++i;
if(i >= args.size())
@@ -2465,7 +2450,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
}
// do we write to a file or to stdout?
- if (resultFile.size() == 0)
+ if (resultFile.empty())
{
resultFile = cwd;
resultFile += "/__cmake_systeminformation/results.txt";
@@ -2546,7 +2531,7 @@ static bool cmakeCheckStampFile(const char* stampName)
while(cmSystemTools::GetLineFromStream(fin, dep))
{
int result;
- if(dep.length() >= 1 && dep[0] != '#' &&
+ if(!dep.empty() && dep[0] != '#' &&
(!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result)
|| result < 0))
{
@@ -2563,7 +2548,7 @@ static bool cmakeCheckStampFile(const char* stampName)
// The build system is up to date. The stamp file has been removed
// by the VS IDE due to a "rebuild" request. Restore it atomically.
- cmOStringStream stampTempStream;
+ std::ostringstream stampTempStream;
stampTempStream << stampName << ".tmp" << cmSystemTools::RandomSeed();
std::string stampTempString = stampTempStream.str();
const char* stampTemp = stampTempString.c_str();
@@ -2627,7 +2612,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace backtrace = bt;
backtrace.MakeRelative();
- cmOStringStream msg;
+ std::ostringstream msg;
bool isError = false;
// Construct the message header.
if(t == cmake::FATAL_ERROR)
@@ -2835,7 +2820,7 @@ void cmake::RunCheckForUnusedVariables()
{
#ifdef CMAKE_BUILD_WITH_CMAKE
bool haveUnused = false;
- cmOStringStream msg;
+ std::ostringstream msg;
msg << "Manually-specified variables were not used by the project:";
for(std::map<std::string, bool>::const_iterator
it = this->UsedCliVariables.begin();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 61b175e..6d25b70 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -96,11 +96,9 @@ static const char * cmDocumentationOptions[][2] =
static int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
+ args.reserve(ac - 1);
args.push_back(av[0]);
- for(int i = 2; i < ac; ++i)
- {
- args.push_back(av[i]);
- }
+ args.insert(args.end(), av + 2, av + ac);
return cmcmd::ExecuteCMakeCommand(args);
}
@@ -203,7 +201,7 @@ int main(int ac, char const* const* av)
int do_cmake(int ac, char const* const* av)
{
- if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
+ if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{
std::cerr << "Current working directory cannot be established."
<< std::endl;
@@ -221,11 +219,7 @@ int do_cmake(int ac, char const* const* av)
// the command line args are processed here so that you can do
// -DCMAKE_MODULE_PATH=/some/path and have this value accessible here
- std::vector<std::string> args;
- for(int i =0; i < ac; ++i)
- {
- args.push_back(av[i]);
- }
+ std::vector<std::string> args(av, av + ac);
hcm.SetCacheArgs(args);
std::vector<cmDocumentationEntry> generators;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index a97444d..28fcd27 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -36,7 +36,7 @@
void CMakeCommandUsage(const char* program)
{
- cmOStringStream errorStream;
+ std::ostringstream errorStream;
#ifdef CMAKE_BUILD_WITH_CMAKE
errorStream
@@ -71,7 +71,7 @@ void CMakeCommandUsage(const char* program)
<< " remove_directory dir - remove a directory and its contents\n"
<< " rename oldname newname - rename a file or directory "
"(on one volume)\n"
- << " tar [cxt][vfz][cvfj] file.tar [file/dir1 file/dir2 ...]\n"
+ << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n"
<< " - create or extract a tar or zip archive\n"
<< " sleep <number>... - sleep for given number of seconds\n"
<< " time command [args] ... - run command and return elapsed time\n"
@@ -94,6 +94,51 @@ void CMakeCommandUsage(const char* program)
cmSystemTools::Error(errorStream.str().c_str());
}
+static bool cmTarFilesFrom(std::string const& file,
+ std::vector<std::string>& files)
+{
+ if (cmSystemTools::FileIsDirectory(file))
+ {
+ std::ostringstream e;
+ e << "-E tar --files-from= file '" << file << "' is a directory";
+ cmSystemTools::Error(e.str().c_str());
+ return false;
+ }
+ cmsys::ifstream fin(file.c_str());
+ if (!fin)
+ {
+ std::ostringstream e;
+ e << "-E tar --files-from= file '" << file << "' not found";
+ cmSystemTools::Error(e.str().c_str());
+ return false;
+ }
+ std::string line;
+ while (cmSystemTools::GetLineFromStream(fin, line))
+ {
+ if (line.empty())
+ {
+ continue;
+ }
+ if (cmHasLiteralPrefix(line, "--add-file="))
+ {
+ files.push_back(line.substr(11));
+ }
+ else if (cmHasLiteralPrefix(line, "-"))
+ {
+ std::ostringstream e;
+ e << "-E tar --files-from='" << file << "' file invalid line:\n"
+ << line << "\n";
+ cmSystemTools::Error(e.str().c_str());
+ return false;
+ }
+ else
+ {
+ files.push_back(line);
+ }
+ }
+ return true;
+}
+
int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
// IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx
@@ -729,20 +774,64 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string flags = args[2];
std::string outFile = args[3];
std::vector<std::string> files;
+ std::string mtime;
+ bool doing_options = true;
for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
- files.push_back(args[cc]);
+ std::string const& arg = args[cc];
+ if (doing_options && cmHasLiteralPrefix(arg, "--"))
+ {
+ if (arg == "--")
+ {
+ doing_options = false;
+ }
+ else if (cmHasLiteralPrefix(arg, "--mtime="))
+ {
+ mtime = arg.substr(8);
+ }
+ else if (cmHasLiteralPrefix(arg, "--files-from="))
+ {
+ std::string const& files_from = arg.substr(13);
+ if (!cmTarFilesFrom(files_from, files))
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str());
+ return 1;
+ }
+ }
+ else
+ {
+ files.push_back(arg);
+ }
}
- bool gzip = false;
- bool bzip2 = false;
+ cmSystemTools::cmTarCompression compress =
+ cmSystemTools::TarCompressNone;
bool verbose = false;
+ int nCompress = 0;
if ( flags.find_first_of('j') != flags.npos )
{
- bzip2 = true;
+ compress = cmSystemTools::TarCompressBZip2;
+ ++nCompress;
+ }
+ if ( flags.find_first_of('J') != flags.npos )
+ {
+ compress = cmSystemTools::TarCompressXZ;
+ ++nCompress;
}
if ( flags.find_first_of('z') != flags.npos )
{
- gzip = true;
+ compress = cmSystemTools::TarCompressGZip;
+ ++nCompress;
+ }
+ if ( nCompress > 1 )
+ {
+ cmSystemTools::Error("Can only compress a tar file one way; "
+ "at most one flag of z, j, or J may be used");
+ return 1;
}
if ( flags.find_first_of('v') != flags.npos )
{
@@ -751,16 +840,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if ( flags.find_first_of('t') != flags.npos )
{
- if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
+ if ( !cmSystemTools::ListTar(outFile.c_str(), verbose) )
{
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
return 1;
}
}
else if ( flags.find_first_of('c') != flags.npos )
{
if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, gzip, bzip2, verbose) )
+ outFile.c_str(), files, compress, verbose, mtime) )
{
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;
@@ -769,7 +858,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if ( flags.find_first_of('x') != flags.npos )
{
if ( !cmSystemTools::ExtractTar(
- outFile.c_str(), gzip, verbose) )
+ outFile.c_str(), verbose) )
{
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
return 1;
@@ -1214,7 +1303,7 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
targetName = i->substr(5);
}
}
- if(targetName.size() == 0 || command.size() == 0)
+ if(targetName.empty() || command.empty())
{
return -1;
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index fb97af6..b77c231 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -136,7 +136,7 @@ int main (int argc, char const* const* argv)
cmCTest inst;
- if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
+ if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{
cmCTestLog(&inst, ERROR_MESSAGE,
"Current working directory cannot be established." << std::endl);
diff --git a/Source/kwsys/Base64.c b/Source/kwsys/Base64.c
index d07bdd0..4b8ede2 100644
--- a/Source/kwsys/Base64.c
+++ b/Source/kwsys/Base64.c
@@ -115,10 +115,10 @@ void kwsysBase64_Encode1(const unsigned char *src, unsigned char *dest)
actually knowing how much data to expect (if the input is not a multiple of
3 bytes then the extra padding needed to complete the encode 4 bytes will
stop the decoding anyway). */
-unsigned long kwsysBase64_Encode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- int mark_end)
+size_t kwsysBase64_Encode(const unsigned char *input,
+ size_t length,
+ unsigned char *output,
+ int mark_end)
{
const unsigned char *ptr = input;
const unsigned char *end = input + length;
@@ -157,7 +157,7 @@ unsigned long kwsysBase64_Encode(const unsigned char *input,
optr += 4;
}
- return (unsigned long)(optr - output);
+ return (size_t)(optr - output);
}
/*--------------------------------------------------------------------------*/
@@ -207,10 +207,10 @@ int kwsysBase64_Decode3(const unsigned char *src, unsigned char *dest)
'length' parameter is ignored. This enables the caller to decode a stream
without actually knowing how much decoded data to expect (of course, the
buffer must be large enough). */
-unsigned long kwsysBase64_Decode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- unsigned long max_input_length)
+size_t kwsysBase64_Decode(const unsigned char *input,
+ size_t length,
+ unsigned char *output,
+ size_t max_input_length)
{
const unsigned char *ptr = input;
unsigned char *optr = output;
@@ -226,7 +226,7 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
optr += len;
if(len < 3)
{
- return (unsigned long)(optr - output);
+ return (size_t)(optr - output);
}
ptr += 4;
}
@@ -240,7 +240,7 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
optr += len;
if(len < 3)
{
- return (unsigned long)(optr - output);
+ return (size_t)(optr - output);
}
ptr += 4;
}
@@ -275,5 +275,5 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
}
}
- return (unsigned long)(optr - output);
+ return (size_t)(optr - output);
}
diff --git a/Source/kwsys/Base64.h.in b/Source/kwsys/Base64.h.in
index 3468007..36ed3cc 100644
--- a/Source/kwsys/Base64.h.in
+++ b/Source/kwsys/Base64.h.in
@@ -14,6 +14,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h>
+#include <stddef.h> /* size_t */
+
/* Redefine all public interface symbol names to be in the proper
namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce
@@ -68,10 +70,10 @@ kwsysEXPORT void kwsysBase64_Encode1(const unsigned char *src,
* the extra padding needed to complete the encode 4 bytes will stop
* the decoding anyway).
*/
-kwsysEXPORT unsigned long kwsysBase64_Encode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- int mark_end);
+kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char *input,
+ size_t length,
+ unsigned char *output,
+ int mark_end);
/**
* Decode 4 bytes into a 3 byte string. Returns the number of bytes
@@ -92,10 +94,10 @@ kwsysEXPORT int kwsysBase64_Decode3(const unsigned char *src,
* much decoded data to expect (of course, the buffer must be large
* enough).
*/
-kwsysEXPORT unsigned long kwsysBase64_Decode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- unsigned long max_input_length);
+kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char *input,
+ size_t length,
+ unsigned char *output,
+ size_t max_input_length);
#if defined(__cplusplus)
} /* extern "C" */
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 04b2866..58cea63 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -244,6 +244,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
{
DIR* dir = opendir(name.c_str());
+ if (!dir)
+ {
+ return 0;
+ }
+
unsigned long count = 0;
for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) )
{
diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c
index cda78e2..ba2cec2 100644
--- a/Source/kwsys/EncodingC.c
+++ b/Source/kwsys/EncodingC.c
@@ -44,7 +44,7 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1;
if(length > 0)
{
- ret = malloc((length)*sizeof(wchar_t));
+ ret = (wchar_t*)malloc((length)*sizeof(wchar_t));
ret[0] = 0;
kwsysEncoding_mbstowcs(ret, str, length);
}
@@ -71,7 +71,7 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str)
size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1;
if(length > 0)
{
- ret = malloc(length);
+ ret = (char*)malloc(length);
ret[0] = 0;
kwsysEncoding_wcstombs(ret, str, length);
}
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index 45425ff..37055d6 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -18,6 +18,11 @@
namespace @KWSYS_NAMESPACE@
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
+# if defined(_NOEXCEPT)
+# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT _NOEXCEPT
+# else
+# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT
+# endif
template<typename CharType,typename Traits>
class basic_filebuf : public std::basic_filebuf<CharType,Traits>
{
@@ -85,7 +90,7 @@ namespace @KWSYS_NAMESPACE@
return buf_;
}
- ~basic_ifstream()
+ ~basic_ifstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT
{
buf_->close();
delete buf_;
@@ -147,7 +152,7 @@ class basic_ofstream : public std::basic_ostream<CharType,Traits>
{
return buf_.get();
}
- ~basic_ofstream()
+ ~basic_ofstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT
{
buf_->close();
delete buf_;
@@ -160,6 +165,7 @@ class basic_ofstream : public std::basic_ostream<CharType,Traits>
typedef basic_ifstream<char> ifstream;
typedef basic_ofstream<char> ofstream;
+# undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT
#else
using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index ca9d424..1be6d02 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -547,7 +547,7 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
}
if(file)
{
- *pfile = malloc(strlen(file)+1);
+ *pfile = (char*)malloc(strlen(file)+1);
if(!*pfile)
{
return 0;
@@ -1468,7 +1468,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
cp->RealWorkingDirectoryLength = 4096;
#endif
cp->RealWorkingDirectory =
- malloc((size_t)(cp->RealWorkingDirectoryLength));
+ (char*)malloc((size_t)(cp->RealWorkingDirectoryLength));
if(!cp->RealWorkingDirectory)
{
return 0;
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index ef71f26..c2965ea 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -340,7 +340,11 @@ kwsysProcess* kwsysProcess_New(void)
osv.dwOSVersionInfoSize = sizeof(osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+# pragma warning (disable:1478)
+# else
+# pragma warning (disable:4996)
+# endif
#endif
GetVersionEx(&osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
@@ -2382,7 +2386,11 @@ static kwsysProcess_List* kwsysProcess_List_New(void)
osv.dwOSVersionInfoSize = sizeof(osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+# pragma warning (disable:1478)
+# else
+# pragma warning (disable:4996)
+# endif
#endif
GetVersionEx(&osv);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 3d5e728..9c7ceee 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -5069,7 +5069,11 @@ bool SystemInformationImplementation::QueryOSInformation()
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+# pragma warning (disable:1478)
+# else
+# pragma warning (disable:4996)
+# endif
#endif
bOsVersionInfoEx = GetVersionExW ((OSVERSIONINFOW*)&osvi);
if (!bOsVersionInfoEx)
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index e4c82d8..2708211 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -16,6 +16,14 @@
# define _XOPEN_SOURCE_EXTENDED
#endif
+#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
+# define KWSYS_WINDOWS_DIRS
+#else
+# if defined(__SUNPRO_CC)
+# include <fcntl.h>
+# endif
+#endif
+
#include "kwsysPrivate.h"
#include KWSYS_HEADER(RegularExpression.hxx)
#include KWSYS_HEADER(SystemTools.hxx)
@@ -205,8 +213,7 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft)
}
#endif
-#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
-
+#ifdef KWSYS_WINDOWS_DIRS
#include <wctype.h>
inline int Mkdir(const kwsys_stl::string& dir)
@@ -4725,7 +4732,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+# pragma warning (disable:1478)
+# else
+# pragma warning (disable:4996)
+# endif
#endif
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
if (!bOsVersionInfoEx)
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index e13003f..d13f79a 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -175,6 +175,7 @@ static const char* kwsysTerminalVT100Names[] =
"xterm-88color",
"xterm-color",
"xterm-debian",
+ "xterm-termite",
0
};
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 3f947f3..82620da 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -548,6 +548,10 @@ int main()
#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
#endif
+#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 \
+ && __linux && __SUNPRO_CC_COMPAT == 'G'
+# include <iostream>
+#endif
#include <cxxabi.h>
int main()
{