I have some rules in CMake which cause the build dir to be non-empty after a prune. Running a configure in the build dir, will then be missing the '-G Ninja'. Reproducible: Always Steps to Reproduce: 1. Prune 2. Configure Actual Results: Unix Makefile (the default) is selected as the generator: build> /.../cmake -DCMAKE_INSTALL_PREFIX=/usr/local /home/.../project Expected Results: Have Ninja as the generator: build> /.../cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G Ninja /home/.../project In projectbuilders/cmakebuilder/cmakejob.cpp The command line for cmake is built with or without the '-G' option, if the build dir is detected to be empty (or inexistant): //if we are creating a new build directory, we'll want to specify the generator QDir builddir(CMake::currentBuildDir( m_project ).toLocalFile()); if(!builddir.exists() || builddir.count()==2) { However, in my case, the build dir is present and non-empty (some wierd reason why, not important for this issue), but make hasn't run yet. I propose a better check, which is to see if the CMakeCache.txt file is present, which it should *always* be created if cmake hasn't run. Even if it has, and this file is missing, cmake will run as if it is the first time. Therefore, the presence of this file is a better check if the build dir is ready in cmake's eyes.
Sorry, steps to reproduce is missing a steop: 1. Prune 2. cd build; touch test 3. Configure
Created attachment 93474 [details] Proposed patch.
@Aleix: Patch looks sane to me. Can you double-check & commit?
So. Almost 2 years. Any chance of merging this?
Git commit fdd6636711a9e5d58a7c18b2f520ee8ef7ec0285 by Aleix Pol, on behalf of Gianni from Bugzilla. Committed on 14/02/2017 at 11:57. Pushed by apol into branch '5.1'. Specify generator whenever there's no CMakeCache.txt M +1 -1 projectbuilders/cmakebuilder/cmakejob.cpp https://commits.kde.org/kdevelop/fdd6636711a9e5d58a7c18b2f520ee8ef7ec0285