summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx2
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageCommand.cxx3
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx3
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx3
-rw-r--r--Source/Checks/cm_cxx_features.cmake2
-rw-r--r--Source/cmArgumentParser.h3
-rw-r--r--Source/cmCTest.cxx3
-rw-r--r--Source/cmCommonTargetGenerator.cxx2
-rw-r--r--Source/cmConfigureFileCommand.cxx3
-rw-r--r--Source/cmCoreTryCompile.cxx4
-rw-r--r--Source/cmExecuteProcessCommand.cxx3
-rw-r--r--Source/cmExportCommand.cxx3
-rw-r--r--Source/cmFileCommand.cxx2
-rw-r--r--Source/cmForEachCommand.cxx3
-rw-r--r--Source/cmFunctionCommand.cxx3
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx3
-rw-r--r--Source/cmGeneratorExpressionNode.cxx3
-rw-r--r--Source/cmGeneratorTarget.cxx16
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx6
-rw-r--r--Source/cmIfCommand.cxx3
-rw-r--r--Source/cmInstallCommand.cxx3
-rw-r--r--Source/cmInstallCommandArguments.cxx2
-rw-r--r--Source/cmListCommand.cxx3
-rw-r--r--Source/cmLocalGenerator.cxx3
-rw-r--r--Source/cmMacroCommand.cxx3
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMessageCommand.cxx3
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx6
-rw-r--r--Source/cmQtAutoGenInitializer.cxx9
-rw-r--r--Source/cmString.hxx3
-rw-r--r--Source/cmStringCommand.cxx3
-rw-r--r--Source/cmSubcommandTable.h3
-rw-r--r--Source/cmTarget.cxx10
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx2
-rw-r--r--Source/cmWhileCommand.cxx3
-rw-r--r--Source/cmXCodeScheme.cxx5
-rw-r--r--Source/cm_static_string_view.hxx41
-rw-r--r--Source/cmake.cxx2
48 files changed, 73 insertions, 127 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 564e647..ec473d2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -698,7 +698,6 @@ set(SRCS
cmWriteFileCommand.cxx
cmWriteFileCommand.h
- cm_static_string_view.hxx
cm_get_date.h
cm_get_date.c
cm_utf8.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 4c8f6d4..72c70c2 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 17)
-set(CMake_VERSION_PATCH 20200430)
+set(CMake_VERSION_PATCH 20200501)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index d1b7701..44fdc29 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -5,7 +5,7 @@
#include <cstring>
#include <sstream>
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestBuildHandler.h"
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 3854710..f42c3f1 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -6,7 +6,7 @@
#include <sstream>
#include <vector>
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestConfigureHandler.h"
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index e335923..7432d08 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -5,8 +5,7 @@
#include <set>
#include <cmext/algorithm>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestCoverageHandler.h"
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index b1034c9..a755632 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -7,7 +7,7 @@
#include <cstring>
#include <sstream>
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 39dec6d..d0e2974 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestMemCheckCommand.h"
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestMemCheckHandler.h"
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 5b2f2e6..279216e 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -9,8 +9,7 @@
#include <cm/memory>
#include <cm/vector>
#include <cmext/algorithm>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestSubmitHandler.h"
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 6b317cb..c71b409 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -6,7 +6,7 @@
#include <cstdlib>
#include <sstream>
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e6b3f36..8fc5cd6 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -20,13 +20,13 @@
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
#include <cmsys/RegularExpression.hxx>
-#include "cm_static_string_view.hxx"
#include "cm_utf8.h"
#include "cmCTest.h"
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index eaef1ca..f86ee0d 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -6,8 +6,7 @@
#include <sstream>
#include <cm/vector>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmCTest.h"
#include "cmCTestUploadHandler.h"
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index 358c5c5..50ccc7c 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -32,6 +32,8 @@ function(cm_check_cxx_feature name)
string(REGEX REPLACE "[^\n]*libhugetlbfs [^\n]*: WARNING[^\n]*" "" check_output "${check_output}")
# Filter out xcodebuild warnings.
string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}")
+ # Filter out icpc warnings
+ string(REGEX REPLACE "[^\n]*icpc: command line warning #10121: overriding [^\n]*" "" check_output "${check_output}")
# Filter out ld warnings.
string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}")
# If using the feature causes warnings, treat it as broken/unavailable.
diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h
index 9426537..5d2dfa2 100644
--- a/Source/cmArgumentParser.h
+++ b/Source/cmArgumentParser.h
@@ -12,8 +12,7 @@
#include <vector>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
namespace ArgumentParser {
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index c2b2a09..2a0ddba1 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -19,6 +19,7 @@
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/Base64.h"
#include "cmsys/Directory.hxx"
@@ -36,8 +37,6 @@
# include <unistd.h> // IWYU pragma: keep
#endif
-#include "cm_static_string_view.hxx"
-
#include "cmCTestBuildAndTestHandler.h"
#include "cmCTestBuildHandler.h"
#include "cmCTestConfigureHandler.h"
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 6c1a476..5414409 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -77,7 +77,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
cmOutputConverter::FortranFormat format =
cmOutputConverter::GetFortranFormat(srcfmt);
if (format == cmOutputConverter::FortranFormatNone) {
- const std::string tgtfmt =
+ std::string const& tgtfmt =
this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT");
format = cmOutputConverter::GetFortranFormat(tgtfmt);
}
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index bac9337..5b3045d 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -5,8 +5,7 @@
#include <set>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dc2df14..4e2caed 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -8,9 +8,9 @@
#include <sstream>
#include <utility>
-#include "cmsys/Directory.hxx"
+#include <cmext/string_view>
-#include "cm_static_string_view.hxx"
+#include "cmsys/Directory.hxx"
#include "cmExportTryCompileFileGenerator.h"
#include "cmGlobalGenerator.h"
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 08a0f7e..9c53bdf 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -10,11 +10,10 @@
#include <vector>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/Process.h"
-#include "cm_static_string_view.hxx"
-
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index ad632ee..9f8a821 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -8,11 +8,10 @@
#include <cm/memory>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
-#include "cm_static_string_view.hxx"
-
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
#include "cmExportBuildAndroidMKGenerator.h"
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4ec128e..161bbe8 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -17,13 +17,13 @@
#include <cm/memory>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include "cm_kwiml.h"
-#include "cm_static_string_view.hxx"
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 82c5223..32e7892 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -18,8 +18,7 @@
#include <cm/memory>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmFunctionBlocker.h"
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index a4c9072..b6f58bd 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -7,8 +7,7 @@
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmFunctionBlocker.h"
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index b4ba1a1..4f379cd 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -7,8 +7,7 @@
#include <utility>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionEvaluator.h"
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 68f466f..e3de2d8 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -17,12 +17,11 @@
#include <cm/string_view>
#include <cm/vector>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
#include "cmsys/String.h"
-#include "cm_static_string_view.hxx"
-
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionContext.h"
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 509df93..62427f6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -18,11 +18,10 @@
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
-#include "cm_static_string_view.hxx"
-
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
@@ -388,14 +387,16 @@ cmProp cmGeneratorTarget::GetProperty(const std::string& prop) const
return this->Target->GetProperty(prop);
}
-const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const
+std::string const& cmGeneratorTarget::GetSafeProperty(
+ std::string const& prop) const
{
cmProp ret = this->GetProperty(prop);
- if (!ret) {
- return "";
+ if (ret) {
+ return *ret;
}
- return ret->c_str();
+ static std::string const s_empty;
+ return s_empty;
}
const char* cmGeneratorTarget::GetOutputTargetType(
@@ -3988,7 +3989,8 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
const std::string useOptVar =
cmStrCat(language, "_COMPILE_OPTIONS_USE_PCH");
- const std::string useOptionListProperty = this->GetSafeProperty(useOptVar);
+ std::string const& useOptionListProperty =
+ this->GetSafeProperty(useOptVar);
useOptionList = cmStrCat(
useOptionList, ";",
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index dc98407..2ef7b43 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -80,7 +80,7 @@ public:
//! Might return a nullptr if the property is not set or invalid
cmProp GetProperty(const std::string& prop) const;
//! Always returns a valid pointer
- const char* GetSafeProperty(const std::string& prop) const;
+ std::string const& GetSafeProperty(std::string const& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files,
const std::string& config) const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 53aa9f3..de6a649 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -384,9 +384,9 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
}
}
- const std::string reuseFrom =
+ std::string const& reuseFrom =
target->GetSafeProperty("PRECOMPILE_HEADERS_REUSE_FROM");
- const std::string compilePdb =
+ std::string const& compilePdb =
target->GetSafeProperty("COMPILE_PDB_NAME");
if (!reuseFrom.empty() && reuseFrom != compilePdb) {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 77fa6fa..cda3338 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -808,7 +808,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add flags from target and source file properties.
std::string flags;
- const std::string srcfmt = sf->GetSafeProperty("Fortran_FORMAT");
+ std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
@@ -2289,7 +2289,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add Fortran source format attribute if property is set.
const char* format = nullptr;
- const std::string tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT");
+ std::string const& tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
format = "fixed";
@@ -2416,7 +2416,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string attribute = prop.substr(16);
this->FilterConfigurationAttribute(configName, attribute);
if (!attribute.empty()) {
- const std::string pr = gtgt->GetSafeProperty(prop);
+ std::string const& pr = gtgt->GetSafeProperty(prop);
std::string processed = cmGeneratorExpression::Evaluate(
pr, this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute,
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 290e064..5808f90 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -7,8 +7,7 @@
#include <cm/memory>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmConditionEvaluator.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c9b22b6..ac57bc2 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -8,11 +8,10 @@
#include <utility>
#include <cm/memory>
+#include <cmext/string_view>
#include "cmsys/Glob.hxx"
-#include "cm_static_string_view.hxx"
-
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
#include "cmExportSet.h"
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 31ba63f..a034689 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -4,7 +4,7 @@
#include <utility>
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmRange.h"
#include "cmSystemTools.h"
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 1d82dfc..edec613 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -17,11 +17,10 @@
#include <cm/memory>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
-#include "cm_static_string_view.hxx"
-
#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a2208e5..b862449 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2670,7 +2670,8 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
std::string dest_file = to_file;
- const std::string prefix = target->GetSafeProperty("PREFIX");
+ std::string const& prefix =
+ target->GetSafeProperty("PREFIX");
if (!prefix.empty()) {
dest_file =
cmStrCat(to_dir, prefix, *ReuseFrom, extension);
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 0b0d9ac..c88b343 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -8,8 +8,7 @@
#include <cm/memory>
#include <cm/string_view>
#include <cmext/algorithm>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmFunctionBlocker.h"
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9ab59ea..6c46353 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -18,13 +18,13 @@
#include <cm/optional>
#include <cm/vector>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
#include "cm_jsoncpp_value.h"
#include "cm_jsoncpp_writer.h"
-#include "cm_static_string_view.hxx"
#include "cm_sys_stat.h"
#include "cmCommandArgumentParserHelper.h"
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index bf8183b..c7bb9a7 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -6,8 +6,7 @@
#include <utility>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 18b135d..a32f3e7 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -95,11 +95,11 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
bool const uic = target->GetPropertyAsBool(kw().AUTOUIC);
bool const rcc = target->GetPropertyAsBool(kw().AUTORCC);
if (moc || uic || rcc) {
- std::string const mocExec =
+ std::string const& mocExec =
target->GetSafeProperty(kw().AUTOMOC_EXECUTABLE);
- std::string const uicExec =
+ std::string const& uicExec =
target->GetSafeProperty(kw().AUTOUIC_EXECUTABLE);
- std::string const rccExec =
+ std::string const& rccExec =
target->GetSafeProperty(kw().AUTORCC_EXECUTABLE);
// We support Qt4, Qt5 and Qt6
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index fa523cc..235ee38 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -440,7 +440,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
// Autogen target parallel processing
{
- std::string prop = this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL");
+ std::string const& prop =
+ this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL");
if (prop.empty() || (prop == "AUTO")) {
// Autodetect number of CPUs
this->AutogenTarget.Parallel = GetParallelCPUCount();
@@ -471,7 +472,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
this->AutogenTarget.DependOrigin =
this->GenTarget->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
- std::string const deps =
+ std::string const& deps =
this->GenTarget->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
if (!deps.empty()) {
for (std::string const& depName : cmExpandedList(deps)) {
@@ -654,7 +655,7 @@ bool cmQtAutoGenInitializer::InitUic()
{
// Uic search paths
{
- std::string const usp =
+ std::string const& usp =
this->GenTarget->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
if (!usp.empty()) {
this->Uic.SearchPaths =
@@ -1794,7 +1795,7 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
// Custom executable
{
std::string const prop = cmStrCat(genVars.GenNameUpper, "_EXECUTABLE");
- std::string const val = this->GenTarget->Target->GetSafeProperty(prop);
+ std::string const& val = this->GenTarget->Target->GetSafeProperty(prop);
if (!val.empty()) {
// Evaluate generator expression
{
diff --git a/Source/cmString.hxx b/Source/cmString.hxx
index 9e91986..87bfdff 100644
--- a/Source/cmString.hxx
+++ b/Source/cmString.hxx
@@ -16,8 +16,7 @@
#include <utility>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
namespace cm {
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 7662204..a7c21cc 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -11,11 +11,10 @@
#include <memory>
#include <cm/iterator>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
-#include "cm_static_string_view.hxx"
-
#include "cmCryptoHash.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h
index 65eb8c7..7deaaed 100644
--- a/Source/cmSubcommandTable.h
+++ b/Source/cmSubcommandTable.h
@@ -11,8 +11,7 @@
#include <vector>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
class cmExecutionStatus;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 955a5cc..a776398 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1789,13 +1789,15 @@ cmProp cmTarget::GetProperty(const std::string& prop) const
return retVal;
}
-const char* cmTarget::GetSafeProperty(const std::string& prop) const
+std::string const& cmTarget::GetSafeProperty(std::string const& prop) const
{
cmProp ret = this->GetProperty(prop);
- if (!ret) {
- return "";
+ if (ret) {
+ return *ret;
}
- return ret->c_str();
+
+ static std::string const s_empty;
+ return s_empty;
}
bool cmTarget::GetPropertyAsBool(const std::string& prop) const
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ddc3b9b..8fecd41 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -174,7 +174,7 @@ public:
//! Might return a nullptr if the property is not set or invalid
cmProp GetProperty(const std::string& prop) const;
//! Always returns a valid pointer
- const char* GetSafeProperty(const std::string& prop) const;
+ std::string const& GetSafeProperty(std::string const& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
cmProp GetComputedProperty(const std::string& prop, cmMessenger* messenger,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9c2b302..2b20a00 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -909,7 +909,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0)
{
- std::string const documentationFile =
+ std::string const& documentationFile =
this->GeneratorTarget->GetSafeProperty("VS_DOTNET_DOCUMENTATION_FILE");
if (this->ProjectType == csproj && !documentationFile.empty()) {
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 26e7c75..0d8e894 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -7,8 +7,7 @@
#include <cm/memory>
#include <cm/string_view>
-
-#include "cm_static_string_view.hxx"
+#include <cmext/string_view>
#include "cmConditionEvaluator.h"
#include "cmExecutionStatus.h"
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index aab367a..9ac1457 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -405,8 +405,9 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
void cmXCodeScheme::WriteCustomWorkingDirectory(
cmXMLWriter& xout, const std::string& configuration)
{
- std::string propertyValue = this->Target->GetTarget()->GetSafeProperty(
- "XCODE_SCHEME_WORKING_DIRECTORY");
+ std::string const& propertyValue =
+ this->Target->GetTarget()->GetSafeProperty(
+ "XCODE_SCHEME_WORKING_DIRECTORY");
if (propertyValue.empty()) {
xout.Attribute("useCustomWorkingDirectory", "NO");
} else {
diff --git a/Source/cm_static_string_view.hxx b/Source/cm_static_string_view.hxx
deleted file mode 100644
index 708ac95..0000000
--- a/Source/cm_static_string_view.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_static_string_view_hxx
-#define cm_static_string_view_hxx
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <cstddef>
-
-#include <cm/string_view>
-
-namespace cm {
-
-/** A string_view that only binds to static storage.
- *
- * This is used together with the `""_s` user-defined literal operator
- * to construct a type-safe abstraction of a string_view that only views
- * statically allocated strings. These strings are const and available
- * for the entire lifetime of the program.
- */
-class static_string_view : public string_view
-{
- static_string_view(string_view v)
- : string_view(v)
- {
- }
-
- friend static_string_view operator"" _s(const char* data, size_t size);
-};
-
-/** Create a static_string_view using `""_s` literal syntax. */
-inline static_string_view operator"" _s(const char* data, size_t size)
-{
- return string_view(data, size);
-}
-
-} // namespace cm
-
-using cm::operator"" _s;
-
-#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index a257a70..c95cf4f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -19,12 +19,12 @@
#endif
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_static_string_view.hxx"
#include "cm_sys_stat.h"
#include "cmCommands.h"