Browse Source

Fixed isysroot settings on MacOS

merge-requests/181/head^2
eidheim 9 months ago
parent
commit
eb9fc4d9e6
  1. 12
      src/compile_commands.cpp

12
src/compile_commands.cpp

@ -126,8 +126,16 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
#ifdef __APPLE__ #ifdef __APPLE__
// Add -isysroot argument if it is missing on MacOS, which is needed by newer libclang // Add -isysroot argument if it is missing on MacOS, which is needed by newer libclang
if(std::none_of(arguments.begin(), arguments.end(), [](const std::string &argument) { return argument == "-isysroot"; })) { if(std::none_of(arguments.begin(), arguments.end(), [](const std::string &argument) { return argument == "-isysroot"; })) {
arguments.emplace_back("-isysroot"); auto sysroots = {"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk",
arguments.emplace_back("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"); "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"};
boost::system::error_code ec;
for(auto &sysroot : sysroots) {
if(boost::filesystem::exists(sysroot, ec)) {
arguments.emplace_back("-isysroot");
arguments.emplace_back(sysroot);
break;
}
}
} }
#endif #endif

Loading…
Cancel
Save