summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-04-20 18:03:43 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2022-04-20 19:33:34 (GMT)
commitd74761b181ccf21e50a3b371617ec8f24cd54a4d (patch)
tree894407770943d0e2429fe8598ece1014da769b4f /Source
parent59cc92085ea7c5a81de7d79946fa97f045adea78 (diff)
downloadCMake-d74761b181ccf21e50a3b371617ec8f24cd54a4d.zip
CMake-d74761b181ccf21e50a3b371617ec8f24cd54a4d.tar.gz
CMake-d74761b181ccf21e50a3b371617ec8f24cd54a4d.tar.bz2
generated-scripts: simplify `if` conditions
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportFileGenerator.cxx15
-rw-r--r--Source/cmInstallGenerator.cxx4
-rw-r--r--Source/cmScriptGenerator.cxx6
3 files changed, 11 insertions, 14 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index fb37080..97a6088 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -985,19 +985,18 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(
/* clang-format off */
os << "# Protect against multiple inclusion, which would fail when already "
"imported targets are added once more.\n"
- "set(_cmake_targets_defined)\n"
- "set(_cmake_targets_not_defined)\n"
- "set(_cmake_expected_targets)\n"
+ "set(_cmake_targets_defined \"\")\n"
+ "set(_cmake_targets_not_defined \"\")\n"
+ "set(_cmake_expected_targets \"\")\n"
"foreach(_cmake_expected_target " << expectedTargets << ")\n"
" list(APPEND _cmake_expected_targets ${_cmake_expected_target})\n"
- " if(NOT TARGET ${_cmake_expected_target})\n"
- " list(APPEND _cmake_targets_not_defined ${_cmake_expected_target})\n"
- " endif()\n"
" if(TARGET ${_cmake_expected_target})\n"
" list(APPEND _cmake_targets_defined ${_cmake_expected_target})\n"
+ " else()\n"
+ " list(APPEND _cmake_targets_not_defined ${_cmake_expected_target})\n"
" endif()\n"
"endforeach()\n"
- "if(\"${_cmake_targets_defined}\" STREQUAL \"${_cmake_expected_targets}\")\n"
+ "if(_cmake_targets_defined STREQUAL _cmake_expected_targets)\n"
" unset(_cmake_targets_defined)\n"
" unset(_cmake_targets_not_defined)\n"
" unset(_cmake_expected_targets)\n"
@@ -1005,7 +1004,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(
" cmake_policy(POP)\n"
" return()\n"
"endif()\n"
- "if(NOT \"${_cmake_targets_defined}\" STREQUAL \"\")\n"
+ "if(NOT _cmake_targets_defined STREQUAL \"\")\n"
" message(FATAL_ERROR \"Some (but not all) targets in this export "
"set were already defined.\\nTargets Defined: ${_cmake_targets_defined}\\n"
"Targets not yet defined: ${_cmake_targets_not_defined}\\n\")\n"
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 4cfeb47..00eb8c3 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -160,9 +160,9 @@ void cmInstallGenerator::AddInstallRule(
std::string cmInstallGenerator::CreateComponentTest(
const std::string& component, bool exclude_from_all)
{
- std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)";
+ std::string result = "CMAKE_INSTALL_COMPONENT STREQUAL \"";
result += component;
- result += "x\"";
+ result += "\"";
if (!exclude_from_all) {
result += " OR NOT CMAKE_INSTALL_COMPONENT";
}
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 5ac7be9..437b938 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -52,8 +52,7 @@ static void cmScriptGeneratorEncodeConfig(const std::string& config,
std::string cmScriptGenerator::CreateConfigTest(const std::string& config)
{
- std::string result =
- cmStrCat("\"${", this->RuntimeConfigVariable, "}\" MATCHES \"^(");
+ std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
if (!config.empty()) {
cmScriptGeneratorEncodeConfig(config, result);
}
@@ -64,8 +63,7 @@ std::string cmScriptGenerator::CreateConfigTest(const std::string& config)
std::string cmScriptGenerator::CreateConfigTest(
std::vector<std::string> const& configs)
{
- std::string result =
- cmStrCat("\"${", this->RuntimeConfigVariable, "}\" MATCHES \"^(");
+ std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
const char* sep = "";
for (std::string const& config : configs) {
result += sep;