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. 20
      src/cmake.cc

20
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))
paths.emplace(paths.begin(), search_cmake_path);
if(find_cmake_project(search_cmake_path))
project_path=search_path;
else {
do {
search_path=search_path.parent_path();
search_cmake_path=search_path;
search_cmake_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);
else
break;
if(find_cmake_project(search_cmake_path)) { if(find_cmake_project(search_cmake_path)) {
project_path=search_path; project_path=search_path;
break; break;
} }
} while(search_path!=search_path.root_directory()); if(search_path==search_path.root_directory())
break;
search_path=search_path.parent_path();
} }
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