Browse Source

Cleanup of cmake project search, no longer tried to search for cmakelists if starting/reaching a directory without cmakelists

merge-requests/365/head
Ole Christian Eidheim 10 years ago
parent
commit
b11494b15d
  1. 32
      src/cmake.cc

32
src/cmake.cc

@ -17,25 +17,21 @@ CMake::CMake(const boost::filesystem::path &path) {
}; };
auto search_path=path; auto search_path=path;
auto search_cmake_path=search_path; while(true) {
search_cmake_path+="/CMakeLists.txt"; auto search_cmake_path=search_path/"CMakeLists.txt";
if(boost::filesystem::exists(search_cmake_path)) if(boost::filesystem::exists(search_cmake_path))
paths.emplace(paths.begin(), search_cmake_path); paths.emplace(paths.begin(), search_cmake_path);
if(find_cmake_project(search_cmake_path)) else
project_path=search_path; break;
else { if(find_cmake_project(search_cmake_path)) {
do { project_path=search_path;
search_path=search_path.parent_path(); break;
search_cmake_path=search_path; }
search_cmake_path+="/CMakeLists.txt"; if(search_path==search_path.root_directory())
if(boost::filesystem::exists(search_cmake_path)) break;
paths.emplace(paths.begin(), search_cmake_path); search_path=search_path.parent_path();
if(find_cmake_project(search_cmake_path)) {
project_path=search_path;
break;
}
} while(search_path!=search_path.root_directory());
} }
if(!project_path.empty()) { if(!project_path.empty()) {
if(boost::filesystem::exists(project_path/"CMakeLists.txt") && !boost::filesystem::exists(project_path/"compile_commands.json")) if(boost::filesystem::exists(project_path/"CMakeLists.txt") && !boost::filesystem::exists(project_path/"compile_commands.json"))
create_compile_commands(project_path); create_compile_commands(project_path);

Loading…
Cancel
Save