cmake 3.7.0-rc1 breaks stage2 bootstrap in openmp on 10.11 with Xcode 8

The new cmake 3.7.0-rc1 release produces a stage2 bootstrap failure in
openmp project build on OS X 10.11 under Xcode 8....

In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_alloc.c:16:
In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp.h:98:
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_lock.h:26:10:
fatal error: 'atomic' file not found
#include <atomic>
         ^

This appears to be due to the new cmake 3.7.0-rc1 resulting in
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
being used in the compilation of openmp....

cd /sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
&& /sw/src/fink.build/llvm40-4.0.0-1/opt-bin/cc-st1-clang
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Domp_EXPORTS -I/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
-I/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
-I/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
-I/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
-I/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
-I/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
-I/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
-Wall -W -Wno-unused-parameter -Wwrite-strings
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wdelete-non-virtual-dtor -Werror=date-time
-O3 -DNDEBUG -arch x86_64 -arch i386 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-fPIC -D _GNU_SOURCE -D _REENTRANT -I/sw/include -std=c++11
-fno-exceptions -Wno-sign-compare -Wno-unused-function
-Wno-unused-local-typedef -Wno-unused-value -Wno-unused-variable
-Wno-switch -Wno-covered-switch-default -Wno-deprecated-register
-Wno-gnu-anonymous-struct -Wno-unknown-pragmas
-Wno-missing-field-initializers -Wno-missing-braces -Wno-comment
-Wno-self-assign -Wno-vla-extension -Wno-format-pedantic -x c++ -o
CMakeFiles/omp.dir/kmp_alloc.c.o -c
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_alloc.c

The problem doesn't exist under cmake 3.6.2 because the openmp build
doesn't append -isysroot in that case.
              Jack
ps Note this seems to be related to using any SDK for -sysroot as
substituting...

-isysroot /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

from the Xcode 7.3.1 release also fails but substituting...

-isysroot /

or omitting -sysroot entirely allows the compilation to succeed. So it
seems that the openmp code doesn't like being compiled against SDKs
rather than / on darwin.

The new cmake 3.7.0-rc1 release produces a stage2 bootstrap failure in
openmp project build on OS X 10.11 under Xcode 8....

In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_alloc.c:16:
In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp.h:98:
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_lock.h:26:10:
fatal error: 'atomic' file not found
#include <atomic>
         ^

Appending -v to see the header search paths emitted from the compiler
shows the following....

compiling without -sysroot (which is the behavior for cmake 3.6.2 and
earlier)....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

compiling with -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
as cmake 3.7.0-rc1 does...

lang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks
(framework directory)
End of search list.

compiling with -isysroot / instead....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

So for both no usage of -sysroot or '-sysroot /', the search path of
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
is appended for the compiler but the case of '-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk',
the compiler attempts to use the non-existent search path of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1.

The new cmake 3.7.0-rc1 release produces a stage2 bootstrap failure in
openmp project build on OS X 10.11 under Xcode 8....

In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_alloc.c:16:
In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp.h:98:
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_lock.h:26:10:
fatal error: 'atomic' file not found
#include <atomic>
         ^

Appending -v to see the header search paths emitted from the compiler
shows the following....

compiling without -sysroot (which is the behavior for cmake 3.6.2 and
earlier)....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

compiling with -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
as cmake 3.7.0-rc1 does...

lang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks
(framework directory)
End of search list.

compiling with -isysroot / instead....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

So for both no usage of -sysroot or '-sysroot /', the search path of
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
is appended for the compiler but the case of '-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk',
the compiler attempts to use the non-existent search path of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1.

This issue seems to be specific to the llvm.org clang compiler. Using....

clang-4.0 -std=c++11 -x c++ --sysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
test.c -v

produces the bad search path of

ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"

whereas for the Apple clang 8.0 compiler, the same compilation
produces the valid search path of...

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1

The new cmake 3.7.0-rc1 release produces a stage2 bootstrap failure in
openmp project build on OS X 10.11 under Xcode 8....

In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_alloc.c:16:
In file included from
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp.h:98:
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/kmp_lock.h:26:10:
fatal error: 'atomic' file not found
#include <atomic>
         ^

Appending -v to see the header search paths emitted from the compiler
shows the following....

compiling without -sysroot (which is the behavior for cmake 3.6.2 and
earlier)....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

compiling with -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
as cmake 3.7.0-rc1 does...

lang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks
(framework directory)
End of search list.

compiling with -isysroot / instead....

clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src
/sw/src/fink.build/llvm40-4.0.0-1/build/stage2/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/include
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/i18n
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/include/45
/sw/src/fink.build/llvm40-4.0.0-1/llvm-4.0.0.src/projects/openmp/runtime/src/thirdparty/ittnotify
/sw/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/sw/src/fink.build/llvm40-4.0.0-1/build/stage1/bin/../lib/clang/4.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

So for both no usage of -sysroot or '-sysroot /', the search path of
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
is appended for the compiler but the case of '-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk',
the compiler attempts to use the non-existent search path of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1.

This issue seems to be specific to the llvm.org clang compiler. Using....

clang-4.0 -std=c++11 -x c++ --sysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
test.c -v

produces the bad search path of

ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"

whereas for the Apple clang 8.0 compiler, the same compilation
produces the valid search path of...

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1

A workaround for this issue under cmake 3.7.0-rc1 is to pass
-DLIBOMP_CFLAGS="-cxx-isystem $libcxx_srcdir" to the stage2 and stage3
cmake options.