|
|
|
@ -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"; })) { |
|
|
|
|
|
|
|
auto sysroots = {"/Library/Developer/CommandLineTools/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("-isysroot"); |
|
|
|
arguments.emplace_back("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"); |
|
|
|
arguments.emplace_back(sysroot); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|