Browse Source

Now fixes compile_commands.json on Windows correctly

merge-requests/365/head
U-ole-PC\ole 10 years ago
parent
commit
7cd81a9747
  1. 5
      src/cmake.cc

5
src/cmake.cc

@ -71,14 +71,13 @@ bool CMake::create_compile_commands(const boost::filesystem::path &path) {
auto default_build_path=get_default_build_path(path); auto default_build_path=get_default_build_path(path);
if(default_build_path.empty()) if(default_build_path.empty())
return false; return false;
Dialog::Message message("Creating "+default_build_path.string()+"/compile_commands.json"); auto compile_commands_path=default_build_path/"compile_commands.json";
Dialog::Message message("Creating "+compile_commands_path.string());
auto exit_status=Terminal::get().process(Config::get().terminal.cmake_command+" "+ auto exit_status=Terminal::get().process(Config::get().terminal.cmake_command+" "+
path.string()+" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON", default_build_path); path.string()+" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON", default_build_path);
message.hide(); message.hide();
if(exit_status==EXIT_SUCCESS) { if(exit_status==EXIT_SUCCESS) {
#ifdef _WIN32 //Temporary fix to MSYS2's libclang #ifdef _WIN32 //Temporary fix to MSYS2's libclang
auto compile_commands_path=path;
compile_commands_path+="/compile_commands.json";
auto compile_commands_file=filesystem::read(compile_commands_path); auto compile_commands_file=filesystem::read(compile_commands_path);
size_t pos=0; size_t pos=0;
while((pos=compile_commands_file.find("-I/", pos))!=std::string::npos) { while((pos=compile_commands_file.find("-I/", pos))!=std::string::npos) {

Loading…
Cancel
Save