From c1d9c1a0db041def6a3bc9b19be9f14a75b72c1a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Nov 2019 08:32:00 +0200 Subject: Redo Apple /usr/include detection using patterns This should cover XCode 11 where the symlinks are the other way around now (see homebrew-core issue #46393 for details). --- libbuild2/cc/module.cxx | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx index 881583f..5ff5639 100644 --- a/libbuild2/cc/module.cxx +++ b/libbuild2/cc/module.cxx @@ -322,7 +322,7 @@ namespace build2 static const dir_path usr_loc_inc ("/usr/local/include"); # ifdef __APPLE__ static const dir_path a_usr_inc ( - "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"); + "/Library/Developer/CommandLineTools/SDKs/MacOSX*.sdk/usr/include"); # endif #endif @@ -475,11 +475,11 @@ namespace build2 // /Library/Developer/CommandLineTools/usr/include // /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include // - // What exactly all this means is anyone's guess, of course. So for - // now we will assume that anything that is or resolves (like that - // MacOSX10.14.sdk symlink) to: + // What exactly all this means is anyone's guess, of course (see + // homebrew-core issue #46393 for some background). So for now we + // will assume that anything that matches this pattern: // - // /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include + // /Library/Developer/CommandLineTools/SDKs/MacOSX*.sdk/usr/include // // Is Apple's /usr/include. // @@ -487,19 +487,11 @@ namespace build2 { for (const dir_path& d: inc_dirs) { - // Both Clang and GCC skip non-existent paths but let's handle - // (and ignore) directories that cause any errors, for good - // measure. - // - try + if (path_match (d, a_usr_inc)) { - if (d == a_usr_inc || dir_path (d).realize () == a_usr_inc) - { - ui = true; - break; - } + ui = true; + break; } - catch (...) {} } } #endif -- cgit v1.1