Browse Source

extended fix to MSYS2's libclang to '-isystem'

merge-requests/365/head
Ben D 10 years ago committed by GitHub
parent
commit
a491b9af91
  1. 14
      src/cmake.cc

14
src/cmake.cc

@ -72,16 +72,18 @@ bool CMake::update_default_build(const boost::filesystem::path &default_build_pa
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_file=filesystem::read(compile_commands_path); auto compile_commands_file=filesystem::read(compile_commands_path);
auto replace_drive = [&compile_commands_file](const std::string& param) {
size_t pos=0; size_t pos=0;
while((pos=compile_commands_file.find("-I/", pos))!=std::string::npos) { auto param_size = param.length();
if(pos+3<compile_commands_file.size()) { while((pos=compile_commands_file.find(param+"/", pos))!=std::string::npos) {
std::string drive; if(pos+param_size+1<compile_commands_file.size())
drive+=compile_commands_file[pos+3]; compile_commands_file.replace(pos, param_size+2, param+compile_commands_file[pos+param_size+1]+":");
compile_commands_file.replace(pos, 4, "-I"+drive+":");
}
else else
break; break;
} }
};
replace_drive("-I");
replace_drive("-isystem ");
filesystem::write(compile_commands_path, compile_commands_file); filesystem::write(compile_commands_path, compile_commands_file);
#endif #endif
return true; return true;

Loading…
Cancel
Save