MCPcopy Create free account
hub / github.com/KDE/kdevelop / commandLine

Method commandLine

plugins/cmakebuilder/cmakejob.cpp:80–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80QStringList CMakeJob::commandLine() const
81{
82 QStringList args;
83 args << CMake::currentCMakeExecutable( m_project ).toLocalFile();
84
85 args << QStringLiteral("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON");
86
87 QString installDir = CMake::currentInstallDir( m_project ).toLocalFile();
88 if( !installDir.isEmpty() )
89 {
90 args << QStringLiteral("-DCMAKE_INSTALL_PREFIX=%1").arg(installDir);
91 }
92 QString buildType = CMake::currentBuildType( m_project );
93 if( !buildType.isEmpty() )
94 {
95 args << QStringLiteral("-DCMAKE_BUILD_TYPE=%1").arg(buildType);
96 }
97 QVariantMap cacheArgs = property("extraCMakeCacheValues").toMap();
98 for( auto it = cacheArgs.constBegin(), itEnd = cacheArgs.constEnd(); it!=itEnd; ++it) {
99 args << QStringLiteral("-D%1=%2").arg(it.key(), it.value().toString());
100 }
101
102 auto rt = ICore::self()->runtimeController()->currentRuntime();
103 //if we are creating a new build directory, we'll want to specify the generator
104 QDir builddir(rt->pathInRuntime(CMake::currentBuildDir( m_project )).toLocalFile());
105 if(!builddir.exists() || !builddir.exists(QStringLiteral("CMakeCache.txt"))) {
106 CMakeBuilderSettings::self()->load();
107 args << QStringLiteral("-G") << CMake::defaultGenerator();
108 }
109 QString cmakeargs = CMake::currentExtraArguments( m_project );
110 if( !cmakeargs.isEmpty() ) {
111 KShell::Errors err;
112 QStringList tmp = KShell::splitArgs( cmakeargs, KShell::TildeExpand | KShell::AbortOnMeta, &err );
113 if( err == KShell::NoError ) {
114 args += tmp;
115 } else {
116 qCWarning(KDEV_CMAKEBUILDER) << "Ignoring cmake Extra arguments";
117 if( err == KShell::BadQuoting ) {
118 qCWarning(KDEV_CMAKEBUILDER) << "CMake arguments badly quoted:" << cmakeargs;
119 } else {
120 qCWarning(KDEV_CMAKEBUILDER) << "CMake arguments had meta character:" << cmakeargs;
121 }
122 }
123 }
124 args << rt->pathInRuntime(CMake::projectRoot( m_project )).toLocalFile();
125
126 return args;
127}
128
129QString CMakeJob::environmentProfile() const
130{

Callers

nothing calls this directly

Calls 15

currentCMakeExecutableFunction · 0.85
currentInstallDirFunction · 0.85
currentBuildTypeFunction · 0.85
currentBuildDirFunction · 0.85
defaultGeneratorFunction · 0.85
currentExtraArgumentsFunction · 0.85
projectRootFunction · 0.85
toLocalFileMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
currentRuntimeMethod · 0.80
runtimeControllerMethod · 0.80

Tested by

no test coverage detected