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

20
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);
size_t pos=0; auto replace_drive = [&compile_commands_file](const std::string& param) {
while((pos=compile_commands_file.find("-I/", pos))!=std::string::npos) { size_t pos=0;
if(pos+3<compile_commands_file.size()) { auto param_size = param.length();
std::string drive; while((pos=compile_commands_file.find(param+"/", pos))!=std::string::npos) {
drive+=compile_commands_file[pos+3]; if(pos+param_size+1<compile_commands_file.size())
compile_commands_file.replace(pos, 4, "-I"+drive+":"); compile_commands_file.replace(pos, param_size+2, param+compile_commands_file[pos+param_size+1]+":");
else
break;
} }
else };
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