Sorry to take so long getting back to this. Christmas got in the way & then I had some other work that needed finished.
I think this addresses your concerns with the first patch
diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index a88716d..19065d7 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -1911,7 +1911,6 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
m_pProject->SetCurrentlyCompilingTarget(0);
return -1;
}
- Manager::Get()->GetMacrosManager()->ReplaceEnvVars(hostapStr);
command << hostapStr << strSPACE;
command << target->GetExecutionParameters();
}
@@ -1936,10 +1935,11 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
}
command << hostapStr << strSPACE;
command << target->GetExecutionParameters();
- Manager::Get()->GetMacrosManager()->ReplaceMacros(command, target);
- Manager::Get()->GetMacrosManager()->ReplaceEnvVars(command);
}
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(command, target);
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(command);
+
wxString script = command;
if (platform::macosx)
diff --git a/src/plugins/contrib/Valgrind/Valgrind.cpp b/src/plugins/contrib/Valgrind/Valgrind.cpp
index cbcec86..d279a13 100644
--- a/src/plugins/contrib/Valgrind/Valgrind.cpp
+++ b/src/plugins/contrib/Valgrind/Valgrind.cpp
@@ -269,7 +269,6 @@ bool CheckRequirements(wxString& ExeTarget, wxString &WorkDir, wxString& Command
// check the type of the target
const TargetType TType = Target->GetTargetType();
- MacrosManager* MacrosMgr = Manager::Get()->GetMacrosManager();
if (TType == ttDynamicLib || TType == ttStaticLib)
{
if (Target->GetHostApplication().IsEmpty())
@@ -281,13 +280,11 @@ bool CheckRequirements(wxString& ExeTarget, wxString &WorkDir, wxString& Command
}
ExeTarget = Project->GetBasePath() + Target->GetHostApplication();
- MacrosMgr->ReplaceMacros(ExeTarget, Target);
WorkDir = Target->GetWorkingDir();
}
else if (TType == ttExecutable || TType == ttConsoleOnly)
{
ExeTarget = Project->GetBasePath() + Target->GetOutputFilename();
- MacrosMgr->ReplaceMacros(ExeTarget, Target);
WorkDir = Target->GetWorkingDir();
}
else
@@ -307,7 +304,15 @@ bool CheckRequirements(wxString& ExeTarget, wxString &WorkDir, wxString& Command
// Manager::Get()->GetLogManager()->DebugLog(msg);
// return false;
// }
+ MacrosManager* MacrosMgr = Manager::Get()->GetMacrosManager();
+ MacrosMgr->ReplaceMacros(ExeTarget, Target);
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(ExeTarget);
+
CommandLineArguments = Target->GetExecutionParameters();
+
+ MacrosMgr->ReplaceMacros(CommandLineArguments, Target);
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(CommandLineArguments);
+
DynamicLinkerPath = cbGetDynamicLinkerPathForTarget(Project, Target);
return true;
} // end of CheckRequirements
diff --git a/src/plugins/debuggergdb/debuggergdb.cpp b/src/plugins/debuggergdb/debuggergdb.cpp
index 24d007c..1cceee6 100644
--- a/src/plugins/debuggergdb/debuggergdb.cpp
+++ b/src/plugins/debuggergdb/debuggergdb.cpp
@@ -867,6 +867,11 @@ int DebuggerGDB::DoDebug(bool breakOnEntry)
ShowWindow(windowHandle, SW_HIDE);
}
#endif
+
+ // Expand macros in command line
+ Manager::Get()->GetMacrosManager()->ReplaceMacros(cmdline, target);
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(cmdline);
+
// start the gdb process
wxString wdir = m_State.GetDriver()->GetDebuggersWorkingDirectory();
if (wdir.empty())
But looking at this now would it be better to do the macro/env expansion in the target GetOutputFilename, GetHostApplication & GetExecutionParameters?