From 62e8884d3f8be6cce8bde32a3f6eb499b4e38758 Mon Sep 17 00:00:00 2001
From: Kyle Edwards <kyle.edwards@kitware.com>
Date: Thu, 2 Feb 2023 13:54:17 -0500
Subject: CTestTargets: Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR}

---
 Modules/CTestTargets.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index b91b48e..99ef8e5 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -41,7 +41,7 @@ set(__conf_types "")
 get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
 if(_isMultiConfig)
   # We need to pass the configuration type on the test command line.
-  set(__conf_types -C "${CMAKE_CFG_INTDIR}")
+  set(__conf_types -C "$<CONFIG>")
 endif()
 
 # Add convenience targets.  Do this at most once in case of nested
-- 
cgit v0.12


From cabad8a37f9370df96dfebc124e38d82c141c76a Mon Sep 17 00:00:00 2001
From: Kyle Edwards <kyle.edwards@kitware.com>
Date: Thu, 2 Feb 2023 14:14:33 -0500
Subject: ExternalProject: Always use $<CONFIG> for source files

---
 Modules/ExternalProject.cmake | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3752ceb..18068cb 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2091,13 +2091,7 @@ function(_ep_get_configuration_subdir_genex suffix_var)
   set(suffix "")
   get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
   if(_isMultiConfig)
-    if(CMAKE_GENERATOR STREQUAL "Xcode")
-      # The Xcode generator does not support per-config sources,
-      # so use the underlying build system's placeholder instead.
-      set(suffix "/${CMAKE_CFG_INTDIR}")
-    else()
-      set(suffix "/$<CONFIG>")
-    endif()
+    set(suffix "/$<CONFIG>")
   endif()
   set(${suffix_var} "${suffix}" PARENT_SCOPE)
 endfunction()
-- 
cgit v0.12


From 78cf427157d15ca39c0e3133e9d05eda532578d0 Mon Sep 17 00:00:00 2001
From: Kyle Edwards <kyle.edwards@kitware.com>
Date: Thu, 2 Feb 2023 16:40:48 -0500
Subject: RULE_LAUNCH_*: Add support for generator expressions

---
 Source/cmLocalGenerator.cxx                    | 13 +++++++++----
 Source/cmLocalGenerator.h                      |  4 +++-
 Source/cmLocalUnixMakefileGenerator3.cxx       |  6 ++++--
 Source/cmMakefileExecutableTargetGenerator.cxx | 14 ++++++++------
 Source/cmMakefileLibraryTargetGenerator.cxx    | 14 ++++++++------
 Source/cmMakefileTargetGenerator.cxx           |  7 ++++---
 Source/cmNinjaNormalTargetGenerator.cxx        | 12 ++++++------
 Source/cmNinjaTargetGenerator.cxx              |  6 +++---
 8 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 75ec694..d3b88d4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -827,13 +827,18 @@ cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
   return this->Makefile->GetStateSnapshot();
 }
 
