How to properly add "${env:PATH};%SEARCH_PATH%" in cmake.debugConfig.environment? #4650
Replies: 3 comments 1 reply
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
I finally decide to add #include <QCoreApplication>
#include <QDebug>
#include <QProcessEnvironment>
void printPathVariable() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString path = env.value( "PATH", "" );
if ( path.isEmpty() ) {
qWarning() << "PATH environment variable is empty or not set!";
return;
}
qDebug().noquote() << "=== PATH Environment Variable ===";
QStringList pathList;
pathList = path.split( ';', Qt::SkipEmptyParts );
qDebug() << "Platform: Windows (separator: ';')";
qDebug() << "Total entries:" << pathList.size();
qDebug() << "\nPaths:";
for ( int i = 0; i < pathList.size(); ++i ) {
qDebug() << QString( "[%1] %2" ).arg( i + 1, 3 ).arg( pathList[i] );
}
qDebug() << "=====================================";
}
int main( int argc, char* argv[] ) {
QCoreApplication app( argc, argv );
printPathVariable();
return 0;
}With this settings.json: {
"cmake.debugConfig": {
"environment": [
{
"name": "PATH",
"value": "${env:PATH};BLABLABLA"
}
],
"logging": {
"engineLogging": true,
"exceptions": true,
"moduleLoad": true,
"programOutput": true,
"traceResponse": true,
"trace": true
},
"console": "externalTerminal"
}
}
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having this in
settings.json:{ "cmake.debugConfig": { "environment": [ { "name": "PATH", "value": "${env:PATH};D:\\Build_Tool_Lib\\Qt\\6.10.1\\msvc2022_64\\bin" } ], "logging": { "engineLogging": true, "exceptions": true, "moduleLoad": true, "programOutput": true, "traceResponse": true, "trace": true }, "console": "integratedTerminal" } }After clicked the
Launch the debugger for the selected target: [***]in bottom toolbar.The debugger immediately exited with the following logging in the debug console:
But After I removed

${env:PATH};, the debugger successfully hit the break point.Isn't that,
${env:PATH};%SEARCH_PATH%, the correct way to add something into PATH?Beta Was this translation helpful? Give feedback.
All reactions