diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-04-20 18:02:40 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2022-04-20 19:33:06 (GMT) |
commit | 59cc92085ea7c5a81de7d79946fa97f045adea78 (patch) | |
tree | 3daa3a24e748ec02f7c5d5bfb23249a6e5488394 /Source/cmExportFileGenerator.cxx | |
parent | a2cb1754a59d870f2a507d071d0c6c5891702645 (diff) | |
download | CMake-59cc92085ea7c5a81de7d79946fa97f045adea78.zip CMake-59cc92085ea7c5a81de7d79946fa97f045adea78.tar.gz CMake-59cc92085ea7c5a81de7d79946fa97f045adea78.tar.bz2 |
generated-cmake: use `_cmake_` prefixes for local variables
This avoids stomping on any user variables.
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 3143c12..fb37080 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -985,34 +985,34 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode( /* clang-format off */ os << "# Protect against multiple inclusion, which would fail when already " "imported targets are added once more.\n" - "set(_targetsDefined)\n" - "set(_targetsNotDefined)\n" - "set(_expectedTargets)\n" - "foreach(_expectedTarget " << expectedTargets << ")\n" - " list(APPEND _expectedTargets ${_expectedTarget})\n" - " if(NOT TARGET ${_expectedTarget})\n" - " list(APPEND _targetsNotDefined ${_expectedTarget})\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 ${_expectedTarget})\n" - " list(APPEND _targetsDefined ${_expectedTarget})\n" + " if(TARGET ${_cmake_expected_target})\n" + " list(APPEND _cmake_targets_defined ${_cmake_expected_target})\n" " endif()\n" "endforeach()\n" - "if(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n" - " unset(_targetsDefined)\n" - " unset(_targetsNotDefined)\n" - " unset(_expectedTargets)\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" " set(CMAKE_IMPORT_FILE_VERSION)\n" " cmake_policy(POP)\n" " return()\n" "endif()\n" - "if(NOT \"${_targetsDefined}\" 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: ${_targetsDefined}\\n" - "Targets not yet defined: ${_targetsNotDefined}\\n\")\n" + "set were already defined.\\nTargets Defined: ${_cmake_targets_defined}\\n" + "Targets not yet defined: ${_cmake_targets_not_defined}\\n\")\n" "endif()\n" - "unset(_targetsDefined)\n" - "unset(_targetsNotDefined)\n" - "unset(_expectedTargets)\n" + "unset(_cmake_targets_defined)\n" + "unset(_cmake_targets_not_defined)\n" + "unset(_cmake_expected_targets)\n" "\n\n"; /* clang-format on */ } @@ -1178,12 +1178,12 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) // but the development package was not installed.). /* clang-format off */ os << "# Loop over all imported files and verify that they actually exist\n" - "foreach(target ${_IMPORT_CHECK_TARGETS} )\n" - " foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n" - " if(NOT EXISTS \"${file}\" )\n" - " message(FATAL_ERROR \"The imported target \\\"${target}\\\"" + "foreach(_cmake_target IN LISTS _cmake_import_check_targets)\n" + " foreach(_cmake_file IN LISTS \"_cmake_import_check_files_for_${_cmake_target}\")\n" + " if(NOT EXISTS \"${_cmake_file}\")\n" + " message(FATAL_ERROR \"The imported target \\\"${_cmake_target}\\\"" " references the file\n" - " \\\"${file}\\\"\n" + " \\\"${_cmake_file}\\\"\n" "but this file does not exist. Possible reasons include:\n" "* The file was deleted, renamed, or moved to another location.\n" "* An install or uninstall procedure did not complete successfully.\n" @@ -1193,9 +1193,9 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) "\")\n" " endif()\n" " endforeach()\n" - " unset(_IMPORT_CHECK_FILES_FOR_${target})\n" + " unset(\"_cmake_import_check_files_for_${_cmake_target}\")\n" "endforeach()\n" - "unset(_IMPORT_CHECK_TARGETS)\n" + "unset(_cmake_import_check_targets)\n" "\n"; /* clang-format on */ } @@ -1208,9 +1208,9 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode( // Construct the imported target name. std::string targetName = cmStrCat(this->Namespace, target->GetExportName()); - os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName + os << "list(APPEND _cmake_import_check_targets " << targetName << " )\n" - "list(APPEND _IMPORT_CHECK_FILES_FOR_" + "list(APPEND _cmake_import_check_files_for_" << targetName << " "; for (std::string const& li : importedLocations) { |