-cmValue cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
-                                          const std::string& prop)
+std::string cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
+                                              const std::string& prop,
+                                              const std::string& config)
 {
+  cmValue value = this->Makefile->GetProperty(prop);
   if (target) {
-    return target->GetProperty(prop);
+    value = target->GetProperty(prop);
+  }
+  if (value) {
+    return cmGeneratorExpression::Evaluate(*value, this, config, target);
   }
-  return this->Makefile->GetProperty(prop);
+  return "";
 }
 
 std::string cmLocalGenerator::ConvertToIncludeReference(
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 20f23de..bda82bc 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -532,7 +532,9 @@ public:
   void CreateEvaluationFileOutputs(const std::string& config);
   void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
 
-  cmValue GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
+  std::string GetRuleLauncher(cmGeneratorTarget* target,
+                              const std::string& prop,
+                              const std::string& config);
 
 protected:
   // The default implementation converts to a Windows shortpath to
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 7172d34..56a41b1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1003,7 +1003,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
 
       std::string launcher;
       // Short-circuit if there is no launcher.
-      cmValue val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM");
+      std::string val = this->GetRuleLauncher(
+        target, "RULE_LAUNCH_CUSTOM",
+        this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       if (cmNonempty(val)) {
         // Expand rule variables referenced in the given launcher command.
         cmRulePlaceholderExpander::RuleVariables vars;
@@ -1022,7 +1024,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
         }
         vars.Output = output.c_str();
 
-        launcher = *val;
+        launcher = val;
         rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
         if (!launcher.empty()) {
           launcher += " ";
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index e53d28c..41daa5a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -222,10 +222,11 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
 
     std::string launcher;
 
-    cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
-                                                        "RULE_LAUNCH_LINK");
+    std::string val = this->LocalGenerator->GetRuleLauncher(
+      this->GeneratorTarget, "RULE_LAUNCH_LINK",
+      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@@ -587,10 +588,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
 
     std::string launcher;
 
-    cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
-                                                        "RULE_LAUNCH_LINK");
+    std::string val = this->LocalGenerator->GetRuleLauncher(
+      this->GeneratorTarget, "RULE_LAUNCH_LINK",
+      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 9669293..cb567ff 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -362,10 +362,11 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
     vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
 
     std::string launcher;
-    cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
-                                                        "RULE_LAUNCH_LINK");
+    std::string val = this->LocalGenerator->GetRuleLauncher(
+      this->GeneratorTarget, "RULE_LAUNCH_LINK",
+      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@@ -808,10 +809,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
     }
 
     std::string launcher;
-    cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
-                                                        "RULE_LAUNCH_LINK");
+    std::string val = this->LocalGenerator->GetRuleLauncher(
+      this->GeneratorTarget, "RULE_LAUNCH_LINK",
+      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 6612595..2b817c3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1167,10 +1167,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
 
     std::string launcher;
     {
-      cmValue val = this->LocalGenerator->GetRuleLauncher(
-        this->GeneratorTarget, "RULE_LAUNCH_COMPILE");
+      std::string val = this->LocalGenerator->GetRuleLauncher(
+        this->GeneratorTarget, "RULE_LAUNCH_COMPILE",
+        this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       if (cmNonempty(val)) {
-        launcher = cmStrCat(*val, ' ');
+        launcher = cmStrCat(val, ' ');
       }
     }
 
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index a1633ca..45a4dda 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -263,10 +263,10 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
     vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS";
 
     std::string launcher;
-    cmValue val = this->GetLocalGenerator()->GetRuleLauncher(
-      this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
+    std::string val = this->GetLocalGenerator()->GetRuleLauncher(
+      this->GetGeneratorTarget(), "RULE_LAUNCH_LINK", config);
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@@ -458,10 +458,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
     }
 
     std::string launcher;
-    cmValue val = this->GetLocalGenerator()->GetRuleLauncher(
-      this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
+    std::string val = this->GetLocalGenerator()->GetRuleLauncher(
+      this->GetGeneratorTarget(), "RULE_LAUNCH_LINK", config);
     if (cmNonempty(val)) {
-      launcher = cmStrCat(*val, ' ');
+      launcher = cmStrCat(val, ' ');
     }
 
     std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b77a363..cea58b7 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -670,10 +670,10 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
     cmLocalGenerator::SHELL);
 
   std::string launcher;
-  cmValue val = this->GetLocalGenerator()->GetRuleLauncher(
-    this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE");
+  std::string val = this->GetLocalGenerator()->GetRuleLauncher(
+    this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE", config);
   if (cmNonempty(val)) {
-    launcher = cmStrCat(*val, ' ');
+    launcher = cmStrCat(val, ' ');
   }
 
   std::string const cmakeCmd =
-- 
cgit v0.12


From f34876561f018d20b26c5b322a37aff2b133850f Mon Sep 17 00:00:00 2001
From: Kyle Edwards <kyle.edwards@kitware.com>
Date: Thu, 2 Feb 2023 16:53:26 -0500
Subject: Tests: Remove or silence instances of ${CMAKE_CFG_INTDIR}

---
 Tests/RunCMake/add_custom_command/WorkingDirectory.cmake    | 2 +-
 Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
index 65b7250..d8a5d86 100644
--- a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
@@ -2,7 +2,7 @@ add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURR
 add_custom_command(
   OUTPUT out.txt
   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake
-  WORKING_DIRECTORY ${CMAKE_CFG_INTDIR}
+  WORKING_DIRECTORY $<CONFIG>
   )
 set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
 add_custom_target(drive ALL DEPENDS out.txt)
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
index c77b43c..f7c551d 100644
--- a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
@@ -11,7 +11,7 @@ string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAK
 
 add_library(example SHARED LinkOptionsLib.c)
 # use LAUNCH facility to dump linker command
-set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"$<TARGET_FILE:dump>\"")
 
 add_dependencies (example dump)
 
-- 
cgit v0.12


From 2b17b6da6acadc6676c342924bb10e2d944bf0f3 Mon Sep 17 00:00:00 2001
From: Kyle Edwards <kyle.edwards@kitware.com>
Date: Fri, 3 Feb 2023 11:24:38 -0500
Subject: cmGlobalGenerator: Avoid referencing CMAKE_CFG_INTDIR

---
 Source/cmGlobalGenerator.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4cfec22..492f848 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2911,7 +2911,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
         singleLine.push_back(cfgArg);
         cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
       } else {
-        cfgArg += *mf->GetDefinition("CMAKE_CFG_INTDIR");
+        cfgArg += this->GetCMakeCFGIntDir();
       }
       singleLine.push_back(cfgArg);
     }
-- 
cgit v0.12