How to properly add "${env:PATH};%SEARCH_PATH%" in cmake.debugConfig.environment? #4650
-
Beta Was this translation helpful? Give feedback.
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.



I encountered the same issue. After checking the cmake-tools source code, I found that four years ago they disabled the syntax of using ${env:XXX} in debugConfig to import other environment variables.
#2236