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

Method createBuildDir

plugins/cmake/settings/cmakepreferences.cpp:285–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void CMakePreferences::createBuildDir()
286{
287 CMakeBuildDirChooser bdCreator;
288 bdCreator.setProject( m_project );
289
290 // NOTE: (on removing the trailing slashes)
291 // Generally, we have no clue about how shall a trailing slash look in the current system.
292 // Moreover, the slash may be a part of the filename.
293 // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths?
294 QStringList used = CMake::allBuildDirs( m_project );
295 bdCreator.setAlreadyUsed(used);
296 bdCreator.setCMakeExecutable(Path(CMakeBuilderSettings::self()->cmakeExecutable().toLocalFile()));
297
298 if(bdCreator.exec())
299 {
300 int addedBuildDirIndex = m_prefsUi->buildDirs->count();
301
302 // Initialize the kconfig items with the values from the dialog, this ensures the settings
303 // end up in the config file once the changes are saved
304 qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex;
305 qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder();
306 qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix();
307 qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments();
308 qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType();
309 qCDebug(CMAKE) << "adding to cmake config: cmake executable " << bdCreator.cmakeExecutable();
310 qCDebug(CMAKE) << "adding to cmake config: environment empty";
311 CMake::setOverrideBuildDirIndex( m_project, addedBuildDirIndex );
312 CMake::setBuildDirCount( m_project, addedBuildDirIndex + 1 );
313 CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() );
314 CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() );
315 CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() );
316 CMake::setCurrentBuildType( m_project, bdCreator.buildType() );
317 CMake::setCurrentCMakeExecutable(m_project, bdCreator.cmakeExecutable());
318 CMake::setCurrentEnvironment( m_project, QString() );
319
320 QString newbuilddir = bdCreator.buildFolder().toLocalFile();
321 m_prefsUi->buildDirs->addItem( newbuilddir );
322 m_prefsUi->buildDirs->setCurrentIndex( addedBuildDirIndex );
323 m_prefsUi->removeBuildDir->setEnabled( true );
324
325 qCDebug(CMAKE) << "Emitting changed signal for cmake kcm";
326 emit changed();
327 }
328 //TODO: Save it for next runs
329}
330
331void CMakePreferences::removeBuildDir()
332{

Callers

nothing calls this directly

Calls 15

allBuildDirsFunction · 0.85
setOverrideBuildDirIndexFunction · 0.85
setBuildDirCountFunction · 0.85
setCurrentBuildDirFunction · 0.85
setCurrentInstallDirFunction · 0.85
setCurrentExtraArgumentsFunction · 0.85
setCurrentBuildTypeFunction · 0.85
setCurrentEnvironmentFunction · 0.85
setAlreadyUsedMethod · 0.80
setCMakeExecutableMethod · 0.80
toLocalFileMethod · 0.80

Tested by

no test coverage detected