diff --git a/src/cmake.cc b/src/cmake.cc index c28a46b..7d7c2a5 100644 --- a/src/cmake.cc +++ b/src/cmake.cc @@ -161,7 +161,6 @@ bool CMake::create_debug_build(const boost::filesystem::path &project_path) { auto it=debug_build_needed.find(project_path.string()); if(it==debug_build_needed.end()) return true; - debug_build_needed.erase(it); } std::unique_ptr message; @@ -170,8 +169,12 @@ bool CMake::create_debug_build(const boost::filesystem::path &project_path) { filesystem::escape_argument(project_path)+" -DCMAKE_BUILD_TYPE=Debug", debug_build_path); if(message) message->hide(); - if(exit_status==EXIT_SUCCESS) + if(exit_status==EXIT_SUCCESS) { + auto it=debug_build_needed.find(project_path.string()); + if(it!=debug_build_needed.end()) + debug_build_needed.erase(it); return true; + } return false; } diff --git a/src/directories.cc b/src/directories.cc index ab027a9..0265cf5 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -130,6 +130,7 @@ void Directories::open(const boost::filesystem::path& dir_path) { update_mutex.unlock(); cmake=std::unique_ptr(new CMake(dir_path)); + CMake::create_default_build(cmake->project_path); auto project=cmake->get_functions_parameters("project"); if(project.size()>0 && project[0].second.size()>0) get_column(0)->set_title(project[0].second[0]); diff --git a/src/window.cc b/src/window.cc index 584c3aa..9d2e6b5 100644 --- a/src/window.cc +++ b/src/window.cc @@ -211,7 +211,8 @@ std::unique_ptr Window::get_cmake() { auto cmake=std::unique_ptr(new CMake(path)); if(cmake->project_path.empty()) return nullptr; - CMake::create_default_build(cmake->project_path); + if(!CMake::create_default_build(cmake->project_path)) + return nullptr; return cmake; }